Esempio n. 1
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView,
                                 IWorkPeriodService workPeriodService, IPrinterService printerService,
                                 IInventoryService inventoryService, IUserService userService,
                                 IApplicationState applicationState, IAutomationService automationService, ILogService logService)
            : base(regionManager, AppScreens.ReportView)
        {
            ReportContext.PrinterService    = printerService;
            ReportContext.WorkPeriodService = workPeriodService;
            ReportContext.InventoryService  = inventoryService;
            ReportContext.UserService       = userService;
            ReportContext.ApplicationState  = applicationState;
            ReportContext.LogService        = logService;

            _userService = userService;

            _regionManager   = regionManager;
            _basicReportView = basicReportView;
            SetNavigationCommand(Resources.Reports, Resources.Common, "Images/Ppt.png", 60);

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

            automationService.RegisterActionType("SaveReportToFile", Resources.SaveReportToFile, new { ReportName = "", FileName = "" });
            automationService.RegisterActionType(ActionNames.PrintReport, Resources.PrintReport, new { ReportName = "" });
            automationService.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.FirstOrDefault(y => y.Header == reportName);
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = ReportContext.ApplicationState.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            ReportViewModelBase.SaveAsXps(fileName, document);
                        }
                    }
                }

                if (x.Value.Action.ActionType == ActionNames.PrintReport)
                {
                    var reportName = x.Value.GetAsString("ReportName");
                    if (!string.IsNullOrEmpty(reportName))
                    {
                        var report = ReportContext.Reports.FirstOrDefault(y => y.Header == reportName);
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = ReportContext.ApplicationState.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            ReportContext.PrinterService.PrintReport(document, ReportContext.ApplicationState.CurrentTerminal.ReportPrinter);
                        }
                    }
                }
            });
        }
