protected void SetNavigationCommand(string caption, string category, string image, int order = 0)
 {
     _navigationCommand = new CategoryCommand <string>(caption, category, image, OnNavigate, CanNavigate)
     {
         Order = order
     };
 }
Example #2
0
 public UserModule(IRegionManager regionManager)
 {
     ListUserRolesCommand = new CategoryCommand<string>(Resources.UserRoleList, Resources.Users, OnListRoles) { Order = 50 };
     ListUsersCommand = new CategoryCommand<string>(Resources.UserList, Resources.Users, OnListUsers);
     NavigateLogoutCommand = new CategoryCommand<string>("Logout", Resources.Common, "images/bmp.png", OnNavigateUserLogout) { Order = 99 };
     _regionManager = regionManager;
 }
Example #3
0
 public DashboardModule(IRegionManager regionManager, DashboardView dashboardView)
 {
     _regionManager = regionManager;
     _dashboardView = dashboardView;
     _navigateDashboardCommand = new CategoryCommand<string>(Resources.Management, Resources.Common, "Images/Tools.png", OnNavigateDashboard, CanNavigateDashboard) { Order = 90 };
     PermissionRegistry.RegisterPermission(PermissionNames.OpenDashboard, PermissionCategories.Navigation, Resources.CanOpenDashboard);
 }
Example #4
0
 public CustomerModule(IRegionManager regionManager, CustomerSelectorView customerSelectorView)
 {
     _regionManager = regionManager;
     _customerSelectorView = customerSelectorView;
     ListCustomersCommand = new CategoryCommand<string>(Resources.CustomerList, Resources.Customers, OnCustomerListExecute) { Order = 40 };
     PermissionRegistry.RegisterPermission(PermissionNames.MakeAccountTransaction, PermissionCategories.Cash, Resources.CanMakeAccountTransaction);
     PermissionRegistry.RegisterPermission(PermissionNames.CreditOrDeptAccount, PermissionCategories.Cash, Resources.CanMakeCreditOrDeptTransaction);
 }
Example #5
0
 public CashModule(IRegionManager regionManager, CashView cashView)
 {
     _regionManager = regionManager;
     _cashView = cashView;
     NavigateCashViewCommand = new CategoryCommand<string>(Resources.Drawer, Resources.Common, "images/Xls.png", OnNavigateCashView, CanNavigateCashView) { Order = 70 };
     PermissionRegistry.RegisterPermission(PermissionNames.NavigateCashView, PermissionCategories.Navigation, Resources.CanNavigateCash);
     PermissionRegistry.RegisterPermission(PermissionNames.MakeCashTransaction, PermissionCategories.Cash, Resources.CanMakeCashTransaction);
 }
Example #6
0
 public TableModule(IRegionManager regionManager, TableSelectorView tableSelectorView)
 {
     _regionManager = regionManager;
     _tableSelectorView = tableSelectorView;
     ListTablesCommand = new CategoryCommand<string>(Resources.TableList, Resources.Tables, OnListTablesExecute) { Order = 30 };
     ListTableScreensCommand = new CategoryCommand<string>(Resources.TableViews, Resources.Tables, OnListTableScreensExecute);
     NavigateTablesCommand = new CategoryCommand<string>(Resources.Tables, Resources.Common, "images/Png.png", OnNavigateTables, CanNavigateTables);
 }
        public CategoryController(ICategoryQuery query, ICategoryCommand command)
        {
            Ensure.Any.IsNotNull(command, nameof(command));
            Ensure.Any.IsNotNull(query, nameof(query));

            _command = command;
            _query   = query;
        }
Example #8
0
 public DashboardModule(IRegionManager regionManager, DashboardView dashboardView)
 {
     _regionManager            = regionManager;
     _dashboardView            = dashboardView;
     _navigateDashboardCommand = new CategoryCommand <string>(Resources.Management, Resources.Common, "Images/Tools.png", OnNavigateDashboard, CanNavigateDashboard)
     {
         Order = 90
     };
     PermissionRegistry.RegisterPermission(PermissionNames.OpenDashboard, PermissionCategories.Navigation, Resources.CanOpenDashboard);
 }
