public ModifyPart(InHouse inHouse)
 {
     InitializeComponent();
     rdoInHouse.Checked     = true;
     txtMachineCompany.Text = "Machine ID";
     txtID.Text             = inHouse.PartID.ToString();
     txtName.Text           = inHouse.Name.ToString();
     txtInventory.Text      = inHouse.InStock.ToString();
     txtPriceCost.Text      = inHouse.Price.ToString();
     txtMin.Text            = inHouse.Min.ToString();
     txtMax.Text            = inHouse.Max.ToString();
     txtMachineCompany.Text = inHouse.machineID.ToString();
 }
Exemple #2
0
 private void btnPartModify_Click(object sender, EventArgs e)
 {
     if (dgvParts.CurrentRow.DataBoundItem.GetType() == typeof(InHouse))
     {
         InHouse inHouse = (InHouse)dgvParts.CurrentRow.DataBoundItem;
         new ModifyPart(inHouse).ShowDialog();
     }
     else
     {
         Outsourced outsourced = (Outsourced)dgvParts.CurrentRow.DataBoundItem;
         new ModifyPart(outsourced).ShowDialog();
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     Validate();
     if (validated == true)
     {
         if (rdoInHouse.Checked)
         {
             InHouse inHouse = new InHouse(Int32.Parse(txtID.Text), txtName.Text, decimal.Parse(txtPriceCost.Text), Int32.Parse(txtInventory.Text), Int32.Parse(txtMin.Text), Int32.Parse(txtMax.Text), Int32.Parse(txtMachineCompany.Text));
             Inventory.updatePart(Int32.Parse(txtID.Text), inHouse);
         }
         else
         {
             Outsourced outsourced = new Outsourced(Int32.Parse(txtID.Text), txtName.Text, decimal.Parse(txtPriceCost.Text), Int32.Parse(txtInventory.Text), Int32.Parse(txtMin.Text), Int32.Parse(txtMax.Text), txtMachineCompany.Text);
             Inventory.updatePart(Int32.Parse(txtID.Text), outsourced);
         }
         this.Close();
     }
     else
     {
         txtWarning.Visible = true;
     }
 }