Esempio n. 2
0
        public AccountModule(IRegionManager regionManager,
                             IUserService userService, IApplicationState applicationState,
                             AccountSelectorView accountSelectorView, AccountSelectorViewModel accountSelectorViewModel,
                             AccountDetailsView accountDetailsView,
                             DocumentCreatorView documentCreatorView,
                             BatchDocumentCreatorView batchDocumentCreatorView, BatchDocumentCreatorViewModel batchDocumentCreatorViewModel)
            : base(regionManager, AppScreens.AccountView)
        {
            _regionManager                 = regionManager;
            _userService                   = userService;
            _applicationState              = applicationState;
            _accountSelectorView           = accountSelectorView;
            _accountSelectorViewModel      = accountSelectorViewModel;
            _accountDetailsView            = accountDetailsView;
            _documentCreatorView           = documentCreatorView;
            _batchDocumentCreatorView      = batchDocumentCreatorView;
            _batchDocumentCreatorViewModel = batchDocumentCreatorViewModel;

            AddDashboardCommand <EntityCollectionViewModelBase <AccountTypeViewModel, AccountType> >(Resources.AccountType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountViewModel, Account> >(Resources.Account.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountScreenViewModel, AccountScreen> >(Resources.AccountScreen.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionTypeViewModel, AccountTransactionType> >(Resources.TransactionType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionDocumentTypeViewModel, AccountTransactionDocumentType> >(Resources.DocumentType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionDocumentViewModel, AccountTransactionDocument> >(Resources.Transaction.ToPlural(), Resources.Accounts, 40);

            PermissionRegistry.RegisterPermission(PermissionNames.NavigateAccountView, PermissionCategories.Navigation, Resources.CanNavigateCash);
            PermissionRegistry.RegisterPermission(PermissionNames.CreateAccount, PermissionCategories.Account, Resources.CanCreateAccount);

            SetNavigationCommand(Resources.Accounts, Resources.Common, "Images/Xls.png", 30);
        }
Esempio n. 3
0
        public NavigationModule(IRegionManager regionManager, NavigationView navigationView)
        {
            _regionManager  = regionManager;
            _navigationView = navigationView;

            PermissionRegistry.RegisterPermission(PermissionNames.OpenNavigation, PermissionCategories.Navigation, Resources.CanOpenNavigation);

            EventServiceFactory.EventService.GetEvent <GenericEvent <User> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.UserLoggedIn)
                {
                    ActivateNavigation();
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ActivateNavigation)
                {
                    ActivateNavigation();
                }
            });
        }
Esempio n. 4
0
        public InventoryModule(IRegionManager regionManager, ICacheService cacheService, IUserService userService, IInventoryService inventoryService,
                               WarehouseInventoryView resourceInventoryView, WarehouseInventoryViewModel resourceInventoryViewModel, ILogService logService)
            : base(regionManager, AppScreens.InventoryView)
        {
            _regionManager               = regionManager;
            _cacheService                = cacheService;
            _userService                 = userService;
            _inventoryService            = inventoryService;
            _warehouseInventoryView      = resourceInventoryView;
            _warehouseInventoryViewModel = resourceInventoryViewModel;
            _logService = logService;

            AddDashboardCommand <EntityCollectionViewModelBase <WarehouseTypeViewModel, WarehouseType> >(Resources.WarehouseType.ToPlural(), Resources.Inventory, 46);
            AddDashboardCommand <EntityCollectionViewModelBase <WarehouseViewModel, Warehouse> >(Resources.Warehouse.ToPlural(), Resources.Inventory, 46);
            AddDashboardCommand <EntityCollectionViewModelBase <TransactionTypeViewModel, InventoryTransactionType> >(Resources.TransactionType.ToPlural(), Resources.Inventory, 46);
            AddDashboardCommand <EntityCollectionViewModelBase <TransactionDocumentTypeViewModel, InventoryTransactionDocumentType> >(Resources.DocumentType.ToPlural(), Resources.Inventory, 46);
            AddDashboardCommand <TransactionDocumentListViewModel>(Resources.Transaction.ToPlural(), Resources.Inventory, 46);
            AddDashboardCommand <EntityCollectionViewModelBase <InventoryItemViewModel, InventoryItem> >(Resources.InventoryItems, Resources.Inventory, 46);
            AddDashboardCommand <RecipeListViewModel>(Resources.Recipes, Resources.Inventory, 46);
            AddDashboardCommand <PeriodicConsumptionListViewModel>(Resources.EndOfDayRecords, Resources.Inventory, 47);

            SetNavigationCommand(Resources.Warehouses, Resources.Common, "Images/Warehouses.png", 40);

            EventServiceFactory.EventService.GetEvent <GenericEvent <Entity> >().Subscribe(OnResourceEvent);
            EventServiceFactory.EventService.GetEvent <GenericEvent <Warehouse> >().Subscribe(OnWarehouseEvent);

            PermissionRegistry.RegisterPermission(PermissionNames.OpenInventory, PermissionCategories.Navigation, string.Format(Resources.CanNavigate_f, Resources.Inventory));
        }
        public TicketModule(IRegionManager regionManager, IUserService userService, TicketExplorerView ticketExplorerView, TicketExplorerViewModel ticketExplorerViewModel)
            : base(regionManager, AppScreens.TicketListView)
        {
            _regionManager = regionManager;
            _userService   = userService;

            _ticketExplorerView      = ticketExplorerView;
            _ticketExplorerViewModel = ticketExplorerViewModel;
            _ticketExplorerViewModel.TicketAction = () => OnNavigate("");

            AddDashboardCommand <EntityCollectionViewModelBase <TicketTypeViewModel, TicketType> >(Resources.TicketType.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <TicketTagGroupViewModel, TicketTagGroup> >(Resources.TicketTag.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <OrderTagGroupViewModel, OrderTagGroup> >(Resources.OrderTag.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <PaymentTypeViewModel, PaymentType> >(Resources.PaymentType.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <ChangePaymentTypeViewModel, ChangePaymentType> >(Resources.ChangePaymentType.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <CalculationTypeViewModel, CalculationType> >(Resources.CalculationType.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <CalculationSelectorViewModel, CalculationSelector> >(Resources.CalculationSelector.ToPlural(), Resources.Tickets, 35);

            PermissionRegistry.RegisterPermission(PermissionNames.AddItemsToLockedTickets, PermissionCategories.Ticket, Resources.CanReleaseTicketLock);
            PermissionRegistry.RegisterPermission(PermissionNames.RemoveTicketTag, PermissionCategories.Ticket, Resources.CanRemoveTicketTag);
            PermissionRegistry.RegisterPermission(PermissionNames.MoveOrders, PermissionCategories.Ticket, Resources.CanMoveTicketLines);
            PermissionRegistry.RegisterPermission(PermissionNames.MergeTickets, PermissionCategories.Ticket, Resources.CanMergeTickets);
            PermissionRegistry.RegisterPermission(PermissionNames.DisplayOldTickets, PermissionCategories.Ticket, Resources.CanDisplayOldTickets);
            PermissionRegistry.RegisterPermission(PermissionNames.MoveUnlockedOrders, PermissionCategories.Ticket, Resources.CanMoveUnlockedTicketLines);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeExtraProperty, PermissionCategories.Ticket, Resources.CanUpdateExtraModifiers);
            PermissionRegistry.RegisterPermission(PermissionNames.DisplayOtherWaitersTickets, PermissionCategories.Ticket, Resources.CanDisplayOtherWaitersTickets);

            SetNavigationCommand(Resources.Tickets, Resources.Common, "Images/Tickets.png", 20);

            ticketExplorerView.DataContext = ticketExplorerViewModel;
        }
Esempio n. 6
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView,
                                 IWorkPeriodService workPeriodService, IPrinterService printerService, ICacheService cacheService,
                                 IInventoryService inventoryService, IUserService userService, IAutomationService automationService,
                                 IApplicationState applicationState, ILogService logService, ISettingService settingService)
            : base(regionManager, AppScreens.ReportView)
        {
            ReportContext.PrinterService    = printerService;
            ReportContext.WorkPeriodService = workPeriodService;
            ReportContext.InventoryService  = inventoryService;
            ReportContext.UserService       = userService;
            ReportContext.ApplicationState  = applicationState;
            ReportContext.CacheService      = cacheService;
            ReportContext.LogService        = logService;
            ReportContext.SettingService    = settingService;

            _userService = userService;

            _regionManager   = regionManager;
            _basicReportView = basicReportView;
            SetNavigationCommand(Resources.Reports, Resources.Common, "Images/Ppt.png", 60);

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

            //todo refactor
            automationService.RegisterParameterSource("ReportName", () => ReportContext.Reports.Select(x => x.Header));
        }
Esempio n. 7
0
        protected override void OnInitialization()
        {
            _regionManager.RegisterViewWithRegion(RegionNames.MainRegion, typeof(TableSelectorView));
            PermissionRegistry.RegisterPermission(PermissionNames.OpenTables, PermissionCategories.Navigation, Resources.CanOpenTableList);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeTable, PermissionCategories.Ticket, Resources.CanChangeTable);

            EventServiceFactory.EventService.GetEvent <GenericEvent <Department> >().Subscribe(x =>
            {
                if (x.Topic == EventTopicNames.SelectTable)
                {
                    ActivateTableView();
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <VisibleViewModelBase> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ViewClosed)
                {
                    if (x.Value == _tableListViewModel)
                    {
                        _tableListViewModel = null;
                    }
                    if (x.Value == _tableScreenListViewModel)
                    {
                        _tableScreenListViewModel = null;
                    }
                }
            }
                );
        }
Esempio n. 8
0
 public ManagementModule(IRegionManager regionManager, ManagementView dashboardView /*, UserManager userManager*/)
     : base(regionManager, AppScreens.Management)
 {
     m_regionManager = regionManager;
     m_dashboardView = dashboardView;
     SetNavigationCommand("管理", "普通", "", 70);
     PermissionRegistry.RegisterPermission(PermissionNames.OpenDashboard, PermissionCategories.Navigation, "可以打开管理界面");
 }
Esempio n. 9
0
 public ManagementModule(IRegionManager regionManager, ManagementView dashboardView, IUserService userService)
     : base(regionManager, AppScreens.Management)
 {
     _regionManager = regionManager;
     _dashboardView = dashboardView;
     _userService   = userService;
     SetNavigationCommand(Resources.Management, Resources.Common, "Images/Manage.png", 70);
     PermissionRegistry.RegisterPermission(PermissionNames.OpenDashboard, PermissionCategories.Navigation, Resources.CanOpenDashboard);
 }
Esempio n. 10
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);
 }
Esempio n. 11
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);
 }
Esempio n. 12
0
        public WorkPeriodsModule(IRegionManager regionManager, WorkPeriodsView workPeriodsView, IUserService userService)
            : base(regionManager, AppScreens.WorkPeriods)
        {
            _regionManager   = regionManager;
            _workPeriodsView = workPeriodsView;
            _userService     = userService;

            SetNavigationCommand(Resources.DayOperations, Resources.Common, "Images/WorkPeriod.png");
            PermissionRegistry.RegisterPermission(PermissionNames.OpenWorkPeriods, PermissionCategories.Navigation,
                                                  Resources.CanStartEndOfDay);
        }
Esempio n. 13
0
        public MarketModule(IRegionManager regionManager, IUserService userService, MarketModuleView marketModuleView, MarketModuleViewModel marketModuleViewModel)
            : base(regionManager, AppScreens.MarketView)
        {
            _regionManager         = regionManager;
            _userService           = userService;
            _marketModuleView      = marketModuleView;
            _marketModuleViewModel = marketModuleViewModel;

            SetNavigationCommand(Resources.SambaMarket, Resources.Common, "Images/dcn.png", 50);
            PermissionRegistry.RegisterPermission(PermissionNames.OpenMarket, PermissionCategories.Navigation, string.Format(Resources.CanNavigate_f, Resources.Market));
        }
Esempio n. 14
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);
 }