Example #9
0
 public CustomerModule(IRegionManager regionManager, CustomerSelectorView customerSelectorView)
 {
     _regionManager        = regionManager;
     _customerSelectorView = customerSelectorView;
     ListCustomersCommand  = new CategoryCommand <string>(Resources.CustomerList, Resources.Customers, OnCustomerListExecute)
     {
         Order = 40
     };
     PermissionRegistry.RegisterPermission(PermissionNames.MakeAccountTransaction, PermissionCategories.Cash, Resources.CanMakeAccountTransaction);
     PermissionRegistry.RegisterPermission(PermissionNames.CreditOrDeptAccount, PermissionCategories.Cash, Resources.CanMakeCreditOrDeptTransaction);
 }
Example #10
0
 public TableModule(IRegionManager regionManager, TableSelectorView tableSelectorView)
 {
     _regionManager     = regionManager;
     _tableSelectorView = tableSelectorView;
     ListTablesCommand  = new CategoryCommand <string>(Resources.TableList, Resources.Tables, OnListTablesExecute)
     {
         Order = 30
     };
     ListTableScreensCommand = new CategoryCommand <string>(Resources.TableViews, Resources.Tables, OnListTableScreensExecute);
     NavigateTablesCommand   = new CategoryCommand <string>(Resources.Tables, Resources.Common, "images/Png.png", OnNavigateTables, CanNavigateTables);
 }
Example #11
0
 public CashModule(IRegionManager regionManager, CashView cashView)
 {
     _regionManager          = regionManager;
     _cashView               = cashView;
     NavigateCashViewCommand = new CategoryCommand <string>(Resources.Drawer, Resources.Common, "images/Xls.png", OnNavigateCashView, CanNavigateCashView)
     {
         Order = 70
     };
     PermissionRegistry.RegisterPermission(PermissionNames.NavigateCashView, PermissionCategories.Navigation, Resources.CanNavigateCash);
     PermissionRegistry.RegisterPermission(PermissionNames.MakeCashTransaction, PermissionCategories.Cash, Resources.CanMakeCashTransaction);
 }
Example #12
0
 public UserModule(IRegionManager regionManager)
 {
     ListUserRolesCommand = new CategoryCommand <string>(Resources.UserRoleList, Resources.Users, OnListRoles)
     {
         Order = 50
     };
     ListUsersCommand      = new CategoryCommand <string>(Resources.UserList, Resources.Users, OnListUsers);
     NavigateLogoutCommand = new CategoryCommand <string>("Logout", Resources.Common, "images/bmp.png", OnNavigateUserLogout)
     {
         Order = 99
     };
     _regionManager = regionManager;
 }
Example #13
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;
                }
            });
        }
