protected void Btn_SubmitProductTypeID(object sender, EventArgs e) { if (Page.IsValid) { try { int ID = Convert.ToInt32(HdnProductTypeId.Value); string Name = NameTxt.Text.ToString(); string Desc = DescTxt.Text.ToString(); ProductTypes productType = ProductTypeFactory.CreateProductType(ID, Name, Desc); ProductTypes updatedProductType = ProductTypeHandler.UpdateProductType(productType); if (productType == null) { throw new Exception(); } else { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Data Updated Succesfully" + "');", true); Response.Redirect("ViewProductType.aspx"); } } catch (Exception ex) { throw ex; } } }
public static Response UpdateProductType(int id, string name, string desc) { ProductType getName = ProductTypeHandler.GetName(name); if (name.Length < 5) { return(new Response(false, "must consist of 5 characters or more")); } else if (name == "") { return(new Response(false, "must be filled")); } else if (getName != null) { return(new Response(false, "must be unique")); } else if (desc == "") { return(new Response(false, "must be filled")); } else { ProductTypeHandler.UpdateProductType(id, name, desc); return(new Response(true)); } }
public static Response UpdateProductType(int id, string name, string desc) { if (name == "" || name.Length < 5) { return(new Response(false, "Please insert the name and a minimum of 5 character")); } if (ProductTypeRepository.isUnique(name) == false) { return(new Response(false, "Product Type Must Be Unique")); } if (desc == "") { return(new Response(false, "Please insert the description")); } return(new Response(ProductTypeHandler.UpdateProductType(id, name, desc), "Product Type has been inserted")); }
public static Response UpdateProductType(int protypeid, string name, string desc) { if (name == "" || name.Length < 5) { return(new Response(false, "Product Type must be filled and consists of 5 characters or more")); } if (desc == "") { return(new Response(false, "Description ust be filled.")); } Response response = ProductTypeHandler.UpdateProductType(protypeid, name, desc); return(response); }