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
91e8b447
authored
Mar 28, 2022
by
Alex Nasyr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
occupation status realized
parent
54856aa9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
30 deletions
SocialMinistryDataExchange/Controllers/apiController.cs
SocialMinistryDataExchange/Model/SMRepository.cs
SocialMinistryDataExchange/Model/SMRequests.cs
SocialMinistryDataExchange/Controllers/apiController.cs
View file @
91e8b447
...
@@ -34,6 +34,19 @@ namespace SocialMinistryDataExchange.Controllers {
...
@@ -34,6 +34,19 @@ namespace SocialMinistryDataExchange.Controllers {
PersonBirthday
=
DateTime
.
Parse
(
"2015-01-01"
),
PersonBirthday
=
DateTime
.
Parse
(
"2015-01-01"
),
},
},
PersonOccupation
=
new
SMPersonOccupationStatus
()
PersonOccupation
=
new
SMPersonOccupationStatus
()
},
new
SMPersonDataOccupationMessage
()
{
Person
=
new
Person
()
{
rowguid_eais
=
"223322"
,
PersonDocumentSeria
=
"V-II"
,
PersonDocumentNumber
=
"123456"
,
PersonDocumentDate
=
DateTime
.
Parse
(
"2010-01-01"
),
PersonFamilyName
=
"Мкртчян"
,
PersonName
=
"Василий"
,
PersonSurname
=
"Алибабаевич"
,
PersonBirthday
=
DateTime
.
Parse
(
"2015-01-01"
),
},
PersonOccupation
=
new
SMPersonOccupationStatus
()
}
}
}
}
};
};
...
...
SocialMinistryDataExchange/Model/SMRepository.cs
View file @
91e8b447
...
@@ -27,7 +27,7 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -27,7 +27,7 @@ namespace SocialMinistryDataExchange.Model {
return
Task
.
FromResult
(
status
);
return
Task
.
FromResult
(
status
);
}
}
//
//
возвращает статус зачисления в учебное заведение
public
Task
<
SMPersonDataRequest
>
GetPersonsOcupation
(
string
OcupationRequest
)
{
public
Task
<
SMPersonDataRequest
>
GetPersonsOcupation
(
string
OcupationRequest
)
{
SMPersonDataRequest
Responce
=
new
();
SMPersonDataRequest
Responce
=
new
();
try
{
try
{
...
@@ -44,7 +44,7 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -44,7 +44,7 @@ namespace SocialMinistryDataExchange.Model {
}
}
var
z
=
(
PersonSearchAttributes
)
x
;
var
z
=
(
PersonSearchAttributes
)
x
;
if
(
x
<
Enum
.
GetValues
(
typeof
(
PersonSearchAttributes
)).
Cast
<
byte
>().
Sum
(
s
=>
s
))
{
if
(
x
<
Enum
.
GetValues
(
typeof
(
PersonSearchAttributes
)).
Cast
<
byte
>().
Sum
(
s
=>
s
))
{
Person
.
Person
.
Error
=
$"Parameters: [
{(
PersonSearchAttributes
)(
31
-
z
)}
] can't be null; "
;
Person
.
Person
.
Error
=
$"Parameters: [
{(
PersonSearchAttributes
)(
Enum
.
GetValues
(
typeof
(
PersonSearchAttributes
)).
Cast
<
byte
>().
Sum
(
s
=>
s
)
-
(
int
)
z
)}
] can't be null; "
;
_logger
.
Error
(
$"MsgID '
{{
@MsgID
}}
':
{{
@Error
}}
;"
,
Responce
.
MsgID
,
Person
.
Person
.
Error
);
_logger
.
Error
(
$"MsgID '
{{
@MsgID
}}
':
{{
@Error
}}
;"
,
Responce
.
MsgID
,
Person
.
Person
.
Error
);
}
}
else
{
else
{
...
@@ -59,6 +59,7 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -59,6 +59,7 @@ namespace SocialMinistryDataExchange.Model {
return
Task
.
FromResult
(
Responce
);
return
Task
.
FromResult
(
Responce
);
}
}
private
void
TryFillPersonStatus
(
SMPersonDataOccupationMessage
Person
)
{
private
void
TryFillPersonStatus
(
SMPersonDataOccupationMessage
Person
)
{
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
)
...
@@ -78,7 +79,7 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -78,7 +79,7 @@ namespace SocialMinistryDataExchange.Model {
,
СерияДокумента
=
Person
.
Person
.
PersonDocumentSeria
,
НомерДокумента
=
Person
.
Person
.
PersonDocumentNumber
,
КогдаВыданДокумент
=
pd
.
КогдаВыданДокумент
,
ВидУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
,
СерияДокумента
=
Person
.
Person
.
PersonDocumentSeria
,
НомерДокумента
=
Person
.
Person
.
PersonDocumentNumber
,
КогдаВыданДокумент
=
pd
.
КогдаВыданДокумент
,
ВидУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
,
НаименованиеУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
Navigation
.
Наименование
,
КодУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
Navigation
.
Код
,
НаименованиеУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
Navigation
.
Наименование
,
КодУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
Navigation
.
Код
// Личность (Guid), Имя, Отчество, БезОтчества, Фамилия
// Личность (Guid), Имя, Отчество, БезОтчества, Фамилия
,
Личность
=
pd
.
Личность
,
Имя
=
pd
.
Личность
Navigation
.
Имя
,
Отчество
=
pd
.
Личность
Navigation
.
Отчество
,
БезОтчества
=
pd
.
Личность
Navigation
.
БезОтчества
,
Фамилия
=
pd
.
Личность
Navigation
.
Фамилия
,
Личность
=
pd
.
Личность
,
Имя
=
pd
.
Личность
Navigation
.
Имя
,
Отчество
=
pd
.
Личность
Navigation
.
Отчество
,
БезОтчества
=
pd
.
Личность
Navigation
.
БезОтчества
==
null
?
false
:
true
,
Фамилия
=
pd
.
Личность
Navigation
.
Фамилия
// ДатаРождения, ТерриторияФактическогоМестаЖительстваNew (нигде не заполнено - null), Снилс
// ДатаРождения, ТерриторияФактическогоМестаЖительстваNew (нигде не заполнено - null), Снилс
,
ДатаРождения
=
pd
.
Личность
Navigation
.
ДатаРождения
,
ТерриторияФактическогоМестаЖительства
New
=
pd
.
Личность
Navigation
.
ТерриторияФактическогоМестаЖительства
New
,
Снилс
=
pd
.
Личность
Navigation
.
Снилс
,
ДатаРождения
=
pd
.
Личность
Navigation
.
ДатаРождения
,
ТерриторияФактическогоМестаЖительства
New
=
pd
.
Личность
Navigation
.
ТерриторияФактическогоМестаЖительства
New
,
Снилс
=
pd
.
Личность
Navigation
.
Снилс
// ТерриторияShortname
// ТерриторияShortname
...
@@ -96,8 +97,9 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -96,8 +97,9 @@ namespace SocialMinistryDataExchange.Model {
// ФормаОбученияКод, ФормаОбученияНаименование
// ФормаОбученияКод, ФормаОбученияНаименование
,
ФормаОбученияКод
=
cp
.
ФормаОбучения
Navigation
.
Код
,
ФормаОбученияНаименование
=
cp
.
ФормаОбучения
Navigation
.
Наименование
,
ФормаОбученияКод
=
cp
.
ФормаОбучения
Navigation
.
Код
,
ФормаОбученияНаименование
=
cp
.
ФормаОбучения
Navigation
.
Наименование
}).
First
();
}).
First
();
if
(
person_record
.
Фамилия
!=
Person
.
Person
.
PersonFamilyName
||
person_record
.
Имя
!=
Person
.
Person
.
PersonName
if
(
person_record
.
Фамилия
!=
Person
.
Person
.
PersonFamilyName
||
person_record
.
Имя
!=
Person
.
Person
.
PersonName
||
(
person_record
.
БезОтчества
!=
false
&
&
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 '
{{
@Person
}}
':
{{
@Error
}}
;"
,
Person
.
Person
,
"Personal information Error"
);
...
@@ -105,7 +107,6 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -105,7 +107,6 @@ namespace SocialMinistryDataExchange.Model {
Person
.
Person
.
PersonName
=
person_record
.
Имя
;
Person
.
Person
.
PersonName
=
person_record
.
Имя
;
Person
.
Person
.
PersonSurname
=
person_record
.
Отчество
;
Person
.
Person
.
PersonSurname
=
person_record
.
Отчество
;
Person
.
Person
.
PersonBirthday
=
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;"
;
...
@@ -113,10 +114,73 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -113,10 +114,73 @@ namespace SocialMinistryDataExchange.Model {
Person
.
Person
.
PersonDocumentSeria
=
person_record
.
СерияДокумента
;
Person
.
Person
.
PersonDocumentSeria
=
person_record
.
СерияДокумента
;
Person
.
Person
.
PersonDocumentNumber
=
person_record
.
НомерДокумента
;
Person
.
Person
.
PersonDocumentNumber
=
person_record
.
НомерДокумента
;
Person
.
Person
.
PersonDocumentDate
=
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
))
{
int
i
=
0
;
Person
.
Person
.
rowguid_contingent
=
person_record
.
Личность
.
ToString
();
Person
.
PersonOccupation
.
Status
=
person_record
.
ПриказОтчисления
==
null
?
person_record
.
ПриказЗачисления
==
null
?
"3"
:
"1"
:
"2"
;
Person
.
PersonOccupation
.
StatusDate
=
Person
.
PersonOccupation
.
Status
switch
{
"1"
=>
person_record
.
НачальнаяДата
,
"2"
=>
person_record
.
КонечнаяДата
,
_
=>
DateTime
.
Now
,
};
if
(
Person
.
PersonOccupation
.
Status
==
"1"
)
{
Person
.
PersonOccupation
.
FounderType
=
person_record
.
ВидУчредителяКод
.
ToString
()
??
String
.
Empty
;
Person
.
PersonOccupation
.
OrganizationType
=
GetOrganizationType
(
_contingentContext
,
person_record
.
ТипОрганизации
).
ToString
()
switch
{
"29025A0D-7C7F-457B-9E14-0A6C16CBF94D"
=>
"1"
,
"CF85F418-FFAD-4C86-8937-B2D4FBF4B661"
=>
"2"
,
"1EB33F46-5A7C-4117-97EB-D3DFE4C3A7B2"
=>
"3"
,
"BB88E168-D124-462B-8870-2D9A35755561"
=>
"4"
,
_
=>
"5"
,
};
Person
.
PersonOccupation
.
EducationProgram
=
GetProgramType
(
_contingentContext
,
person_record
.
ОбразовательнаяПрограммаТип
).
ToString
()
switch
{
"5BE7BD7C-1202-45E2-8E9E-7247070EA7B6"
=>
"1"
,
"C09D82B4-CC8D-4EB8-9703-C95AEA53E044"
=>
"2"
,
"8E674FDF-32CF-4080-B062-85C41A067A6F"
=>
"3"
,
_
=>
"4"
,
};
Person
.
PersonOccupation
.
EducationForm
=
person_record
.
ФормаОбученияКод
switch
{
11
=>
"1"
,
12
=>
"2"
,
13
=>
"3"
,
21
=>
"4"
,
22
=>
"5"
,
_
=>
String
.
Empty
};
}
}
}
catch
(
Exception
ex
)
{
Person
.
Person
.
Error
+=
"Person not found;"
;
_logger
.
Error
(
$"Person '
{{
@Person
}}
':
{{
@Error
}}
;"
,
Person
.
Person
,
"Person not found"
);
}
}
private
static
Guid
?
GetOrganizationType
(
IContingentContext
context
,
Guid
?
OrgTypeUid
)
{
if
(
OrgTypeUid
==
null
)
{
return
null
;
}
}
var
type
=
(
from
too
in
context
.
ТипОбразовательнойОрганизации
s
where
too
.
PrimaryKey
==
OrgTypeUid
select
too
).
First
();
return
type
.
Иерархия
==
null
?
type
.
PrimaryKey
:
GetOrganizationType
(
context
,
type
.
Иерархия
);
}
private
static
Guid
?
GetProgramType
(
IContingentContext
context
,
Guid
?
ProgramTypeUid
)
{
if
(
ProgramTypeUid
==
null
)
{
return
null
;
}
// выделяем ДОШКОЛЬНУЮ в отдельный тип
if
(
ProgramTypeUid
.
ToString
()
==
"5BE7BD7C-1202-45E2-8E9E-7247070EA7B6"
)
{
return
ProgramTypeUid
;
}
var
type
=
(
from
opt
in
context
.
ТипОбразовательнойПрограммы
s
where
opt
.
PrimaryKey
==
ProgramTypeUid
select
opt
).
First
();
return
type
.
Иерархия
==
null
?
type
.
PrimaryKey
:
GetProgramType
(
context
,
type
.
Иерархия
);
}
}
public
Task
<
List
<
SMData
>>
GetPersonByDoc
(
string
document
)
{
public
Task
<
List
<
SMData
>>
GetPersonByDoc
(
string
document
)
{
...
@@ -177,29 +241,6 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -177,29 +241,6 @@ namespace SocialMinistryDataExchange.Model {
return
Task
.
FromResult
(
responce
);
return
Task
.
FromResult
(
responce
);
}
}
private
static
Guid
?
GetOrganizationType
(
IContingentContext
context
,
Guid
?
OrgTypeUid
)
{
if
(
OrgTypeUid
==
null
)
{
return
null
;
}
var
type
=
(
from
too
in
context
.
ТипОбразовательнойОрганизации
s
where
too
.
PrimaryKey
==
OrgTypeUid
select
too
).
First
();
return
type
.
Иерархия
==
null
?
type
.
PrimaryKey
:
GetOrganizationType
(
context
,
type
.
Иерархия
);
}
private
static
Guid
?
GetProgramType
(
IContingentContext
context
,
Guid
?
ProgramTypeUid
)
{
if
(
ProgramTypeUid
==
null
)
{
return
null
;
}
// выделяем ДОШКОЛЬНУЮ в отдельный тип
if
(
ProgramTypeUid
.
ToString
()
==
"5BE7BD7C-1202-45E2-8E9E-7247070EA7B6"
)
{
return
ProgramTypeUid
;
}
var
type
=
(
from
opt
in
context
.
ТипОбразовательнойПрограммы
s
where
opt
.
PrimaryKey
==
ProgramTypeUid
select
opt
).
First
();
return
type
.
Иерархия
==
null
?
type
.
PrimaryKey
:
GetProgramType
(
context
,
type
.
Иерархия
);
}
private
static
SMData
FormatResponce
(
IContingentContext
context
,
SMResponceTemp
record
)
{
private
static
SMData
FormatResponce
(
IContingentContext
context
,
SMResponceTemp
record
)
{
SMData
responce
=
new
();
SMData
responce
=
new
();
if
(
record
.
Личность
!=
Guid
.
Empty
)
{
// записи найдены
if
(
record
.
Личность
!=
Guid
.
Empty
)
{
// записи найдены
...
...
SocialMinistryDataExchange/Model/SMRequests.cs
View file @
91e8b447
...
@@ -36,7 +36,7 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -36,7 +36,7 @@ namespace SocialMinistryDataExchange.Model {
public
string
PersonName
{
get
;
set
;
}
public
string
PersonName
{
get
;
set
;
}
public
string
?
PersonSurname
{
get
;
set
;
}
public
string
?
PersonSurname
{
get
;
set
;
}
public
DateTime
?
PersonBirthday
{
get
;
set
;
}
public
DateTime
?
PersonBirthday
{
get
;
set
;
}
public
int
PersonDocumentType
{
get
;
set
;
}
public
int
?
PersonDocumentType
{
get
;
set
;
}
public
string
PersonDocumentSeria
{
get
;
set
;
}
public
string
PersonDocumentSeria
{
get
;
set
;
}
public
string
PersonDocumentNumber
{
get
;
set
;
}
public
string
PersonDocumentNumber
{
get
;
set
;
}
public
DateTime
?
PersonDocumentDate
{
get
;
set
;
}
public
DateTime
?
PersonDocumentDate
{
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