Пример #1
0
        public ActionResult UpdateMenuExecutive(ReqNavMenuView navMenu)
        {
            var menuId = navMenu.MenuId;
            var opera  = (int)Operation.Update;

            if (!navMenu.GetIsValid())
            {
                string errorMsg = navMenu.GetErrorMessageList().First().ErrorMessage;
                return(Json(ResMessage.CreatMessage(ResultTypeEnum.Exception, errorMsg)));
            }
            var isBtn = _buttonBll.BtnJurisdiction(menuId, opera);

            if (!isBtn)
            {
                return(Json(ResMessage.CreatMessage(ResultTypeEnum.ValidateError, "您没有修改按钮权限")));
            }
            var nav = _menuShareBll.FirstOrDefault <Sys_NavMenu>(x => x.MenuId.Equals(menuId));

            if (nav == null)
            {
                return(Json(ResMessage.CreatMessage(ResultTypeEnum.Error, "菜单不存在")));
            }
            nav.MenuId      = navMenu.MenuId;
            nav.MenuName    = navMenu.MenuName;
            nav.ParentMenId = navMenu.ParentMenId;
            nav.Level       = navMenu.Level;
            nav.Url         = navMenu.Url;
            var result = _menuShareBll.UpdateEntity(nav);

            return(Json(ResMessage.CreatMessage(result ? ResultTypeEnum.Success : ResultTypeEnum.Exception)));
        }
Пример #2
0
        public ActionResult NavMenuExecutive(ReqNavMenuView navMenu)
        {
            bool result = false;

            if (navMenu.GetIsValid())
            {
                string errorMsg = navMenu.GetErrorMessageList().First().ErrorMessage;
                return(RequestAction(RequestResult.Exception(errorMsg)));
            }
            var enumTest = TestEnum.AgeSmall.GetRemark();
            var nav      = _menuShareBll.FirstOrDefault <Sys_NavMenu>(x => x.MenuId.Equals(navMenu.MenuId));

            if (navMenu.ExecutiveAction == (int)Operation.Add)
            {
                var sysNav = new Sys_NavMenu
                {
                    MenuId      = navMenu.MenuId,
                    MenuName    = navMenu.MenuName,
                    ParentMenId = navMenu.ParentMenId,
                    Level       = navMenu.Level,
                    Url         = navMenu.Url
                };
                result = _menuShareBll.AddEntity(sysNav);
            }
            else if (navMenu.ExecutiveAction == (int)Operation.Update)
            {
                nav.MenuId      = navMenu.MenuId;
                nav.MenuName    = navMenu.MenuName;
                nav.ParentMenId = navMenu.ParentMenId;
                nav.Level       = navMenu.Level;
                nav.Url         = navMenu.Url;
                result          = _menuShareBll.UpdateEntity(nav);
            }
            else if (navMenu.ExecutiveAction == (int)Operation.Delete)
            {
                if (nav == null)
                {
                    return(RequestAction(RequestResult.Exception("记录不存在")));
                }
                _menuShareBll.DeleteEntity(nav);
                result = true;
            }

            if (result)
            {
                return(RequestAction(RequestResult.Success("执行成功")));
            }
            else
            {
                return(RequestAction(RequestResult.Exception("执行操作出错")));
            }
        }
Пример #3
0
        public ActionResult AddMenuExecutive(ReqNavMenuView navMenu)
        {
            bool result = false;

            if (!navMenu.GetIsValid())
            {
                string errorMsg = navMenu.GetErrorMessageList().First().ErrorMessage;
                return(Json(ResMessage.CreatMessage(ResultTypeEnum.Exception, errorMsg)));
            }
            string newMenuId = string.Empty;

            if (navMenu.ParentMenId != null || navMenu.Level > 1)
            {
                var nav = _menuShareBll.FirstOrDefault <Sys_NavMenu>(x => x.MenuId.Equals(navMenu.ParentMenId));
                if (nav == null)
                {
                    return(Json(ResMessage.CreatMessage(ResultTypeEnum.Error, "父级菜单不存在")));
                }
                newMenuId     = _navMenuBll.maxSubMenuId(navMenu.ParentMenId);
                navMenu.Level = 2;
            }
            else
            {
                newMenuId           = _navMenuBll.maxParentMenuId();
                navMenu.Level       = 2;
                navMenu.ParentMenId = "$";
            }
            result = _menuShareBll.AddEntity(new Sys_NavMenu
            {
                MenuId      = newMenuId,
                MenuName    = navMenu.MenuName,
                ParentMenId = navMenu.ParentMenId,
                Level       = navMenu.Level,
                Url         = navMenu.Url,
                Seq         = navMenu.Seq,
                IsVisible   = navMenu.IsVisible
            });
            return(Json(ResMessage.CreatMessage(result ? ResultTypeEnum.Success : ResultTypeEnum.Exception)));
        }