Esempio n. 15
0
        public DepartmentModule(IRegionManager regionManager, IDepartmentService departmentService)
        {
            _departmentService = departmentService;
            _regionManager     = regionManager;
            AddDashboardCommand <DepartmentListViewModel>(Resources.Departments, Resources.Settings, 20);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeDepartment, PermissionCategories.Department, Resources.CanChangeDepartment);

            foreach (var department in _departmentService.GetDepartments())
            {
                PermissionRegistry.RegisterPermission(PermissionNames.UseDepartment + department.Id, PermissionCategories.Department, department.Name);
            }
        }
Esempio n. 16
0
        public BackupModule(IRegionManager regionManager, IUserService userService, BackupModuleView BackupModuleView, BackupModuleViewModel BackupModuleViewModel, BackupHelper backupHelper)
            : base(regionManager, AppScreens.BackupView)
        {
            _regionManager         = regionManager;
            _userService           = userService;
            _BackupModuleView      = BackupModuleView;
            _BackupModuleViewModel = BackupModuleViewModel;
            this._backupHelper     = backupHelper;

            SetNavigationCommand(Resources.MagentixBackup, Resources.Common, "Images/Market.png", 50);
            PermissionRegistry.RegisterPermission(PermissionNames.OpenBackup, PermissionCategories.Navigation, string.Format(Resources.CanNavigate_f, Resources.BackupRestore));
            EventServiceFactory.EventService.GetEvent <GenericEvent <WorkPeriod> >().Subscribe(new Action <EventParameters <WorkPeriod> >(this.OnWorkperiodStatusChanged));
        }
        public NavigationModule(IRegionManager regionManager, NavigationView navigationView, IUserService userService,
                                IApplicationState applicationState)
            : base(regionManager, AppScreens.Navigation)
        {
            _regionManager    = regionManager;
            _navigationView   = navigationView;
            _userService      = userService;
            _applicationState = applicationState;

            PermissionRegistry.RegisterPermission(PermissionNames.OpenNavigation, PermissionCategories.Navigation, Resources.CanOpenNavigation);

            EventServiceFactory.EventService.GetEvent <GenericEvent <User> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.UserLoggedIn)
                {
                    ActivateNavigation();
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ActivateNavigation)
                {
                    ActivateNavigation();
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <AppScreenChangeData> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.Changed)
                {
                    _applicationState.NotifyEvent(RuleEventNames.ApplicationScreenChanged,
                                                  new
                    {
                        PreviousScreen = Enum.GetName(typeof(AppScreens), x.Value.PreviousScreen),
                        CurrentScreen  = Enum.GetName(typeof(AppScreens), x.Value.CurrentScreen)
                    });
                }
            });
        }
