//Save Button private void buttonModifyPartSave_Click(object sender, EventArgs e) { //Exception if (textBoxModifyPartMax < textBoxModifyPartMin) { MessageBox.Show("Minimum must not exceed maximum"); return; } if (textBoxModifyPartInv < textBoxModifyPartMin || textBoxModifyPartInv > textBoxModifyPartMax) { MessageBox.Show("Inventory must be between minimum and maximum"); return; } if (radioModifyPartInHouse.Checked) { Inhouse inhouse = new Inhouse(Convert.ToInt32(BoxModifyPartID.Text), BoxModifyPartName.Text, Convert.ToDouble(BoxModifyPartPriceCost.Text), Convert.ToInt32(BoxModifyPartInv.Text), Convert.ToInt32(BoxModifyPartMin.Text), Convert.ToInt32(BoxModifyPartMax.Text), Convert.ToInt32(BoxModifyPartMachineID.Text)); Inventory.UpdateInHouse(Convert.ToInt32(BoxModifyPartID.Text), inhouse); radioModifyPartInHouse.Checked = true; } else { Outsourced outsourced = new Outsourced(Convert.ToInt32(BoxModifyPartID.Text), BoxModifyPartName.Text, Convert.ToDouble(BoxModifyPartPriceCost.Text), Convert.ToInt32(BoxModifyPartInv.Text), Convert.ToInt32(BoxModifyPartMin.Text), Convert.ToInt32(BoxModifyPartMax.Text), BoxModifyPartMachineID.Text); Inventory.UpdateOutsourced(Convert.ToInt32(BoxModifyPartID.Text), outsourced); radioModifyPartOutsourced.Checked = true; } this.Hide(); MainScreen f1 = new MainScreen(); f1.Show(); }
private void buttonModifyProductCancel_Click(object sender, EventArgs e) { this.Hide(); MainScreen f1 = new MainScreen(); f1.Show(); }
// //Save Button private void buttonAddPartSave_Click(object sender, EventArgs e) { try { //Exception Min must not exceed Max if (textBoxAddPartMax < textBoxAddPartMin) { MessageBox.Show("Minimum must not exceed maximum"); return; } } catch (FormatException formatException) { MessageBox.Show("Please enter a numeric value for Min and Max."); } try { //Exception Inventory must be between min and max if (textBoxAddPartInv < textBoxAddPartMin || textBoxAddPartInv > textBoxAddPartMax) { MessageBox.Show("Inventory must be between minimum and maximum"); return; } } catch (FormatException formatException) { MessageBox.Show("Please enter a numeric value for Inv."); } try { if (radioAddPartInHouse.Checked) { Inhouse inHouse = new Inhouse((Inventory.AllParts.Count + 1), textBoxAddPartName, textBoxAddPartPriceCost, textBoxAddPartInv, textBoxAddPartMin, textBoxAddPartMax, int.Parse(textBoxAddPartMachineID)); Inventory.AddPart(inHouse); } else { //Exception Min must not exceed Max if (textBoxAddPartMax < textBoxAddPartMin) { MessageBox.Show("Minimum must not exceed maximum"); return; } //Exception Inventory must be between min and max if (textBoxAddPartInv < textBoxAddPartMin || textBoxAddPartInv > textBoxAddPartMax) { MessageBox.Show("Inventory must be between minimum and maximum"); return; } Outsourced outsourced = new Outsourced((Inventory.AllParts.Count + 1), textBoxAddPartName, textBoxAddPartPriceCost, textBoxAddPartInv, textBoxAddPartMin, textBoxAddPartMax, textBoxAddPartMachineID); Inventory.AddPart(outsourced); } } catch (FormatException formatException) { MessageBox.Show("Price must be a numeric value"); } this.Hide(); MainScreen f1 = new MainScreen(); f1.Show(); }