Files
BeWoPlaner/Report/ReportObjects/SBDCharacteristicsRO.cs
Lyndon cb39ab94fb Schulbegleitender Dienst:
Tabellen angepasst und eine für Klienten ohne Vertretungsbedarf hinzugefügt
Bindingfehler behoben

WaitLayer2
Bindingfehler behoben
2019-09-02 15:48:37 +02:00

232 lines
7.6 KiB
C#

using System.Collections.Generic;
using System.Linq;
using BeWo.Data.ICD10;
using BS.Shared;
using BS.Shared.DataContracts;
namespace BeWo.Report.ReportObjects
{
public class SBDCharacteristicsRO : AbstractBeWoReportObject<SBDCharacteristicsRO>
{
public long CustomerOid { get; set; }
public List<CustomerCostBearerRelationDC> CostBearers { get; set; }
public string DateOfBirth { get; set; }
public string Disabilities { get; set; }
public List<CustomerPersonRelationDC> EnvironmentPersons { get; set; }
public List<CustomerOrganisationRelationDC> EnvironmentOrganisations { get; set; }
public List<AbsenceTimeDC> Abwesenheiten { get; set; }
public string FamilyStatus { get; set; }
public string Fax { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Mail { get; set; }
public string Mobile { get; set; }
public string Name => FirstName + " " + LastName;
public string Notice { get; set; }
public string Occupation { get; set; }
public string Phone { get; set; }
public string PostCode { get; set; }
public string ReferenceNumber { get; set; }
public List<CustomerEmployeeRelationDC> RelatedEmployees { get; set; }
public string Sex { get; set; }
public string Street { get; set; }
public string Town { get; set; }
public object VarField1 { get; set; }
public object VarField2 { get; set; }
public object VarField3 { get; set; }
public object VarField4 { get; set; }
public object VarField5 { get; set; }
public object VarField6 { get; set; }
public object VarField7 { get; set; }
public object VarField8 { get; set; }
public object VarField9 { get; set; }
public object VarField10 { get; set; }
public List<ICD10Row> ICD10Diagnosen { get; set; }
public CustomerDC Customer { get; set; }
public static SBDCharacteristicsRO Create(CustomerDC pDC)
{
var result = new SBDCharacteristicsRO {Customer = pDC};
if (pDC.AbsenceTimes != null)
{
result.Abwesenheiten = pDC.AbsenceTimes.OrderBy(a => a.Start).ToList();
}
result.CustomerOid = pDC.CustomerOid.Value;
result.FirstName = pDC.FirstName;
result.LastName = pDC.LastName;
result.ReferenceNumber = pDC.ReferenceNumber;
if (pDC.DateOfBirth.HasValue)
{
result.DateOfBirth = pDC.DateOfBirth.Value.ToShortDateString();
}
result.ICD10Diagnosen = new List<ICD10Row>();
foreach (var idc10 in pDC.ICD10DiagnosisCodes)
{
result.ICD10Diagnosen.Add(new ICD10Row(idc10, ICD10DAO.GetDiagnosisForCode(idc10)));
}
result.Sex = pDC.Sex == BS.Shared.Sex.Female ? "weiblich" : "männlich";
result.Occupation = pDC.Profession;
if (pDC.FamilyStatus.HasValue)
{
switch (pDC.FamilyStatus.Value)
{
case BS.Shared.FamilyStatus.Divorced:
result.FamilyStatus = "geschieden";
break;
case BS.Shared.FamilyStatus.Married:
result.FamilyStatus = "verheiratet";
break;
case BS.Shared.FamilyStatus.Single:
result.FamilyStatus = "ledig";
break;
case BS.Shared.FamilyStatus.Widowed:
result.FamilyStatus = "verwitwet";
break;
case BS.Shared.FamilyStatus.Partner:
result.FamilyStatus = "in Partnerschaft";
break;
case BS.Shared.FamilyStatus.PartnerDivorced:
result.FamilyStatus = "getrennt lebend";
break;
case BS.Shared.FamilyStatus.PartnerDead:
result.FamilyStatus = "partnerhinterblieben";
break;
case BS.Shared.FamilyStatus.PartnerMarried:
result.FamilyStatus = "verpartnert";
break;
case BS.Shared.FamilyStatus.Entpartnert:
result.FamilyStatus = "entpartnert";
break;
}
}
result.Street = pDC.Street;
result.Town = pDC.Town;
result.PostCode = pDC.PostalCode;
foreach (var iContact in pDC.ContactInformations)
{
switch (iContact.ContactType)
{
case ContactType.business_Phone:
result.Phone = iContact.ContactValue;
break;
case ContactType.business_MobilePhone:
result.Mobile = iContact.ContactValue;
break;
case ContactType.business_Mail:
result.Mail = iContact.ContactValue;
break;
case ContactType.business_Fax:
result.Fax = iContact.ContactValue;
break;
}
}
result.Notice = pDC.Notice;
result.Disabilities = string.Join(", ", pDC.Disabilities.Select(d => d.TypeDescription).ToArray());
result.CostBearers = pDC.CostBearers;
result.RelatedEmployees = pDC.RelatedEmployees;
result.EnvironmentPersons = pDC.EnvironmentPersons;
result.EnvironmentOrganisations = pDC.EnvironmentOrganisations;
if (pDC.CustomerVarFields != null)
{
if (pDC.CustomerVarFields.Count > 0)
{
result.VarField1 = pDC.CustomerVarFields[0].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 1)
{
result.VarField2 = pDC.CustomerVarFields[1].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 2)
{
result.VarField3 = pDC.CustomerVarFields[2].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 3)
{
result.VarField4 = pDC.CustomerVarFields[3].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 4)
{
result.VarField5 = pDC.CustomerVarFields[4].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 5)
{
result.VarField6 = pDC.CustomerVarFields[5].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 6)
{
result.VarField7 = pDC.CustomerVarFields[6].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 7)
{
result.VarField8 = pDC.CustomerVarFields[7].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 8)
{
result.VarField9 = pDC.CustomerVarFields[8].VarFieldValue;
}
if (pDC.CustomerVarFields.Count > 9)
{
result.VarField10 = pDC.CustomerVarFields[9].VarFieldValue;
}
}
return result;
}
}
}