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 GoalRatingVM : AbstractDCMapperVM { public static string PropertyName_RatingType = "RatingType"; public static string PropertyName_GoalEntry = "GoalEntry"; public static string PropertyName_Notice = "Notice"; private ValueListEntryDC _GoalEntry; private RatingTypeDC _RatingType; private String _Notice; public GoalRatingVM(GoalRatingDC pDC) : base(pDC, pDC.GoalRatingOid == null) { } public ValueListEntryDC GoalEntry { get { return this._GoalEntry; } set { if (this.AreDifferent(this._GoalEntry, value)) { this._GoalEntry = value; this.StoreDirtyInformation(this.AreDifferent(this.DataContract.GoalEntry, value), PropertyName_GoalEntry); this.FirePropertyChanged(PropertyName_GoalEntry); } } } public RatingTypeDC RatingType { get { return this._RatingType; } set { if (this.AreDifferent(this._RatingType, value)) { this._RatingType = value; this.StoreDirtyInformation(this.AreDifferent(this.DataContract.RatingType, value), PropertyName_RatingType); this.FirePropertyChanged(PropertyName_RatingType); } } } 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(GoalRatingDC pDataContract) { this._GoalEntry = pDataContract.GoalEntry; this._RatingType = pDataContract.RatingType; this._Notice = pDataContract.Notice; } protected override GoalRatingDC MapToDataContract(GoalRatingDC pDataContract, bool doCommit) { pDataContract.GoalEntry = _GoalEntry; pDataContract.RatingType = _RatingType; pDataContract.Notice = _Notice; return pDataContract; } } }