Esempio n. 18
0
        public TicketModule()
        {
            AddDashboardCommand <EntityCollectionViewModelBase <TicketTemplateViewModel, TicketTemplate> >(Resources.TicketTemplate.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <TicketTagGroupViewModel, TicketTagGroup> >(Resources.TicketTag.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <OrderStateGroupViewModel, OrderStateGroup> >(Resources.OrderState.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <OrderTagTemplateViewModel, OrderTagTemplate> >(Resources.OrderTagTemplate.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <OrderTagGroupViewModel, OrderTagGroup> >(Resources.OrderTag.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <PaymentTypeViewModel, PaymentType> >(Resources.PaymentType.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <ChangePaymentTypeViewModel, ChangePaymentType> >(Resources.ChangePaymentType.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <CalculationTypeViewModel, CalculationType> >(Resources.CalculationType.ToPlural(), Resources.Tickets, 35);
            AddDashboardCommand <EntityCollectionViewModelBase <CalculationSelectorViewModel, CalculationSelector> >(Resources.CalculationSelector.ToPlural(), Resources.Tickets, 35);

            PermissionRegistry.RegisterPermission(PermissionNames.AddItemsToLockedTickets, PermissionCategories.Ticket, Resources.CanReleaseTicketLock);
            PermissionRegistry.RegisterPermission(PermissionNames.RemoveTicketTag, PermissionCategories.Ticket, Resources.CanRemoveTicketTag);
            PermissionRegistry.RegisterPermission(PermissionNames.MoveOrders, PermissionCategories.Ticket, Resources.CanMoveTicketLines);
            PermissionRegistry.RegisterPermission(PermissionNames.MergeTickets, PermissionCategories.Ticket, Resources.CanMergeTickets);
            PermissionRegistry.RegisterPermission(PermissionNames.DisplayOldTickets, PermissionCategories.Ticket, Resources.CanDisplayOldTickets);
            PermissionRegistry.RegisterPermission(PermissionNames.MoveUnlockedOrders, PermissionCategories.Ticket, Resources.CanMoveUnlockedTicketLines);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeExtraProperty, PermissionCategories.Ticket, Resources.CanUpdateExtraModifiers);
        }
Esempio n. 19
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);
                            }
                        }
                    }
                }
            });
        }
