Files
BeWoPlaner/Data/Entities/ServiceRecord.cs
2017-02-01 13:53:59 +01:00

593 lines
15 KiB
C#

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";
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;
public virtual int? DistanceInMeter { get; set; }
public virtual int? Relevance { get; set; }
private ZeiterfassungsDauer? _DurationInStunden;
private ServiceRecordFormate? _ServiceRecordFormat;
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} Betreuer). Dauer: {2:0.##} Minuten.", GroupPersonCount.Value, GroupEmployeeCount.Value, GroupRoundedDuration.Value);
}
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;
}
}
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;
}
}
}
}
}