132 lines
4.7 KiB
C#
132 lines
4.7 KiB
C#
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
|
|
namespace BeWoPlanerMobil.Util
|
|
{
|
|
public class JsonPerson
|
|
{
|
|
#region Eigenschaften
|
|
public string Titel { get; set; }
|
|
public string Vorname { get; set; }
|
|
public string Nachname { get; set; }
|
|
public string Geburtstag { get; set; }
|
|
public Sex? PersonSex { get; set; }
|
|
public string Geschlecht { get; set; }
|
|
public string Familienstand { get; set; }
|
|
public string Funktion { get; set; }
|
|
public string Staatsangehoerigkeit { get; set; }
|
|
public string Migrationshintergrund { get; set; }
|
|
public string Aufenthaltsstatus { get; set; }
|
|
public string Archiviert { get; set; }
|
|
public string Notizen { get; set; }
|
|
#endregion
|
|
|
|
#region Adresse
|
|
public string Adresszusatz { get; set; }
|
|
public string Strasse { get; set; }
|
|
public string Postleitzahl { get; set; }
|
|
public string Ort { get; set; }
|
|
#endregion
|
|
|
|
#region Rechnungsadresse
|
|
public string RechnungsadresseStrasse { get; set; }
|
|
public string RechnungsadressePostleitzahl { get; set; }
|
|
public string RechnungsadresseOrt { get; set; }
|
|
#endregion
|
|
|
|
#region Kontakt
|
|
public string Handy { get; set; }
|
|
public string Telefon { get; set; }
|
|
public string Fax { get; set; }
|
|
public string EMail { get; set; }
|
|
public string Homepage { get; set; }
|
|
#endregion
|
|
|
|
public string GoogleMapsLink
|
|
{
|
|
get
|
|
{
|
|
var encodedStreet = HttpUtility.UrlEncode(Strasse);
|
|
var encodedCity = HttpUtility.UrlEncode(Ort);
|
|
|
|
return $"http://maps.google.de/maps?q={encodedStreet},+{Postleitzahl}+{encodedCity}&t=h&z=17";
|
|
}
|
|
}
|
|
|
|
public List<Organisation2PersonDC> Organisations { get; set; } = new List<Organisation2PersonDC>();
|
|
|
|
public List<Umfeldsperson> Umfeldpersonen { get; set; } = new List<Umfeldsperson>();
|
|
|
|
public JsonPerson(PersonDC person, List<CustomerPersonRelationDC> umfeld)
|
|
{
|
|
Titel = person.Title?.DisplayName;
|
|
Vorname = person.FirstName;
|
|
Nachname = person.LastName;
|
|
Geburtstag = person.DateOfBirth?.ToString("yyyy-MM-dd") ?? string.Empty;
|
|
|
|
PersonSex = person.Sex;
|
|
|
|
switch(person.Sex)
|
|
{
|
|
case Sex.Male:
|
|
Geschlecht = "Männlich";
|
|
break;
|
|
case Sex.Female:
|
|
Geschlecht = "Weiblich";
|
|
break;
|
|
case Sex.Divers:
|
|
Geschlecht = "Divers";
|
|
break;
|
|
default:
|
|
Geschlecht = string.Empty;
|
|
break;
|
|
}
|
|
|
|
Familienstand = person.FamilyStatus != null ? EnumTranslations.FamilyStatusTranslations[person.FamilyStatus] : string.Empty;
|
|
Funktion = person.Function?.DisplayName ?? string.Empty;
|
|
Staatsangehoerigkeit = person.Nationalitaet?.DisplayName ?? string.Empty;
|
|
Migrationshintergrund = person.IsMigrant ? "checked" : string.Empty;
|
|
Aufenthaltsstatus = person.AufenthaltsStatus?.DisplayName ?? string.Empty;
|
|
Archiviert = person.ActivationType == ActivationTypeId.Archived ? "checked" : string.Empty;
|
|
Notizen = person.PersonNotice;
|
|
|
|
Adresszusatz = person.AddressLine1;
|
|
Strasse = person.Street;
|
|
Postleitzahl = person.PostalCode;
|
|
Ort = person.Town;
|
|
|
|
RechnungsadresseStrasse = person.InvoiceAddressStreet;
|
|
RechnungsadressePostleitzahl = person.InvoiceAddressPostalCode;
|
|
RechnungsadresseOrt = person.InvoiceAddressTown;
|
|
|
|
foreach(var contact in person.ContactInformations)
|
|
{
|
|
switch(contact.ContactType)
|
|
{
|
|
case ContactType.private_Mail:
|
|
EMail = contact.ContactValue;
|
|
break;
|
|
case ContactType.private_Fax:
|
|
Fax = contact.ContactValue;
|
|
break;
|
|
case ContactType.private_Phone:
|
|
Telefon = contact.ContactValue;
|
|
break;
|
|
case ContactType.private_MobilePhone:
|
|
Handy = contact.ContactValue;
|
|
break;
|
|
}
|
|
}
|
|
|
|
foreach(var rel in umfeld)
|
|
{
|
|
Umfeldpersonen.Add(new Umfeldsperson(rel));
|
|
}
|
|
|
|
Organisations = person.OrganisationRelations;
|
|
}
|
|
}
|
|
} |