Ejemplo 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);
                        }
                    }
                }
            });
        }
Ejemplo n.º 2
0
        public UserInteraction(IAutomationService automationService)
        {
            _popupDataViewModel = new PopupDataViewModel();

            automationService.RegisterActionType("ShowMessage", Resources.ShowMessage, new { Message = "" });
            automationService.RegisterActionType("DisplayPopup", Resources.DisplayPopup, new { Title = "", Message = "", Color = "" });

            EventServiceFactory.EventService.GetEvent <GenericEvent <IActionData> >().Subscribe(x =>
            {
                if (x.Value.Action.ActionType == "ShowMessage")
                {
                    var param = x.Value.GetAsString("Message");
                    if (!string.IsNullOrEmpty(param))
                    {
                        GiveFeedback(param);
                    }
                }

                if (x.Value.Action.ActionType == "DisplayPopup")
                {
                    var title   = x.Value.GetAsString("Title");
                    var message = x.Value.GetAsString("Message");
                    var color   = x.Value.GetAsString("Color");
                    color       = string.IsNullOrEmpty(color.Trim()) ? "DarkRed" : color;
                    if (!string.IsNullOrEmpty(message.Trim()))
                    {
                        DisplayPopup(title, message, null, "", color);
                    }
                }
            });
        }
Ejemplo n.º 3
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<IActionData>>().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);
                        }
                    }
                }
            });
        }
Ejemplo n.º 4
0
        public AccountModule(IRegionManager regionManager,
                             IAutomationService automationService,
                             IUserService userService,
                             IAccountService accountService,
                             AccountSelectorView accountSelectorView, AccountSelectorViewModel accountSelectorViewModel,
                             AccountDetailsView accountDetailsView,
                             DocumentCreatorView documentCreatorView,
                             BatchDocumentCreatorView batchDocumentCreatorView, BatchDocumentCreatorViewModel batchDocumentCreatorViewModel)
            : base(regionManager, AppScreens.AccountList)
        {
            _regionManager                 = regionManager;
            _userService                   = userService;
            _accountService                = accountService;
            _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.TransactionDocument.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", 70);

            automationService.RegisterActionType(ActionNames.CreateAccountTransactionDocument, string.Format(Resources.Create_f, Resources.AccountTransactionDocument), new { AccountTransactionDocumentName = "" });
        }
Ejemplo n.º 5
0
        public AccountModule(IRegionManager regionManager,
            IAutomationService automationService,
            IUserService userService,
            IAccountService accountService,
            AccountSelectorView accountSelectorView, AccountSelectorViewModel accountSelectorViewModel,
            AccountDetailsView accountDetailsView,
            DocumentCreatorView documentCreatorView,
            BatchDocumentCreatorView batchDocumentCreatorView, BatchDocumentCreatorViewModel batchDocumentCreatorViewModel)
            : base(regionManager, AppScreens.AccountList)
        {
            _regionManager = regionManager;
            _userService = userService;
            _accountService = accountService;
            _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.TransactionDocument.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", 70);

            automationService.RegisterActionType(ActionNames.CreateAccountTransactionDocument, string.Format(Resources.Create_f, Resources.AccountTransactionDocument), new { AccountTransactionDocumentName = "" });
        }
