Beispiel #1
0
        public ActionResult ShowEditInfo()
        {
            var id         = int.Parse(Request["id"]);
            var actionInfo = ActionInfoBll.LoadEntities(a => a.ID == id).FirstOrDefault();

            ViewData.Model = actionInfo;

            return(View());
        }
        public ActionResult SetAction(int id)
        {
            //TODO 根据id查出当前用户
            var user = UserInfoBll.LoadEntities(u => u.Id == id).FirstOrDefault();

            //把所有的权限发送到前台
            ViewBag.AllActions = ActionInfoBll.LoadEntities(a => a.DelFlag == delNormal).ToList();
            //把当前用户所有的特殊权限查询出来,发送到前台
            ViewBag.AllExistActions = user.R_UserInfo_ActionInfo.ToList();
            return(View(user));
        }
Beispiel #3
0
        public ActionResult DeleteActionInfo()
        {
            var actionId = int.Parse(Request["actionId"]);

            var actionInfo = ActionInfoBll.LoadEntities(a => a.ID == actionId).FirstOrDefault();

            if (ActionInfoBll.DeleteEntity(actionInfo))
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("no"));
            }
        }
Beispiel #4
0
        //为权限配置角色信息
        public ActionResult SetActionRole()
        {
            var actionId   = int.Parse(Request["actionId"]);
            var actionInfo = ActionInfoBll.LoadEntities(a => a.ID == actionId).FirstOrDefault();

            ViewBag.ActionInfo = actionInfo;

            var delFlag       = (short)DelFlagEnum.Normal;
            var allRoleList   = RoleInfoBll.LoadEntities(a => a.DelFlag == delFlag).ToList();
            var extRoleIdList = (from r in actionInfo.RoleInfo
                                 select r.ID).ToList();

            ViewBag.RoleList   = allRoleList;
            ViewBag.RoleIdList = extRoleIdList;

            return(View());
        }
Beispiel #5
0
        /// <summary>
        /// 展示用户权限
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowUserAction()
        {
            //当前用户ID
            int userID = Convert.ToInt32(Request["userID"]);
            //当前用户
            var userInfo = UserInfoBll.LoadEntities(u => u.ID == userID).FirstOrDefault();
            //当前用户已经拥有的权限(中间表)
            var userActionList = (from a in userInfo.R_UserInfo_ActionInfo
                                  select a).ToList();
            //获取所有权限
            var actionList = ActionInfoBll.LoadEntities(a => a.DelFlag == (short)DeleteEnumType.Normal).ToList();

            //放在ViewBag
            ViewBag.userInfo       = userInfo;
            ViewBag.userActionList = userActionList;
            ViewBag.actionList     = actionList;
            return(View());
        }
Beispiel #6
0
        /// <summary>
        /// 为用户分配权限
        /// </summary>
        /// <returns></returns>
        public ActionResult SetUserActionInfo()
        {
            var userId = int.Parse(Request["userId"]);
            //查询要分配权限的用户信息
            var userInfo = UserInfoBll.LoadEntities(u => u.UserID == userId).FirstOrDefault();

            ViewBag.UserInfo = userInfo;
            //获取所有的权限信息
            var delFlag       = (short)DelFlagEnum.Normal;
            var allActionList = ActionInfoBll.LoadEntities(a => a.DelFlag == delFlag).ToList();

            ViewBag.ActionList = allActionList;
            //获取所有用户已经有的权限
            var allActionIdList = userInfo.R_UserInfo_ActionInfo.ToList();

            ViewBag.ActionIdList = allActionIdList;

            return(View());
        }