GenealogicalDataCommunication

This commit is contained in:
2023-04-02 23:19:15 -07:00
parent 5c3a151cd3
commit f69c100669
21 changed files with 677 additions and 376 deletions

View File

@ -7,7 +7,7 @@ internal abstract class PersonName
// ...
internal static Models.PersonName Create(string name)
internal static Models.PersonName GetPersonName(string name)
{
Models.PersonName result;
Models.PersonNameLast personNameLast;
@ -71,4 +71,16 @@ internal abstract class PersonName
return result.ToString();
}
internal static Models.PersonName? GetPersonName(Models.GenealogicalDataCommunication genealogicalDataCommunication)
{
Models.PersonName? result;
string[] surNameSegments = genealogicalDataCommunication.SurName is null ? Array.Empty<string>() : genealogicalDataCommunication.SurName.Split(' ');
string[] givenNameSegments = genealogicalDataCommunication.GivenName is null ? Array.Empty<string>() : genealogicalDataCommunication.GivenName.Split(' ');
if (!givenNameSegments.Any() || !surNameSegments.Any())
result = null;
else
result = new(new(givenNameSegments[0]), new(givenNameSegments.Length == 1 ? string.Empty : givenNameSegments[1]), new(surNameSegments[^1]), new(string.Empty));
return result;
}
}