Files
BeWoPlaner/BeWo/ViewModel/FeiertagVM.cs

78 lines
2.0 KiB
C#

using BS.Shared;
using BS.Shared.DataContracts;
using System;
using System.Collections.Generic;
using BeWo.ServiceProxy;
using BeWo.Validation;
using BeWo.ViewModel.ListViewModel;
namespace BeWo.ViewModel
{
public class FeiertagVM : AbstractDCMapperVM<FeiertagDC>
{
public static string PropertyName_Name = "Name";
public static string PropertyName_Datum = "Datum";
private string _Name;
private DateTime _Datum;
public FeiertagVM(FeiertagDC pDC)
: base(pDC, pDC.FeiertagOid == null)
{
}
public bool IsSystem
{
get { return this.DataContract.FeiertagOid.HasValue && this.DataContract.FeiertagOid.Value == 0; }
}
public DateTime Datum
{
get { return this._Datum; }
set
{
if (this.AreDifferent(this._Datum, value))
{
this._Datum = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Datum, value), PropertyName_Datum);
this.FirePropertyChanged(PropertyName_Datum);
}
}
}
public string Name
{
get { return _Name; }
set
{
if (AreDifferent(_Name, value))
{
_Name = value;
StoreDirtyInformation(AreDifferent(DataContract.Name, value), PropertyName_Name);
FirePropertyChanged(PropertyName_Name);
}
}
}
protected override void InitByDataContract(FeiertagDC pDataContract)
{
this._Datum = pDataContract.Datum;
this._Name = pDataContract.Name;
}
protected override FeiertagDC MapToDataContract(FeiertagDC pDataContract, bool doCommit)
{
pDataContract.Datum = _Datum;
pDataContract.Name = _Name;
return pDataContract;
}
}
}