protected void btnClick_btnAddDept(object sender, EventArgs e) { productdata = new ProductData(); product = new Product(); product.DeptId = 0; product.DeptName = string.IsNullOrEmpty(txtDeptName.Text.ToString()) ? string.Empty : Convert.ToString(txtDeptName.Text); product.DeptHead = string.IsNullOrEmpty(txtDeptHead.Text.ToString()) ? string.Empty : Convert.ToString(txtDeptHead.Text); product.Dept_CreatedBy = GlobalInfo.Userid; product.Dept_CreatedDate = DateTime.Now.ToString("dd-MM-yyyy"); product.flag = "Insert"; int Result = 0; Result = productdata.AddDeptInfo(product); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Department Add Successfully"; ClearTextBox(); BindTypeInfo(); pnlError.Update(); upMain.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } }
public void DeleteTypebyID(int DeptId) { productdata = new ProductData(); product = new Product(); product.DeptId = Convert.ToInt32(DeptId); product.DeptName = string.Empty; product.DeptHead = string.Empty; product.Dept_CreatedBy = GlobalInfo.Userid; product.Dept_CreatedDate = DateTime.Now.ToString("dd-MM-yyyy"); product.flag = "Delete"; int Result = 0; Result = productdata.AddDeptInfo(product); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Department Deleted Successfully"; ClearTextBox(); //BindRouteList(); pnlError.Update(); upMain.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } }