private void cb_deal_SelectionChanged(object sender, SelectionChangedEventArgs e) { selectedDeal=(Deal)cb_deal.SelectedItem; _productsInOrder = new List<Product_in_order>(); foreach(Product_in_deal pid in selectedDeal.Products_in_deal ) { Product_in_order pio = new Product_in_order(); pio.ID = Globals.GetId("IPO"); pio.Product = pid.Product; pio.Price = pid.Price; pio.Quantity_in_order = pid.Quantity; _productsInOrder.Add(pio); } if(selectedDeal.Has_collective_product) { ProductSelector ps = new ProductSelector(_productsInOrder); if(ps.ShowDialog()==true) { } } datagrid_productsInOrder.ItemsSource = _productsInOrder; lbl_productsInOrder.Visibility = System.Windows.Visibility.Visible; datagrid_productsInOrder.Visibility = System.Windows.Visibility.Visible; Validate(); }
public DealWizzard(string externalDealId="",string externalDealName="", Partner_site partner=null, int productsPrice=-1) { InitializeComponent(); newDeal = new Deal(); _prodInDeal = new List<Product_in_deal>(); cb_partner.ItemsSource = Databases.localModel.Partner_siteSet.ToList(); _products = Databases.localModel.ProductSet.ToList(); cb_product.ItemsSource = _products; _shippingPrices = new List<Shipping_price>(); shippingPrices_datagrid.ItemsSource = _shippingPrices; wizz.Finished += wizz_Finished; tb_externalId.Text = externalDealId; tb_name.Text = externalDealName; cb_priority.ItemsSource = Enum.GetValues(typeof(OrderPriority)); cb_priority.SelectedItem = Enum.Parse(typeof(OrderPriority), "Normál"); if(partner!=null) { cb_partner.SelectedItem = partner; cb_partner.IsEnabled = false; } if(productsPrice!=-1) { lbl_needToBe.Content = "Várt érték: "+productsPrice + " Ft."; lbl_needToBe.Visibility = System.Windows.Visibility.Visible; } }
public static bool AddDeal(Deal d, DataModelContainer destModel) { try { destModel.DealSet.Add(d); destModel.SaveChanges(); return true; } catch (Exception ex) { return false; } }