private void FixupProduct(Product previousValue) { if (previousValue != null && previousValue.ProductReworks.Contains(this)) { previousValue.ProductReworks.Remove(this); } if (Product != null) { if (!Product.ProductReworks.Contains(this)) { Product.ProductReworks.Add(this); } } }
public override void Save(object param) { ProductDataService.AttachModel(_model,SelectedGroupVM.Id); _model = ProductDataService.GetSingle(_model.Id);OnPropertyChanged("ModifiedBy");OnPropertyChanged("ModifiedDate"); Mode = ModificationStatus.Saved; }
/// <summary> /// Initializes a new instance of the <see cref="ProductVM"/> class. /// </summary> /// <param name="entity">The entity.</param> /// <param name="access"></param> /// <param name="dataService"></param> /// <param name="groupDataService"></param> public ProductVM(Product entity, AccessType access, ProductDataService dataService, ProductGroupDataService groupDataService) : base(access) { _model = entity; InitializeData(dataService, groupDataService); Groups = new ListCollectionView(new ObservableCollection<ProductGroupVM>()); }
/// <summary> /// Initializes a new instance of the <see cref="ProductVM"/> class from the model. /// </summary> /// <param name="entity">The model.</param> /// <param name="groupItems">The group view models.</param> /// <param name="access"></param> /// <param name="dataService"></param> /// <param name="groupDataService"></param> public ProductVM(Product entity, ListCollectionView groupItems, AccessType access, ProductDataService dataService, ProductGroupDataService groupDataService) : base(access) { InitializeData(dataService, groupDataService); _model = entity; Groups = groupItems; foreach (ProductGroupVM groupVm in groupItems) { if (groupVm.Id == entity.ProductGroup.Id) { SelectedGroupVM = groupVm; break; } } }
private void FixupParent(Product previousValue) { if (previousValue != null && previousValue.Children.Contains(this)) { previousValue.Children.Remove(this); } if (Parent != null) { if (!Parent.Children.Contains(this)) { Parent.Children.Add(this); } } }
/// <summary> /// Initializes a new instance of the <see cref="ProductInfoVM"/> class from the model. /// </summary> /// <param name="entity">The model.</param> public ProductInfoVM(Product entity) { _model = entity; }