public void GenerateProductPanel(OrderDetail generatedOrder) { ProductPanel temp = new ProductPanel(panelProducts, 4, productList); temp.BringToFront(); listProductPanel.Add(temp); foreach (ProductPanel item in listProductPanel) { if (item.comboProduct.SelectedItem != null) { temp.productListInternal.Remove((Product)item.comboProduct.SelectedItem); } } temp.txtDiscount.Text = generatedOrder.Discount.ToString(); temp.txtPrice.Text = generatedOrder.UnitPrice.ToString(); temp.txtQuantity.Text = generatedOrder.Quantity.ToString(); temp.comboProduct.DataSource = temp.productListInternal; temp.comboProduct.SelectedItem = generatedOrder.ProductID; temp.comboProduct.SelectedIndexChanged += comboProduct_SelectedIndexChanged; temp.updPrice += temp_updPrice; temp.updPercent += temp_updPercent; temp.btnDelete.Click += btnDelete_Click; updatepanelLocation(); temp_updPercent(); }
public void GenerateProductPanel() { ProductPanel temp = new ProductPanel(panelProducts, 4, productList); temp.BringToFront(); listProductPanel.Add(temp); foreach (ProductPanel item in listProductPanel) { if (item.comboProduct.SelectedItem != null) { temp.productListInternal.Remove((Product)item.comboProduct.SelectedItem); } } temp.comboProduct.DataSource = temp.productListInternal; temp.comboProduct.SelectedItem = null; temp.comboProduct.SelectedIndexChanged += comboProduct_SelectedIndexChanged; temp.updPrice += temp_updPrice; temp.updPercent += temp_updPercent; temp.btnDelete.Click += btnDelete_Click; updatepanelLocation(); }