protected void btnDelete_Click(object sender, EventArgs e) { BusinessActivityRole objBusinessActivityRole = new BusinessActivityRole(); try { int intRoleID; if (ddlRoleName.SelectedItem.Value == "Select") { intRoleID = 0; } else { intRoleID = Convert.ToInt32(ddlRoleName.SelectedItem.Value); } objBusinessActivityRole.EditActivityRoleData("DELETE", txtRoleName.Text, intRoleID); } catch (System.Exception ex) { if (ex.Message != "Thread was being aborted.") { GeneralTools.ExceptionLogger.ExceptionLog(ex); //Session["Msg"] = "An error has occurred while saving roles data"; Session["Msg"] = Common.CommonFunctions.GetResourceValue("en-US", "ER10"); Response.Redirect("../ErrorPages/ErrorPage.aspx"); } } }
protected void btnEdit_Click(object sender, EventArgs e) { if (btnEdit.Text == "Edit") { btnDelete.Enabled = false; ddlRoleName.Enabled = false; txtRoleName.Visible = true; rowRoleNameText.Visible = true; txtRoleName.Text = ""; //rowRoleNameDropDown.Visible = false; //RFVRoleNameText.Enabled = false; //REVRoleNameText.Enabled = false; btnEdit.Text = "Update"; ViewState["ModeofOperation"] = "EDIT"; } else { if (txtRoleName.Text.Trim() == "") { //GeneralTools.MessageBox.ShowMessage("Please enter Role Name"); return; } if (txtRoleName.Visible == true) { if (txtRoleName.Text.Trim().Length > 30) { GeneralTools.MessageBox.ShowMessage("Role Name Should be Max. 50 Char Long"); return; } } btnDelete.Enabled = true; rowRoleNameText.Visible = false; rowRoleNameDropDown.Visible = true; ddlRoleName.Enabled = true; txtRoleName.Visible = false; btnEdit.Text = "Edit"; ViewState["ModeofOperation"] = "UPDATE"; BusinessActivityRole objBusinessActivityRole = new BusinessActivityRole(); try { int intRoleID; if (ddlRoleName.SelectedItem.Value == "Select") { intRoleID = 0; } else { intRoleID = Convert.ToInt32(ddlRoleName.SelectedItem.Value); } objBusinessActivityRole.EditActivityRoleData("UPDATE", txtRoleName.Text, intRoleID); } catch (System.Exception ex) { if (ex.Message != "Thread was being aborted.") { GeneralTools.ExceptionLogger.ExceptionLog(ex); //Session["Msg"] = "An error has occurred while saving roles data"; Session["Msg"] = Common.CommonFunctions.GetResourceValue("en-US", "ER10"); Response.Redirect("../ErrorPages/ErrorPage.aspx"); } } } }