private void ButtonModifySave_Click(object sender, EventArgs e)
        {
            if (isInhouse)
            {
                Part p = new Inhouse(Convert.ToInt32(TextBoxPartID.Text), TextBoxPartName.Text, Double.Parse(TextBoxPartPriceCost.Text),
                                     Convert.ToInt32(TextBoxPartInv.Text), Convert.ToInt32(TextBoxPartMin.Text), Convert.ToInt32(TextBoxPartMax.Text),
                                     Convert.ToInt32(TextBoxX.Text));
                Inventory.UpdatePart(p);
            }
            else
            {
                Part p = new Outsourced(Convert.ToInt32(TextBoxPartID.Text), TextBoxPartName.Text, Double.Parse(TextBoxPartPriceCost.Text),
                                        Convert.ToInt32(TextBoxPartInv.Text), Convert.ToInt32(TextBoxPartMin.Text), Convert.ToInt32(TextBoxPartMax.Text),
                                        TextBoxX.Text);
                Inventory.UpdatePart(p);
            }

            this.Hide();
            //InventoryManagementSystemMainScreen s1 = new InventoryManagementSystemMainScreen();
            //s1.Show();
        }
        private void ButtonPartSave_Click(object sender, EventArgs e)
        {
            if (rbselected == 1)
            {
                Inhouse x = new Inhouse(Int32.Parse(TextBoxPartID.Text), TextBoxPartName.Text, Double.Parse(TextBoxPartPriceCost.Text), Int32.Parse(TextBoxPartInv.Text), Int32.Parse(TextBoxPartMin.Text), Int32.Parse(TextBoxPartMax.Text), Int32.Parse(TextBoxX.Text));
                Inventory.MyPartList.Add(x);
                this.Hide();
            }
            else if (rbselected == 2)
            {
                //int tempPartID;
                //if (Int32.TryParse(TextBoxPartID.Text, out tempPartID))
                //{
                //    return;
                //}
                //else
                //    MessageBox.Show("Part ID requires numerical input");

                //int number = 0;
                //if (int.Parse(textBox1.Text.Trim(), out number))
                //{
                //    //textBox value is a number
                //}
                //else
                //{
                //    //not a number
                //    MessageBox.Show("Please insert a numerical value");
                //}


                Outsourced x = new Outsourced(Int32.Parse(TextBoxPartID.Text), TextBoxPartName.Text, Double.Parse(TextBoxPartPriceCost.Text), Int32.Parse(TextBoxPartInv.Text), Int32.Parse(TextBoxPartMin.Text), Int32.Parse(TextBoxPartMax.Text), TextBoxX.Text);
                Inventory.MyPartList.Add(x);
                this.Hide();
            }
            else
            {
                MessageBox.Show("Please Select a Part's Source");
            }
        }
 public ModifyPartScreen()
 {
     InitializeComponent();
     TextBoxPartID.Text        = Inventory.CurrentPart.PartID.ToString();
     TextBoxPartName.Text      = Inventory.CurrentPart.Name;
     TextBoxPartInv.Text       = Inventory.CurrentPart.InStock.ToString();
     TextBoxPartPriceCost.Text = Inventory.CurrentPart.Price.ToString();
     TextBoxPartMax.Text       = Inventory.CurrentPart.Max.ToString();
     TextBoxPartMin.Text       = Inventory.CurrentPart.Min.ToString();
     if (Inventory.CurrentPart is Inhouse)
     {
         Inhouse e = (Inhouse)Inventory.CurrentPart;
         TextBoxX.Text = e.MachineID.ToString();
         isInhouse     = true;
         RadioButtonInHouse.Checked = true;
     }
     else
     {
         Outsourced e = (Outsourced)Inventory.CurrentPart;
         TextBoxX.Text = e.CompanyName;
         isInhouse     = false;
         RadioButtonOutsourced.Checked = true;
     }
 }