protected void btnAdd_Click(object sender, EventArgs e) { string loginID = "1"; try { if (Session["Login"] == null) { Session["PreviousPage"] = HttpContext.Current.Request.Url.AbsoluteUri; Response.Redirect("../LoginPage.aspx"); } loginID = ((Login)Session["Login"]).LoginID.ToString(); } catch (Exception ex) { } ButtonRole buttonRole = new ButtonRole(); buttonRole.RoleID = Int32.Parse(ddlRole.SelectedValue); buttonRole.ButtonID = Int32.Parse(ddlButton.SelectedValue); buttonRole.AddedDate = DateTime.Now; buttonRole.AddedBy = loginID; buttonRole.ModifyDate = DateTime.Now; buttonRole.ModifyBy = loginID; buttonRole.RowStatusID = Int32.Parse(ddlRowStatus.SelectedValue); int resutl = ButtonRoleManager.InsertButtonRole(buttonRole); Response.Redirect("AdminButtonRoleDisplay.aspx"); }
protected void btnRoleWisePageNMenuAccess_Click(object sender, EventArgs e) { string loginID = "1"; try { if (Session["Login"] == null) { Session["PreviousPage"] = HttpContext.Current.Request.Url.AbsoluteUri; Response.Redirect("../LoginPage.aspx"); } loginID = ((Login)Session["Login"]).LoginID.ToString(); } catch (Exception ex) { } RoleManager.DeleteModuleMenuPageButtonRole(int.Parse(ddlRole.SelectedValue)); int resutl = 0; foreach (GridViewRow grModule in gvModule.Rows) { CheckBox chkSelect = (CheckBox)grModule.FindControl("chkSelect"); if (chkSelect.Checked) { ModuleRole moduleRole = new ModuleRole(); moduleRole.ModuleID = Int32.Parse(chkSelect.ToolTip); moduleRole.RoleID = Int32.Parse(ddlRole.SelectedValue); moduleRole.AddedDate = DateTime.Now; moduleRole.AddedBy = loginID; moduleRole.ModifyDate = DateTime.Now; moduleRole.ModifyBy = loginID; moduleRole.RowStatusID = 1; resutl = ModuleRoleManager.InsertModuleRole(moduleRole); GridView gvPagenMenu = (GridView)grModule.FindControl("gvPagenMenu"); foreach (GridViewRow grPageNMenu in gvPagenMenu.Rows) { CheckBox chkSelectPageNMenu = (CheckBox)grPageNMenu.FindControl("chkSelectPageNMenu"); if (chkSelectPageNMenu.Checked) { PageRole pageRole = new PageRole(); pageRole.PageID = Int32.Parse(chkSelectPageNMenu.ToolTip); pageRole.RoleID = Int32.Parse(ddlRole.SelectedValue); pageRole.AddedDate = DateTime.Now; pageRole.AddedBy = loginID; pageRole.ModifyDate = DateTime.Now; pageRole.ModifyBy = loginID; pageRole.RowStatusID = 1; resutl = PageRoleManager.InsertPageRole(pageRole); if (chkSelectPageNMenu.ValidationGroup != "0") { MenuRole menuRole = new MenuRole(); menuRole.MenuID = Int32.Parse(chkSelectPageNMenu.ValidationGroup); menuRole.RoleID = Int32.Parse(ddlRole.SelectedValue); menuRole.AddedDate = DateTime.Now; menuRole.AddedBy = loginID; menuRole.ModifyDate = DateTime.Now; menuRole.ModifyBy = loginID; menuRole.RowStatusID = 1; resutl = MenuRoleManager.InsertMenuRole(menuRole); } DataList dlButton = (DataList)grPageNMenu.FindControl("dlButton"); foreach (DataListItem dliButton in dlButton.Items) { CheckBox chkSelectButton = (CheckBox)dliButton.FindControl("chkSelectButton"); if (chkSelectButton.Checked) { ButtonRole buttonRole = new ButtonRole(); buttonRole.RoleID = Int32.Parse(ddlRole.SelectedValue); buttonRole.ButtonID = Int32.Parse(chkSelectButton.ToolTip); buttonRole.AddedDate = DateTime.Now; buttonRole.AddedBy = loginID; buttonRole.ModifyDate = DateTime.Now; buttonRole.ModifyBy = loginID; buttonRole.RowStatusID = 1; resutl = ButtonRoleManager.InsertButtonRole(buttonRole); } } } } } { GridView gvPagenMenu = (GridView)grModule.FindControl("gvPagenMenu"); foreach (GridViewRow grPageNMenu in gvPagenMenu.Rows) { CheckBox chkSelectPageNMenu = (CheckBox)grPageNMenu.FindControl("chkSelectPageNMenu"); if (!chkSelectPageNMenu.Checked) { DataList dlButton = (DataList)grPageNMenu.FindControl("dlButton"); foreach (DataListItem dliButton in dlButton.Items) { CheckBox chkSelectButton = (CheckBox)dliButton.FindControl("chkSelectButton"); if (chkSelectButton.Checked) { ButtonRole buttonRole = new ButtonRole(); buttonRole.RoleID = Int32.Parse(ddlRole.SelectedValue); buttonRole.ButtonID = Int32.Parse(chkSelectButton.ToolTip); buttonRole.AddedDate = DateTime.Now; buttonRole.AddedBy = loginID; buttonRole.ModifyDate = DateTime.Now; buttonRole.ModifyBy = loginID; buttonRole.RowStatusID = 1; resutl = ButtonRoleManager.InsertButtonRole(buttonRole); } } } } } } Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri); }