Commit 7fc149d8 by AlexNasyr

requestt class "from SM" added

parent 0ebf45b7
...@@ -31,7 +31,7 @@ namespace SocialMinistryDataExchange.Controllers { ...@@ -31,7 +31,7 @@ namespace SocialMinistryDataExchange.Controllers {
[HttpGet] [HttpGet]
[Route("[controller]/getpersonFixDoc")] [Route("[controller]/getpersonFixDoc")]
public async Task<List<SMResponce>> GetPersonFixDoc() { public async Task<List<SMResponce>> GetPersonFixDoc() {
var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(new SMRequest() { rowguid_eais = "223322", document_seria = "V-II", document_number = "123456" })); var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(new SMPersonRequest() { rowguid_eais = "223322", document_seria = "V-II", document_number = "123456" }));
return result; return result;
} }
// запрос по серии/номеру документа личности // запрос по серии/номеру документа личности
...@@ -39,7 +39,7 @@ namespace SocialMinistryDataExchange.Controllers { ...@@ -39,7 +39,7 @@ namespace SocialMinistryDataExchange.Controllers {
[HttpGet] [HttpGet]
[Route("[controller]/getpersonByDoc/{Rowguid}/{Seria}/{Number}")] [Route("[controller]/getpersonByDoc/{Rowguid}/{Seria}/{Number}")]
public async Task<List<SMResponce>> GetPersonFixDoc(string Rowguid, string Seria, string Number) { public async Task<List<SMResponce>> GetPersonFixDoc(string Rowguid, string Seria, string Number) {
var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(new SMRequest() { rowguid_eais = Rowguid, document_seria = Seria, document_number = Number })); var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(new SMPersonRequest() { rowguid_eais = Rowguid, document_seria = Seria, document_number = Number }));
return result; return result;
} }
...@@ -51,5 +51,11 @@ namespace SocialMinistryDataExchange.Controllers { ...@@ -51,5 +51,11 @@ namespace SocialMinistryDataExchange.Controllers {
var result = await _repository.GetPersonDefenceDemandByID(PersonID); var result = await _repository.GetPersonDefenceDemandByID(PersonID);
return result; return result;
} }
[HttpGet]
[Route("[controller]/getSMPersonNewDataRequest")]
public async Task<SMPersonNewDataRequest> GetSMPersonNewDataRequest() {
return new SMPersonNewDataRequest();
}
} }
} }
using Microsoft.EntityFrameworkCore;
...@@ -8,11 +8,11 @@ using System.Threading.Tasks; ...@@ -8,11 +8,11 @@ using System.Threading.Tasks;
#nullable disable #nullable disable
namespace SocialMinistryDataExchange.Model.DB.Center { namespace SocialMinistryDataExchange.Model.DB.Center {
public partial class Контингент_center_Context : DbContext, IContingentContext { public partial class Contingent_center_Context : DbContext, IContingentContext {
public Контингент_center_Context() { public Contingent_center_Context() {
} }
public Контингент_center_Context(DbContextOptions<Контингент_center_Context> options) public Contingent_center_Context(DbContextOptions<Contingent_center_Context> options)
: base(options) { : base(options) {
} }
......
...@@ -22,7 +22,7 @@ namespace SocialMinistryDataExchange.Model { ...@@ -22,7 +22,7 @@ namespace SocialMinistryDataExchange.Model {
} }
public Task<List<SMResponce>> GetPersonByDoc(string document) { public Task<List<SMResponce>> GetPersonByDoc(string document) {
var doc = JsonSerializer.Deserialize<SMRequest>(document); var doc = JsonSerializer.Deserialize<SMPersonRequest>(document);
try { try {
var records = (from pd in _contingentContext.ДокументЛичностиs var records = (from pd in _contingentContext.ДокументЛичностиs
where pd.СерияДокумента == doc.document_seria && pd.НомерДокумента == doc.document_number where pd.СерияДокумента == doc.document_seria && pd.НомерДокумента == doc.document_number
......
namespace SocialMinistryDataExchange.Model { using System;
public class SMRequest {
namespace SocialMinistryDataExchange.Model {
public class SMPersonRequest {
public string rowguid_eais { get; set; } public string rowguid_eais { get; set; }
public string document_seria { get; set; } public string document_seria { get; set; }
public string document_number { get; set; } public string document_number { get; set; }
} }
public class SMPersonNewDataRequest {
public string MsgID { get; set; }
public DateTime MsgDataTime { get; set; }
public Person Person { get; set; }
public string PersonStatus { get; set; }
public DateTime PersonStatusStartDate { get; set; }
public DateTime PersonStatusEndDate { get; set; }
public Person[] Relatives { get; set; }
public int FamilyPersonsCount { get; set; }
public double AvgIncome { get; set; }
public double MinIncome { get; set; }
public string Territory { get; set; }
}
public class Person {
public string rowguid_eais { get; set; }
public string? rowguid_contingent { get; set; }
public string PersonFamilyName { get; set; }
public string PersonName { get; set; }
public string PersonSurname { get; set; }
public DateTime PersonBirthday { get; set; }
public string PersonDocumentType { get; set; }
public string PersonDocumentSeria { get; set; }
public string PersonDocumentNumber { get; set; }
public DateTime PersonDocumentDate { get; set; }
public string? PersonSnils { get; set; }
public string? PersonAddress { get; set; }
public string? DependentPerson { get; set; }
public string? DependenceType { get; set; }
public int? DependenceCode { get; set; }
}
} }
...@@ -25,8 +25,8 @@ namespace SocialMinistryDataExchange { ...@@ -25,8 +25,8 @@ namespace SocialMinistryDataExchange {
services.AddSwaggerGen(c => { services.AddSwaggerGen(c => {
c.SwaggerDoc("v1", new OpenApiInfo { Title = "SocialMinistryDataExchange", Version = "v1" }); c.SwaggerDoc("v1", new OpenApiInfo { Title = "SocialMinistryDataExchange", Version = "v1" });
}); });
services.AddDbContext<Êîíòèíãåíò_center_Context>(options => options.UseSqlServer(ConnectionString)); services.AddDbContext<Contingent_center_Context>(options => options.UseSqlServer(ConnectionString));
services.AddTransient<IContingentContext, Êîíòèíãåíò_center_Context>(); services.AddTransient<IContingentContext, Contingent_center_Context>();
services.AddTransient<ISMRepository, SMRepository>(); services.AddTransient<ISMRepository, SMRepository>();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment