private void btn_UpdateProduct_Click(object sender, EventArgs e) { M = new WorkFlowMessage(); //Set the product based on ID if (CE.isValidInt(txt_ProductID.Text, "ID") && CE.isnotNull(txt_ProductID.Text, "ID") && CE.isnotNull(txt_ProductName.Text, "Name") && CE.isnotNull(txt_ProductMaterials.Text, "Materials") && CE.isnotNull(txt_ProductQuantity.Text, "Quantity")) { P.SetProduct(Int32.Parse(txt_ProductID.Text)); if (M.UpdateProduct(P, txt_ProductID.Text, txt_ProductName.Text, txt_ProductMaterials.Text, txt_ProductQuantity.Text)) { P.UpdateProduct(Int32.Parse(txt_ProductID.Text), txt_ProductName.Text, txt_ProductMaterials.Text, Int32.Parse(txt_ProductQuantity.Text), "In Progress"); ViewProducts_Load(sender, e); } } else { M.IncorrectEntry(); } }
private void btn_AddMaterialtoProduct_Click(object sender, EventArgs e) { if (CE.isnotNull(txt_Material.Text, "ID") && CE.isnotNull(txt_MaterialQuantity.Text, "Quantity")) { //Add materials one at a time to materialsProduct in Productclass. product.AddMaterialtoProduct(txt_Material.Text, txt_MaterialQuantity.Text); //Update the description in the bottom half so the user can see what has been added thus far. lbl_Description.Text = string.Empty; foreach (var v in product.productMaterials) { lbl_Description.Text = lbl_Description.Text + v.Name + ", " + v.Quantity + "\n"; } txt_Material.SelectedIndex = -1; txt_MaterialQuantity.Text = ""; } }