diff --git a/AICore/Context/Entry/PersonNavigationContextEntry.cs b/AICore/Context/Entry/PersonNavigationContextEntry.cs index 5ae9ad2b2..db5fce945 100644 --- a/AICore/Context/Entry/PersonNavigationContextEntry.cs +++ b/AICore/Context/Entry/PersonNavigationContextEntry.cs @@ -26,5 +26,17 @@ namespace AICore.Context.Entry [JsonPropertyName("Funktion")] public string Function { get; set; } + + [JsonPropertyName("Telefon")] + public string Tel { get; set; } + + [JsonPropertyName("Mobil")] + public string Mobil { get; set; } + + [JsonPropertyName("Email")] + public string Email { get; set; } + + [JsonPropertyName("Fax")] + public string Fax { get; set; } } } diff --git a/AICore/Context/EntryMapper/PersonNavigationContextEntryMapper.cs b/AICore/Context/EntryMapper/PersonNavigationContextEntryMapper.cs index 92979107d..a783428ff 100644 --- a/AICore/Context/EntryMapper/PersonNavigationContextEntryMapper.cs +++ b/AICore/Context/EntryMapper/PersonNavigationContextEntryMapper.cs @@ -2,6 +2,9 @@ using System.Linq; using AICore.Context.Entry; using BeWo.Data.Entities; +using BS.Shared.DataContracts; +using BS.Shared; +using BS.Shared.Extensions; namespace AICore.Context.EntryMapper { @@ -11,11 +14,14 @@ namespace AICore.Context.EntryMapper { pContext.AddressString = pObject.Address?.ToSingleLine() ?? "null"; pContext.DateOfBirth = pObject.DateOfBirth; - //pContext.CustomerOid = "---"; - //pContext.EmployeeOid = "---"; pContext.FullName = pObject.FirstNameLastName; pContext.Geschlecht = pObject.Sex?.ToString(); pContext.Function = pObject.Function?.Value; + + pContext.Tel = ContactExtensions.GetPrivatePhoneNumber(pObject.Contacts); + pContext.Fax = ContactExtensions.GetPrivateFaxNumber(pObject.Contacts); + pContext.Mobil = ContactExtensions.GetPrivateMobilePhoneNumber(pObject.Contacts); + pContext.Email = ContactExtensions.GetPrivateMailNumber(pObject.Contacts); } } } diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 4c32cab0c..0c4f3b825 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -46,7 +46,7 @@ publish.htm false true - 275 + 276 2.0.1.%2a false true diff --git a/Data/Entities/Contact.cs b/Data/Entities/Contact.cs index e4bc059b9..6101aaac9 100644 --- a/Data/Entities/Contact.cs +++ b/Data/Entities/Contact.cs @@ -1,11 +1,12 @@ using BS.Shared; +using BS.Shared.Interface; using System.Diagnostics; namespace BeWo.Data.Entities { [DebuggerDisplay("{Type}: {Value}")] - public class Contact : BeWoEntityBase - { + public class Contact : BeWoEntityBase, IContact + { public static string PropertyName_Type = "Type"; public static string PropertyName_Value = "Value"; diff --git a/Shared/DataContracts/ContactDC.cs b/Shared/DataContracts/ContactDC.cs index 80c7e8cb6..1c19b1c9a 100644 --- a/Shared/DataContracts/ContactDC.cs +++ b/Shared/DataContracts/ContactDC.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using BS.Shared.Interface; +using System.Diagnostics; using System.Runtime.Serialization; namespace BS.Shared.DataContracts @@ -6,8 +7,8 @@ namespace BS.Shared.DataContracts [DataContract] [DebuggerDisplay("{ContactType}: {ContactValue}")] - public partial class ContactDC : IDataContract - { + public partial class ContactDC : IDataContract, IContact + { [DataMember] public long? ContactOID { get; set; } @@ -28,5 +29,8 @@ namespace BS.Shared.DataContracts ContactValue = this.ContactValue }; } - } + + public ContactType Type => ContactType; + public string Value => ContactValue; + } } \ No newline at end of file diff --git a/Shared/Extensions/ContactExtensions.cs b/Shared/Extensions/ContactExtensions.cs new file mode 100644 index 000000000..63b1ac71d --- /dev/null +++ b/Shared/Extensions/ContactExtensions.cs @@ -0,0 +1,26 @@ +using BS.Shared.Interface; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.Extensions +{ + public static class ContactExtensions + { + public static string GetPrivatePhoneNumber(this IEnumerable contacts) + => contacts.GetInformation(ContactType.private_Phone); + public static string GetPrivateMobilePhoneNumber(this IEnumerable contacts) + => contacts.GetInformation(ContactType.private_MobilePhone); + public static string GetPrivateFaxNumber(this IEnumerable contacts) + => contacts.GetInformation(ContactType.private_Fax); + public static string GetPrivateMailNumber(this IEnumerable contacts) + => contacts.GetInformation(ContactType.private_Mail); + + public static string GetInformation(this IEnumerable contacts, ContactType contactType) + { + return contacts?.FirstOrDefault(x => x.Type == contactType)?.Value; + } + } +} diff --git a/Shared/Interface/IContact.cs b/Shared/Interface/IContact.cs new file mode 100644 index 000000000..ec7085215 --- /dev/null +++ b/Shared/Interface/IContact.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.Interface +{ + public interface IContact + { + ContactType Type { get; } + string Value { get; } + } +} diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index 952ff31f9..f56e8a410 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -387,6 +387,7 @@ + @@ -394,6 +395,7 @@ +