Example #14
0
        public InventoryModule()
        {
            ListInventoryItemsCommand = new CategoryCommand <string>(Resources.InventoryItems, Resources.Products, OnListInventoryItems)
            {
                Order = 26
            };
            ListRecipesCommand = new CategoryCommand <string>(Resources.Recipes, Resources.Products, OnListRecipes)
            {
                Order = 27
            };
            ListTransactionsCommand = new CategoryCommand <string>(Resources.Transactions, Resources.Products, OnListTransactions)
            {
                Order = 28
            };
            ListPeriodicConsumptionsCommand = new CategoryCommand <string>(Resources.EndOfDayRecords, Resources.Products, OnListPeriodicConsumptions)
            {
                Order = 29
            };

            EventServiceFactory.EventService.GetEvent <GenericEvent <VisibleViewModelBase> >().Subscribe(s =>
            {
                if (s.Topic == EventTopicNames.ViewClosed)
                {
                    if (s.Value == _inventoryItemListViewModel)
                    {
                        _inventoryItemListViewModel = null;
                    }
                    if (s.Value == _recipeListViewModel)
                    {
                        _recipeListViewModel = null;
                    }
                    if (s.Value == _transactionListViewModel)
                    {
                        _transactionListViewModel = null;
                    }
                    if (s.Value == _periodicConsumptionListViewModel)
                    {
                        _periodicConsumptionListViewModel = null;
                    }
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <WorkPeriod> >().Subscribe(OnWorkperiodStatusChanged);
        }
Example #15
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView)
        {
            _regionManager          = regionManager;
            _basicReportView        = basicReportView;
            _navigateReportsCommand = new CategoryCommand <string>(Resources.Reports, Resources.Common, "Images/Ppt.png", OnNavigateReportModule, CanNavigateReportModule)
            {
                Order = 80
            };

            PermissionRegistry.RegisterPermission(PermissionNames.OpenReports, PermissionCategories.Navigation, Resources.CanDisplayReports);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeReportDate, PermissionCategories.Report, Resources.CanChangeReportFilter);

            RuleActionTypeRegistry.RegisterActionType("SaveReportToFile", Resources.SaveReportToFile, new { ReportName = "", FileName = "" });
            RuleActionTypeRegistry.RegisterParameterSoruce("ReportName", () => ReportContext.Reports.Select(x => x.Header));

            EventServiceFactory.EventService.GetEvent <GenericEvent <ActionData> >().Subscribe(x =>
            {
                if (x.Value.Action.ActionType == "SaveReportToFile")
                {
                    var reportName = x.Value.GetAsString("ReportName");
                    var fileName   = x.Value.GetAsString("FileName");
                    if (!string.IsNullOrEmpty(reportName))
                    {
                        var report = ReportContext.Reports.Where(y => y.Header == reportName).FirstOrDefault();
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = AppServices.MainDataContext.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            try
                            {
                                ReportViewModelBase.SaveAsXps(fileName, document);
                            }
                            catch (Exception e)
                            {
                                AppServices.LogError(e);
                            }
                        }
                    }
                }
            });
        }
Example #16
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView)
        {
            _regionManager = regionManager;
            _basicReportView = basicReportView;
            _navigateReportsCommand = new CategoryCommand<string>(Resources.Reports, Resources.Common, "Images/Ppt.png", OnNavigateReportModule, CanNavigateReportModule) { Order = 80 };

            PermissionRegistry.RegisterPermission(PermissionNames.OpenReports, PermissionCategories.Navigation, Resources.CanDisplayReports);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeReportDate, PermissionCategories.Report, Resources.CanChangeReportFilter);

            RuleActionTypeRegistry.RegisterActionType("SaveReportToFile", Resources.SaveReportToFile, new { ReportName = "", FileName = "" });
            RuleActionTypeRegistry.RegisterParameterSoruce("ReportName", () => ReportContext.Reports.Select(x => x.Header));

            EventServiceFactory.EventService.GetEvent<GenericEvent<ActionData>>().Subscribe(x =>
            {
                if (x.Value.Action.ActionType == "SaveReportToFile")
                {
                    var reportName = x.Value.GetAsString("ReportName");
                    var fileName = x.Value.GetAsString("FileName");
                    if (!string.IsNullOrEmpty(reportName))
                    {
                        var report = ReportContext.Reports.Where(y => y.Header == reportName).FirstOrDefault();
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = AppServices.MainDataContext.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            try
                            {
                                ReportViewModelBase.SaveAsXps(fileName, document);
                            }
                            catch (Exception e)
                            {
                                AppServices.LogError(e);
                            }
                        }
                    }
                }
            });
        }
Example #17
0
        public InventoryModule()
        {
            ListInventoryItemsCommand = new CategoryCommand<string>(Resources.InventoryItems, Resources.Products, OnListInventoryItems) { Order = 26 };
            ListRecipesCommand = new CategoryCommand<string>(Resources.Recipes, Resources.Products, OnListRecipes) { Order = 27 };
            ListTransactionsCommand = new CategoryCommand<string>(Resources.Transactions, Resources.Products, OnListTransactions) { Order = 28 };
            ListPeriodicConsumptionsCommand = new CategoryCommand<string>(Resources.EndOfDayRecords, Resources.Products, OnListPeriodicConsumptions) { Order = 29 };

            EventServiceFactory.EventService.GetEvent<GenericEvent<VisibleViewModelBase>>().Subscribe(s =>
            {
                if (s.Topic == EventTopicNames.ViewClosed)
                {
                    if (s.Value == _inventoryItemListViewModel)
                        _inventoryItemListViewModel = null;
                    if (s.Value == _recipeListViewModel)
                        _recipeListViewModel = null;
                    if (s.Value == _transactionListViewModel)
                        _transactionListViewModel = null;
                    if (s.Value == _periodicConsumptionListViewModel)
                        _periodicConsumptionListViewModel = null;
                }
            });

            EventServiceFactory.EventService.GetEvent<GenericEvent<WorkPeriod>>().Subscribe(OnWorkperiodStatusChanged);
        }
