Commit 72efe79f by Alex Nasyr

111

parent 91e8b447
...@@ -50,7 +50,7 @@ namespace SocialMinistryDataExchange.Controllers { ...@@ -50,7 +50,7 @@ namespace SocialMinistryDataExchange.Controllers {
} }
} }
}; };
var result = await _repository.GetPersonsOcupation(JsonSerializer.Serialize(msg)); var result = await _repository.GetOcupationByPerson(JsonSerializer.Serialize(msg));
return result; return result;
} }
......
...@@ -4,8 +4,10 @@ using System.Threading.Tasks; ...@@ -4,8 +4,10 @@ using System.Threading.Tasks;
namespace SocialMinistryDataExchange.Model { namespace SocialMinistryDataExchange.Model {
public interface ISMRepository { public interface ISMRepository {
Task<List<SMData>> GetPersonByDoc(string Document); Task<List<SMData>> GetPersonByDoc(string Document);
Task<SMDefenceDemandResponce> GetPersonDefenceDemandByID(string PersonID);
Task<SMPersonDataRequest> GetPersonsOcupation(string OcupationRequest); // возвращает статус нуждаемости личности
Task<SMDefenceDemandResponce> GetPersonDefenceDemandByID(string PersonID);
// возвращает статус зачисленности в учебное заведение
Task<SMPersonDataRequest> GetOcupationByPerson(string OcupationRequest);
} }
} }
...@@ -17,7 +17,6 @@ namespace SocialMinistryDataExchange.Model { ...@@ -17,7 +17,6 @@ namespace SocialMinistryDataExchange.Model {
_logger = logger; _logger = logger;
} }
// возвращает статус нуждаемости личности
public Task<SMDefenceDemandResponce> GetPersonDefenceDemandByID(string PersonID) { public Task<SMDefenceDemandResponce> GetPersonDefenceDemandByID(string PersonID) {
var status = (from st in _contingentContext.СтатусыНуждаемостиs var status = (from st in _contingentContext.СтатусыНуждаемостиs
where st.Личность == new Guid(PersonID) where st.Личность == new Guid(PersonID)
...@@ -27,8 +26,8 @@ namespace SocialMinistryDataExchange.Model { ...@@ -27,8 +26,8 @@ namespace SocialMinistryDataExchange.Model {
return Task.FromResult(status); return Task.FromResult(status);
} }
// возвращает статус зачисления в учебное заведение // возвращает статус зачисленности в учебное заведение
public Task<SMPersonDataRequest> GetPersonsOcupation(string OcupationRequest) { public Task<SMPersonDataRequest> GetOcupationByPerson(string OcupationRequest) {
SMPersonDataRequest Responce = new(); SMPersonDataRequest Responce = new();
try { try {
var Request = JsonSerializer.Deserialize<SMPersonDataRequest>(OcupationRequest); var Request = JsonSerializer.Deserialize<SMPersonDataRequest>(OcupationRequest);
...@@ -62,9 +61,9 @@ namespace SocialMinistryDataExchange.Model { ...@@ -62,9 +61,9 @@ namespace SocialMinistryDataExchange.Model {
try { try {
var person_record = (from pd in _contingentContext.ДокументЛичностиs var person_record = (from pd in _contingentContext.ДокументЛичностиs
where pd.СерияДокумента.Contains(Person.Person.PersonDocumentSeria) && pd.НомерДокумента.Contains(Person.Person.PersonDocumentNumber) where pd.СерияДокумента.Contains(Person.Person.PersonDocumentSeria) && pd.НомерДокумента.Contains(Person.Person.PersonDocumentNumber)
&& pd.ЛичностьNavigation.Фамилия.Contains(Person.Person.PersonFamilyName) && pd.ЛичностьNavigation.Имя.Contains(Person.Person.PersonName) && pd.ЛичностьNavigation.Фамилия.Contains(Person.Person.PersonFamilyName) && pd.ЛичностьNavigation.Имя.Contains(Person.Person.PersonName)
//&& (pd.ЛичностьNavigation.БезОтчества == false & pd.ЛичностьNavigation.Отчество.Contains(Person.Person.PersonSurname)) && ((pd.ЛичностьNavigation.БезОтчества == null || pd.ЛичностьNavigation.БезОтчества == false) & pd.ЛичностьNavigation.Отчество.Contains(Person.Person.PersonSurname))
//&& pd.ЛичностьNavigation.ДатаРождения == Person.Person.PersonBirthday && pd.ЛичностьNavigation.ДатаРождения == Person.Person.PersonBirthday
join lp in _contingentContext.ЛичностьПодразделенияs on pd.Личность equals lp.Личность into lps join lp in _contingentContext.ЛичностьПодразделенияs on pd.Личность equals lp.Личность into lps
from lp in lps.DefaultIfEmpty() from lp in lps.DefaultIfEmpty()
join op in _contingentContext.ОбразовательнаяПрограммаОрганизацииs on lp.Организация equals op.Организация into ops join op in _contingentContext.ОбразовательнаяПрограммаОрганизацииs on lp.Организация equals op.Организация into ops
...@@ -102,22 +101,24 @@ namespace SocialMinistryDataExchange.Model { ...@@ -102,22 +101,24 @@ namespace SocialMinistryDataExchange.Model {
|| (person_record.БезОтчества == true & person_record.Отчество != Person.Person.PersonSurname || (person_record.БезОтчества == true & person_record.Отчество != Person.Person.PersonSurname
|| person_record.ДатаРождения != Person.Person.PersonBirthday)) { || person_record.ДатаРождения != Person.Person.PersonBirthday)) {
Person.Person.Error += "Personal information Error;"; Person.Person.Error += "Personal information Error;";
_logger.Error($"Person '{{@Person}}': {{@Error}};", Person.Person, "Personal information Error"); _logger.Error($"Person '{{@Error}}': {{@Person}};", "TryFillPersonStatus: ", Person.Person);
Person.Person.PersonFamilyName = person_record.Фамилия;
Person.Person.PersonName = person_record.Имя;
Person.Person.PersonSurname = person_record.Отчество;
Person.Person.PersonBirthday = person_record.ДатаРождения;
} }
if (person_record.СерияДокумента != Person.Person.PersonDocumentSeria || person_record.НомерДокумента != Person.Person.PersonDocumentNumber || person_record.КогдаВыданДокумент != Person.Person.PersonDocumentDate) { if (person_record.СерияДокумента != Person.Person.PersonDocumentSeria || person_record.НомерДокумента != Person.Person.PersonDocumentNumber
|| person_record.КогдаВыданДокумент != Person.Person.PersonDocumentDate) {
Person.Person.Error += "Personal document Error;"; Person.Person.Error += "Personal document Error;";
_logger.Error($"Person '{{@Person}}': {{@Error}};", Person.Person, "Personal document Error"); _logger.Error($"Person '{{@Error}}': {{@Person}};", "TryFillPersonStatus: ", Person.Person);
Person.Person.PersonDocumentSeria = person_record.СерияДокумента;
Person.Person.PersonDocumentNumber = person_record.НомерДокумента;
Person.Person.PersonDocumentDate = person_record.КогдаВыданДокумент;
Person.Person.PersonDocumentType = person_record.КодУдостоверяющегоДокумента == 12 || person_record.КодУдостоверяющегоДокумента == 13 || person_record.КодУдостоверяющегоДокумента == 21 ? 1
: person_record.КодУдостоверяющегоДокумента == 11 || person_record.КодУдостоверяющегоДокумента == 31 ? 2 : null;
Person.Person.PersonSnils = person_record.Снилс;
} }
Person.Person.PersonFamilyName = person_record.Фамилия;
Person.Person.PersonName = person_record.Имя;
Person.Person.PersonSurname = person_record.Отчество;
Person.Person.PersonBirthday = person_record.ДатаРождения;
Person.Person.PersonDocumentSeria = person_record.СерияДокумента;
Person.Person.PersonDocumentNumber = person_record.НомерДокумента;
Person.Person.PersonDocumentDate = person_record.КогдаВыданДокумент;
Person.Person.PersonDocumentType = person_record.КодУдостоверяющегоДокумента == 12 || person_record.КодУдостоверяющегоДокумента == 13 || person_record.КодУдостоверяющегоДокумента == 21 ? 1
: person_record.КодУдостоверяющегоДокумента == 11 || person_record.КодУдостоверяющегоДокумента == 31 ? 2 : null;
Person.Person.PersonSnils = person_record.Снилс;
if (string.IsNullOrEmpty(Person.Person.Error)) { if (string.IsNullOrEmpty(Person.Person.Error)) {
Person.Person.rowguid_contingent = person_record.Личность.ToString(); Person.Person.rowguid_contingent = person_record.Личность.ToString();
...@@ -158,10 +159,9 @@ namespace SocialMinistryDataExchange.Model { ...@@ -158,10 +159,9 @@ namespace SocialMinistryDataExchange.Model {
} }
catch (Exception ex) { catch (Exception ex) {
Person.Person.Error += "Person not found;"; Person.Person.Error += "Person not found;";
_logger.Error($"Person '{{@Person}}': {{@Error}};", Person.Person, "Person not found"); _logger.Error($"Person '{{@Error}}': {{@Person}};", "TryFillPersonStatus: ", Person.Person);
} }
} }
private static Guid? GetOrganizationType(IContingentContext context, Guid? OrgTypeUid) { private static Guid? GetOrganizationType(IContingentContext context, Guid? OrgTypeUid) {
if (OrgTypeUid == null) { if (OrgTypeUid == null) {
return null; return null;
...@@ -183,6 +183,7 @@ namespace SocialMinistryDataExchange.Model { ...@@ -183,6 +183,7 @@ namespace SocialMinistryDataExchange.Model {
return type.Иерархия == null ? type.PrimaryKey : GetProgramType(context, type.Иерархия); return type.Иерархия == null ? type.PrimaryKey : GetProgramType(context, type.Иерархия);
} }
public Task<List<SMData>> GetPersonByDoc(string document) { public Task<List<SMData>> GetPersonByDoc(string document) {
var docs = JsonSerializer.Deserialize<SMPersonDataRequest>(document); var docs = JsonSerializer.Deserialize<SMPersonDataRequest>(document);
List<SMData> responce = new(); List<SMData> responce = new();
......
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