194 lines
7.8 KiB
C#
194 lines
7.8 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWoPlanerMobil.Util
|
|
{
|
|
public class JsonCustomer
|
|
{
|
|
public string Vorname { get; set; }
|
|
public string Nachname { get; set; }
|
|
|
|
public string Alias { get; set; }
|
|
public string Geburtstag { get; set; }
|
|
public string Geschlecht { get; set; }
|
|
|
|
public string Adresszusatz { get; set; }
|
|
public string Strasse { get; set; }
|
|
public string Postleitzahl { get; set; }
|
|
public string Ort { get; set; }
|
|
|
|
public string RechnungsadresseName { get; set; }
|
|
public string RechnungsadresseStrasse { get; set; }
|
|
public string RechnungsadressePostleitzahl { get; set; }
|
|
public string RechnungsadresseOrt { get; set; }
|
|
|
|
public string EMail { get; set; }
|
|
public string Fax { get; set; }
|
|
public string Telefon { get; set; }
|
|
public string Handy { get; set; }
|
|
public string Kommentar { get; set; }
|
|
|
|
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<Umfeldsperson> Umfeldpersonen { get; set; } = new List<Umfeldsperson>();
|
|
|
|
public List<ReferenceNumberWithNotice> ReferenceNumbers { get; set; } = new List<ReferenceNumberWithNotice>();
|
|
|
|
public List<JsonAbsenceTime> AbsenceTimes { get; set; } = new List<JsonAbsenceTime>();
|
|
|
|
public List<JsonOrganisation> Organisations { get; set; } = new List<JsonOrganisation>();
|
|
|
|
public Sex? CustomerSex { get; set; }
|
|
|
|
public Dictionary<string, string> ICD10Diagnosen { get; }
|
|
|
|
public bool HasDiagnosen => ICD10Diagnosen?.Any() ?? false;
|
|
public bool HasDisabilities { get; }
|
|
|
|
public string SchwebiIsUnlimited { get; }
|
|
public string SchwebiMerkzeichen { get; }
|
|
public string SchwebiBehinderungsart { get; }
|
|
public string SchwebiGueltigVon { get; }
|
|
public string SchwebiGueltigBis { get; }
|
|
public string SchwebiBeiblattGueltigBis { get; }
|
|
public string SchwebiAusstAmt { get; }
|
|
public string SchwebiGradDerBehinderung { get; }
|
|
public string SchwebiPflegegrad { get; }
|
|
public string SchwebiAktenzeichen { get; }
|
|
public bool HasSchwebi { get; }
|
|
public string Krankenkasse { get; }
|
|
public string Versichertennummer { get; }
|
|
public string Versichertenstatus { get; }
|
|
|
|
|
|
public JsonCustomer(CustomerDC customer, List<BeWoFolderDC> folderTree, Dictionary<string, string> icd10Diagnosen)
|
|
{
|
|
Krankenkasse = customer.HealthInsurance;
|
|
Versichertennummer = customer.InsuranceNumber;
|
|
Versichertenstatus = customer.VersichertenStatus;
|
|
|
|
HasDisabilities = customer.Disabilities.Any();
|
|
SchwebiIsUnlimited = customer.AusweisUnbefristetGueltig == true ? "JA" : "NEIN";
|
|
SchwebiGradDerBehinderung = customer.GradDerBehinderung;
|
|
SchwebiPflegegrad = customer.Pflegegrad?.ToString() ?? string.Empty;
|
|
SchwebiAktenzeichen = customer.AusweisAktenzeichen;
|
|
SchwebiMerkzeichen = string.Empty;
|
|
foreach(var mz in customer.MerkzeichenListe)
|
|
{
|
|
SchwebiMerkzeichen += $"{mz}; ";
|
|
}
|
|
SchwebiMerkzeichen = SchwebiMerkzeichen.Trim().Trim(';');
|
|
|
|
SchwebiBehinderungsart = string.Empty;
|
|
foreach(var ba in customer.BehinderungsartenListe)
|
|
{
|
|
SchwebiBehinderungsart += $"{ba}; ";
|
|
}
|
|
SchwebiBehinderungsart = SchwebiBehinderungsart.Trim().Trim(';');
|
|
|
|
SchwebiGueltigVon = customer.AusweisGueltigVon?.ToString("dd.MM.yyyy") ?? string.Empty;
|
|
SchwebiGueltigBis = customer.AusweisGueltigBis?.ToString("dd.MM.yyyy") ?? string.Empty;
|
|
SchwebiBeiblattGueltigBis = customer.BeiblattGueltigBis?.ToString("dd.MM.yyyy") ?? string.Empty;
|
|
SchwebiAusstAmt = customer.AusstVersAmt;
|
|
|
|
HasSchwebi = SchwebiIsUnlimited == "JA" ||
|
|
!string.IsNullOrWhiteSpace(SchwebiGradDerBehinderung) ||
|
|
!string.IsNullOrWhiteSpace(SchwebiPflegegrad) ||
|
|
!string.IsNullOrWhiteSpace(SchwebiAktenzeichen) ||
|
|
!string.IsNullOrWhiteSpace(SchwebiMerkzeichen) ||
|
|
!string.IsNullOrWhiteSpace(SchwebiBehinderungsart) ||
|
|
!string.IsNullOrWhiteSpace(SchwebiGueltigVon) ||
|
|
!string.IsNullOrWhiteSpace(SchwebiGueltigBis) ||
|
|
!string.IsNullOrWhiteSpace(SchwebiBeiblattGueltigBis) ||
|
|
!string.IsNullOrWhiteSpace(SchwebiAusstAmt);
|
|
|
|
ICD10Diagnosen = icd10Diagnosen;
|
|
Vorname = customer.FirstName;
|
|
Nachname = customer.LastName;
|
|
Alias = customer.CustomerAlias;
|
|
Geburtstag = customer.DateOfBirth?.ToString("yyyy-MM-dd") ?? string.Empty;
|
|
|
|
switch(customer.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;
|
|
}
|
|
|
|
CustomerSex = customer.Sex;
|
|
|
|
Adresszusatz = customer.AddressLine1;
|
|
Strasse = customer.Street;
|
|
Postleitzahl = customer.PostalCode;
|
|
Ort = customer.Town;
|
|
|
|
RechnungsadresseName = customer.InvoiceAddressLine1;
|
|
RechnungsadresseStrasse = customer.InvoiceAddressStreet;
|
|
RechnungsadressePostleitzahl = customer.InvoiceAddressPostalCode;
|
|
RechnungsadresseOrt = customer.InvoiceAddressTown;
|
|
|
|
Kommentar = customer.Notice;
|
|
|
|
customer.CostBearers?.Where(costBearer => !string.IsNullOrWhiteSpace(costBearer.ReferenceNumber)).DoForEach(cb =>
|
|
{
|
|
ReferenceNumbers.AddIfNotIn(new ReferenceNumberWithNotice(cb.ReferenceNumber, cb.Notice, cb.CostBearer.Name));
|
|
});
|
|
|
|
foreach(var iContactDC in customer.ContactInformations)
|
|
{
|
|
switch(iContactDC.ContactType)
|
|
{
|
|
case ContactType.business_Mail:
|
|
EMail = iContactDC.ContactValue;
|
|
break;
|
|
case ContactType.business_Fax:
|
|
Fax = iContactDC.ContactValue;
|
|
break;
|
|
case ContactType.business_Phone:
|
|
Telefon = iContactDC.ContactValue;
|
|
break;
|
|
case ContactType.business_MobilePhone:
|
|
Handy = iContactDC.ContactValue;
|
|
break;
|
|
}
|
|
}
|
|
|
|
foreach(var rel in customer.EnvironmentPersons)
|
|
{
|
|
Umfeldpersonen.Add(new Umfeldsperson(rel));
|
|
}
|
|
|
|
foreach(var absenceTime in customer.AbsenceTimes.OrderByDescending(o => o.Start))
|
|
{
|
|
AbsenceTimes.Add(new JsonAbsenceTime(absenceTime.Start, absenceTime.End, absenceTime.Notice, absenceTime.Reason));
|
|
}
|
|
|
|
foreach(var organisation in customer.EnvironmentOrganisations)
|
|
{
|
|
Organisations.Add(new JsonOrganisation(organisation));
|
|
}
|
|
}
|
|
}
|
|
} |