Example #18
0
 public static void PublishNavigationCommandEvent(ICategoryCommand command)
 {
     command.PublishEvent(EventTopicNames.NavigationCommandAdded);
 }
Example #19
0
 public static void PublishDashboardCommandEvent(ICategoryCommand command)
 {
     command.PublishEvent(EventTopicNames.DashboardCommandAdded);
 }
Example #20
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;
                    }
                }
            });
        }
Example #21
0
 public static void PublishNavigationCommandEvent(ICategoryCommand command)
 {
     command.PublishEvent(EventTopicNames.NavigationCommandAdded);
 }
Example #22
0
        public TicketModule(IRegionManager regionManager, TicketEditorView ticketEditorView)
        {
            _navigateTicketCommand = new CategoryCommand<string>("POS", Resources.Common, "Images/Network.png", OnNavigateTicketCommand, CanNavigateTicket);
            _regionManager = regionManager;
            _ticketEditorView = ticketEditorView;

            PermissionRegistry.RegisterPermission(PermissionNames.AddItemsToLockedTickets, PermissionCategories.Ticket, Resources.CanReleaseTicketLock);
            PermissionRegistry.RegisterPermission(PermissionNames.RemoveTicketTag, PermissionCategories.Ticket, Resources.CanRemoveTicketTag);
            PermissionRegistry.RegisterPermission(PermissionNames.GiftItems, PermissionCategories.Ticket, Resources.CanGiftItems);
            PermissionRegistry.RegisterPermission(PermissionNames.VoidItems, PermissionCategories.Ticket, Resources.CanVoidItems);
            PermissionRegistry.RegisterPermission(PermissionNames.MoveTicketItems, PermissionCategories.Ticket, Resources.CanMoveTicketLines);
            PermissionRegistry.RegisterPermission(PermissionNames.MergeTickets, PermissionCategories.Ticket, Resources.CanMergeTickets);
            PermissionRegistry.RegisterPermission(PermissionNames.DisplayOldTickets, PermissionCategories.Ticket, Resources.CanDisplayOldTickets);
            PermissionRegistry.RegisterPermission(PermissionNames.MoveUnlockedTicketItems, PermissionCategories.Ticket, Resources.CanMoveUnlockedTicketLines);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeExtraProperty, PermissionCategories.Ticket, Resources.CanUpdateExtraModifiers);

            PermissionRegistry.RegisterPermission(PermissionNames.MakePayment, PermissionCategories.Payment, Resources.CanGetPayment);
            PermissionRegistry.RegisterPermission(PermissionNames.MakeFastPayment, PermissionCategories.Payment, Resources.CanGetFastPayment);
            PermissionRegistry.RegisterPermission(PermissionNames.MakeDiscount, PermissionCategories.Payment, Resources.CanMakeDiscount);
            PermissionRegistry.RegisterPermission(PermissionNames.RoundPayment, PermissionCategories.Payment, Resources.CanRoundTicketTotal);
            PermissionRegistry.RegisterPermission(PermissionNames.FixPayment, PermissionCategories.Payment, Resources.CanFlattenTicketTotal);

            EventServiceFactory.EventService.GetEvent<GenericEvent<Customer>>().Subscribe(
                x =>
                {
                    if (x.Topic == EventTopicNames.CustomerSelectedForTicket || x.Topic == EventTopicNames.PaymentRequestedForTicket)
                        ActivateTicketEditorView();
                }
                );

            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(
                x =>
                {
                    if (x.Topic == EventTopicNames.ActivateTicketView || x.Topic == EventTopicNames.DisplayTicketView)
                        ActivateTicketEditorView();
                });

            EventServiceFactory.EventService.GetEvent<GenericEvent<WorkPeriod>>().Subscribe(
            x =>
            {
                if (x.Topic == EventTopicNames.WorkPeriodStatusChanged)
                {
                    if (x.Value.StartDate < x.Value.EndDate)
                    {
                        using (var v = WorkspaceFactory.Create())
                        {
                            var items = v.All<ScreenMenuItem>().ToList();
                            using (var vr = WorkspaceFactory.CreateReadOnly())
                            {
                                AppServices.ResetCache();
                                var endDate = AppServices.MainDataContext.LastTwoWorkPeriods.Last().EndDate;
                                var startDate = endDate.AddDays(-7);
                                vr.Queryable<TicketItem>()
                                    .Where(y => y.CreatedDateTime >= startDate && y.CreatedDateTime < endDate)
                                    .GroupBy(y => y.MenuItemId)
                                    .ToList().ForEach(
                                        y => items.Where(z => z.MenuItemId == y.Key).ToList().ForEach(z => z.UsageCount = y.Count()));
                            }
                            v.CommitChanges();
                        }
                    }
                }
            });
        }
