Files
BeWoPlaner/BeWo/SchulbegleitenderDienst/ViewModel/VertretungsansichtBaseVM.cs
Lyndon Jetten dd96a5b0f7 Der Vertretungsalgorithmus wurde überarbeitet und berücksichtigt jetzt die Betreuungszeiten.
"Vertretung ab dem x. Tag" beginnt jetzt bei 1 und nicht mehr bei 0. Ein DB-Skript passt alle Werte mit 0 an -> Changes_2019_12_07 AbWelchemKrankheitsTag UPDATE.txt
2019-12-07 21:06:03 +01:00

202 lines
5.7 KiB
C#

using System.Collections.Generic;
using BeWo.ViewModel;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
namespace BeWo.SchulbegleitenderDienst.ViewModel
{
public class VertretungsansichtBaseVM : AbstractBaseVM
{
public CompactEmployeeDC Employee { get;set; }
public CompactCustomerDC Customer { get; set; }
public string EmployeeName => Employee?.ToString();
public string CustomerName => Customer?.ToString();
public string Dringlichkeit { get; set; }
public string DringlichkeitColor { get; set; }
public string Teamleitung { get; set; }
public string Geschlecht { get; set; }
public string Pflege { get; set; }
public string Toilettengang { get; set; }
public string Aggressiv { get; set; }
private string _Notice;
public string Bemerkung
{
get => _Notice;
set
{
if (Equals(_Notice, value))
{
return;
}
_Notice = value;
FirePropertyChanged(nameof(Bemerkung));
}
}
public List<ContactDC> CustomerContactInformation { get; set; }
public string CustomerContactInformationString
{
get
{
if (CustomerContactInformation == null || CustomerContactInformation.Count == 0)
{
return null;
}
return GetContactInformationString(CustomerContactInformation);
}
}
public List<ContactDC> EmployeeContactInformation { get; set; }
public string EmployeeContactInformationString
{
get
{
if (EmployeeContactInformation == null || EmployeeContactInformation.Count == 0)
{
return null;
}
return GetContactInformationString(EmployeeContactInformation);
}
}
private static string GetContactInformationString(IReadOnlyCollection<ContactDC> contactList)
{
if (contactList == null || contactList.Count == 0)
{
return null;
}
var result = string.Empty;
foreach (var item in contactList)
{
if (result.Length > 0)
{
result += "\n";
}
var typeAsString = string.Empty;
switch (item.ContactType)
{
case ContactType.business_Mail:
typeAsString = "E-Mail: ";
break;
case ContactType.business_Fax:
typeAsString = "Fax: ";
break;
case ContactType.business_Phone:
typeAsString = "Tel.: ";
break;
case ContactType.business_MobilePhone:
typeAsString = "Handynr.: ";
break;
}
result += typeAsString + item.ContactValue;
}
return result;
}
public string SchoolString
{
get
{
if (Schools == null || Schools.Count == 0)
{
return null;
}
var result = string.Empty;
foreach (var item in Schools)
{
if (result.Length > 0)
{
result += ", ";
}
result += item.Organisation.Name;
}
return result;
}
}
public List<VertretungDC> LastSubstitutions { get; set; }
public string LastSubstitutionsString
{
get
{
if (LastSubstitutions == null || LastSubstitutions.Count == 0)
{
return null;
}
var result = string.Empty;
foreach (var item in LastSubstitutions)
{
if (result.Length > 0)
{
result += "\n";
}
var start = item.VertretungsZeitraumVon.Minute == 0 && item.VertretungsZeitraumVon.Hour == 0 ? item.VertretungsZeitraumVon.ToString("dd.MM.yyyy") : item.VertretungsZeitraumVon.ToString("dd.MM.yyyy HH:mm");
var end = item.VertretungsZeitraumBis.Minute == 0 && item.VertretungsZeitraumBis.Hour == 0 ? item.VertretungsZeitraumBis.ToString("dd.MM.yyyy") : item.VertretungsZeitraumBis.ToString("dd.MM.yyyy HH:mm");
result += $"{start} - {end}";
}
return result;
}
}
public string SchulbegleitenderDienstString { get; set; }
public List<CustomerOrganisationRelationDC> Schools { get; set; }
public string CustomerPflege { get; set; }
public string EmployeePflege { get; set; }
public string CustomerToilettengang { get; set; }
public string EmployeeToilettengang { get; set; }
public string CustomerAggressivitaet { get; set; }
public string EmployeeAggressivitaet { get; set; }
public string CustomerHygienebelehrung { get; set; }
public string EmployeeHygienebelehrung { get; set; }
public string CustomerSchutzstufe { get; set; }
public string EmployeeSchutzstufe { get; set; }
public string VertreterInfoString { get; set; }
public string EmployeeAddressString { get; set; }
}
}