using System; using System.Collections.Generic; using BS.Shared; namespace BeWo.Data.Entities { public class ServiceRecord : BeWoEntityBase { public static string PropertyName_CostBearer2SupportConcept = "CostBearer2SupportConcept"; public static string PropertyName_CostBearer2SupportConceptOid = "CostBearer2SupportConceptOid"; public static string PropertyName_Customer = "Customer"; public static string PropertyName_CustomerOid = "CustomerOid"; public static string PropertyName_Employee = "Employee"; public static string PropertyName_EmployeeOid = "EmployeeOid"; public static string PropertyName_End = "End"; public static string PropertyName_GroupEmployeeCount = "GroupEmployeeCount"; public static string PropertyName_GroupOid = "GroupOid"; public static string PropertyName_GroupPersonCount = "GroupPersonCount"; public static string PropertyName_GroupRoundedDuration = "GroupRoundedDuration"; public static string PropertyName_IP = "IP"; public static string PropertyName_RoundedDuration = "RoundedDuration"; public static string PropertyName_ServiceDescription = "ServiceDescription"; public static string PropertyName_Start = "Start"; public static string PropertyName_SupportConcept = "SupportConcept"; public static string PropertyName_ValueList = "ValueList"; public static string PropertyName_ServiceRecordType = "ServiceRecordType"; public static string PropertyName_IsCreatedInMobileClient = "IsCreatedInMobileClient"; public static string PropertyName_WohnheimbuchungsOid = "WohnheimbuchungsOid"; public static string PropertyName_DurationInStunden = "DurationInStunden"; public static string PropertyName_ServiceRecordFormat = "ServiceRecordFormat"; public static string PropertyName_RTFNotice1 = "RTFNotice1"; public static string PropertyName_RTFNotice2 = "RTFNotice2"; public static string PropertyName_RTFNotice3 = "RTFNotice3"; public static string PropertyName_RTFNotice4 = "RTFNotice4"; public static string PropertyName_RTFNotice5 = "RTFNotice5"; public static string PropertyName_Notice2 = "Notice2"; public static string PropertyName_Notice3 = "Notice3"; public static string PropertyName_Notice4 = "Notice4"; public static string PropertyName_Notice5 = "Notice5"; public static string PropertyName_Betrag = "Betrag"; private long? _WohnheimbuchungsOid; private bool _isCreatedInMobileClient; private CostBearer2SupportConcept _CostBearer2SupportConcept; private long? _CostBearer2SupportConceptOid; private Customer _Customer; private long? _CustomerOid; private Employee _Employee; private long? _EmployeeOid; private DateTime? _End; private ServiceRecordGroup _Group; private int? _GroupEmployeeCount; private long? _GroupOid; private long? _SignatureOid; private int? _GroupPersonCount; private decimal? _GroupRoundedDuration; private string _IP; private decimal _RoundedDuration; private ServiceRecordTypeId? _ServiceRecordType; private ServiceDescription _ServiceDescription; private DateTime? _Start; private SupportConcept _SupportConcept; private IList _ValueList; public virtual decimal? DistanceInMeter { get; set; } public virtual int? Relevance { get; set; } private ZeiterfassungsDauer? _DurationInStunden; private ServiceRecordFormate? _ServiceRecordFormat; private string _RTFNotice1; private string _RTFNotice2; private string _RTFNotice3; private string _RTFNotice4; private string _RTFNotice5; private string _Notice2; private string _Notice3; private string _Notice4; private string _Notice5; private decimal? _Betrag; public virtual bool IsCreatedInMobileClient { get { return _isCreatedInMobileClient; } set { if (AreDifferent(_isCreatedInMobileClient, value)) { _isCreatedInMobileClient = value; } } } public virtual CostBearer2SupportConcept CostBearer2SupportConcept { get { return this._CostBearer2SupportConcept; } set { if (this.AreDifferent(this._CostBearer2SupportConcept, value)) { this._CostBearer2SupportConcept = value; } } } public virtual long? CostBearer2SupportConceptOid { get { return this._CostBearer2SupportConceptOid; } set { if (this.AreDifferent(this._CostBearer2SupportConceptOid, value)) { this._CostBearer2SupportConceptOid = value; } } } public virtual Customer Customer { get { return this._Customer; } set { if (this.AreDifferent(this._Customer, value)) { this._Customer = value; } } } public virtual long? CustomerOid { get { return this._CustomerOid; } set { if (this.AreDifferent(this._CustomerOid, value)) { this._CustomerOid = value; } } } public virtual long? SignatureOid { get { return this._SignatureOid; } set { if (this.AreDifferent(this._SignatureOid, value)) { this._SignatureOid = value; } } } public virtual double DurationMinutes { get { return this.GetDurationMinutes(); } } public virtual Employee Employee { get { return this._Employee; } set { if (this.AreDifferent(this._Employee, value)) { this._Employee = value; if (this._Employee != null) { this.EmployeeOid = this._Employee.Oid; } else { this.EmployeeOid = null; } } } } public virtual long? EmployeeOid { get { return this._EmployeeOid; } set { if (this.AreDifferent(this._EmployeeOid, value)) { this._EmployeeOid = value; } } } public virtual DateTime? End { get { return this._End; } set { if (this.AreDifferent(this._End, value)) { this._End = value; } } } public virtual ServiceRecordGroup Group { get { return this._Group; } set { if (this.AreDifferent(this._Group, value)) { this._Group = value; if (this._Group != null) { this.GroupOid = this._Group.Oid; } else { this.GroupOid = null; } } } } public virtual int? GroupEmployeeCount { get { if (!_GroupOid.HasValue && _GroupPersonCount.HasValue && _GroupEmployeeCount.HasValue && _GroupPersonCount.Value == 1 && _GroupEmployeeCount.Value == 1) { return null; } return this._GroupEmployeeCount; } set { if (this.AreDifferent(this._GroupEmployeeCount, value)) { this._GroupEmployeeCount = value; } } } public virtual long? GroupOid { get { return this._GroupOid; } set { if (this.AreDifferent(this._GroupOid, value)) { this._GroupOid = value; } } } public virtual long? WohnheimbuchungsOid { get { return _WohnheimbuchungsOid; } set { if (AreDifferent(_WohnheimbuchungsOid, value)) { _WohnheimbuchungsOid = value; } } } public virtual int? GroupPersonCount { get { if (!_GroupOid.HasValue && _GroupPersonCount.HasValue && _GroupEmployeeCount.HasValue && _GroupPersonCount.Value == 1 && _GroupEmployeeCount.Value == 1) { return null; } return this._GroupPersonCount; } set { if (this.AreDifferent(this._GroupPersonCount, value)) { this._GroupPersonCount = value; } } } public virtual decimal? GroupRoundedDuration { get { if (!_GroupOid.HasValue && _GroupPersonCount.HasValue && _GroupEmployeeCount.HasValue && _GroupPersonCount.Value == 1 && _GroupEmployeeCount.Value == 1) { return null; } return this._GroupRoundedDuration; } set { if (this.AreDifferent(this._GroupRoundedDuration, value)) { this._GroupRoundedDuration = value; } } } public virtual string IP { get { return this._IP; } set { if (this.AreDifferent(this._IP, value)) { this._IP = value; } } } public virtual decimal RoundedDuration { get { return this._RoundedDuration; } set { if (this.AreDifferent(this._RoundedDuration, value)) { this._RoundedDuration = value; } } } public virtual ServiceDescription ServiceDescription { get { return this._ServiceDescription; } set { if (this.AreDifferent(this._ServiceDescription, value)) { this._ServiceDescription = value; } } } public virtual DateTime? Start { get { return this._Start; } set { if (this.AreDifferent(this._Start, value)) { this._Start = value; } } } public virtual SupportConcept SupportConcept { get { return this._SupportConcept; } set { if (this.AreDifferent(this._SupportConcept, value)) { this._SupportConcept = value; } } } public virtual ServiceRecordTypeId? ServiceRecordType { get { return this._ServiceRecordType; } set { if (this.AreDifferent(this._ServiceRecordType, value)) { this._ServiceRecordType = value; } } } //public virtual string Title //{ // get // { // string result = String.Format("{0:ddd. dd MMM. yyyy }", this.Start); // if (this.Start.Value.Second == 0) // { // result += string.Format(" | {0:HH:mm} - {1: HH:mm}", this.Start, this.End); // } // return result; // } //} public virtual string Title { get { String date = ""; String time = ""; if (Start.HasValue) { date = Start.Value.Date.ToShortDateString(); DateTime timeDt = Start.Value; if (timeDt.Second == 0) { time = timeDt.ToShortTimeString(); if (GroupOid != null && GroupRoundedDuration != null) timeDt = timeDt.AddMinutes((double)GroupRoundedDuration); else timeDt = timeDt.AddMinutes((double)RoundedDuration); time = time + " - " + timeDt.ToShortTimeString(); } } date += " " + time; if (GroupOid != null && GroupPersonCount != null && GroupRoundedDuration != null) { date += String.Format(" Gruppe ({0} Teilnehmer, {1} " + BS.Shared.Translation.Translator.Translate("Betreuer(in)") + "). Dauer: {2:0.##} Minuten.", GroupPersonCount.Value, GroupEmployeeCount.Value, GroupRoundedDuration.Value); } return date; } } public virtual IList ValueList { get { return this._ValueList ?? (this._ValueList = new List()); } set { if (this.AreDifferent(this._ValueList, value)) { this._ValueList = value; } } } public virtual double GetDurationMinutes() { if (GroupOid.HasValue) { return (double)RoundedDuration; } else { return (End.Value - Start.Value).TotalMinutes; } } public virtual ZeiterfassungsDauer? DurationInStunden { get { return this._DurationInStunden; } set { if (this.AreDifferent(this._DurationInStunden, value)) { this._DurationInStunden = value; } } } public virtual ServiceRecordFormate? ServiceRecordFormat { get { return this._ServiceRecordFormat; } set { if (this.AreDifferent(this._ServiceRecordFormat, value)) { this._ServiceRecordFormat = value; } } } public virtual string RTFNotice1 { get { return this._RTFNotice1; } set { if (this.AreDifferent(this._RTFNotice1, value)) { this._RTFNotice1 = value; } } } public virtual string RTFNotice2 { get { return this._RTFNotice2; } set { if (this.AreDifferent(this._RTFNotice2, value)) { this._RTFNotice2 = value; } } } public virtual string RTFNotice3 { get { return this._RTFNotice3; } set { if (this.AreDifferent(this._RTFNotice3, value)) { this._RTFNotice3 = value; } } } public virtual string RTFNotice4 { get { return this._RTFNotice4; } set { if (this.AreDifferent(this._RTFNotice4, value)) { this._RTFNotice4 = value; } } } public virtual string RTFNotice5 { get { return this._RTFNotice5; } set { if (this.AreDifferent(this._RTFNotice5, value)) { this._RTFNotice5 = value; } } } public virtual string Notice2 { get { return this._Notice2; } set { if (this.AreDifferent(this._Notice2, value)) { this._Notice2 = value; } } } public virtual string Notice3 { get { return this._Notice3; } set { if (this.AreDifferent(this._Notice3, value)) { this._Notice3 = value; } } } public virtual string Notice4 { get { return this._Notice4; } set { if (this.AreDifferent(this._Notice4, value)) { this._Notice4 = value; } } } public virtual string Notice5 { get { return this._Notice5; } set { if (this.AreDifferent(this._Notice5, value)) { this._Notice5 = value; } } } public virtual decimal? Betrag { get { return this._Betrag; } set { if (this.AreDifferent(this._Betrag, value)) { this._Betrag = value; } } } } }