Example #23
0
 public void AddCommand(ICategoryCommand command)
 {
     _commands.Add(command);
 }
Example #24
0
 public static void PublishDashboardCommandEvent(ICategoryCommand command)
 {
     command.PublishEvent(EventTopicNames.DashboardCommandAdded);
 }
Example #25
0
        public TicketModule(IRegionManager regionManager, TicketEditorView ticketEditorView)
        {
            _navigateTicketCommand = new CategoryCommand <string>("POS", Resources.Common, "Images/Network.png", OnNavigateTicketCommand, CanNavigateTicket);
            _regionManager         = regionManager;
            _ticketEditorView      = ticketEditorView;

            PermissionRegistry.RegisterPermission(PermissionNames.AddItemsToLockedTickets, PermissionCategories.Ticket, Resources.CanReleaseTicketLock);
            PermissionRegistry.RegisterPermission(PermissionNames.RemoveTicketTag, PermissionCategories.Ticket, Resources.CanRemoveTicketTag);
            PermissionRegistry.RegisterPermission(PermissionNames.GiftItems, PermissionCategories.Ticket, Resources.CanGiftItems);
            PermissionRegistry.RegisterPermission(PermissionNames.VoidItems, PermissionCategories.Ticket, Resources.CanVoidItems);
            PermissionRegistry.RegisterPermission(PermissionNames.MoveTicketItems, PermissionCategories.Ticket, Resources.CanMoveTicketLines);
            PermissionRegistry.RegisterPermission(PermissionNames.MergeTickets, PermissionCategories.Ticket, Resources.CanMergeTickets);
            PermissionRegistry.RegisterPermission(PermissionNames.DisplayOldTickets, PermissionCategories.Ticket, Resources.CanDisplayOldTickets);
            PermissionRegistry.RegisterPermission(PermissionNames.MoveUnlockedTicketItems, PermissionCategories.Ticket, Resources.CanMoveUnlockedTicketLines);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeExtraProperty, PermissionCategories.Ticket, Resources.CanUpdateExtraModifiers);

            PermissionRegistry.RegisterPermission(PermissionNames.MakePayment, PermissionCategories.Payment, Resources.CanGetPayment);
            PermissionRegistry.RegisterPermission(PermissionNames.MakeFastPayment, PermissionCategories.Payment, Resources.CanGetFastPayment);
            PermissionRegistry.RegisterPermission(PermissionNames.MakeDiscount, PermissionCategories.Payment, Resources.CanMakeDiscount);
            PermissionRegistry.RegisterPermission(PermissionNames.RoundPayment, PermissionCategories.Payment, Resources.CanRoundTicketTotal);
            PermissionRegistry.RegisterPermission(PermissionNames.FixPayment, PermissionCategories.Payment, Resources.CanFlattenTicketTotal);

            EventServiceFactory.EventService.GetEvent <GenericEvent <Customer> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.CustomerSelectedForTicket || x.Topic == EventTopicNames.PaymentRequestedForTicket)
                {
                    ActivateTicketEditorView();
                }
            }
                );

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ActivateTicketView || x.Topic == EventTopicNames.DisplayTicketView)
                {
                    ActivateTicketEditorView();
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <WorkPeriod> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.WorkPeriodStatusChanged)
                {
                    if (x.Value.StartDate < x.Value.EndDate)
                    {
                        using (var v = WorkspaceFactory.Create())
                        {
                            var items = v.All <ScreenMenuItem>().ToList();
                            using (var vr = WorkspaceFactory.CreateReadOnly())
                            {
                                AppServices.ResetCache();
                                var endDate   = AppServices.MainDataContext.LastTwoWorkPeriods.Last().EndDate;
                                var startDate = endDate.AddDays(-7);
                                vr.Queryable <TicketItem>()
                                .Where(y => y.CreatedDateTime >= startDate && y.CreatedDateTime < endDate)
                                .GroupBy(y => y.MenuItemId)
                                .ToList().ForEach(
                                    y => items.Where(z => z.MenuItemId == y.Key).ToList().ForEach(z => z.UsageCount = y.Count()));
                            }
                            v.CommitChanges();
                        }
                    }
                }
            });
        }
