示例#1
0
 public SKUCollections()
 {
     if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
     {
         CurrentSKUCollection = new DataModel.SKUCollection();
         Refresh();
     }
 }
示例#2
0
        private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var skuCollection = new DataModel.SKUCollection();

            if (e.AddedItems.Count > 0)
            {
                skuCollection = e.AddedItems[0] as DataModel.SKUCollection ?? skuCollection;
            }

            ((ViewModels.SKUCollections)DataContext).CurrentSKUCollection = skuCollection.Copy();
        }
示例#3
0
        public void SaveCurrentSKUCollection()
        {
            DataModel.SKUCollection match = SKUHandlerInstance.SKUCollectionList.FirstOrDefault(c => c.Code == CurrentSKUCollection.Code);
            // The user is (visually) updating based on SKUCollection code, not database id.
            CurrentSKUCollection.Id = match == null ? null : match.Id;
            bool noNewLinks = (CurrentSKUCollection != null && match != null) &&
                              (CurrentSKUCollection.SKUs.Count == match.SKUs.Count) &&
                              (CurrentSKUCollection.SKUs.Zip(match.SKUs, (a, b) => a.Id == b.Id).All(boolVal => boolVal));

            CurrentSKUCollection.Save(noNewLinks);
            SKUHandlerInstance.SKUCollectionList = new ObservableCollection <DataModel.SKUCollection>(DataModel.SKUCollection.LoadAll());
        }
示例#4
0
 public void RemoveSKUCollection(DataModel.SKUCollection SKUCollection)
 {
     SKUCollection.Delete();
     SKUHandlerInstance.SKUCollectionList.Remove(SKUCollection);
 }