public static void updatePart(Part part, ModifyPart_Form form) { outsource = null; inhouse = null; if (form.OutsourcedIsChecked) { outsource = new Outsourced(Convert.ToInt32(form.PartID), form.PartName, Convert.ToDecimal(form.PartPrice), Convert.ToInt32(form.InStock), Convert.ToInt32(form.PartMin), Convert.ToInt32(form.PartMax), form.PartCompanyName); AllParts.Insert(part.PartID, outsource); } else if (form.InHouseIsChecked) { inhouse = new Inhouse(Convert.ToInt32(form.PartID), form.PartName, Convert.ToDecimal(form.PartPrice), Convert.ToInt32(form.InStock), Convert.ToInt32(form.PartMin), Convert.ToInt32(form.PartMax), Convert.ToInt32(form.PartMachineID)); AllParts.Insert(part.PartID, inhouse); } AllParts.Remove(part); }
private void partsModify_Button_Click(object sender, EventArgs e) { if (Inventory.partsIndex == null) { MessageBox.Show("Must select part to modify.", "No selection"); return; } var modifyPart_Form = new ModifyPart_Form(); modifyPart_Form.SaveClicked += new EventHandler(modifyPart_Form_SaveClicked); modifyPart_Form.Show(); }