コード例 #1
0
ファイル: SKUCollections.cs プロジェクト: ohel/kerppi
 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
ファイル: SKUCollections.cs プロジェクト: ohel/kerppi
        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
ファイル: SKUCollections.cs プロジェクト: ohel/kerppi
 public void RemoveSKUCollection(DataModel.SKUCollection SKUCollection)
 {
     SKUCollection.Delete();
     SKUHandlerInstance.SKUCollectionList.Remove(SKUCollection);
 }