public ModifyPart(Inhouse inhouse)
        {
            InitializeComponent();

            partIDText.Text         = Convert.ToString(inhouse.PartID);
            nameText.Text           = inhouse.Name;
            priceText.Text          = Convert.ToString(inhouse.Price);
            inventoryText.Text      = Convert.ToString(inhouse.InStock);
            minText.Text            = Convert.ToString(inhouse.Min);
            maxText.Text            = Convert.ToString(inhouse.Max);
            companyMachineText.Text = Convert.ToString(inhouse.MachineID);
            inhouseButton.Checked   = true;
        }
 private void modPart_Click(object sender, EventArgs e)
 {
     if (PartTable.CurrentRow.DataBoundItem.GetType() == typeof(Inhouse))
     {
         Inhouse inhouse = (Inhouse)PartTable.CurrentRow.DataBoundItem;
         new ModifyPart(inhouse).ShowDialog();
     }
     else
     {
         Outsourced outsourced = (Outsourced)PartTable.CurrentRow.DataBoundItem;
         new ModifyPart(outsourced).ShowDialog();
     }
 }
        private void savePart_Click(object sender, EventArgs e)
        {
            if (inhouseButton.Checked)
            {
                inhouseButton.Checked = true;

                if (int.Parse(inventoryText.Text) < int.Parse(minText.Text) || int.Parse(inventoryText.Text) > int.Parse(maxText.Text))
                {
                    MessageBox.Show("Inventory can't be less than the minimum or greater than the maximum");
                }

                else if (int.Parse(minText.Text) > int.Parse(maxText.Text))
                {
                    MessageBox.Show("The minimum inventory can't be greater than the maximum");
                }

                else
                {
                    Inhouse inhouse = new Inhouse(int.Parse(partIDText.Text), nameText.Text, decimal.Parse(priceText.Text), int.Parse(inventoryText.Text),
                                                  int.Parse(minText.Text), int.Parse(maxText.Text), int.Parse(companyMachineText.Text));
                    Inventory.UpdatePart(int.Parse(partIDText.Text), inhouse);
                }
                Close();
            }
            else
            {
                outsourcedButton.Checked = true;

                if (int.Parse(inventoryText.Text) < int.Parse(minText.Text) || int.Parse(inventoryText.Text) > int.Parse(maxText.Text))
                {
                    MessageBox.Show("Inventory can't be less than the minimum or greater than the maximum");
                }

                else if (int.Parse(minText.Text) > int.Parse(maxText.Text))
                {
                    MessageBox.Show("The minimum inventory can't be greater than the maximum");
                }
                else
                {
                    Outsourced outsourced = new Outsourced(int.Parse(partIDText.Text), nameText.Text, decimal.Parse(priceText.Text), int.Parse(inventoryText.Text),
                                                           int.Parse(minText.Text), int.Parse(maxText.Text), companyMachineText.Text);
                    Inventory.UpdatePart(int.Parse(partIDText.Text), outsourced);
                }
                Close();
            }
        }