protected void btnUpdate_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) { } ModuleRole moduleRole = new ModuleRole(); moduleRole = ModuleRoleManager.GetModuleRoleByID(Int32.Parse(Request.QueryString["moduleRoleID"])); ModuleRole tempModuleRole = new ModuleRole(); tempModuleRole.ModuleRoleID = moduleRole.ModuleRoleID; tempModuleRole.ModuleID = Int32.Parse(ddlModule.SelectedValue); tempModuleRole.RoleID = Int32.Parse(ddlRole.SelectedValue); tempModuleRole.AddedDate = DateTime.Now; tempModuleRole.AddedBy = loginID; tempModuleRole.ModifyDate = DateTime.Now; tempModuleRole.ModifyBy = loginID; tempModuleRole.RowStatusID = Int32.Parse(ddlRowStatus.SelectedValue); bool result = ModuleRoleManager.UpdateModuleRole(tempModuleRole); Response.Redirect("AdminModuleRoleDisplay.aspx"); }
protected void lbDelete_Click(object sender, EventArgs e) { LinkButton linkButton = new LinkButton(); linkButton = (LinkButton)sender; bool result = ModuleRoleManager.DeleteModuleRole(Convert.ToInt32(linkButton.CommandArgument)); showModuleRoleGrid(); }
private void showModuleRoleData() { ModuleRole moduleRole = new ModuleRole(); moduleRole = ModuleRoleManager.GetModuleRoleByID(Int32.Parse(Request.QueryString["moduleRoleID"])); ddlModule.SelectedValue = moduleRole.ModuleID.ToString(); ddlRole.SelectedValue = moduleRole.RoleID.ToString(); txtAddedBy.Text = moduleRole.AddedBy; txtModifyDate.Text = moduleRole.ModifyDate.ToString("dd MMM yyyy hh:mm tt"); txtModifyBy.Text = moduleRole.ModifyBy; ddlRowStatus.SelectedValue = moduleRole.RowStatusID.ToString(); }
private void showModuleRoleGrid() { gvModuleRole.DataSource = ModuleRoleManager.GetAllModuleRoles(); gvModuleRole.DataBind(); }
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); }