Exemple #1
0
        /// <summary>
        /// 获取所有角色列表
        /// </summary>
        public string GetUsersList()
        {
            string    s   = string.Empty;
            DataTable dt1 = new DataTable();

            bll.rolebll bll = new bll.rolebll();
            dt1 = bll.getRole();
            s  += "<select><option selected='selected' value=''>请选择</option>";
            for (int i = 0; i < dt1.Rows.Count; i++)
            {
                s += "<option value='" + dt1.Rows[i]["Id"] + "'>" + dt1.Rows[i]["PersonaName"] + "</option>";
            }
            s += "</select>";
            return(s);
        }
Exemple #2
0
        /// <summary>
        /// 编辑角色
        /// </summary>
        /// <returns></returns>
        public ActionResult editRole(int id)
        {
            bll.rolebll      roleBll = new bll.rolebll();
            IDataParameter[] ipara   = new IDataParameter[] {
                new SqlParameter("id", SqlDbType.Int, 4)
            };
            ipara[0].Value = id;
            List <model.persona> list = roleBll.getRole(ipara, "roleEdit");

            model.persona roleMd = new model.persona();

            roleMd = list.Where(c => c.Id == id).ToList()[0];

            return(View(roleMd));
        }
        /// <summary>
        /// 获取所有角色
        /// </summary>
        /// <returns></returns>
        public string getRoleData()
        {
            StringBuilder s = new StringBuilder();

            s.Append("<option value='0'>请选择</option>");
            bll.rolebll roleBll = new bll.rolebll();
            DataTable   dt      = roleBll.getRole();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    s.Append("<option value=");
                    s.Append(dt.Rows[i]["Id"].ToString());
                    s.Append(">");
                    s.Append(dt.Rows[i]["PersonaName"].ToString());
                    s.Append("</option>");
                }
            }

            return(s.ToString());
        }
Exemple #4
0
        /// <summary>
        /// 获取角色列表
        /// </summary>
        /// <returns></returns>
        public ActionResult getRole()
        {
            #region
            int menuId = helpcommon.ParmPerportys.GetNumParms(Request.QueryString["menuId"]);
            PublicHelpController ph = new PublicHelpController();
            ViewData["menuId"] = menuId;

            if (userInfo.User.userName == "sa")
            {
                funName f = new funName();
                System.Reflection.MemberInfo[] properties = f.GetType().GetMembers();
                foreach (System.Reflection.MemberInfo item in properties)
                {
                    string value = item.Name;
                    ViewData[value] = 1;
                }
            }
            else
            {
                #region 添加(1有权限,0无权限)
                if (!ph.isFunPermisson(int.Parse(userInfo.User.personaId.ToString()), menuId, funName.addName))
                {
                    ViewData["addName"] = 0;//无添加权限
                }
                else
                {
                    ViewData["addName"] = 1;//有添加权限
                }
                #endregion

                #region 编辑(1有权限,0无权限)
                if (!ph.isFunPermisson(int.Parse(userInfo.User.personaId.ToString()), menuId, funName.updateName))
                {
                    ViewData["updateName"] = 0;//无编辑权限
                }
                else
                {
                    ViewData["updateName"] = 1;//有编辑权限
                }
                #endregion

                #region 菜单分配权限(1有权限,0无权限)
                if (!ph.isFunPermisson(int.Parse(userInfo.User.personaId.ToString()), menuId, funName.menuList))
                {
                    ViewData["menuList"] = 0;//无菜单分配权限
                }
                else
                {
                    ViewData["menuList"] = 1;//有菜单分配权限
                }
                #endregion

                #region 用户管理(1有权限,0无权限)
                if (!ph.isFunPermisson(int.Parse(userInfo.User.personaId.ToString()), menuId, funName.userList))
                {
                    ViewData["userList"] = 0;//无用户管理权限
                }
                else
                {
                    ViewData["userList"] = 1;//有用户管理权限
                }
                #endregion

                #region 查询
                if (!ph.isFunPermisson(int.Parse(userInfo.User.personaId.ToString()), menuId, funName.selectName))
                {
                    List <model.persona> myList = new List <model.persona>();
                    return(View("../NoPermisson/Index"));
                }
                #endregion
            }
            #endregion


            bll.rolebll      roleBll = new bll.rolebll();
            IDataParameter[] ipara   = new IDataParameter[] {
                //new SqlParameter("menuName",SqlDbType.NVarChar,20)
            };
            //ipara[0].Value = "张三";
            List <model.persona> list = roleBll.getRole(ipara, "roleSelect");

            return(View(list));
        }