Example #1
0
     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);
             }
         }
     }
Example #2
0
 public override void Save(object param)
 {
     ProductDataService.AttachModel(_model,SelectedGroupVM.Id);
     _model = ProductDataService.GetSingle(_model.Id);OnPropertyChanged("ModifiedBy");OnPropertyChanged("ModifiedDate");
     Mode = ModificationStatus.Saved;
 }
Example #3
0
 /// <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>());
 }
Example #4
0
 /// <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;
         }
     }
 }
Example #5
0
     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);
             }
         }
     }
Example #6
0
 /// <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;
 }