private void productDeleteButton_Click(object sender, EventArgs e) { if (ProdIndx >= 0) { if (!(creatingNewProdID)) { for (int j = 0; j < Inventory.Products.Count; j++) { if (Inventory.Products[j].ProductID == ProdIDLookup) { Inventory.Products[j].removeAssociatedPart((int)dataGridView2.Rows[ProdIndx].Cells[0].Value); } } DGVBuild.displProdDGV(dataGridView2); ProdIndx = -1; } else { for (int j = 0; j < Inventory.TempAssocParts.Count; j++) { if (Inventory.TempAssocParts[j].PartID == (int)dataGridView2.Rows[PartIndx].Cells[0].Value) { Inventory.TempAssocParts.RemoveAt(j); } } DGVBuild.displTempAssocPartsDGV(dataGridView2); ProdIndx = -1; } } else { MessageBox.Show("Select an associated part row"); } dataGridView2.ClearSelection(); }
public AddModifyProductScreen(Product product) { InitializeComponent(); creatingNewProdID = false; mainProductHeader.Text = "Modify Product"; productIDTextBox.Text = product.ProductID.ToString(); productNameTextBox.Text = product.Name; productInvTextBox.Text = product.InStock.ToString(); productPriceTextBox.Text = product.Price.ToString(); productMaxTextBox.Text = product.Max.ToString(); productMinTextBox.Text = product.Min.ToString(); //making the product ID read-only mode for modify productIDTextBox.ReadOnly = true; productIDTextBox.BackColor = Color.DarkGray; DGVBuild.displProdDGV(dataGridView2, product); ProdIDLookup = product.ProductID; }
//constructors for the screen public AddModifyProductScreen() { InitializeComponent(); DGVBuild.displProdDGV(dataGridView2); creatingNewProdID = true; }