Files
BeWoPlaner/BeWo/ViewModel/EmploymentTypeVM.cs

68 lines
2.1 KiB
C#

using BeWo.Core.Service;
using BeWo.Validation;
using BS.Shared;
using BS.Shared.DataContracts;
namespace BeWo.ViewModel
{
public class EmploymentTypeVM : AbstractDCMapperVM<EmploymentTypeDC>
{
public static string PropertyName_Name = "Name";
public static string PropertyName_LeaveDays = "LeaveDays";
private string _Name;
private decimal? _LeaveDays;
public EmploymentTypeVM(EmploymentTypeDC pDC) : base(pDC, pDC.EmploymentTypeOid == null)
{
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public string Name
{
get { return this._Name; }
set
{
if (this.AreDifferent(this._Name, value))
{
this._Name = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Name, value), PropertyName_Name);
this.FirePropertyChanged(PropertyName_Name);
}
}
}
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);
}
}
}
protected override void InitByDataContract(EmploymentTypeDC pDataContract)
{
if (!this.IsNew)
{
this._Name = pDataContract.Name;
this._LeaveDays = pDataContract.LeaveDays;
}
}
protected override EmploymentTypeDC MapToDataContract(EmploymentTypeDC pDataContract, bool doCommit)
{
pDataContract.Name = this._Name;
pDataContract.LeaveDays = this._LeaveDays;
return pDataContract;
}
}
}