protected void btnAddRole_Click(object sender, EventArgs e) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to Perform any operation on this page. Please contact system administrator.", false); // Server.Transfer("UM_BlankPage.aspx"); //?? send Message through Query String to the BlankPage // string cat = Request.QueryString["Message"]; // Response.Redirect("UM_BlankPage.aspx?Message=You are not authorised to Perform any operation on this page. Please contact system administrator."); return; } if (ValidData()) { } else { UserBE user = (UserBE)Session["LoggedInUser"]; RoleBE addRoleBE = new RoleBE(); RoleDAL addRoleDal = new RoleDAL(); RoleBAL addRoleBal = new RoleBAL(); addRoleBE.RoleShortDesc = txtRoleShortDesc.Text; addRoleBE.RoleLongDesc = txtRoleLongDesc.Text; addRoleBE.LastModifiedBy = user.UserId; if (addRoleBal.AddRole(addRoleBE)) { txtRoleShortDesc.Text = ""; txtRoleLongDesc.Text = ""; LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Record Inserted Successfully.", true); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful.", false); } } }
//protected void btnUpdate_Click(object sender, EventArgs e) //{ // RoleBE role = new RoleBE(); // RoleBAL roleBAL = new RoleBAL(); // role.RoleId = Convert.ToInt32(hdnRoleUpdateId.Value); // //role.RoleShortDesc = txtRoleShortDesc.Text; // //role.RoleLongDesc = txtRolelongDesc.Text; // role.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; // if (roleBAL.ModifyRole(role)) // { // LvRoleItems.EditIndex = -1; // bind(); // recalcNoOfPages(); // LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("Role successfully Updated.", true); // } // else // { // LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("Unsuccessful", true); // } //} //protected void btnCancel_Click(object sender, EventArgs e) //{ // LvRoleItems.EditIndex = -1; // bind(); // recalcNoOfPages(); //} protected void btnDeleteYes_Click(object sender, EventArgs e) { RoleBE role = new RoleBE(); RoleBAL roleBAL = new RoleBAL(); int RoleId = Convert.ToInt32(hdnRoleId.Value); role.RoleId = Convert.ToInt32(RoleId); if (roleBAL.DeleteRole(role)) { if (LvRoleItems.Items.Count == 1) { RoleDataPager.SetPageProperties(RoleDataPager.TotalRowCount - RoleDataPager.PageSize - 1, RoleDataPager.PageSize, true); bind(); recalcNoOfPages(); LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Role successfully deleted.", true); } else { LvRoleItems.EditIndex = -1; bind(); recalcNoOfPages(); LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Role successfully deleted.", true); } } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Sorry You cannot delete Role because it is already in use", false); recalcNoOfPages(); } }
private void bind() { RoleBAL roleBAL = new RoleBAL(); DataTable dt = new DataTable(); if (roleBAL.GetAllRoleDetails(ref dt)) { this.LvRoleItems.DataSource = dt; LvRoleItems.DataBind(); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful", false); } }
void UCRoleAddList_btnUpdateClick(object sender, EventArgs e) { RoleBE role = new RoleBE(); RoleBAL roleBAL = new RoleBAL(); role.RoleId = Convert.ToInt32(hdnRoleUpdateId.Value); role.RoleShortDesc = UCRoleAddList.ShortDesc; role.RoleLongDesc = UCRoleAddList.LongDesc; role.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; if (roleBAL.ModifyRole(role)) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Role successfully Updated.", true); LvRoleItems.EditIndex = -1; bind(); recalcNoOfPages(); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful", true); } }