124 lines
2.7 KiB
C#
124 lines
2.7 KiB
C#
using System;
|
|
using BeWo.Validation;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWo.ViewModel
|
|
{
|
|
public class AbsenceTimeVM : AbstractDCMapperVM<AbsenceTimeDC>
|
|
{
|
|
public static string PropertyName_End = "End";
|
|
|
|
public static string PropertyName_Notice = "Notice";
|
|
|
|
public static string PropertyName_Reason = "Reason";
|
|
|
|
public static string PropertyName_Start = "Start";
|
|
|
|
private DateTime? _End;
|
|
|
|
private string _Notice;
|
|
|
|
private AbsenceReasonDC _Reason;
|
|
|
|
private DateTime? _Start;
|
|
|
|
public AbsenceTimeVM(AbsenceTimeDC pDC) : base(pDC, pDC.AbsenceTimeOid == null)
|
|
{
|
|
}
|
|
|
|
public DateTime? End
|
|
{
|
|
get { return _End; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_End, value))
|
|
{
|
|
_End = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.End, value), PropertyName_End);
|
|
FirePropertyChanged(PropertyName_End);
|
|
}
|
|
}
|
|
}
|
|
|
|
//public DateTime EndDT
|
|
//{
|
|
// get { return this._End != null ? this._End.Value : DateTime.Now.Date.AddMilliseconds(123); }
|
|
|
|
// set { this.End = value.Date; }
|
|
//}
|
|
|
|
public string Notice
|
|
{
|
|
get { return _Notice; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Notice, value))
|
|
{
|
|
_Notice = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Notice, value), PropertyName_Notice);
|
|
FirePropertyChanged(PropertyName_Notice);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
|
|
public AbsenceReasonDC Reason
|
|
{
|
|
get { return _Reason; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Reason, value))
|
|
{
|
|
_Reason = value;
|
|
StoreDirtyInformation(!AreEqual(value, DataContract.Reason), PropertyName_Reason);
|
|
FirePropertyChanged(PropertyName_Reason);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
|
|
public DateTime? Start
|
|
{
|
|
get { return _Start; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Start, value))
|
|
{
|
|
_Start = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Start, value), PropertyName_Start);
|
|
FirePropertyChanged(PropertyName_Start);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void InitByDataContract(AbsenceTimeDC pDataContract)
|
|
{
|
|
if (!IsNew)
|
|
{
|
|
_Start = pDataContract.Start;
|
|
_End = pDataContract.End;
|
|
_Notice = pDataContract.Notice;
|
|
|
|
_Reason = pDataContract.Reason;
|
|
}
|
|
}
|
|
|
|
protected override AbsenceTimeDC MapToDataContract(AbsenceTimeDC pDataContract, bool doCommit)
|
|
{
|
|
if (_Reason != null)
|
|
{
|
|
pDataContract.Reason = _Reason;
|
|
}
|
|
|
|
pDataContract.Start = _Start;
|
|
pDataContract.End = _End;
|
|
pDataContract.Notice = _Notice;
|
|
|
|
return pDataContract;
|
|
}
|
|
}
|
|
} |