using System; using System.Collections.Generic; using BeWo.Core; using BeWo.Validation; using BeWo.ViewModel.ListViewModel; using BS.Shared; using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.Extensions; namespace BeWo.ViewModel { public class RatingTypeVM : AbstractDCMapperVM { public static string PropertyName_DisplayName = "DisplayName"; public static string PropertyName_Position = "Position"; public static string PropertyName_RatingId = "RatingId"; public static string PropertyName_Notice = "Notice"; private String _DisplayName; private int? _Position; private int? _RatingId; private String _Notice; public RatingTypeVM(RatingTypeDC pDC) : base(pDC, pDC.RatingTypeOid == null) { } public string DisplayName { get { return this._DisplayName; } set { if (this.AreDifferent(this._DisplayName, value)) { this._DisplayName = value; this.StoreDirtyInformation(this.AreDifferent(this.DataContract.DisplayName, value), PropertyName_DisplayName); this.FirePropertyChanged(PropertyName_DisplayName); } } } public int? Position { get { return this._Position; } set { if (this.AreDifferent(this._Position, value)) { this._Position = value; this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Position, value), PropertyName_Position); this.FirePropertyChanged(PropertyName_Position); } } } public int? RatingId { get { return this._RatingId; } set { if (this.AreDifferent(this._RatingId, value)) { this._RatingId = value; this.StoreDirtyInformation(this.AreDifferent(this.DataContract.RatingId, value), PropertyName_RatingId); this.FirePropertyChanged(PropertyName_RatingId); } } } public string Notice { get { return this._Notice; } set { if (this.AreDifferent(this._Notice, value)) { this._Notice = value; this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Notice, value), PropertyName_Notice); this.FirePropertyChanged(PropertyName_Notice); } } } protected override void InitByDataContract(RatingTypeDC pDataContract) { this._DisplayName = pDataContract.DisplayName; this._RatingId = pDataContract.RatingId; this._Position = pDataContract.Position; this._Notice = pDataContract.Notice; } protected override RatingTypeDC MapToDataContract(RatingTypeDC pDataContract, bool doCommit) { pDataContract.DisplayName = _DisplayName; pDataContract.RatingId = _RatingId; pDataContract.Position = _Position; pDataContract.Notice = _Notice; return pDataContract; } } }