Exemple #1
0
        //保存权限设置
        #region
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string power;
            int    RoleID = DataConverter.CLng(ViewState["roleid"]);

            //内容管理
            for (int m = 0; m < this.CheckBoxList1.Items.Count; m++)
            {
                power = this.CheckBoxList1.Items[m].Value;
                if (this.CheckBoxList1.Items[m].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int t = 0; t < this.CheckBoxList2.Items.Count; t++)
            {
                power = this.CheckBoxList2.Items[t].Value;
                if (this.CheckBoxList2.Items[t].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int y = 0; y < this.CheckBoxList3.Items.Count; y++)
            {
                power = this.CheckBoxList3.Items[y].Value;
                if (this.CheckBoxList3.Items[y].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int v = 0; v < this.CheckBoxList4.Items.Count; v++)
            {
                power = this.CheckBoxList4.Items[v].Value;
                if (this.CheckBoxList4.Items[v].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            Response.Redirect("RoleManage.aspx");
        }
        //保存权限设置
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string power;
            int    RoleID = DataConverter.CLng(ViewState["roleid"]);

            //内容管理
            for (int m = 0; m < this.CheckBoxList1.Items.Count; m++)
            {
                power = this.CheckBoxList1.Items[m].Value;
                if (this.CheckBoxList1.Items[m].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int t = 0; t < this.CheckBoxList2.Items.Count; t++)
            {
                power = this.CheckBoxList2.Items[t].Value;
                if (this.CheckBoxList2.Items[t].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int y = 0; y < this.CheckBoxList3.Items.Count; y++)
            {
                power = this.CheckBoxList3.Items[y].Value;
                if (this.CheckBoxList3.Items[y].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int v = 0; v < this.CheckBoxList4.Items.Count; v++)
            {
                power = this.CheckBoxList4.Items[v].Value;
                if (this.CheckBoxList4.Items[v].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int v = 0; v < this.CheckBoxList5.Items.Count; v++)
            {
                power = this.CheckBoxList5.Items[v].Value;
                if (this.CheckBoxList5.Items[v].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int v = 0; v < this.CheckBoxList6.Items.Count; v++)
            {
                power = this.CheckBoxList6.Items[v].Value;
                if (this.CheckBoxList6.Items[v].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int v = 0; v < this.CheckBoxList7.Items.Count; v++)
            {
                power = this.CheckBoxList7.Items[v].Value;
                if (this.CheckBoxList7.Items[v].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int v = 0; v < this.CheckBoxList8.Items.Count; v++)
            {
                power = this.CheckBoxList8.Items[v].Value;
                if (this.CheckBoxList8.Items[v].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            for (int v = 0; v < this.CheckBoxList9.Items.Count; v++)
            {
                power = this.CheckBoxList9.Items[v].Value;
                if (this.CheckBoxList9.Items[v].Selected)
                {
                    if (!B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            //互动权限
            for (int i = 0; i < this.PubManage.Items.Count; i++)
            {
                power = this.PubManage.Items[i].Value;
                if (this.PubManage.Items[i].Selected)
                {
                    if (!B_Role.SavePower(RoleID, power))
                    {
                        B_Role.SavePower(RoleID, power);
                    }
                }
                else
                {
                    if (B_Role.IsExistPower(RoleID, power))
                    {
                        B_Role.DelPower(RoleID, power);
                    }
                }
            }
            //Crm权限
            crmModel.RoleID   = RoleID;
            crmModel.Add_Date = DateTime.Now;
            crmModel.Add_Man  = badmin.GetAdminLogin().AdminId.ToString();

            crmModel.AllowOption      = crmAuthChk.Items[0].Selected ? "1" : "0";
            crmModel.AllowOptionValue = crmAuthChk.Items[1].Selected ? "1" : "0";
            crmModel.AllowExcel       = crmAuthChk.Items[2].Selected ? "1" : "0";
            crmModel.AllowAddClient   = crmAuthChk.Items[3].Selected ? "1" : "0";
            crmModel.AllCustomer      = crmAuthChk.Items[4].Selected ? "1" : "0";
            crmModel.AssignFPMan      = crmAuthChk.Items[5].Selected ? "1" : "0";
            crmModel.AllowFPAll       = crmAuthChk.Items[6].Selected ? "1" : "0";
            crmModel.IsSalesMan       = crmAuthChk.Items[7].Selected ? "1" : "0";
            if (crmBll.IsExist(RoleID))
            {
                crmBll.UpdateModel(crmModel);
            }
            else
            {
                crmBll.insert(crmModel);
            }
            function.WriteSuccessMsg("操作成功", "RoleManage.aspx");
            //Response.Redirect("RoleManage.aspx");
        }