private void SaveProduct(Product mobjProduct) { try { BLL.Component.ProductBLL objProd = new ProductBLL(); if (mobjProduct.ProductID == 0) { int mintReturn = objProd.AddProduct(mobjProduct); if (mintReturn == -1) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Product for the Manufacturer already exists!');", true); return; } } else { mobjProduct.UpdatedBy = 1; int mintReturn = objProd.EditProduct(mobjProduct); if (mintReturn == -1) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Product for the Manufacturer already exists!');", true); return; } } Response.Redirect("Product.aspx"); } catch (Exception ex) { SendMail.MailMessage("CSWeb > Error > " + (new System.Diagnostics.StackTrace()).GetFrame(0).GetMethod().Name, ex.ToString()); } }