예제 #1
0
        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();
        }
예제 #2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     _selectedList = new List<Product_in_order>();
     foreach (ComboBox cb in _cbs)
     {
         SelectableSubProduct ssp = cb.SelectedItem as SelectableSubProduct;
         Product_in_order temp = _selectedList.Where(x => x.Product.Product_properties == ssp.Product.Product_properties).FirstOrDefault();
         if (temp != null)
             temp.Quantity_in_order++;
         else
         {
             Product_in_order p = new Product_in_order();
             p.Quantity_in_order = 1;
             p.Product = ssp.Product;
             p.Price = ssp.Price;
             p.ID = Globals.GetId("PIO");
             _selectedList.Add(p);
         }
     }
     for (int i = 0; i < _pio.Count; i++)
     {
         if (_pio[i].Product is Collective_product)
             _pio.Remove(_pio[i]);
     }
     _pio.AddRange(_selectedList);
     this.DialogResult = true;
 }