Ejemplo n.º 6
0
        public AutomationModule(IExpressionService expressionService, IAutomationService automationService)
        {
            _expressionService = expressionService;
            AddDashboardCommand<EntityCollectionViewModelBase<RuleActionViewModel, AppAction>>(Resources.RuleActions, Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<RuleViewModel, AppRule>>(Resources.Rules, Resources.Automation, 45);
            AddDashboardCommand<TriggerListViewModel>(Resources.Trigger.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<AutomationCommandViewModel, AutomationCommand>>(Resources.AutomationCommand.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<ScriptViewModel, Script>>(Resources.Script.ToPlural(), Resources.Automation, 45);

            automationService.RegisterActionType(ActionNames.ExecuteScript, Resources.ExecuteScript, new { ScriptName = "" });

            HighlightingManager.Instance.RegisterHighlighting("SambaDSL", null, () => LoadHighlightingDefinition("SambaDSL.xshd"));
        }
Ejemplo n.º 7
0
        public AutomationModule(IExpressionService expressionService, IAutomationService automationService)
        {
            _expressionService = expressionService;
            AddDashboardCommand <EntityCollectionViewModelBase <RuleActionViewModel, AppAction> >(Resources.RuleActions, Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <RuleViewModel, AppRule> >(Resources.Rules, Resources.Automation, 45);
            AddDashboardCommand <TriggerListViewModel>(Resources.Trigger.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <AutomationCommandViewModel, AutomationCommand> >(Resources.AutomationCommand.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <ScriptViewModel, Script> >(Resources.Script.ToPlural(), Resources.Automation, 45);

            automationService.RegisterActionType(ActionNames.ExecuteScript, Resources.ExecuteScript, new { ScriptName = "" });

            HighlightingManager.Instance.RegisterHighlighting("SambaDSL", null, () => LoadHighlightingDefinition("SambaDSL.xshd"));
        }
Ejemplo n.º 8
0
 private static void RegisterActions()
 {
     AutomationService.RegisterActionType(ActionNames.SendEmail, Resources.SendEmail, new { SMTPServer = "", SMTPUser = "", SMTPPassword = "", SMTPPort = 0, ToEMailAddress = "", Subject = "", CCEmailAddresses = "", FromEMailAddress = "", EMailMessage = "", FileName = "", DeleteFile = false, BypassSslErrors = false });
     AutomationService.RegisterActionType(ActionNames.Addticketdiscount, Resources.AddTicketDiscount, new { DiscountPercentage = 0m });
     AutomationService.RegisterActionType(ActionNames.Addorder, Resources.AddOrder, new { MenuItemName = "", PortionName = "", Quantity = 0, Tag = "" });
     AutomationService.RegisterActionType(ActionNames.UpdateTicketTag, Resources.UpdateTicketTag, new { TagName = "", TagValue = "" });
     AutomationService.RegisterActionType(ActionNames.TagOrder, Resources.TagOrder, new { OrderTagName = "", OrderTagValue = "" });
     AutomationService.RegisterActionType(ActionNames.UntagOrder, Resources.UntagOrder, new { OrderTagName = "", OrderTagValue = "" });
     AutomationService.RegisterActionType(ActionNames.RemoveOrderTag, Resources.RemoveOrderTag, new { OrderTagName = "" });
     AutomationService.RegisterActionType(ActionNames.MoveTaggedOrders, Resources.MoveTaggedOrders, new { OrderTagName = "", OrderTagValue = "" });
     AutomationService.RegisterActionType(ActionNames.UpdatePriceTag, Resources.UpdatePriceTag, new { DepartmentName = "", PriceTag = "" });
     AutomationService.RegisterActionType(ActionNames.RefreshCache, Resources.RefreshCache);
     AutomationService.RegisterActionType(ActionNames.SendMessage, Resources.BroadcastMessage, new { Command = "" });
     AutomationService.RegisterActionType(ActionNames.UpdateProgramSetting, Resources.UpdateProgramSetting, new { SettingName = "", SettingValue = "", UpdateType = Resources.Update, IsLocal = true });
     AutomationService.RegisterActionType(ActionNames.UpdateTicketTax, Resources.UpdateTicketTax, new { TaxTemplate = "" });
     AutomationService.RegisterActionType(ActionNames.RegenerateTicketTax, Resources.RegenerateTicketTax);
     AutomationService.RegisterActionType(ActionNames.UpdateTicketCalculation, Resources.UpdateTicketCalculation, new { CalculationType = "", Amount = 0m });
     AutomationService.RegisterActionType(ActionNames.UpdateTicketAccount, Resources.UpdateTicketAccount, new { AccountPhone = "", AccountName = "", Note = "" });
     AutomationService.RegisterActionType(ActionNames.ExecutePrintJob, Resources.ExecutePrintJob, new { PrintJobName = "" });
     AutomationService.RegisterActionType(ActionNames.UpdateResourceState, Resources.UpdateResourceState, new { ResourceTypeName = "", ResourceState = "" });
     AutomationService.RegisterActionType(ActionNames.CloseActiveTicket, Resources.CloseTicket);
     AutomationService.RegisterActionType(ActionNames.LockTicket, Resources.LockTicket);
     AutomationService.RegisterActionType(ActionNames.UnlockTicket, Resources.UnlockTicket);
     AutomationService.RegisterActionType(ActionNames.CreateTicket, string.Format(Resources.Create_f, Resources.Ticket));
     AutomationService.RegisterActionType(ActionNames.DisplayTicket, Resources.DisplayTicket, new { TicketId = 0 });
     AutomationService.RegisterActionType(ActionNames.DisplayPaymentScreen, Resources.DisplayPaymentScreen);
 }
Ejemplo n.º 9
0
 private static void RegisterActions()
 {
     AutomationService.RegisterActionType(ActionNames.SendEmail, Resources.SendEmail, new { SMTPServer = "", SMTPUser = "", SMTPPassword = "", SMTPPort = 0, ToEMailAddress = "", Subject = "", CCEmailAddresses = "", FromEMailAddress = "", EMailMessage = "", FileName = "", DeleteFile = false, BypassSslErrors = false });
     AutomationService.RegisterActionType(ActionNames.AddOrder, Resources.AddOrder, new { MenuItemName = "", PortionName = "", Quantity = 0, Tag = "" });
     AutomationService.RegisterActionType(ActionNames.SetActiveTicketType, Resources.SetActiveTicketType, new { TicketTypeName = "" });
     AutomationService.RegisterActionType(ActionNames.TagOrder, Resources.TagOrder, new { OrderTagName = "", OldOrderTagValue = "", OrderTagValue = "", OrderTagNote = "", OrderTagPrice = "" });
     AutomationService.RegisterActionType(ActionNames.UntagOrder, Resources.UntagOrder, new { OrderTagName = "", OrderTagValue = "" });
     AutomationService.RegisterActionType(ActionNames.RemoveOrderTag, Resources.RemoveOrderTag, new { OrderTagName = "" });
     AutomationService.RegisterActionType(ActionNames.MoveTaggedOrders, Resources.MoveTaggedOrders, new { OrderTagName = "", OrderTagValue = "" });
     AutomationService.RegisterActionType(ActionNames.UpdateOrder, Resources.UpdateOrder, new { Quantity = 0m, Price = 0m, PortionName = "", PriceTag = "", IncreaseInventory = false, DecreaseInventory = false, CalculatePrice = false, Locked = false, AccountTransactionType = "" });
     AutomationService.RegisterActionType(ActionNames.UpdateOrderState, Resources.UpdateOrderState, new { StateName = "", GroupOrder = 0, CurrentState = "", State = "", StateOrder = 0, StateValue = "" });
     AutomationService.RegisterActionType(ActionNames.UpdateEntityState, Resources.UpdateEntityState, new { EntityTypeName = "", EntityStateName = "", CurrentState = "", EntityState = "" });
     AutomationService.RegisterActionType(ActionNames.UpdateProgramSetting, Resources.UpdateProgramSetting, new { SettingName = "", SettingValue = "", UpdateType = Resources.Update, IsLocal = true });
     AutomationService.RegisterActionType(ActionNames.UpdateTicketTag, Resources.UpdateTicketTag, new { TagName = "", TagValue = "" });
     AutomationService.RegisterActionType(ActionNames.ChangeTicketEntity, Resources.ChangeTicketEntity, new { EntityTypeName = "", EntityName = "" });
     AutomationService.RegisterActionType(ActionNames.UpdateTicketCalculation, Resources.UpdateTicketCalculation, new { CalculationType = "", Amount = 0m });
     AutomationService.RegisterActionType(ActionNames.UpdateTicketState, Resources.UpdateTicketState, new { StateName = "", CurrentState = "", State = "", StateValue = "", Quantity = 0 });
     AutomationService.RegisterActionType(ActionNames.CloseActiveTicket, Resources.CloseTicket);
     AutomationService.RegisterActionType(ActionNames.LoadTicket, Resources.LoadTicket, new { TicketId = 0 });
     AutomationService.RegisterActionType(ActionNames.CreateTicket, string.Format(Resources.Create_f, Resources.Ticket));
     AutomationService.RegisterActionType(ActionNames.DisplayTicket, Resources.DisplayTicket, new { TicketId = 0 });
     AutomationService.RegisterActionType(ActionNames.DisplayTicketList, Resources.DisplayTicketList, new { TicketTagName = "", TicketStateName = "" });
     AutomationService.RegisterActionType(ActionNames.LockTicket, Resources.LockTicket);
     AutomationService.RegisterActionType(ActionNames.UnlockTicket, Resources.UnlockTicket);
     AutomationService.RegisterActionType(ActionNames.MarkTicketAsClosed, Resources.MarkTicketAsClosed);
     AutomationService.RegisterActionType(ActionNames.DisplayPaymentScreen, Resources.DisplayPaymentScreen);
     AutomationService.RegisterActionType(ActionNames.UpdatePriceTag, Resources.UpdatePriceTag, new { DepartmentName = "", PriceTag = "" });
     AutomationService.RegisterActionType(ActionNames.RefreshCache, Resources.RefreshCache);
     AutomationService.RegisterActionType(ActionNames.ExecutePrintJob, Resources.ExecutePrintJob, new { PrintJobName = "", OrderStateName = "", OrderState = "", OrderStateValue = "", OrderTagName = "", OrderTagValue = "" });
     AutomationService.RegisterActionType(ActionNames.SendMessage, Resources.BroadcastMessage, new { Command = "" });
     AutomationService.RegisterActionType(ActionNames.StartProcess, Resources.StartProcess, new { FileName = "", Arguments = "", UseShellExecute = false, IsHidden = false });
 }