//Save data and return to the Main screen. private void PartSave_Click(object sender, EventArgs e) { //Add new Parts, Save and return to the main form. if (rbOutsourced.Checked == true) { Inventory.AddPart(new Outsourced((Inventory.partInc()), tbPartName.Text, int.Parse(tbPartInvenory.Text), decimal.Parse(tbPartCost.Text), int.Parse(tbPartMin.Text), int.Parse(tbPartMax.Text), tbPartMachineId.Text)); } else if (rbInHouse.Checked == true) { Inventory.AddPart(new InHouse((Inventory.partInc()), tbPartName.Text, int.Parse(tbPartInvenory.Text), decimal.Parse(tbPartCost.Text), int.Parse(tbPartMin.Text), int.Parse(tbPartMax.Text), int.Parse(tbPartMachineId.Text))); } Hide(); MainScreen mainScreen = new MainScreen(); mainScreen.ShowDialog(); }
//Save Product and return to the Main form. private void BtnModSave_Click(object sender, EventArgs e) { int changeProd = int.Parse(tbModId.Text); Product prodChange = new Product(changeProd, tbModName.Text, int.Parse(tbModInv.Text), decimal.Parse(tbModPrice.Text), int.Parse(tbModMin.Text), int.Parse(tbModMax.Text)); Inventory.UpdateProduct(changeProd, prodChange); foreach (Part part in partProd) { Product.AddAssociatedPart(part); } Hide(); MainScreen main = new MainScreen(); main.ShowDialog(); }
//Save changes and return to the Main screen. private void BtnModSave_Click(object sender, EventArgs e) { int partChangeId = Convert.ToInt32(tbModID.Text); if (rbModOutsourced.Checked == true) { Outsourced partChange = new Outsourced(int.Parse(tbModID.Text), tbModName.Text, int.Parse(tbModInv.Text), decimal.Parse(tbModCost.Text), int.Parse(tbModMin.Text), int.Parse(tbModMax.Text), tbModMachineID.Text); Inventory.UpdatePart(partChangeId, partChange); } else { InHouse partChange = new InHouse(int.Parse(tbModID.Text), tbModName.Text, int.Parse(tbModInv.Text), decimal.Parse(tbModCost.Text), int.Parse(tbModMin.Text), int.Parse(tbModMax.Text), int.Parse(tbModMachineID.Text)); Inventory.UpdatePart(partChangeId, partChange); } Hide(); MainScreen mainscreen = new MainScreen(); mainscreen.ShowDialog(); }