} // Команда открытия окна создания товара // Добавление товара к заказу private object AddingGood(int param) { good_view selected_item = goods_base.First(x => x.id_good == param); good order_item = order.Where(x => x.id_good == selected_item.id_good).FirstOrDefault(); if (selected_item.in_storage > 0) { if (order_item != null) { if (order_item.in_storage < selected_item.in_storage) { good i = order_item; i.in_storage++; int index = order.IndexOf(order_item); order.Remove(order_item); order.Insert(index, i); } } else { good j = selected_item.ToGood(); order.Add(j); } } res.prop = 0; foreach (var item in order) { res.prop += item.price * item.in_storage; } return(null); }
public EditGoodWindow(good_view editingGood, ShopViewModel shopViewModel) { InitializeComponent(); this.shopViewModel = shopViewModel; this.good_id = editingGood.id_good; this.good_name.Text = editingGood.name_g.ToString(); this.good_price.Text = editingGood.price.ToString(); this.category_id.ItemsSource = shopViewModel.goods_categories; this.category_id.DisplayMemberPath = "name_gc"; this.category_id.SelectedValuePath = "id_gc"; this.category_id.SelectedValue = editingGood.cat_g; this.in_storage.Text = editingGood.in_storage.ToString(); }