示例#1
0
        public EasyUIGrid GetUserGridMenus(EasyUIGridRequest request, List <int> userMenuId, int parentid)
        {
            int        total = 0;
            EasyUIGrid grid  = new EasyUIGrid();

            if (OperateContext.Current.UserRole.Contains(1))
            {
                grid.rows = ViewModelMenu.ToListViewModel(ModuleManager.GetPagedList(request.PageNumber, request.PageSize, ref total, m => m.isDel == false && m.moduleParentId == parentid, m => m.sort));
            }
            else
            {
                grid.rows = ViewModelMenu.ToListViewModel(ModuleManager.GetPagedList(request.PageNumber, request.PageSize, ref total, m => m.isDel == false && m.moduleParentId == parentid && userMenuId.Contains(m.moduleId), m => m.sort));
            }
            //记录总数
            grid.total = total;
            //返回ui层的菜单
            return(grid);
        }
示例#2
0
        public IEnumerable <ViewModelMenu> GetUserTreeMenus(EasyUITreeRequest request, string userRoles)
        {
            //返回ui层的菜单
            IEnumerable <ViewModelMenu> rootMenus = new List <ViewModelMenu>()
            {
                new ViewModelMenu()
                {
                    icon         = request.RootIcon,
                    MenuIcon     = request.RootIcon,
                    MenuParentNo = request.PidField,
                    MenuName     = "主菜单",
                    MenuNo       = request.IdField,
                    text         = "主菜单",
                    children     = (List <ViewModelMenu>)ViewModelMenu.ToListViewModel(ModuleManager.GetListBy(m => m.moduleParentId == 0))
                }
            };

            return(rootMenus);
        }