Files
BeWoPlaner/BeWo/ViewModel/ArbeitszeitEintragVM.cs

117 lines
3.4 KiB
C#

using BS.Shared;
using BS.Shared.DataContracts;
using System;
using BeWo.Validation;
using BS.Shared.Extensions;
namespace BeWo.ViewModel
{
public class ArbeitszeitEintragVM : AbstractDCMapperVM<ArbeitszeitEintragDC>
{
public static string PropertyName_UhrzeitVon = "UhrzeitVon";
public static string PropertyName_UhrzeitBis = "UhrzeitBis";
public static string PropertyName_Tag = "Tag";
public static string PropertyName_Notice = "Notice";
private string _UhrzeitVon;
private string _UhrzeitBis;
private AppointmentDayOfWeek _Tag;
private string _Notice;
public ArbeitszeitEintragVM(ArbeitszeitEintragDC pDC)
: base(pDC, pDC.ArbeitszeitEintragOid == null)
{
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public string UhrzeitVon
{
get { return this._UhrzeitVon; }
set
{
if (this.AreDifferent(this._UhrzeitVon, value))
{
this._UhrzeitVon = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.UhrzeitVon, value), PropertyName_UhrzeitVon);
this.FirePropertyChanged(PropertyName_UhrzeitVon);
}
}
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public string UhrzeitBis
{
get { return this._UhrzeitBis; }
set
{
if (this.AreDifferent(this._UhrzeitBis, value))
{
this._UhrzeitBis = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.UhrzeitBis, value), PropertyName_UhrzeitBis);
this.FirePropertyChanged(PropertyName_UhrzeitBis);
}
}
}
public AppointmentDayOfWeek Tag
{
get { return this._Tag; }
set
{
if (this.AreDifferent(this._Tag, value))
{
this._Tag = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Tag, value), PropertyName_Tag);
this.FirePropertyChanged(PropertyName_Tag);
}
}
}
public string Notice
{
get { return _Notice; }
set
{
if (AreDifferent(_Notice, value))
{
_Notice = value;
StoreDirtyInformation(AreDifferent(DataContract.Notice, value), PropertyName_Notice);
FirePropertyChanged(PropertyName_Notice);
}
}
}
protected override void InitByDataContract(ArbeitszeitEintragDC pDataContract)
{
this._Tag = pDataContract.Tag;
this._UhrzeitVon = pDataContract.UhrzeitVon;
this._UhrzeitBis = pDataContract.UhrzeitBis;
this._Notice = pDataContract.Notice;
}
protected override ArbeitszeitEintragDC MapToDataContract(ArbeitszeitEintragDC pDataContract, bool doCommit)
{
pDataContract.UhrzeitVon = _UhrzeitVon;
pDataContract.UhrzeitBis = _UhrzeitBis;
pDataContract.Tag = _Tag;
pDataContract.Notice = _Notice;
return pDataContract;
}
}
}