Example #26
0
        public SettingsModule(IRegionManager regionManager, WorkPeriodsView workPeriodsView)
        {
            _regionManager = regionManager;
            _workPeriodsView = workPeriodsView;

            NavigateWorkPeriodsCommand = new CategoryCommand<string>(Resources.DayOperations, Resources.Common, "Images/Run.png", OnNavigateWorkPeriods, CanNavigateWorkPeriods);

            ListProgramSettingsCommand = new CategoryCommand<string>(Resources.LocalSettings, Resources.Settings, OnListProgramSettings);
            ListTerminalsCommand = new CategoryCommand<string>(Resources.Terminals, Resources.Settings, OnListTerminals);
            ListPrintersCommand = new CategoryCommand<string>(Resources.Printers, Resources.Settings, OnListPrinters);
            ListPrintJobsCommand = new CategoryCommand<string>(Resources.PrintJobs, Resources.Settings, OnListPrintJobs);
            ListPrinterTemplatesCommand = new CategoryCommand<string>(Resources.PrinterTemplates, Resources.Settings, OnListPrinterTemplates);
            ListNumeratorsCommand = new CategoryCommand<string>(Resources.Numerators, Resources.Settings, OnListNumerators);
            ListVoidReasonsCommand = new CategoryCommand<string>(Resources.VoidReasons, Resources.Products, OnListVoidReasons);
            ListGiftReasonsCommand = new CategoryCommand<string>(Resources.GiftReasons, Resources.Products, OnListGiftReasons);
            ListMenuItemSettingsCommand = new CategoryCommand<string>(Resources.ProgramSettings, Resources.Settings, OnListMenuItemSettings) { Order = 10 };
            ListRuleActionsCommand = new CategoryCommand<string>(Resources.RuleActions, Resources.Settings, OnListRuleActions);
            ListRulesCommand = new CategoryCommand<string>(Resources.Rules, Resources.Settings, OnListRules);
            ListTriggersCommand = new CategoryCommand<string>(Resources.Triggers, Resources.Settings, OnListTriggers);

            ShowBrowser = new CategoryCommand<string>(Resources.SambaPosWebsite, Resources.SambaNetwork, OnShowBrowser) { Order = 99 };

            PermissionRegistry.RegisterPermission(PermissionNames.OpenWorkPeriods, PermissionCategories.Navigation, Resources.CanStartEndOfDay);
            PermissionRegistry.RegisterPermission(PermissionNames.CloseActiveWorkPeriods, PermissionCategories.Navigation, Resources.ForceClosingActiveWorkPeriod);

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

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

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

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

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

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

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

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

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

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

                    if (s.Value == _triggerListViewModel)
                        _triggerListViewModel = null;
                }
            });
        }
 public void AddCommand(ICategoryCommand command)
 {
     _commands.Add(command);
 }
