예제 #1
0
 private void SetDefaultEditProperties()
 {
     EditID            = EditingItem.ID;
     EditName          = EditingItem.Name;
     EditCategory      = Categories.SingleOrDefault(category => category.ID.Equals(EditingItem.ItemCategory.ID));
     EditSalesPrice    = EditingItem.SalesPrice;
     EditPurchasePrice = EditingItem.PurchasePrice;
     UpdateEditSuppliers();
     EditSelectedSupplier = EditSuppliers.FirstOrDefault();
 }
예제 #2
0
 private void UpdateEditSuppliers()
 {
     EditSuppliers.Clear();
     foreach (var supplier in EditingItem.Suppliers.OrderBy(supplier => supplier.Name))
     {
         EditSuppliers.Add(new SupplierVM {
             Model = supplier
         });
     }
 }
예제 #3
0
        private Item MakeEditedItem()
        {
            var editedItem = new Item
            {
                ID            = _editID,
                ItemCategory  = _editCategory.Model,
                Name          = _editName,
                PurchasePrice = _editPurchasePrice,
                SalesPrice    = _editSalesPrice,
                Suppliers     = new ObservableCollection <Supplier>()
            };

            foreach (var supplier in EditSuppliers.ToList())
            {
                editedItem.Suppliers.Add(supplier.Model);
            }

            return(editedItem);
        }