Example #1
0
        public IActionResult Index()
        {
            MenuListViewModel model = new MenuListViewModel();

            model.Menu = _menuService.GetAll();
            return(View(model));
        }
Example #2
0
        public async Task <IActionResult> Index(
            string currentSortOrder,
            string sortOrder,
            string searchString,
            string category,
            int?pageNumber
            )
        {
            if (pageNumber == null)
            {
                currentSortOrder = sortOrder;
                sortOrder        = string.IsNullOrEmpty(sortOrder) ? "name_desc" : string.Empty;
            }

            var menus = new MenuListViewModel
            {
                Menus            = await repository.GetAllMenusAsync(currentSortOrder, searchString, category, pageNumber),
                Category         = category,
                SearchString     = searchString,
                SortOrder        = sortOrder,
                CurrentSortOrder = currentSortOrder,
            };

            return(View(menus));
        }
        public ViewResult List(string category, int page = 1)
        {
            var model = new MenuListViewModel
            {
                MenuItems = _baseDataAccess.GetMenuItems()
                            .Where(m => category == null || m.Category.Name == category)
                            .OrderBy(m => m.Id)
                            .Skip((page - 1) * PageSize)
                            .Take(PageSize),

                PagingInfo = new PagingInfo()
                {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,
                    TotalItems   = category == null?
                                   _baseDataAccess.GetMenuItems().Count() :
                                       _baseDataAccess.GetMenuItems().Count(e => e.Category.Name == category)
                },
                CurrentCategory = category
            };

            ViewBag.SelectedCategory = category;

            return(View(model));
        }
        public MenuListPage()
        {
            BindingContext = new MenuListViewModel();

            InitializeComponent();

            Menu = lstMenu;
        }
        public MainWindow()
        {
            InitializeComponent();
            //DisplayUsersList();

            var menuItems = MenuListViewModel.GenerateMenuForUser(((UserIdentity)Thread.CurrentPrincipal.Identity).UserID);

            LoadMenuItems(menuItems);
        }
Example #6
0
        public ViewResult List()
        {
            ViewBag.Title = "Страница меню";
            MenuListViewModel obj = new MenuListViewModel();

            obj.allMenu      = _allMenu.Menus;
            obj.MenuCategory = "Меню";
            return(View(obj));
        }
Example #7
0
 void RefreshTreeList()
 {
     menuItemsBindingSource.DataSource = null;
     if (groupsLookUp.EditValue != null && resourceTypeLookUp.EditValue != null)
     {
         menuItemsBindingSource.DataSource = MenuListViewModel.GenerateMenuItems((int)groupsLookUp.EditValue, (int)resourceTypeLookUp.EditValue);
         menuItemsBindingSource.DataSource = HierarchicalCheck(menuItemsBindingSource.DataSource);
         RefreshReadOnlyView();
     }
 }
        public ActionResult MenuList(int?page, string qry, string target)
        {
            MenuListViewModel model = new MenuListViewModel();

            model.Filter.FilterTargetStr = target;
            model.Filter.QueryString     = qry;
            model.Filter.CurrentPage     = page ?? 1;
            model.Result      = this.Repository.GetMenuList(model.Filter);
            ViewBag.Targer    = target;
            ViewBag.SearchStr = qry;
            return(View(model));
        }
        public async Task <IViewComponentResult> InvokeAsync(int parentId)
        {
            MenuListViewModel result = new MenuListViewModel();
            var backmenu             = _context.Menu.FirstOrDefault(f => f.MenuId == parentId);

            if (backmenu != null)
            {
                result.RootMenu = backmenu;
                //ViewBag.backId = backmenu.ParentId;
            }
            result.MenuList = _context.Menu.Where(w => w.ParentId == parentId).ToList();
            return(View(result));
        }
        public PartialViewResult MenuForAdmin(SearchGoods searchGoods)
        {
            IEnumerable <CategoryModel>    categories   = this._categoryRepository.GetCategories();
            ICollection <ClothesTypeModel> clothesTypes = this._typesRepository.GetClothesTypes();

            MenuListViewModel mlvm = new MenuListViewModel
            {
                Categories   = new SelectList(categories, "CategoryId", "Name"),
                ClothesTypes = clothesTypes,
                Search       = searchGoods
            };

            return(PartialView(mlvm));
        }
Example #11
0
        public ActionResult Index()
        {
            MenuCategoryRepository categoryRepo = new MenuCategoryRepository(memoryCache);

            categoryRepo.GetAll();
            MenuRepository menuRepo = new MenuRepository(applicationCache);

            menuRepo.GetAll();
            MenuListViewModel vm = new MenuListViewModel();

            vm.MenuItems      = menuRepo.GetAll();
            vm.MenuCategories = categoryRepo.GetAll();


            return(View("~/Views/MenuItems.cshtml", vm));
        }