Example #28
0
 public CategoryRepository(ICategoryCommand categoryCommand, ICategoryQuery categoryQuery)
 {
     _categoryCommand = categoryCommand;
     _categoryQuery   = categoryQuery;
 }
Example #29
0
 protected void SetNavigationCommand(string caption, string category, string image, int order = 0)
 {
     _navigationCommand = new CategoryCommand<string>(caption, category, image, OnNavigate, CanNavigate) { Order = order };
 }
Example #30
0
        public SettingsModule(IRegionManager regionManager, WorkPeriodsView workPeriodsView)
        {
            _regionManager   = regionManager;
            _workPeriodsView = workPeriodsView;

            NavigateWorkPeriodsCommand = new CategoryCommand <string>(Resources.DayOperations, Resources.Common, "Images/Run.png", OnNavigateWorkPeriods, CanNavigateWorkPeriods);

            ListProgramSettingsCommand  = new CategoryCommand <string>(Resources.LocalSettings, Resources.Settings, OnListProgramSettings);
            ListTerminalsCommand        = new CategoryCommand <string>(Resources.Terminals, Resources.Settings, OnListTerminals);
            ListPrintersCommand         = new CategoryCommand <string>(Resources.Printers, Resources.Settings, OnListPrinters);
            ListPrintJobsCommand        = new CategoryCommand <string>(Resources.PrintJobs, Resources.Settings, OnListPrintJobs);
            ListPrinterTemplatesCommand = new CategoryCommand <string>(Resources.PrinterTemplates, Resources.Settings, OnListPrinterTemplates);
            ListNumeratorsCommand       = new CategoryCommand <string>(Resources.Numerators, Resources.Settings, OnListNumerators);
            ListVoidReasonsCommand      = new CategoryCommand <string>(Resources.VoidReasons, Resources.Products, OnListVoidReasons);
            ListGiftReasonsCommand      = new CategoryCommand <string>(Resources.GiftReasons, Resources.Products, OnListGiftReasons);
            ListMenuItemSettingsCommand = new CategoryCommand <string>(Resources.ProgramSettings, Resources.Settings, OnListMenuItemSettings)
            {
                Order = 10
            };
            ListRuleActionsCommand = new CategoryCommand <string>(Resources.RuleActions, Resources.Settings, OnListRuleActions);
            ListRulesCommand       = new CategoryCommand <string>(Resources.Rules, Resources.Settings, OnListRules);
            ListTriggersCommand    = new CategoryCommand <string>(Resources.Triggers, Resources.Settings, OnListTriggers);

            ShowBrowser = new CategoryCommand <string>(Resources.SambaPosWebsite, Resources.SambaNetwork, OnShowBrowser)
            {
                Order = 99
            };

            PermissionRegistry.RegisterPermission(PermissionNames.OpenWorkPeriods, PermissionCategories.Navigation, Resources.CanStartEndOfDay);
            PermissionRegistry.RegisterPermission(PermissionNames.CloseActiveWorkPeriods, PermissionCategories.Navigation, Resources.ForceClosingActiveWorkPeriod);

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

                    if (s.Value == _terminalListViewModel)
                    {
                        _terminalListViewModel = null;
                    }

                    if (s.Value == _printerListViewModel)
                    {
                        _printerListViewModel = null;
                    }

                    if (s.Value == _printerTemplateCollectionViewModel)
                    {
                        _printerTemplateCollectionViewModel = null;
                    }

                    if (s.Value == _printJobsViewModel)
                    {
                        _printJobsViewModel = null;
                    }

                    if (s.Value == _numeratorListViewModel)
                    {
                        _numeratorListViewModel = null;
                    }

                    if (s.Value == _voidReasonListViewModel)
                    {
                        _voidReasonListViewModel = null;
                    }

                    if (s.Value == _giftReasonListViewModel)
                    {
                        _giftReasonListViewModel = null;
                    }

                    if (s.Value == _ruleActionListViewModel)
                    {
                        _ruleActionListViewModel = null;
                    }

                    if (s.Value == _ruleListViewModel)
                    {
                        _ruleListViewModel = null;
                    }

                    if (s.Value == _triggerListViewModel)
                    {
                        _triggerListViewModel = null;
                    }
                }
            });
        }