Files
BeWoPlaner/Data/Entities/ServiceRecord.cs

801 lines
20 KiB
C#
Raw Permalink Normal View History

2016-06-27 01:45:38 +02:00
using System;
using System.Collections.Generic;
2024-12-30 16:09:20 +01:00
using System.Diagnostics;
2016-06-27 01:45:38 +02:00
using BS.Shared;
namespace BeWo.Data.Entities
{
2024-12-30 16:09:20 +01:00
[DebuggerDisplay("{Customer.Person.LastNameFirstName} {Start}-{End} ({RoundedDuration}min)")]
2025-04-17 01:11:16 +02:00
public class ServiceRecord : BeWoEntityBase, IServiceRecord
2016-06-27 01:45:38 +02:00
{
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";
2017-01-11 11:02:58 +01:00
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";
2020-10-12 13:03:05 +02:00
public static string PropertyName_Betrag = "Betrag";
2016-06-27 01:45:38 +02:00
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<ValueListEntry2Object> _ValueList;
2022-11-09 09:44:24 +01:00
public virtual decimal? DistanceInMeter { get; set; }
2016-06-27 01:45:38 +02:00
public virtual int? Relevance { get; set; }
2017-01-11 11:02:58 +01:00
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;
2016-06-27 01:45:38 +02:00
private string _Notice5;
2020-10-12 13:03:05 +02:00
private decimal? _Betrag;
2025-07-28 11:07:52 +02:00
public ServiceRecord()
{
_Tid = TableID.ServiceRecord;
}
2025-07-28 11:07:52 +02:00
public virtual bool IsCreatedInMobileClient
2016-06-27 01:45:38 +02:00
{
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
{
2017-02-01 13:53:59 +01:00
if (!_GroupOid.HasValue && _GroupPersonCount.HasValue && _GroupEmployeeCount.HasValue &&
_GroupPersonCount.Value == 1 && _GroupEmployeeCount.Value == 1)
{
return null;
}
2016-06-27 01:45:38 +02:00
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
{
2017-02-01 13:53:59 +01:00
if (!_GroupOid.HasValue && _GroupPersonCount.HasValue && _GroupEmployeeCount.HasValue &&
_GroupPersonCount.Value == 1 && _GroupEmployeeCount.Value == 1)
{
return null;
}
2016-06-27 01:45:38 +02:00
return this._GroupPersonCount;
}
set
{
if (this.AreDifferent(this._GroupPersonCount, value))
{
this._GroupPersonCount = value;
}
}
}
public virtual decimal? GroupRoundedDuration
{
get
{
2017-02-01 13:53:59 +01:00
if (!_GroupOid.HasValue && _GroupPersonCount.HasValue && _GroupEmployeeCount.HasValue &&
_GroupPersonCount.Value == 1 && _GroupEmployeeCount.Value == 1)
{
return null;
}
2016-06-27 01:45:38 +02:00
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);
2016-06-27 01:45:38 +02:00
}
return date;
}
}
public virtual IList<ValueListEntry2Object> ValueList
{
get
{
return this._ValueList ?? (this._ValueList = new List<ValueListEntry2Object>());
}
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;
}
}
2017-01-11 11:02:58 +01:00
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;
}
}
}
2020-10-12 13:03:05 +02:00
public virtual decimal? Betrag
{
get
{
return this._Betrag;
}
set
{
if (this.AreDifferent(this._Betrag, value))
{
this._Betrag = value;
}
}
}
2024-12-30 16:09:20 +01:00
//public override string ToString()
//{
// return string.Format("{0}", Customer.Person.LastNameFirstName);
//}
2016-06-27 01:45:38 +02:00
}
}