Example #12
0
        public static MenuListViewModel GetMenuList()
        {
            var menuList = new MenuListViewModel();

            using (var context = new Model.Entities.RecipeDbContext())
            {
                foreach (var menuItem in context.MenuItems)
                {
                    var menuItemViewModel = new MenuItemViewModel(menuItem);
                    menuItemViewModel.Recipe = recipes.First(r => r.Id == menuItem.RecipeId);
                    menuItemViewModel.Recipe.LoadDetails();
                    menuItemViewModel.Recipe.AddMenuItem(menuItem);
                    menuList.Add(menuItemViewModel);
                }
            }
            return(menuList);
        }
Example #13
0
        public ActionResult List()
        {
            try
            {
                //初始化物件
                var m = new MenuListViewModel();
                m.Authority = Tool.GetPageAuthority();

                //所有選單資料
                var dtMenu = MenuDataAccess.GetAllMenuList(null);
                m.List = Util.ToList <ListItem>(dtMenu);

                return(View(m));
            }
            catch
            {
                return(RedirectToAction("Error", "Home"));
            }
        }
Example #14
0
        public IActionResult MenuList(int page = 1)
        {
            int pageIndex = page - 1;

            if (pageIndex < 0)
            {
                pageIndex = 0;
            }

            Pagination pagination = new Pagination
            {
                PageIndex = pageIndex, PageSize = 5
            };
            MenuListViewModel vm = new MenuListViewModel
            {
                MenuList = _MenuService.GetMenuList(pagination), GetMenuFunc = _MenuService.GetMenu, PageInfo = pagination
            };

            return(View(vm));
        }
Example #15
0
        private void LogUserIn(User us)
        {
            // Now change the connection string to have the user id in the application name...
            ConnectionHelper.CurrentConnection.ApplicationName = string.Format("HCMIS-Warehouse-V-{0}-U-{1}", Program.HCMISVersionString, us.ID);

            // Re-register the connection string manager here.

            MyGeneration.dOOdads.BusinessEntity.RegistryConnectionString = ConnectionHelper.CurrentConnection.ToString();
            ConnectionManager.ConnectionString = ConnectionHelper.CurrentConnection.ToString();

            if (BLL.Settings.UseNewUserManagement)
            {
                // Idealy, this has to work, but we don't know the kind of code that depends on the legacy new main window object.
                var        menuItems  = MenuListViewModel.GenerateMenuForUser(((UserIdentity)Thread.CurrentPrincipal.Identity).UserID);
                MainWindow mainWindow = new MainWindow(menuItems);

                //Legacy Code ... Remove this when not in use.
                CurrentContext main = new CurrentContext();
                CurrentContext.UserId           = us.ID;
                CurrentContext.LoggedInUser     = us;
                CurrentContext.LoggedInUserName = string.Format("{0} {1}", us.FirstName, us.LastName);

                if (string.IsNullOrEmpty(CurrentContext.LoggedInUserName))
                {
                    CurrentContext.LoggedInUserName = us.UserName;
                }

                mainWindow.Show();
                this.Hide();
            }

            if (!System.Diagnostics.Debugger.IsAttached)
            {
                BLL.LogLogin newLoginLog = new LoginLog();
                newLoginLog.AddNew(us.ID, DateTimeHelper.ServerDateTime, true, Environment.MachineName, "", "",
                                   false, "", Program.HCMISVersionString);
                // Also update the last login time on the User Object
            }
        }
Example #16
0
 public IActionResult Edit(string id)
 {
     if (User.IsInRole("Vendor"))
     {
         Vendor vendor = _db._Users.Where(e => e.AspNetUser.Id.Equals(User.FindFirstValue(ClaimTypes.NameIdentifier))).FirstOrDefault().ListVendors.Where(e => e.Id.Equals(id) && e.Deleted == false).FirstOrDefault();
         if (vendor == null)
         {
             return(RedirectToAction("Index", "Menu"));
         }
         else
         {
             ViewBag.Nav = 2;
             MenuListViewModel model = new MenuListViewModel();
             model.SelectedVendor = vendor;
             model.Vendors        = _db._Users.Where(e => e.AspNetUser.Id.Equals(User.FindFirstValue(ClaimTypes.NameIdentifier))).FirstOrDefault().ListVendors.Where(e => e.Deleted == false).OrderBy(e => e.DateCreated).ToList();
             model.Menus          = vendor.Menus.Where(e => e.Deleted == false).OrderBy(e => e.Name).ToList();
             return(View(model));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Example #17
0
 public MenuList(MyModel currentItem)
 {
     InitializeComponent();
     BindingContext = new MenuListViewModel(currentItem);
 }