示例#1
0
 //string[] powerList = string.Empty;
 //StringBuilder sb = new StringBuilder();
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         B_Admin badmin = new B_Admin();
         badmin.CheckMulitLogin();
         ViewState["roleid"] = Request.QueryString["id"];
         //默认显示该角色信息
         M_RoleInfo role = B_Role.GetRoleById(DataConverter.CLng(ViewState["roleid"]));
         this.LblRoleName.Text    = role.RoleName;
         this.LblDescription.Text = role.Description;
         //填充该角色所具有的权限
         string Power   = "";
         string RoleStr = B_Role.GetPowerInfo(role.RoleID);
         for (int t = 0; t < this.CheckBoxList1.Items.Count; t++)
         {
             Power = this.CheckBoxList1.Items[t].Value;
             if (RoleStr.IndexOf(Power) >= 0)
             {
                 this.CheckBoxList1.Items[t].Selected = true;
             }
         }
         for (int y = 0; y < this.CheckBoxList2.Items.Count; y++)
         {
             Power = this.CheckBoxList2.Items[y].Value;
             if (RoleStr.IndexOf(Power) >= 0)
             {
                 this.CheckBoxList2.Items[y].Selected = true;
             }
         }
         for (int x = 0; x < this.CheckBoxList3.Items.Count; x++)
         {
             Power = this.CheckBoxList3.Items[x].Value;
             if (RoleStr.IndexOf(Power) >= 0)
             {
                 this.CheckBoxList3.Items[x].Selected = true;
             }
         }
         for (int s = 0; s < this.CheckBoxList4.Items.Count; s++)
         {
             Power = this.CheckBoxList4.Items[s].Value;
             if (RoleStr.IndexOf(Power) >= 0)
             {
                 this.CheckBoxList4.Items[s].Selected = true;
             }
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            ZoomLa.Common.function.AccessRulo();
            B_Admin badmin = new B_Admin();

            if (!Page.IsPostBack)
            {
                if (!B_ARoleAuth.Check(ZLEnum.Auth.user, "RoleMange"))
                {
                    function.WriteErrMsg("没有权限进行此项操作");
                }
                else if (string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    function.WriteErrMsg("未选择操作角色");
                }
                int RoleID = DataConverter.CLng(Request.QueryString["id"]);
                ViewState["roleid"] = Request.QueryString["id"];
                PubManageBind();
                //默认显示该角色信息
                M_RoleInfo role = B_Role.GetRoleById(DataConverter.CLng(ViewState["roleid"]));
                this.LblRoleName.Text    = role.RoleName;
                this.LblDescription.Text = role.Description;
                //填充该角色所具有的权限
                string Power   = "";
                string RoleStr = B_Role.GetPowerInfo(role.RoleID);
                for (int t = 0; t < this.CheckBoxList1.Items.Count; t++)
                {
                    Power = this.CheckBoxList1.Items[t].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList1.Items[t].Selected = true;
                    }
                }
                for (int y = 0; y < this.CheckBoxList2.Items.Count; y++)
                {
                    Power = this.CheckBoxList2.Items[y].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList2.Items[y].Selected = true;
                    }
                }
                for (int x = 0; x < this.CheckBoxList3.Items.Count; x++)
                {
                    Power = this.CheckBoxList3.Items[x].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList3.Items[x].Selected = true;
                    }
                }
                for (int s = 0; s < this.CheckBoxList4.Items.Count; s++)
                {
                    Power = this.CheckBoxList4.Items[s].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList4.Items[s].Selected = true;
                    }
                }
                for (int s = 0; s < this.CheckBoxList5.Items.Count; s++)
                {
                    Power = this.CheckBoxList5.Items[s].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList5.Items[s].Selected = true;
                    }
                }
                for (int s = 0; s < this.CheckBoxList6.Items.Count; s++)
                {
                    Power = this.CheckBoxList6.Items[s].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList6.Items[s].Selected = true;
                    }
                }
                for (int s = 0; s < this.CheckBoxList7.Items.Count; s++)
                {
                    Power = this.CheckBoxList7.Items[s].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList7.Items[s].Selected = true;
                    }
                }
                for (int s = 0; s < this.CheckBoxList8.Items.Count; s++)
                {
                    Power = this.CheckBoxList8.Items[s].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList8.Items[s].Selected = true;
                    }
                }
                for (int s = 0; s < this.CheckBoxList9.Items.Count; s++)
                {
                    Power = this.CheckBoxList9.Items[s].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.CheckBoxList9.Items[s].Selected = true;
                    }
                }
                for (int s = 0; s < this.PubManage.Items.Count; s++)
                {
                    Power = this.PubManage.Items[s].Value;
                    if (RoleStr.IndexOf(Power) >= 0)
                    {
                        this.PubManage.Items[s].Selected = true;
                    }
                }
                if (crmBll.IsExist(RoleID))
                {
                    crmModel = crmBll.GetSelect(RoleID);
                    crmAuthChk.Items[0].Selected = crmModel.AllowOption == "1" ? true : false;
                    crmAuthChk.Items[1].Selected = crmModel.AllowOptionValue == "1" ? true : false;
                    crmAuthChk.Items[2].Selected = crmModel.AllowExcel == "1" ? true : false;
                    crmAuthChk.Items[3].Selected = crmModel.AllowAddClient == "1" ? true : false;
                    crmAuthChk.Items[4].Selected = crmModel.AllCustomer == "1" ? true : false;
                    crmAuthChk.Items[5].Selected = crmModel.AssignFPMan == "1" ? true : false;
                    crmAuthChk.Items[6].Selected = crmModel.AllowFPAll == "1" ? true : false;
                    crmAuthChk.Items[7].Selected = crmModel.IsSalesMan == "1" ? true : false;
                }
            }
            Call.SetBreadCrumb(Master, "<li>后台管理</li><li><a href='AdminManage.aspx'>管理员管理</a></li><li><a href='RoleManage.aspx'>角色管理</a></li><li><a href='RoleManager.aspx?ID=<%= Request.QueryString[" + ID + "] %>'>权限管理</a></li>");
        }