Files
BeWoPlaner/BeWo/ViewModel/WohnheimbuchungEmployeeRelationVM.cs
2016-06-27 01:45:38 +02:00

86 lines
2.7 KiB
C#

using System;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
namespace BeWo.ViewModel
{
public class WohnheimbuchungEmployeeRelationVM : AbstractDCMapperVM<WohnheimbuchungEmployeeRelationDC>
{
public static string PropertyName_StartDate = "StartDate";
public static string PropertyName_EndDate = "EndDate";
public static string PropertyName_Employee = "Employee";
private DateTime? _EndDate;
private DateTime? _StartDate;
private CompactEmployeeDC _Employee;
public WohnheimbuchungEmployeeRelationVM(WohnheimbuchungEmployeeRelationDC pDC) : base(pDC, pDC.Employee2WohnheimOid == null)
{
}
public DateTime? StartDate
{
get { return _StartDate; }
set
{
if (AreDifferent(_StartDate, value))
{
_StartDate = value;
StoreDirtyInformation(AreDifferent(DataContract.StartDate, value), PropertyName_StartDate);
FirePropertyChanged(PropertyName_StartDate);
}
}
}
public DateTime? EndDate
{
get { return _EndDate; }
set
{
if (AreDifferent(_EndDate, value))
{
_EndDate = value;
StoreDirtyInformation(AreDifferent(DataContract.EndDate, value), PropertyName_EndDate);
FirePropertyChanged(PropertyName_EndDate);
}
}
}
public CompactEmployeeDC Employee
{
get { return _Employee; }
set
{
if (AreDifferent(_Employee, value))
{
_Employee = value;
StoreDirtyInformation(AreDifferent(DataContract.Employee, value), PropertyName_Employee);
FirePropertyChanged(PropertyName_Employee);
}
}
}
protected override void InitByDataContract(WohnheimbuchungEmployeeRelationDC pDataContract)
{
if (!IsNew)
{
_StartDate = pDataContract.StartDate;
_EndDate = pDataContract.EndDate;
_Employee = pDataContract.Employee;
}
}
protected override WohnheimbuchungEmployeeRelationDC MapToDataContract(WohnheimbuchungEmployeeRelationDC pDataContract, bool doCommit)
{
pDataContract.StartDate = _StartDate;
pDataContract.EndDate = _EndDate;
pDataContract.Employee = _Employee;
return pDataContract;
}
}
}