コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         listRole = roleBLL.GetList(p => p.Role_Name != Constant.SysAdminRoleName && p.Role_Name != Constant.SuperAdminRoleName).OrderBy(p => p.Role_Sequence).ToList();//p.Role_IsAdmin == false &&
     }
     InitGrid();
 }
コード例 #2
0
        private object GetRoleList()
        {
            Sys_RoleBLL roleApp = new Sys_RoleBLL();
            var         data    = roleApp.GetList();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (Sys_Role item in data)
            {
                var fieldItem = new
                {
                    encode   = item.F_EnCode,
                    fullname = item.F_FullName
                };
                dictionary.Add(item.F_Id, fieldItem);
            }
            return(dictionary);
        }
コード例 #3
0
        public JsonResult Create(sys_role model)
        {
            ExecuteResult Er = new ExecuteResult();

            if (string.IsNullOrEmpty(model.KeyId))
            {
                int count = bll.GetList <sys_role>(item => item.FullName == model.FullName && item.IsDeleted == false).Count();
                if (count > 0)
                {
                    Er.Result  = false;
                    Er.Message = "已存在相同角色命名";
                }
                else
                {
                    #region 新增
                    model.KeyId      = Guid.NewGuid().ToString();
                    model.CreateDate = DateTime.Now;
                    model.IsDeleted  = false;
                    Er.Result        = bll.Insert <sys_role>(model) > 0;
                    Er.Message       = Er.Result ? "新增成功" : "新增失败";
                    #endregion
                }
            }
            else
            {
                int count = bll.GetList <sys_role>(item => item.FullName == model.FullName && item.KeyId != model.KeyId && item.IsDeleted == false).Count();
                if (count > 0)
                {
                    Er.Result  = false;
                    Er.Message = "已存在相同角色命名";
                }
                else
                {
                    #region 修改
                    var old = bll.GetModelById <sys_role>(model.KeyId);
                    old.FullName    = model.FullName;
                    old.Description = model.Description;
                    Er.Result       = bll.Update <sys_role>(old) > 0;
                    Er.Message      = Er.Result ? "编辑成功" : "编辑失败";
                    #endregion
                }
            }
            return(Json(Er));
        }
コード例 #4
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.GetList("UserChargeDep_ExecutiveOfficerID='" + RequstStr("id") + "'");
                List <Sys_UserChargeDep> list = bll.GetList(p => p.UserChargeDep_ExecutiveOfficerID == str).ToList();
                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.GetList("UserChargeDep_ExecutiveOfficerID='" + RequstStr("id") + "'");
                //List<Sys_UserChargeDep> list = bll.GetList(p => p.UserChargeDep_ExecutiveOfficerID == RequstStr("id")).ToList();
                string userChargeDepMessage = "";// string.Format("您已添加{0}个" + st, list.Count);
                lblFgbm.Text = userChargeDepMessage;
            }

            //List<Sys_Department> d = bllSys_Department.GetList(p => p.Department_Code == this.hid_Dep.Value).ToList();
            //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.GetList(sqlWhere);
                this.ckbxlist.DataSource = bllRole.GetList(p => p.Role_Name == "系统管理员" || p.Role_Name == "部门管理员" || p.Role_Name == "总队管理员" || p.Role_Name != "超级管理员").ToList();
            }
            else
            {
                //this.ckbxlist.DataSource = bllRole.GetList(sqlWhere + " AND Role_Name not in('超级管理员') ");
                this.ckbxlist.DataSource = bllRole.GetList(p => (p.Role_Name == "系统管理员" || p.Role_Name == "部门管理员" || p.Role_Name == "总队管理员" || p.Role_Name != "超级管理员") && p.Role_Name != "超级管理员").ToList();
            }
            this.ckbxlist.DataTextField  = "Role_Name";
            this.ckbxlist.DataValueField = "RoleID";
            this.ckbxlist.DataBind();
        }
コード例 #5
0
        public ActionResult GetGridJson(string keyword)
        {
            var data = roleApp.GetList(keyword);

            return(Content(data.ToJson()));
        }