// //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(); }