protected void Page_Load(object sender, EventArgs e) { //判断权限 if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_角色管理_角色管理栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_角色管理_角色管理栏目, true); return; } string roleIds = Utils.GetQueryStringValue("roleIds");//报价标准Id pageIndex = Utils.GetInt(Utils.GetQueryStringValue("Page"), 1); itemIndex2 = (pageIndex - 1) * pageSize + 1; EyouSoft.BLL.CompanyStructure.SysRoleManage roleBll = new EyouSoft.BLL.CompanyStructure.SysRoleManage();//初始化角色bll //报价Id不为空执行删除操作 if (roleIds != "") { int[] roleIdArr = roleIds.TrimEnd(',').Split(',').Select(i => Utils.GetInt(i)).ToArray(); bool result = roleBll.Delete(CurrentUserCompanyID, roleIdArr); MessageBox.ShowAndRedirect(this, result?"删除成功!":"删除失败!", "/systemset/rolemanage/RolesManage.aspx"); } //绑定角色列表 IList <EyouSoft.Model.CompanyStructure.SysRoleManage> list = roleBll.GetList(pageSize, pageIndex, ref recordCount, CurrentUserCompanyID); if (list != null && list.Count > 0) { rptRoles.DataSource = list; rptRoles.DataBind(); BindExportPage(); } else { rptRoles.EmptyText = "<tr><td colspan='6' align='center'>对不起,暂无角色信息!</td></tr>"; this.ExportPageInfo1.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { //判断权限 if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_组织机构_部门人员栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_组织机构_部门人员栏目, false); return; } this.cu_perList.SysId = SiteUserInfo.SysId; string method = Utils.GetQueryStringValue("method"); //获取当期操作 empId = Utils.GetInt(Utils.GetQueryStringValue("empId")); //获取要设置的员工Id roleBll = new EyouSoft.BLL.CompanyStructure.SysRoleManage(); EyouSoft.BLL.CompanyStructure.CompanyUser userBll = new EyouSoft.BLL.CompanyStructure.CompanyUser(SiteUserInfo); //初始化bll if (method == "setPermit") { #region 设置权限 //设置权限 roleId = Utils.GetInt(Utils.GetFormValue("roleId")); string[] perIds = Utils.GetFormValue("perIds").Split(',');//获取选中的权限 if (userBll.SetPermission(empId, roleId, perIds)) { Utils.ResponseMegSuccess(); } else { Utils.ResponseMegError(); } return; #endregion } else { #region 初始化数据或切换角色 int recordCount = 0; //绑定角色下拉框 IList <EyouSoft.Model.CompanyStructure.SysRoleManage> roleList = roleBll.GetList(100000, 1, ref recordCount, CurrentUserCompanyID); if (roleList != null) { selRole.DataTextField = "RoleName"; selRole.DataValueField = "Id"; selRole.DataSource = roleList; selRole.DataBind(); selRole.Attributes.Add("onchange", "SepPermit.changeRole(this);"); } if (method == "getPermit") //切换角色 { roleId = Utils.GetInt(Utils.GetQueryStringValue("roleId")); //获取角色 if (roleId != 0) { //获取角色拥有的权限 BindPermit(roleId); } } else if (method == "")//初始化数据 { EyouSoft.Model.CompanyStructure.CompanyUser userModel = userBll.GetUserInfo(empId); selRole.Value = userModel.RoleID.ToString(); if (userModel != null) { if (!string.IsNullOrEmpty(userModel.PermissionList)) { string[] permits = userModel.PermissionList.Split(','); cu_perList.SetPermitList = permits; } else { if (userModel.RoleID == 0) { BindPermit(roleList != null && roleList.Count > 0 ? roleList[0].Id : 0); } } } else { BindPermit(roleList != null && roleList.Count > 0 ? roleList[0].Id : 0); } } #endregion } }