Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Marat Pavlov
/
AlexAdapter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
94a7fc86
authored
Mar 25, 2022
by
AlexNasyr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transit
parent
b28ec718
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
11 deletions
SocialMinistryDataExchange/Controllers/apiController.cs
SocialMinistryDataExchange/Model/SMRepository.cs
SocialMinistryDataExchange/Model/SMRequest.cs
SocialMinistryDataExchange/Controllers/apiController.cs
View file @
94a7fc86
...
...
@@ -20,7 +20,13 @@ namespace SocialMinistryDataExchange.Controllers {
var
msg
=
new
SMPersonDataRequest
()
{
MsgID
=
"123"
,
MsgDataTime
=
DateTime
.
Now
,
MsgData
=
new
SMPersonDataOccupationMessage
[]
{
new
SMPersonDataOccupationMessage
()
{
Person
=
new
Person
()
{
rowguid_eais
=
"223322"
,
PersonDocumentSeria
=
"V-II"
,
PersonDocumentNumber
=
"123456"
},
PersonOccupation
=
new
SMPersonOccupation
(),
Error
=
""
}
}
MsgData
=
new
SMPersonDataOccupationMessage
[]
{
new
SMPersonDataOccupationMessage
()
{
Person
=
new
Person
()
{
rowguid_eais
=
"223322"
,
PersonDocumentSeria
=
"V-II"
,
PersonDocumentNumber
=
"123456"
},
PersonOccupation
=
new
SMPersonOccupation
(),
Error
=
""
}
}
};
var
result
=
await
_repository
.
GetPersonByDoc
(
JsonSerializer
.
Serialize
(
msg
));
//var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(new List<SMPersonRequest>() { new SMPersonRequest() { rowguid_eais = "223322", document_seria = "V-II", document_number = "123456" }, new SMPersonRequest() { rowguid_eais = "322223", document_seria = "1234", document_number = "123456" } }));
...
...
SocialMinistryDataExchange/Model/SMRepository.cs
View file @
94a7fc86
...
...
@@ -24,13 +24,20 @@ namespace SocialMinistryDataExchange.Model {
public
Task
<
List
<
SMResponce
>>
GetPersonByDoc
(
string
document
)
{
var
docs
=
JsonSerializer
.
Deserialize
<
SMPersonDataRequest
>(
document
);
List
<
SMResponce
>
responce
=
new
();
SMResponce
responce_record
;
foreach
(
var
doc
in
docs
.
MsgData
)
{
SMResponce
responce_record
=
new
SMResponce
();
try
{
if
(
doc
.
Person
.
PersonDocumentSeria
is
null
||
doc
.
Person
.
PersonDocumentNumber
is
null
||
doc
.
Person
.
PersonFamilyName
is
null
||
doc
.
Person
.
PersonName
is
null
||
doc
.
Person
.
PersonBirthday
is
null
)
{
throw
new
ArgumentNullException
(
$"
{
nameof
(
doc
.
Person
)}
"
);
}
responce_record
=
new
SMResponce
();
var
record
=
(
from
pd
in
_contingentContext
.
ДокументЛичности
s
where
pd
.
СерияДокумента
==
doc
.
Person
.
PersonDocumentSeria
&&
pd
.
НомерДокумента
==
doc
.
Person
.
PersonDocumentNumber
&&
pd
.
Личность
Navigation
.
Фамилия
==
doc
.
Person
.
PersonFamilyName
&&
pd
.
Личность
Navigation
.
Имя
==
doc
.
Person
.
PersonName
&&
(
pd
.
Личность
Navigation
.
БезОтчества
==
false
&
pd
.
Личность
Navigation
.
Отчество
==
doc
.
Person
.
PersonSurname
)
&&
pd
.
Личность
Navigation
.
ДатаРождения
==
doc
.
Person
.
PersonBirthday
&&
(
pd
.
Личность
Navigation
.
БезОтчества
==
false
&
pd
.
Личность
Navigation
.
Отчество
==
doc
.
Person
.
PersonSurname
)
&&
pd
.
Личность
Navigation
.
ДатаРождения
==
doc
.
Person
.
PersonBirthday
join
lp
in
_contingentContext
.
ЛичностьПодразделения
s
on
pd
.
Личность
equals
lp
.
Личность
into
lps
from
lp
in
lps
.
DefaultIfEmpty
()
join
op
in
_contingentContext
.
ОбразовательнаяПрограммаОрганизации
s
on
lp
.
Организация
equals
op
.
Организация
into
ops
...
...
@@ -59,18 +66,16 @@ namespace SocialMinistryDataExchange.Model {
// ФормаОбученияКод, ФормаОбученияНаименование
,
ФормаОбученияКод
=
cp
.
ФормаОбучения
Navigation
.
Код
,
ФормаОбученияНаименование
=
cp
.
ФормаОбучения
Navigation
.
Наименование
}).
First
();
// записи не найдены
if
(
record
==
null
)
{
record
=
new
SMResponceTemp
()
{
rowguid_eais
=
doc
.
Person
.
rowguid_eais
,
СерияДокумента
=
doc
.
Person
.
PersonDocumentSeria
,
НомерДокумента
=
doc
.
Person
.
PersonDocumentNumber
};
}
responce_record
=
FormatResponce
(
_contingentContext
,
record
);
}
catch
(
Exception
ex
)
{
// TODO log exception
// TODO separate exceptions
responce_record
=
FormatResponce
(
_contingentContext
,
new
SMResponceTemp
()
{
rowguid_eais
=
doc
.
Person
.
rowguid_eais
,
СерияДокумента
=
doc
.
Person
.
PersonDocumentSeria
,
НомерДокумента
=
doc
.
Person
.
PersonDocumentNumber
});
}
responce
.
Add
(
responce_record
);
}
return
Task
.
FromResult
(
responce
);
...
...
SocialMinistryDataExchange/Model/SMRequest.cs
View file @
94a7fc86
...
...
@@ -53,11 +53,11 @@ namespace SocialMinistryDataExchange.Model {
public
string
PersonFamilyName
{
get
;
set
;
}
public
string
PersonName
{
get
;
set
;
}
public
string
?
PersonSurname
{
get
;
set
;
}
public
DateTime
PersonBirthday
{
get
;
set
;
}
public
DateTime
?
PersonBirthday
{
get
;
set
;
}
public
int
PersonDocumentType
{
get
;
set
;
}
public
string
PersonDocumentSeria
{
get
;
set
;
}
public
string
PersonDocumentNumber
{
get
;
set
;
}
public
DateTime
PersonDocumentDate
{
get
;
set
;
}
public
DateTime
?
PersonDocumentDate
{
get
;
set
;
}
public
string
?
PersonSnils
{
get
;
set
;
}
public
string
?
PersonAddress
{
get
;
set
;
}
public
string
?
DependentPerson
{
get
;
set
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment