private void FixupActivity(Activity previousValue) { if (previousValue != null && previousValue.Costs.Contains(this)) { previousValue.Costs.Remove(this); } if (Activity != null) { if (!Activity.Costs.Contains(this)) { Activity.Costs.Add(this); } } }
/// <summary> /// Initializes a new instance of the <see cref="ActivityVM"/> class from the model. /// </summary> /// <param name="entity">The model.</param> /// <param name="groupVms">The group view models.</param> /// <param name="access"></param> /// <param name="dataService"></param> /// <param name="groupDataService"></param> public ActivityVM(Activity entity, ListCollectionView groupVms, AccessType access, ActivityDataService dataService, ActivityGroupDataService groupDataService) : base(access) { InitializeData(dataService, groupDataService); _model = entity; Groups = groupVms; foreach (ActivityGroupVM groupVm in Groups) { if (groupVm.Id == entity.ActivityGroup.Id) { SelectedGroupVM = groupVm; break; } } }
/// <summary> /// Initializes a new instance of the <see cref="ActivityVM"/> class. /// </summary> /// <param name="entity">The entity.</param> /// <param name="access"></param> /// <param name="dataService"></param> /// <param name="groupDataService"></param> public ActivityVM(Activity entity, AccessType access, ActivityDataService dataService, ActivityGroupDataService groupDataService) : base(access) { InitializeData(dataService, groupDataService); _model = entity; }
public override void Save(object param) { ActivityDataService.AttachModel(_model,SelectedGroupVM.Id); _model = ActivityDataService.GetSingle(_model.Id); OnPropertyChanged("ModifiedBy");OnPropertyChanged("ModifiedDate");Mode = ModificationStatus.Saved; }
/// <summary> /// Initializes a new instance of the <see cref="ActivityInfoVM"/> class from the model. /// </summary> /// <param name="entity">The model.</param> public ActivityInfoVM(Activity entity) { _model = entity; }