Esempio n. 20
0
        public AccountModule(IRegionManager regionManager,
                             IAutomationService automationService,
                             IUserService userService,
                             IAccountService accountService,
                             ITicketService ticketService,
                             ICacheService cacheService,
                             AccountSelectorView accountSelectorView, AccountSelectorViewModel accountSelectorViewModel,
                             AccountDetailsView accountDetailsView,
                             DocumentCreatorView documentCreatorView,
                             BatchDocumentCreatorView batchDocumentCreatorView, BatchDocumentCreatorViewModel batchDocumentCreatorViewModel)
            : base(regionManager, AppScreens.AccountView)
        {
            _regionManager                 = regionManager;
            _userService                   = userService;
            _accountService                = accountService;
            _ticketService                 = ticketService;
            _cacheService                  = cacheService;
            _accountSelectorView           = accountSelectorView;
            _accountSelectorViewModel      = accountSelectorViewModel;
            _accountDetailsView            = accountDetailsView;
            _documentCreatorView           = documentCreatorView;
            _batchDocumentCreatorView      = batchDocumentCreatorView;
            _batchDocumentCreatorViewModel = batchDocumentCreatorViewModel;

            AddDashboardCommand <EntityCollectionViewModelBase <AccountTypeViewModel, AccountType> >(Resources.AccountType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountViewModel, Account> >(Resources.Account.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountScreenViewModel, AccountScreen> >(Resources.AccountScreen.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionTypeViewModel, AccountTransactionType> >(Resources.TransactionType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionDocumentTypeViewModel, AccountTransactionDocumentType> >(Resources.DocumentType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionDocumentViewModel, AccountTransactionDocument> >(Resources.Transaction.ToPlural(), Resources.Accounts, 40);

            PermissionRegistry.RegisterPermission(PermissionNames.NavigateAccountView, PermissionCategories.Navigation, Resources.CanNavigateCash);
            PermissionRegistry.RegisterPermission(PermissionNames.CreateAccount, PermissionCategories.Account, Resources.CanCreateAccount);

            SetNavigationCommand(Resources.Accounts, Resources.Common, "Images/Xls.png", 30);

            automationService.RegisterActionType(ActionNames.CreateAccountTransactionDocument, string.Format(Resources.Create_f, Resources.AccountTransactionDocument), new { AccountTransactionDocumentName = "" });
            automationService.RegisterActionType(ActionNames.CreateAccountTransaction, string.Format(Resources.Create_f, Resources.AccountTransaction), new { AccountTransactionTypeName = "", Amount = 0m });
        }
Esempio n. 21
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;
                    }
                }
            });
        }
