コード例 #1
0
 //delete buttons
 private void partDeleteButton_Click(object sender, EventArgs e)
 {
     if (PartIndx != null)
     {
         for (int j = 0; j < Inventory.AllParts.Count; j++)
         {
             if (Inventory.AllParts[j].PartID == (int)partListGrid.Rows[(int)PartIndx].Cells[0].Value)
             {
                 var confirmResult = MessageBox.Show("Are you sure to delete this item?",
                                                     "Confirm Delete!", MessageBoxButtons.YesNo);
                 if (confirmResult == DialogResult.Yes)
                 {
                     Inventory.deletePart(j);
                 }
             }
         }
         DGVBuild.displAllPartsDGV(partListGrid);
         PartIndx = null;
     }
     else
     {
         MessageBox.Show("Select a row");
     }
     partListGrid.ClearSelection();
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 private void MainScreen_Load(object sender, EventArgs e)
 {
     DGVBuild.dgvStyle(partListGrid);
     DGVBuild.dgvStyle(productListGrid);
     DGVBuild.displAllPartsDGV(partListGrid);
     DGVBuild.displProductsDGV(productListGrid);
 }
コード例 #4
0
 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();
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 private void AddModifyProductScreen_Load(object sender, EventArgs e)
 {
     DGVBuild.dgvStyle(dataGridView1);
     DGVBuild.dgvStyle(dataGridView2);
     DGVBuild.displAllPartsDGV(dataGridView1);
 }
コード例 #7
0
 //constructors for the screen
 public AddModifyProductScreen()
 {
     InitializeComponent();
     DGVBuild.displProdDGV(dataGridView2);
     creatingNewProdID = true;
 }