Пример #1
0
        public IActionResult Index(string id)
        {
            ViewBag.Nav = 2;
            MenuItemListViewModel model = new MenuItemListViewModel();

            model.Menu = _db.Menus.Where(e => e.Id.Equals(id) && e.Deleted == false).FirstOrDefault();
            AspUserService userService = new AspUserService(_db, this);

            if (model.Menu == null)
            {
                return(RedirectToAction("Index", "Menu"));
            }
            else
            {
                if (userService.User == model.Menu.Vendor.Owner || userService.IsStaff)
                {
                    model.MenuItems = model.Menu.MenuItems.Where(e => e.Deleted == false).OrderByDescending(e => e.Name).ToList();
                    model.Vendor    = model.Menu.Vendor;
                    return(View(model));
                }
                else
                {
                    return(RedirectToAction("Index", "Menu"));
                }
            }
        }
Пример #2
0
        public MenuModule()
        {
            ListDepartmentsCommand = new CategoryCommand<string>(Resources.Departments, Resources.Settings, OnListDepartments);
            ListMenuItemsCommand = new CategoryCommand<string>(Resources.ProductList, Resources.Products, OnListMenuItems);
            ListScreenMenusCommand = new CategoryCommand<string>(Resources.MenuList, Resources.Products, OnListScreenMenus);
            ListMenuItemPropertyGroupsCommand = new CategoryCommand<string>(Resources.ModifierGroups, Resources.Products, OnListMenuItemPropertyGroupsCommand);
            ListPricesCommand = new CategoryCommand<string>(Resources.BatchPriceList, Resources.Products, OnListPrices);
            ListTicketTagGroupsCommand = new CategoryCommand<string>(Resources.TicketTags, Resources.Settings, OnListTicketTags) { Order = 10 };
            ListMenuItemPriceDefinitionsCommand = new CategoryCommand<string>(Resources.PriceDefinitions, Resources.Products, OnListMenuItemPriceDefinitions);
            ListVatTemplatesCommand = new CategoryCommand<string>(Resources.VatTemplates, Resources.Products, OnListVatTemplates);
            ListTaxServiceTemplates = new CategoryCommand<string>(Resources.TaxServiceTemplates, Resources.Products, OnListTaxServiceTemplates);

            PermissionRegistry.RegisterPermission(PermissionNames.ChangeDepartment, PermissionCategories.Department, Resources.CanChangeDepartment);
            foreach (var department in AppServices.MainDataContext.Departments)
            {
                PermissionRegistry.RegisterPermission(PermissionNames.UseDepartment + department.Id, PermissionCategories.Department, department.Name);
            }

            EventServiceFactory.EventService.GetEvent<GenericEvent<VisibleViewModelBase>>().Subscribe(s =>
            {
                if (s.Topic == EventTopicNames.ViewClosed)
                {
                    if (s.Value == _menuItemListViewModel)
                        _menuItemListViewModel = null;

                    if (s.Value == _screenMenuListViewModel)
                        _screenMenuListViewModel = null;

                    if (s.Value == _departmentListViewModel)
                        _departmentListViewModel = null;

                    if (s.Value == _menuItemPropertyGroupListViewModel)
                        _menuItemPropertyGroupListViewModel = null;

                    if (s.Value == _priceListViewModel)
                        _priceListViewModel = null;

                    if (s.Value == _ticketTagGroupListViewModel)
                        _ticketTagGroupListViewModel = null;

                    if (s.Value == _menuItemPriceDefinitionListViewModel)
                        _menuItemPriceDefinitionListViewModel = null;

                    if (s.Value == _vatTemplateListViewModel)
                        _vatTemplateListViewModel = null;

                    if (s.Value == _taxServiceTemplateListViewModel)
                        _taxServiceTemplateListViewModel = null;
                }
            });
        }
Пример #3
0
        public ActionResult MenuItems(string id)
        {
            var context            = new AppSecurityContext();
            var menuRepository     = new MenuRepository(context);
            var menuItemRepository = new MenuItemRepository(context);
            var menu  = menuRepository.Find(id);
            var items = menuItemRepository.GetItemsByMenuKey(id);
            var model = new MenuItemListViewModel();

            model.MenuItems = mapper.Map <ICollection <MenuItemViewModel> >(items);
            model.MenuKey   = menu.Key;
            model.MenuName  = menu.Name;
            return(View(model));
        }
Пример #4
0
        // GET: Order
        public ActionResult List(pizzaEntities context)
        {
            //Create list to pass to the view
            List <MenuItem> MList = new List <MenuItem>();

            //Cycle through the menu items and add them to the list
            foreach (var item in context.MenuItems)
            {
                MList.Add(item);
            }
            MenuItemListViewModel model = new MenuItemListViewModel(MList);

            return(View(model));
        }
Пример #5
0
 public void OnListMenuItems(string value)
 {
     if (_menuItemListViewModel == null)
         _menuItemListViewModel = new MenuItemListViewModel();
     CommonEventPublisher.PublishViewAddedEvent(_menuItemListViewModel);
 }