Esempio n. 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();
                        }
                    }
                }
            });
        }
Esempio n. 23
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;
                    }
                }
            });
        }
Esempio n. 24
0
        public MainWindowViewModel()
        {
            //TODO: Para birimi servisinden al.

            LocalizeDictionary.ChangeLanguage(LocalSettings.CurrentLanguage);
            LocalSettings.SetTraceLogPath("term");

            LocalSettings.DefaultCurrencyFormat = "#,#0.00";
            LocalSettings.AppPath      = System.IO.Path.GetDirectoryName(Application.ResourceAssembly.Location);
            AppServices.MainDispatcher = Application.Current.Dispatcher;
            GenericRuleRegistator.RegisterOnce();
            TriggerService.UpdateCronObjects();

            LoggedInUserViewModel = new LoggedInUserViewModel();
            LoggedInUserViewModel.CloseButtonClickedEvent += LoggedInUserViewModelCloseButtonClickedEvent;

            LoginViewModel = new LoginViewModel();
            LoginViewModel.PinSubmitted += LoginViewModelPinSubmitted;

            TableScreenViewModel = new TableScreenViewModel();
            TableScreenViewModel.TableSelectedEvent += TableScreenViewModelTableSelectedEvent;

            TicketScreenViewModel = new TicketScreenViewModel();
            TicketScreenViewModel.TicketSelectedEvent += TicketScreenViewModelTicketSelectedEvent;

            DepartmentSelectorViewModel = new DepartmentSelectorViewModel();
            DepartmentSelectorViewModel.DepartmentSelected += DepartmentSelectorViewModelDepartmentSelected;

            TicketEditorViewModel = new TicketEditorViewModel();
            TicketEditorViewModel.OnAddMenuItemsRequested     += TicketEditorViewModel_OnAddMenuItemsRequested;
            TicketEditorViewModel.OnCloseTicketRequested      += TicketEditorViewModel_OnCloseTicketRequested;
            TicketEditorViewModel.OnSelectTableRequested      += TicketEditorViewModel_OnSelectTableRequested;
            TicketEditorViewModel.OnTicketNoteEditorRequested += TicketEditorViewModel_OnTicketNoteEditorRequested;
            TicketEditorViewModel.OnTicketTagEditorRequested  += TicketEditorViewModel_OnTicketTagEditorRequested;

            MenuItemSelectorViewModel = new MenuItemSelectorViewModel();
            MenuItemSelectorViewModel.OnTicketItemSelected += MenuItemSelectorViewModel_OnTicketItemSelected;

            SelectedTicketItemEditorViewModel             = new SelectedTicketItemEditorViewModel();
            SelectedTicketItemEditorViewModel.TagUpdated += SelectedTicketItemEditorViewModelTagUpdated;

            PermissionRegistry.RegisterPermission(PermissionNames.AddItemsToLockedTickets, PermissionCategories.Ticket, "Kilitli adisyona ekleme yapabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.GiftItems, PermissionCategories.Ticket, "İkram yapabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.VoidItems, PermissionCategories.Ticket, "İade alabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.MoveTicketItems, PermissionCategories.Ticket, "Adisyon satırlarını taşıyabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.MoveUnlockedTicketItems, PermissionCategories.Ticket, "Kilitlenmemiş adisyon satırlarını taşıyabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeExtraProperty, PermissionCategories.Ticket, "Ekstra özellik girebilir");

            AppServices.MessagingService.RegisterMessageListener(new MessageListener());
            if (LocalSettings.StartMessagingClient)
            {
                AppServices.MessagingService.StartMessagingClient();
            }

            EventServiceFactory.EventService.GetEvent <GenericEvent <Message> >().Subscribe(
                x =>
            {
                if (SelectedIndex == 2 && x.Topic == EventTopicNames.MessageReceivedEvent &&
                    x.Value.Command == Messages.TicketRefreshMessage)
                {
                    TableScreenViewModel.Refresh();
                }
            });
        }