protected void ddlRoleId_SelectedIndexChanged(object sender, EventArgs e) { if (ddlRoleId.SelectedItem.Value == "-Select-") { lblSelect.Visible = false; ddlPageSize.Visible = false; lvRoleMember.Visible = false; RoleMemberDataPager.Visible = false; } else { RoleMemberBE roleMember = new RoleMemberBE(); RoleMemberBAL roleMemberBAL = new RoleMemberBAL(); DataTable dt = new DataTable(); roleMember.RoleId = Convert.ToInt32(ddlRoleId.SelectedItem.Value); hdnRoleId.Value = roleMember.RoleId.ToString(); RoleMemberDataPager.SetPageProperties(0, RoleMemberDataPager.PageSize, true); lblSelect.Visible = true; ddlPageSize.Visible = true; lvRoleMember.Visible = true; RoleMemberDataPager.Visible = true; bindlvRoleMember(); recalcNoOfPages(); } }
public bool GetAllRoleAccessRightDetails(ref DataTable dt, ref UserSecBE.RoleMemberBE roleMember) { CommonDAL commondal = new CommonDAL(); SqlConnection con = commondal.Connection(); SqlDataAdapter da = new SqlDataAdapter("Sp_UM_GetRoleAccessRight", con); da.SelectCommand.CommandType = CommandType.StoredProcedure; SqlParameter p1 = new SqlParameter("@RoleId", SqlDbType.Int); p1.Value = roleMember.RoleId; da.SelectCommand.Parameters.Add(p1); da.Fill(dt); if (loadRoleMembersProfile(ref dt)) { return(true); } else { return(false); } }
public bool DeleteRoleMember(RoleMemberBE roleMember) { RoleMemberDAL roleMemberDAL = new RoleMemberDAL(); if (roleMemberDAL.DeleteRoleMember(roleMember)) { return true; } else { return false; } }
public bool GetAllRoleMembers(ref DataTable dt , ref RoleMemberBE roleMember) { RoleMemberDAL roleMemberDAL = new RoleMemberDAL(); if (roleMemberDAL.GetAllRoleMembers(ref dt, ref roleMember)) { return true; } else { return false; } }
public bool GetAllRoleAccessRightDetails(ref DataTable dt, ref RoleMemberBE roleMember) { RoleAccessRightsDAL roleAccessDAL = new RoleAccessRightsDAL(); if (roleAccessDAL.GetAllRoleAccessRightDetails(ref dt, ref roleMember)) { return true; } else { return false; } }
public bool GetAllRoleMembers(ref DataTable dt, ref RoleMemberBE roleMember) { CommonDAL commondal = new CommonDAL(); SqlConnection con = commondal.Connection(); //con.Open(); SqlDataAdapter da = new SqlDataAdapter("Sp_UM_GetAllRoleMembers", con); da.SelectCommand.CommandType = CommandType.StoredProcedure; SqlParameter p1 = new SqlParameter("@RoleId", SqlDbType.Int); p1.Value = roleMember.RoleId; da.SelectCommand.Parameters.Add(p1); da.Fill(dt); if (loadRoleMembersProfile(ref dt)) { return true; } else { return false; } }
public bool AddRoleMember(RoleMemberBE roleMember) { CommonDAL commondal = new CommonDAL(); SqlConnection con = commondal.Connection(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Sp_UM_RoleMembersInsert"; cmd.Parameters.Add("@RoleId", SqlDbType.Int).Value = roleMember.RoleId; cmd.Parameters.Add("@UserId", SqlDbType.Int).Value = roleMember.UserId; cmd.Parameters.Add("@LastModifiedBy", SqlDbType.Int).Value = roleMember.LastModifiedBy; cmd.Connection = con; //con.Open(); int count = cmd.ExecuteNonQuery(); if (count ==1) { return true; } else { return false; } }
protected void lvRoleMember_OnItemCommand(object sender, ListViewCommandEventArgs e) { RoleMemberBAL roleMemberBAL= new RoleMemberBAL(); RoleMemberBE roleMember = new RoleMemberBE(); roleMember.LastModifiedBy= ((UserBE)Session["LoggedInUser"]).UserId; LoggedIn master = (LoggedIn)this.Master; if (String.Equals(e.CommandName, "Add")) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add")) { master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); return; } string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(','); roleMember.UserId = Convert.ToInt32(arg[0]); roleMember.RoleId = Convert.ToInt32(arg[1]); if (roleMemberBAL.AddRoleMember(roleMember)) { bindlvRoleMember(); recalcNoOfPages(); master.ShowMessage("Successfully Added.", true); } else { master.ShowMessage("Unsuccessful.", false); } lvRoleMember.EditIndex = -1; } else if (String.Equals(e.CommandName, "Remove")) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add")) { master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); return; } string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(','); roleMember.UserId = Convert.ToInt32(arg[0]); roleMember.RoleId = Convert.ToInt32(arg[1]); if (roleMemberBAL.DeleteRoleMember(roleMember)) { bindlvRoleMember(); recalcNoOfPages(); master.ShowMessage("Successfully Removed.", true); } else { master.ShowMessage("Unsuccessful.", false); } lvRoleMember.EditIndex = -1; } }
private void bindlvRoleMember() { RoleMemberBE roleMember = new RoleMemberBE(); RoleMemberBAL roleMemberBAL = new RoleMemberBAL(); DataTable dt = new DataTable(); roleMember.RoleId =Convert.ToInt32(hdnRoleId.Value.ToString()); if (roleMemberBAL.GetAllRoleMembers(ref dt,ref roleMember)) { this.lvRoleMember.DataSource = dt; lvRoleMember.Visible = true; RoleMemberDataPager.Visible = true; lvRoleMember.DataBind(); recalcNoOfPages(); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful",false); } }
private void bindListView() { RoleMemberBE roleMember = new RoleMemberBE(); RoleAccessRightsBAL roleAccessBAL = new RoleAccessRightsBAL(); DataTable dt = new DataTable(); roleMember.RoleId = Convert.ToInt32(hdnRoleId.Value.ToString()); if (roleAccessBAL.GetAllRoleAccessRightDetails(ref dt, ref roleMember)) { this.lvRoleAccessRight.DataSource = dt; lvRoleAccessRight.Visible = true; RoleAccessRightDataPager.Visible = true; btnSave.Visible = true; ddlPageSize.Visible = true; lblSelect.Visible = true; lvRoleAccessRight.DataBind(); recalcNoOfPages(); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful", false); } }