Exemplo n.º 1
0
        /// <summary>
        /// 获得排序号
        /// </summary>
        /// <param name="menucode"></param>
        /// <returns></returns>
        public string GetSortNum(HttpContext context)
        {
            string pcode = context.Request.QueryString["pcode"];
            List <Sys_Department> lists = bll.FindWhere(" Department_Code ='" + pcode + "'");

            if (lists.Count > 0)
            {
                List <Sys_Department> list = bll.FindWhere(" Department_ParentCode ='" + pcode + "'");

                if (list.Count > 0)
                {
                    Sys_Department model = list.OrderByDescending(p => p.Department_Sequence).First();

                    return((model.Department_Sequence + 1).ToString());
                }
                else
                {
                    return("1");
                }
            }
            else
            {
                return("0");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 绑定角色信息
        /// </summary>
        private void RoleBind()
        {
            string roleName = base.CurrUserInfo().RoleName;

            string sqlWhere = "";

            string code = ddlUserType.SelectedValue;

            if (code == "0401")//管理员
            {
                sqlWhere          = " Role_Name in('系统管理员','部门管理员','总队管理员') and Role_Name !='超级管理员'";
                lt_Open.Visible   = false;
                lblFgbm.Visible   = false;
                lbl_FGtxt.Visible = false;
            }
            else if (code == "0402")//分管用户
            {
                lt_Open.Visible   = true;
                lblFgbm.Visible   = true;
                lbl_FGtxt.Visible = true;
                sqlWhere          = " Role_Name in('分管领导','纪委领导') ";

                string st = "分管部门";
                this.lbl_FGtxt.Text = st;
                lt_Open.Text        = " <a href=\"#\" style=\"color: Blue\" onclick=\"OpenForm('2');\">添加" + st + "</a>";
                Sys_UserChargeDepBLL bll = new Sys_UserChargeDepBLL();
                string str = RequstStr("id");
                //List<Sys_UserChargeDep> list = bll.FindWhere("UserChargeDep_ExecutiveOfficerID='" + RequstStr("id") + "'");
                List <Sys_UserChargeDep> list = bll.FindWhere(p => p.UserChargeDep_ExecutiveOfficerID == str);
                string userChargeDepMessage   = string.Format("您已添加{0}个" + st, list.Count);
                lblFgbm.Text = userChargeDepMessage;
            }
            else//普通用户
            {
                lt_Open.Visible   = true;
                lblFgbm.Visible   = true;
                lbl_FGtxt.Visible = true;
                sqlWhere          = "Role_Name not in('分管领导','纪委领导','超级管理员','系统管理员','部门管理员') ";
                string st = "";           // "挂钩学校";
                this.lbl_FGtxt.Text = st;
                lt_Open.Text        = ""; // " <a href=\"#\" style=\"color: Blue\" onclick=\"OpenForm('1');\">添加" + st + "</a>";
                Sys_UserChargeDepBLL bll = new Sys_UserChargeDepBLL();
                //List<Sys_UserChargeDep> list = bll.FindWhere("UserChargeDep_ExecutiveOfficerID='" + RequstStr("id") + "'");
                List <Sys_UserChargeDep> list = bll.FindWhere(p => p.UserChargeDep_ExecutiveOfficerID == RequstStr("id"));
                string userChargeDepMessage   = "";// string.Format("您已添加{0}个" + st, list.Count);
                lblFgbm.Text = userChargeDepMessage;
            }

            //Sys_Department d = bllSys_Department.FindByCode(this.hid_Dep.Value);
            List <Sys_Department> d = bllSys_Department.FindWhere(p => p.Department_Code == this.hid_Dep.Value);

            foreach (Sys_Department list_dep in d)
            {
                sqlWhere += " and cast(Role_Calss as int )>=" + list_dep.Department_Class;
            }


            if (roleName.Contains("超级管理员"))
            {
                //sqlWhere = " Role_Name in('系统管理员','部门管理员','总队管理员') and Role_Name !='超级管理员'";
                //this.ckbxlist.DataSource = bllRole.FindWhere(sqlWhere);
                this.ckbxlist.DataSource = bllRole.FindWhere(p => p.Role_Name == "系统管理员" || p.Role_Name == "部门管理员" || p.Role_Name == "总队管理员" || p.Role_Name != "超级管理员");
            }
            else
            {
                //this.ckbxlist.DataSource = bllRole.FindWhere(sqlWhere + " AND Role_Name not in('超级管理员') ");
                this.ckbxlist.DataSource = bllRole.FindWhere(p => (p.Role_Name == "系统管理员" || p.Role_Name == "部门管理员" || p.Role_Name == "总队管理员" || p.Role_Name != "超级管理员") && p.Role_Name != "超级管理员");
            }
            this.ckbxlist.DataTextField  = "Role_Name";
            this.ckbxlist.DataValueField = "RoleID";
            this.ckbxlist.DataBind();
        }