public ModifyPart(Outsourced outsourced) { InitializeComponent(); rdoOutscourced.Checked = true; txtMachineCompany.Text = "Company Name"; txtID.Text = outsourced.PartID.ToString(); txtName.Text = outsourced.Name.ToString(); txtInventory.Text = outsourced.InStock.ToString(); txtPriceCost.Text = outsourced.Price.ToString(); txtMin.Text = outsourced.Min.ToString(); txtMax.Text = outsourced.Max.ToString(); txtMachineCompany.Text = outsourced.companyName; }
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; } }