示例#1
0
        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;
            }
        }
示例#2
0
        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
            }
        }
示例#3
0
        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;
            method1 = Utils.GetQueryStringValue("method");     //判断是否为复制
            string method2  = Utils.GetFormValue("hidMethod"); //判断是否为保存
            string showMess = "数据保存成功!";

            roleId = Utils.GetInt(Utils.GetQueryStringValue("roleId"));
            EyouSoft.Model.CompanyStructure.SysRoleManage roleModel = null;
            EyouSoft.BLL.CompanyStructure.SysRoleManage   roleBll   = new EyouSoft.BLL.CompanyStructure.SysRoleManage();//初始化角色bll
            //如果当前操作不为保存则为初次加载
            if (method2 != "save")
            {
                #region 初始化加载数据
                if (roleId != 0)
                {//如果角色编号不为0则加载角色信息
                    roleModel = roleBll.GetModel(CurrentUserCompanyID, roleId);
                    if (roleModel != null)
                    {
                        roleName = roleModel.RoleName;
                        cu_perList.SetPermitList = !string.IsNullOrEmpty(roleModel.RoleChilds) ? roleModel.RoleChilds.Split(',').ToArray() : null;
                    }//获取设置角色拥有的权限
                }
                #endregion
            }
            else
            {
                #region 保存数据
                bool   result  = false;
                string perItem = Utils.GetFormValue("perItem"); //获取权限信息
                roleName = Utils.GetFormValue("txtRoleName");   //获取角色名
                if (roleName == "")
                {
                    MessageBox.Show(this, "角色名称不为空!");
                    return;
                }

                roleModel            = new EyouSoft.Model.CompanyStructure.SysRoleManage();
                roleModel.RoleName   = roleName;
                roleModel.RoleChilds = perItem;

                roleModel.CompanyId = CurrentUserCompanyID;
                if (roleId != 0)
                {
                    if (method1 == "copy")
                    {
                        if (roleName == "管理员")
                        {
                            MessageBox.Show(this, "管理员帐号不能添加!");
                            return;
                        }
                        //添加新角色
                        result = roleBll.Add(roleModel);
                    }
                    else
                    {
                        //修改角色
                        roleModel.Id = roleId;
                        result       = roleBll.Update(roleModel);
                    }
                }
                else
                {
                    //添加新角色
                    result = roleBll.Add(roleModel);
                }
                if (!result)
                {
                    showMess = "数据保存失败!";
                }
                MessageBox.ResponseScript(this, string.Format(";alert('{0}'); window.parent.location='/systemset/rolemanage/RolesManage.aspx';window.parent.Boxy.getIframeDialog('{1}').hide()", showMess, Request.QueryString["iframeId"]));
                return;

                #endregion
            }
        }