547 lines
11 KiB
C#
547 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using BS.Shared;
|
|
|
|
namespace BeWo.Data.Entities
|
|
{
|
|
[DebuggerDisplay("{Person}")]
|
|
|
|
public class Employee : BeWoEntityBase
|
|
{
|
|
public static string PropertyName_AbsenceTimes = "AbsenceTimes";
|
|
|
|
public static string PropertyName_ChildCount = "ChildCount";
|
|
|
|
public static string PropertyName_Employee2CustomerList = "Employee2CustomerList";
|
|
|
|
public static string PropertyName_HealthInsurance = "HealthInsurance";
|
|
|
|
public static string PropertyName_IncomingMail2Receiver = "IncomingMail2Receiver";
|
|
|
|
public static string PropertyName_InsuranceNumber = "InsuranceNumber";
|
|
|
|
public static string PropertyName_IsQualified = "IsQualified";
|
|
|
|
public static string PropertyName_LeadingTeams = "LeadingTeams";
|
|
|
|
public static string PropertyName_OutgoingMails = "OutgoingMails";
|
|
|
|
public static string PropertyName_Person = "Person";
|
|
|
|
public static string PropertyName_PersonnelNumber = "PersonnelNumber";
|
|
|
|
public static string PropertyName_ServiceRecordList = "ServiceRecordList";
|
|
|
|
public static string PropertyName_TaxClass = "TaxClass";
|
|
|
|
public static string PropertyName_TaxNumber = "TaxNumber";
|
|
|
|
public static string PropertyName_ValueList = "ValueList";
|
|
|
|
public static string PropertyName_Overtimes = "Overtimes";
|
|
|
|
public static string PropertyName_Contracts = "Contracts";
|
|
|
|
public static string PropertyName_Arbeitszeiten = "Arbeitszeiten";
|
|
|
|
public static string PropertyName_Text1 = "Text1";
|
|
|
|
public static string PropertyName_Text2 = "Text2";
|
|
|
|
public static string PropertyName_Text3 = "Text3";
|
|
|
|
public static string PropertyName_Text4 = "Text4";
|
|
|
|
public static string PropertyName_Text5 = "Text5";
|
|
|
|
public static string PropertyName_Notice2 = "Notice2";
|
|
|
|
public static String PropertyName_EmployeeColor = "EmployeeColor";
|
|
|
|
public static string PropertyName_VarFieldValueList = "VarFieldValueList";
|
|
|
|
private IList<AbsenceTime> _AbsenceTimes;
|
|
|
|
private IList<Contract> _Contracts;
|
|
|
|
private string _ChildCount;
|
|
|
|
private IList<Arbeitszeit> _Arbeitszeiten;
|
|
|
|
private IList<Employee2Customer> _Employee2CustomerList;
|
|
|
|
private string _HealthInsurance;
|
|
|
|
private IList<Mail2Receiver> _IncomingMail2Receiver;
|
|
|
|
private string _InsuranceNumber;
|
|
|
|
private bool? _IsQualified;
|
|
|
|
private IList<Team> _LeadingTeams;
|
|
|
|
private string _Notice2;
|
|
|
|
private IList<Mail> _OutgoingMails;
|
|
|
|
private IList<Overtime> _Overtimes;
|
|
|
|
private Person _Person;
|
|
|
|
private string _PersonnelNumber;
|
|
|
|
private IList<ServiceRecord> _ServiceRecordList;
|
|
|
|
private string _TaxClass;
|
|
|
|
private string _TaxNumber;
|
|
|
|
private string _Text1;
|
|
|
|
private string _Text2;
|
|
|
|
private string _Text3;
|
|
|
|
private string _Text4;
|
|
|
|
private string _Text5;
|
|
|
|
private IList<ValueListEntry2Object> _ValueList;
|
|
|
|
private String _EmployeeColor;
|
|
|
|
private IList<VarFieldValue> _VarFieldValueList;
|
|
|
|
public Employee()
|
|
{
|
|
_Tid = TableID.Employee;
|
|
}
|
|
|
|
public virtual String EmployeeColor
|
|
{
|
|
get { return _EmployeeColor; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_EmployeeColor, value))
|
|
{
|
|
_EmployeeColor = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Overtime> Overtimes
|
|
{
|
|
get { return _Overtimes ?? (_Overtimes = new List<Overtime>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Overtimes, value))
|
|
{
|
|
_Overtimes = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<AbsenceTime> AbsenceTimes
|
|
{
|
|
get { return _AbsenceTimes ?? (_AbsenceTimes = new List<AbsenceTime>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_AbsenceTimes, value))
|
|
{
|
|
_AbsenceTimes = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Contract> Contracts
|
|
{
|
|
get { return _Contracts ?? (_Contracts = new List<Contract>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Contracts, value))
|
|
{
|
|
_Contracts = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Arbeitszeit> Arbeitszeiten
|
|
{
|
|
get { return _Arbeitszeiten ?? (_Arbeitszeiten = new List<Arbeitszeit>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Arbeitszeiten, value))
|
|
{
|
|
_Arbeitszeiten = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string ChildCount
|
|
{
|
|
get { return _ChildCount; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_ChildCount, value))
|
|
{
|
|
_ChildCount = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Employee2Customer> Employee2CustomerList
|
|
{
|
|
get { return _Employee2CustomerList ?? (_Employee2CustomerList = new List<Employee2Customer>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Employee2CustomerList, value))
|
|
{
|
|
_Employee2CustomerList = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public virtual string HealthInsurance
|
|
{
|
|
get { return _HealthInsurance; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_HealthInsurance, value))
|
|
{
|
|
_HealthInsurance = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Mail2Receiver> IncomingMail2Receiver
|
|
{
|
|
get { return _IncomingMail2Receiver ?? (_IncomingMail2Receiver = new List<Mail2Receiver>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_IncomingMail2Receiver, value))
|
|
{
|
|
_IncomingMail2Receiver = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string InsuranceNumber
|
|
{
|
|
get { return _InsuranceNumber; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_InsuranceNumber, value))
|
|
{
|
|
_InsuranceNumber = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual bool? IsQualified
|
|
{
|
|
get { return _IsQualified; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_IsQualified, value))
|
|
{
|
|
_IsQualified = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Team> LeadingTeams
|
|
{
|
|
get { return _LeadingTeams ?? (_LeadingTeams = new List<Team>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_LeadingTeams, value))
|
|
{
|
|
_LeadingTeams = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<Mail> OutgoingMails
|
|
{
|
|
get { return _OutgoingMails ?? (_OutgoingMails = new List<Mail>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_OutgoingMails, value))
|
|
{
|
|
_OutgoingMails = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual Person Person
|
|
{
|
|
get { return _Person; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Person, value))
|
|
{
|
|
_Person = value;
|
|
_Person.Type = PersonType.Employee;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string PersonnelNumber
|
|
{
|
|
get { return _PersonnelNumber; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_PersonnelNumber, value))
|
|
{
|
|
_PersonnelNumber = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<ServiceRecord> ServiceRecordList
|
|
{
|
|
get { return _ServiceRecordList; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_ServiceRecordList, value))
|
|
{
|
|
_ServiceRecordList = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string TaxClass
|
|
{
|
|
get { return _TaxClass; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_TaxClass, value))
|
|
{
|
|
_TaxClass = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string TaxNumber
|
|
{
|
|
get { return _TaxNumber; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_TaxNumber, value))
|
|
{
|
|
_TaxNumber = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual IList<ValueListEntry2Object> ValueList
|
|
{
|
|
get { return _ValueList ?? (_ValueList = new List<ValueListEntry2Object>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_ValueList, value))
|
|
{
|
|
_ValueList = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual string Text1
|
|
{
|
|
get { return _Text1; }
|
|
set
|
|
{
|
|
if (base.AreDifferent(_Text1, value))
|
|
_Text1 = value;
|
|
}
|
|
}
|
|
|
|
public virtual string Text2
|
|
{
|
|
get { return _Text2; }
|
|
set
|
|
{
|
|
if (base.AreDifferent(_Text2, value))
|
|
_Text2 = value;
|
|
}
|
|
}
|
|
|
|
public virtual string Text3
|
|
{
|
|
get { return _Text3; }
|
|
set
|
|
{
|
|
if (base.AreDifferent(_Text3, value))
|
|
_Text3 = value;
|
|
}
|
|
}
|
|
|
|
public virtual string Text4
|
|
{
|
|
get { return _Text4; }
|
|
set
|
|
{
|
|
if (base.AreDifferent(_Text4, value))
|
|
_Text4 = value;
|
|
}
|
|
}
|
|
|
|
public virtual string Text5
|
|
{
|
|
get { return _Text5; }
|
|
set
|
|
{
|
|
if (base.AreDifferent(_Text5, value))
|
|
_Text5 = value;
|
|
}
|
|
}
|
|
|
|
public virtual string Notice2
|
|
{
|
|
get { return _Notice2; }
|
|
set
|
|
{
|
|
if (base.AreDifferent(_Notice2, value))
|
|
_Notice2 = value;
|
|
}
|
|
}
|
|
|
|
public virtual bool Pflege { get; set; }
|
|
public virtual bool Toilettengang { get; set; }
|
|
public virtual bool Aggressiv { get; set; }
|
|
public virtual bool Hygienebelehrung { get; set; }
|
|
public virtual String Schutzstufe { get; set; }
|
|
public virtual string BemerkungenSbd { get; set; }
|
|
|
|
public virtual DateTime? AusweisGueltigVon { get; set; }
|
|
public virtual DateTime? AusweisGueltigBis { get; set; }
|
|
public virtual string GradDerBehinderung { get; set; }
|
|
public virtual string AusweisBemerkung { get; set; }
|
|
|
|
public virtual IList<VarFieldValue> VarFieldValueList
|
|
{
|
|
get { return _VarFieldValueList ?? (_VarFieldValueList = new List<VarFieldValue>()); }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_VarFieldValueList, value))
|
|
{
|
|
_VarFieldValueList = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual Contract LastContract
|
|
{
|
|
get
|
|
{
|
|
DateTime maxDate = DateTime.MinValue;
|
|
Contract contractWithMaxDate = null;
|
|
|
|
foreach (Contract item in Contracts)
|
|
{
|
|
if (!item.ContractEndDate.HasValue)
|
|
{
|
|
contractWithMaxDate = item;
|
|
maxDate = DateTime.MaxValue;
|
|
}
|
|
else if (item.ContractEndDate.Value > maxDate)
|
|
{
|
|
maxDate = item.ContractEndDate.Value;
|
|
contractWithMaxDate = item;
|
|
}
|
|
}
|
|
|
|
return contractWithMaxDate;
|
|
}
|
|
}
|
|
|
|
public virtual Contract FirstContract
|
|
{
|
|
get
|
|
{
|
|
DateTime minDate = DateTime.MaxValue;
|
|
Contract contractWithMinDate = null;
|
|
|
|
foreach (Contract item in Contracts)
|
|
{
|
|
if (!item.EntryDate.HasValue)
|
|
{
|
|
contractWithMinDate = item;
|
|
minDate = DateTime.MinValue;
|
|
}
|
|
else if (item.EntryDate.Value < minDate)
|
|
{
|
|
minDate = item.EntryDate.Value;
|
|
contractWithMinDate = item;
|
|
}
|
|
}
|
|
|
|
return contractWithMinDate;
|
|
}
|
|
}
|
|
|
|
public virtual Contract GetValidContractForDate(DateTime? dt)
|
|
{
|
|
if (!dt.HasValue)
|
|
return LastContract;
|
|
Contract contract = null;
|
|
DateTime minDate = DateTime.MinValue;
|
|
DateTime maxDate = DateTime.MaxValue;
|
|
|
|
foreach (Contract item in Contracts)
|
|
{
|
|
DateTime start = DateTime.MinValue;
|
|
DateTime end = DateTime.MaxValue;
|
|
|
|
if (item.EntryDate.HasValue)
|
|
start = item.EntryDate.Value;
|
|
if (item.ContractEndDate.HasValue)
|
|
end = item.ContractEndDate.Value.AddDays(1);
|
|
|
|
|
|
if (start <= dt && dt < end)
|
|
{
|
|
if (start >= minDate && end <= maxDate)
|
|
{
|
|
minDate = start;
|
|
maxDate = end;
|
|
contract = item;
|
|
}
|
|
}
|
|
}
|
|
return contract;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Person.LastName + ", " + Person.FirstName;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return GetType().Name.GetHashCode() ^ Oid.GetHashCode();
|
|
}
|
|
}
|
|
} |