private void productDeleteButton_Click(object sender, EventArgs e) { if (ProdIndx != null) { for (int j = 0; j < Inventory.Products.Count; j++) { if (Inventory.Products[j].ProductID == (int)productListGrid.Rows[(int)ProdIndx].Cells[0].Value) { int productPartCount = Inventory.Products[j].AssociatedParts.Count; if (productPartCount > 0) { MessageBox.Show("Remove associated parts before attempting to delete the product. "); } else { var confirmResult = MessageBox.Show("Are you sure to delete this item?", "Confirm Delete!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { Inventory.RemoveProduct(j); } } } } DGVBuild.displProductsDGV(productListGrid); ProdIndx = null; } else { MessageBox.Show("Select a row"); } productListGrid.ClearSelection(); }
private void MainScreen_Load(object sender, EventArgs e) { DGVBuild.dgvStyle(partListGrid); DGVBuild.dgvStyle(productListGrid); DGVBuild.displAllPartsDGV(partListGrid); DGVBuild.displProductsDGV(productListGrid); }