- Projekt Kopie LH Remscheid -> LH Remscheid Frühförderung nach DB Spiegelung - Bugfixing Pool Abrechnung Christopherus Haus - Änderung Ansprechpartner LH Frankfurt Oder - Leistungsnachweis für KK Praxis Pusteblume - Bugfixing Kloss Vertretungssuche und Frau Hildmann diverse Stundenkonten
527 lines
19 KiB
C#
527 lines
19 KiB
C#
using System;
|
|
using System.Linq;
|
|
|
|
using BeWo.Validation;
|
|
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
|
|
using System.Collections.Generic;
|
|
using BS.Shared.Core;
|
|
using System.Windows;
|
|
|
|
namespace BeWo.ViewModel
|
|
{
|
|
public class ContractVM : AbstractDCMapperVM<ContractDC>
|
|
{
|
|
public static string PropertyName_ContractType = "ContractType";
|
|
public static string PropertyName_ProbationPeriod = "ProbationPeriod";
|
|
public static string PropertyName_ProbationPeriod2 = "ProbationPeriod2";
|
|
public static string PropertyName_WeeklyDays = "WeeklyDays";
|
|
public static string PropertyName_CancellationPeriod = "CancellationPeriod";
|
|
public static string PropertyName_EntryDate = "EntryDate";
|
|
public static string PropertyName_ContractEndDate = "ContractEndDate";
|
|
public static string PropertyName_HourlyRate = "HourlyRate";
|
|
public static string PropertyName_HourlyRateCostRatePeriod = "HourlyRateCostRatePeriod";
|
|
public static string PropertyName_WeeklyFLS = "WeeklyFLS";
|
|
public static string PropertyName_MonthlyFLS = "MonthlyFLS";
|
|
public static string PropertyName_WeeklyTotalHours = "WeeklyTotalHours";
|
|
public static string PropertyName_MonthlyTotalHours = "MonthlyTotalHours";
|
|
public static string PropertyName_LeaveDays = "LeaveDays";
|
|
public static string PropertyName_Notice = "Notice";
|
|
public static string PropertyName_EmploymentType = "EmploymentType";
|
|
public static string PropertyName_PossibleEmploymentTypes = "PossibleEmploymentTypes";
|
|
public static string PropertyName_ContractString = "ContractString";
|
|
|
|
private ValueListEntryDC _ContractType;
|
|
private decimal? _LeaveDays;
|
|
private decimal? _WeeklyTotalHours;
|
|
private decimal? _MonthlyTotalHours;
|
|
private decimal? _WeeklyFLS;
|
|
private decimal? _MonthlyFLS;
|
|
private decimal? _HourlyRate;
|
|
private CostRatePeriodDC _HourlyRateCostRatePeriod;
|
|
private DateTime? _EntryDate;
|
|
private DateTime? _ContractEndDate;
|
|
private int _CancellationPeriod;
|
|
private int _ProbationPeriod;
|
|
private decimal? _ProbationPeriod2;
|
|
private int _WeeklyDays;
|
|
private String _Notice;
|
|
private EmploymentTypeDC _EmploymentType;
|
|
|
|
|
|
//private Visibility _EmploymentTypeLeaveDaysVisibility;
|
|
//private Visibility _LeaveDaysVisibility;
|
|
public Visibility EmploymentTypeLeaveDaysVisibility
|
|
{
|
|
get
|
|
{
|
|
if (EmploymentType != null && EmploymentType.LeaveDays.HasValue)
|
|
{
|
|
return Visibility.Visible;
|
|
}
|
|
|
|
return Visibility.Collapsed;
|
|
|
|
}
|
|
//set
|
|
//{
|
|
// _EmploymentTypeLeaveDaysVisibility = value;
|
|
// FirePropertyChanged("EmploymentTypeLeaveDaysVisibility");
|
|
// FirePropertyChanged("LeaveDaysVisibility");
|
|
//}
|
|
}
|
|
public Visibility LeaveDaysVisibility
|
|
{
|
|
get {
|
|
if (EmploymentType == null || !EmploymentType.LeaveDays.HasValue)
|
|
{
|
|
return Visibility.Visible;
|
|
}
|
|
|
|
return Visibility.Collapsed;
|
|
}
|
|
//set
|
|
//{
|
|
// _LeaveDaysVisibility = value;
|
|
// FirePropertyChanged("EmploymentTypeLeaveDaysVisibility");
|
|
// FirePropertyChanged("LeaveDaysVisibility");
|
|
//}
|
|
}
|
|
|
|
public bool WeeklyHoursEnabled
|
|
{
|
|
get
|
|
{
|
|
if (_MonthlyTotalHours.HasValue && !_WeeklyTotalHours.HasValue)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public bool MonthlyHoursEnabled
|
|
{
|
|
get
|
|
{
|
|
if (_WeeklyTotalHours.HasValue && !_MonthlyTotalHours.HasValue)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public bool WeeklyFlsEnabled
|
|
{
|
|
get
|
|
{
|
|
if (_MonthlyFLS.HasValue && !_WeeklyFLS.HasValue)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public bool MonthlyFlsEnabled
|
|
{
|
|
get
|
|
{
|
|
if (_WeeklyFLS.HasValue && !_MonthlyFLS.HasValue)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
private IList<ValueListEntryDC> _AllContractTypes;
|
|
|
|
private IList<CostRatePeriodDC> _AllHourlyRateCostRatePeriods;
|
|
|
|
private IList<EmploymentTypeDC> _PossibleEmploymentTypes;
|
|
|
|
public ContractVM(ContractDC pDC)
|
|
: base(pDC, pDC.ContractOid == null)
|
|
{
|
|
}
|
|
|
|
public string ContractString
|
|
{
|
|
get
|
|
{
|
|
String text = "";
|
|
if (this.EntryDate.HasValue)
|
|
{
|
|
text = String.Format("Vertrag vom {0:dd.MM.yyyy}", this.EntryDate);
|
|
|
|
if (this.ContractEndDate.HasValue)
|
|
{
|
|
text += String.Format(" - {0:dd.MM.yyyy}", this.ContractEndDate);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.ContractEndDate.HasValue)
|
|
{
|
|
text = String.Format("Vertrag bis {0:dd.MM.yyyy}", this.ContractEndDate);
|
|
}
|
|
}
|
|
if (String.IsNullOrEmpty(text))
|
|
{
|
|
if (this.IsNew)
|
|
text = "Neuer Vertrag";
|
|
else
|
|
text = "Vertrag";
|
|
}
|
|
return text;
|
|
}
|
|
|
|
set { }
|
|
}
|
|
|
|
public ValueListEntryDC ContractType
|
|
{
|
|
get { return this._ContractType; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._ContractType, value))
|
|
{
|
|
this._ContractType = value;
|
|
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.ContractTypeValueListEntry, value), PropertyName_ContractType);
|
|
|
|
this.FirePropertyChanged(PropertyName_ContractType);
|
|
}
|
|
}
|
|
}
|
|
|
|
public IList<ValueListEntryDC> AllContractTypes
|
|
{
|
|
get { return this._AllContractTypes; }
|
|
set { this._AllContractTypes = value; }
|
|
}
|
|
|
|
|
|
public IList<EmploymentTypeDC> PossibleEmploymentTypes
|
|
{
|
|
get { return this._PossibleEmploymentTypes; }
|
|
set { this._PossibleEmploymentTypes= value; }
|
|
}
|
|
|
|
|
|
|
|
public EmploymentTypeDC EmploymentType
|
|
{
|
|
get
|
|
{
|
|
return this._EmploymentType;
|
|
}
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._EmploymentType, value))
|
|
{
|
|
this._EmploymentType = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.EmploymentType, value), PropertyName_EmploymentType);
|
|
this.FirePropertyChanged(PropertyName_EmploymentType);
|
|
FirePropertyChanged("EmploymentTypeLeaveDaysVisibility");
|
|
FirePropertyChanged("LeaveDaysVisibility");
|
|
}
|
|
}
|
|
}
|
|
|
|
public decimal? LeaveDays
|
|
{
|
|
get { return this._LeaveDays; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._LeaveDays, value))
|
|
{
|
|
this._LeaveDays = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.LeaveDays, value), PropertyName_LeaveDays);
|
|
this.FirePropertyChanged(PropertyName_LeaveDays);
|
|
}
|
|
}
|
|
}
|
|
|
|
public decimal? WeeklyTotalHours
|
|
{
|
|
get { return this._WeeklyTotalHours; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._WeeklyTotalHours, value))
|
|
{
|
|
this._WeeklyTotalHours = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.WeeklyTotalHours, value), PropertyName_WeeklyTotalHours);
|
|
this.FirePropertyChanged(PropertyName_WeeklyTotalHours);
|
|
this.FirePropertyChanged("WeeklyHoursEnabled");
|
|
this.FirePropertyChanged("MonthlyHoursEnabled");
|
|
}
|
|
}
|
|
}
|
|
|
|
public decimal? MonthlyTotalHours
|
|
{
|
|
get { return this._MonthlyTotalHours; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._MonthlyTotalHours, value))
|
|
{
|
|
this._MonthlyTotalHours = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.MonthlyTotalHours, value), PropertyName_MonthlyTotalHours);
|
|
this.FirePropertyChanged(PropertyName_MonthlyTotalHours);
|
|
this.FirePropertyChanged("WeeklyHoursEnabled");
|
|
this.FirePropertyChanged("MonthlyHoursEnabled");
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public decimal? WeeklyFLS
|
|
{
|
|
get { return this._WeeklyFLS; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._WeeklyFLS, value))
|
|
{
|
|
this._WeeklyFLS = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.WeeklyFLS, value), PropertyName_WeeklyFLS);
|
|
this.FirePropertyChanged(PropertyName_WeeklyFLS);
|
|
this.FirePropertyChanged("WeeklyFlsEnabled");
|
|
this.FirePropertyChanged("MonthlyFlsEnabled");
|
|
}
|
|
}
|
|
}
|
|
|
|
public decimal? MonthlyFLS
|
|
{
|
|
get { return this._MonthlyFLS; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._MonthlyFLS, value))
|
|
{
|
|
this._MonthlyFLS = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.MonthlyFLS, value), PropertyName_MonthlyFLS);
|
|
this.FirePropertyChanged(PropertyName_MonthlyFLS);
|
|
this.FirePropertyChanged("WeeklyFlsEnabled");
|
|
this.FirePropertyChanged("MonthlyFlsEnabled");
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool IsHourlyRateTextfieldVisible
|
|
{
|
|
get { return _AllHourlyRateCostRatePeriods == null || _AllHourlyRateCostRatePeriods.Count == 0; }
|
|
}
|
|
|
|
public bool IsHourlyRateComboVisible
|
|
{
|
|
get { return !IsHourlyRateTextfieldVisible; }
|
|
}
|
|
public decimal? HourlyRate
|
|
{
|
|
get { return this._HourlyRate; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._HourlyRate, value))
|
|
{
|
|
this._HourlyRate = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.HourlyRate, value), PropertyName_HourlyRate);
|
|
this.FirePropertyChanged(PropertyName_HourlyRate);
|
|
}
|
|
}
|
|
}
|
|
|
|
public CostRatePeriodDC HourlyRateCostRatePeriod
|
|
{
|
|
get { return this._HourlyRateCostRatePeriod; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._HourlyRateCostRatePeriod, value))
|
|
{
|
|
this._HourlyRateCostRatePeriod = value;
|
|
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.HourlyRateCostRateValue, value), PropertyName_HourlyRateCostRatePeriod);
|
|
|
|
this.FirePropertyChanged(PropertyName_HourlyRateCostRatePeriod);
|
|
}
|
|
}
|
|
}
|
|
|
|
public IList<CostRatePeriodDC> AllHourlyRateCostRatePeriods
|
|
{
|
|
get { return this._AllHourlyRateCostRatePeriods; }
|
|
set { this._AllHourlyRateCostRatePeriods = value; }
|
|
}
|
|
|
|
public DateTime? EntryDate
|
|
{
|
|
get { return this._EntryDate; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._EntryDate, value))
|
|
{
|
|
this._EntryDate = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.EntryDate, value), PropertyName_EntryDate);
|
|
this.FirePropertyChanged(PropertyName_EntryDate);
|
|
this.FirePropertyChanged(PropertyName_ContractString);
|
|
}
|
|
}
|
|
}
|
|
|
|
public DateTime? ContractEndDate
|
|
{
|
|
get { return this._ContractEndDate; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._ContractEndDate, value))
|
|
{
|
|
this._ContractEndDate = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.ContractEndDate, value), PropertyName_ContractEndDate);
|
|
this.FirePropertyChanged(PropertyName_ContractEndDate);
|
|
this.FirePropertyChanged(PropertyName_ContractString);
|
|
}
|
|
}
|
|
}
|
|
|
|
public int CancellationPeriod
|
|
{
|
|
get { return this._CancellationPeriod; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._CancellationPeriod, value))
|
|
{
|
|
this._CancellationPeriod = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.CancellationPeriod, value), PropertyName_CancellationPeriod);
|
|
this.FirePropertyChanged(PropertyName_CancellationPeriod);
|
|
}
|
|
}
|
|
}
|
|
|
|
public int ProbationPeriod
|
|
{
|
|
get { return this._ProbationPeriod; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._ProbationPeriod, value))
|
|
{
|
|
this._ProbationPeriod = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.ProbationPeriod, value), PropertyName_ProbationPeriod);
|
|
this.FirePropertyChanged(PropertyName_ProbationPeriod);
|
|
}
|
|
}
|
|
}
|
|
|
|
public decimal? ProbationPeriod2
|
|
{
|
|
get { return this._ProbationPeriod2; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._ProbationPeriod2, value))
|
|
{
|
|
this._ProbationPeriod2 = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.ProbationPeriod2, value), PropertyName_ProbationPeriod2);
|
|
this.FirePropertyChanged(PropertyName_ProbationPeriod2);
|
|
}
|
|
}
|
|
}
|
|
|
|
public int WeeklyDays
|
|
{
|
|
get { return this._WeeklyDays; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._WeeklyDays, value))
|
|
{
|
|
this._WeeklyDays = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.WeeklyDays, value), PropertyName_WeeklyDays);
|
|
this.FirePropertyChanged(PropertyName_WeeklyDays);
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Notice
|
|
{
|
|
get { return this._Notice; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._Notice, value))
|
|
{
|
|
this._Notice = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Notice, value), PropertyName_Notice);
|
|
this.FirePropertyChanged(PropertyName_Notice);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected override void InitByDataContract(ContractDC pDataContract)
|
|
{
|
|
if (!this.IsNew)
|
|
{
|
|
this._ContractType = pDataContract.ContractTypeValueListEntry;
|
|
this._CancellationPeriod = pDataContract.CancellationPeriod;
|
|
this._ContractEndDate = pDataContract.ContractEndDate;
|
|
this._EntryDate = pDataContract.EntryDate;
|
|
this._HourlyRate = pDataContract.HourlyRate;
|
|
this._HourlyRateCostRatePeriod = pDataContract.HourlyRateCostRateValue;
|
|
this._LeaveDays = pDataContract.LeaveDays;
|
|
this._ProbationPeriod = pDataContract.ProbationPeriod;
|
|
this._ProbationPeriod2 = pDataContract.ProbationPeriod2;
|
|
this._WeeklyDays = pDataContract.WeeklyDays;
|
|
this._WeeklyFLS = pDataContract.WeeklyFLS;
|
|
this._MonthlyFLS = pDataContract.MonthlyFLS;
|
|
this._WeeklyTotalHours = pDataContract.WeeklyTotalHours;
|
|
_MonthlyTotalHours = pDataContract.MonthlyTotalHours;
|
|
this._Notice = pDataContract.Notice;
|
|
this._EmploymentType = pDataContract.EmploymentType;
|
|
|
|
}
|
|
}
|
|
|
|
protected override ContractDC MapToDataContract(ContractDC pDataContract, bool doCommit)
|
|
{
|
|
pDataContract.ContractTypeValueListEntry = this._ContractType;
|
|
pDataContract.CancellationPeriod = this._CancellationPeriod;
|
|
pDataContract.ContractEndDate = this._ContractEndDate;
|
|
pDataContract.EntryDate = this._EntryDate;
|
|
pDataContract.HourlyRate = this._HourlyRate;
|
|
pDataContract.HourlyRateCostRateValue = this._HourlyRateCostRatePeriod;
|
|
pDataContract.LeaveDays = this._LeaveDays;
|
|
pDataContract.ProbationPeriod = this._ProbationPeriod;
|
|
pDataContract.ProbationPeriod2 = this.ProbationPeriod2;
|
|
pDataContract.WeeklyDays = this._WeeklyDays;
|
|
pDataContract.WeeklyFLS = this._WeeklyFLS;
|
|
pDataContract.MonthlyFLS = this._MonthlyFLS;
|
|
pDataContract.WeeklyTotalHours = this._WeeklyTotalHours;
|
|
pDataContract.MonthlyTotalHours = _MonthlyTotalHours;
|
|
pDataContract.Notice = this._Notice;
|
|
|
|
pDataContract.EmploymentType = this._EmploymentType;
|
|
|
|
return pDataContract;
|
|
}
|
|
}
|
|
} |