예제 #1
0
        public override void Process(ActionData actionData)
        {
            var settingName = actionData.GetAsString("SettingName");
            var updateType = actionData.GetAsString("UpdateType");
            if (!string.IsNullOrEmpty(settingName))
            {
                var isLocal = actionData.GetAsBoolean("IsLocal");
                var setting = isLocal
                    ? _settingService.ReadLocalSetting(settingName)
                    : _settingService.ReadGlobalSetting(settingName);

                if (updateType == Resources.Increase)
                {
                    var settingValue = actionData.GetAsInteger("SettingValue");
                    if (string.IsNullOrEmpty(setting.StringValue))
                        setting.IntegerValue = settingValue;
                    else
                        setting.IntegerValue = setting.IntegerValue + settingValue;
                }
                else if (updateType == Resources.Decrease)
                {
                    var settingValue = actionData.GetAsInteger("SettingValue");
                    if (string.IsNullOrEmpty(setting.StringValue))
                        setting.IntegerValue = settingValue;
                    else
                        setting.IntegerValue = setting.IntegerValue - settingValue;
                }
                else if (updateType == Resources.Toggle)
                {
                    var settingValue = actionData.GetAsString("SettingValue");
                    var parts = settingValue.Split(',');
                    if (string.IsNullOrEmpty(setting.StringValue))
                    {
                        setting.StringValue = parts[0];
                    }
                    else
                    {
                        for (var i = 0; i < parts.Length; i++)
                        {
                            if (parts[i] == setting.StringValue)
                            {
                                setting.StringValue = (i + 1) < parts.Length ? parts[i + 1] : parts[0];
                                break;
                            }
                        }
                    }
                }
                else
                {
                    var settingValue = actionData.GetAsString("SettingValue");
                    setting.StringValue = settingValue;
                }
                if (!isLocal) _settingService.SaveProgramSettings();
            }
        }
예제 #2
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     var orders = Helper.GetOrders(actionData, ticket);
     if (orders.Any())
     {
         var stateName = actionData.GetAsString("StateName");
         var currentState = actionData.GetAsString("CurrentState");
         var groupOrder = actionData.GetAsInteger("GroupOrder");
         var state = actionData.GetAsString("State");
         var stateOrder = actionData.GetAsInteger("StateOrder");
         var stateValue = actionData.GetAsString("StateValue");
         _ticketService.UpdateOrderStates(ticket, orders.ToList(), stateName, currentState, groupOrder, state, stateOrder, stateValue);
     }
 }
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");
            var orders = Helper.GetOrders(actionData, ticket);

            if (orders.Any())
            {
                var stateName    = actionData.GetAsString("StateName");
                var currentState = actionData.GetAsString("CurrentState");
                var groupOrder   = actionData.GetAsInteger("GroupOrder");
                var state        = actionData.GetAsString("State");
                var stateOrder   = actionData.GetAsInteger("StateOrder");
                var stateValue   = actionData.GetAsString("StateValue");
                _ticketService.UpdateOrderStates(ticket, orders.ToList(), stateName, currentState, groupOrder, state, stateOrder, stateValue);
            }
        }
예제 #4
0
 public override void Process(ActionData actionData)
 {
     var ticketId = actionData.GetAsInteger("TicketId");
     var ticket = _ticketService.OpenTicket(ticketId);
     actionData.DataObject.Ticket = ticket;
     ticket.PublishEvent(EventTopicNames.SetSelectedTicket);
 }
        public override void Process(ActionData actionData)
        {
            var documentId = actionData.GetAsInteger("DocumentId");
            var document   = _accountService.GetAccountTransactionDocumentById(documentId);

            if (document == null)
            {
                return;
            }
            var printerName         = actionData.GetAsString("PrinterName");
            var printerTemplateName = actionData.GetAsString("PrinterTemplateName");
            var printer             = _cacheService.GetPrinters().FirstOrDefault(x => x.Name == printerName);
            var printerTemplate     = _cacheService.GetPrinterTemplates().FirstOrDefault(y => y.Name == printerTemplateName);

            if (printer == null)
            {
                printer = _applicationState.GetTransactionPrinter();
            }
            if (printerTemplate == null)
            {
                var documentType = _cacheService.GetAccountTransactionDocumentTypeById(document.DocumentTypeId);
                printerTemplate = _cacheService.GetPrinterTemplates().First(x => x.Id == documentType.PrinterTemplateId);
            }
            if (printer == null)
            {
                return;
            }
            if (printerTemplate == null)
            {
                return;
            }
            _printerService.PrintObject(document, printer, printerTemplate);
        }
예제 #6
0
        public override void Process(ActionData actionData)
        {
            var ticketId = actionData.GetAsInteger("TicketId");
            var ticket   = _ticketService.OpenTicket(ticketId);

            actionData.DataObject.Ticket = ticket;
            ticket.PublishEvent(EventTopicNames.SetSelectedTicket);
        }
예제 #7
0
 public override void Process(ActionData actionData)
 {
     var ticketId = actionData.GetAsInteger("TicketId");
     if (ticketId > 0)
         ExtensionMethods.PublishIdEvent(ticketId, EventTopicNames.DisplayTicket);
     else
     {
         if (_applicationState.IsLocked)
             EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket);
     }
 }
예제 #8
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         var stateName = actionData.GetAsString("StateName");
         var currentState = actionData.GetAsString("CurrentState");
         var state = actionData.GetAsString("State");
         var stateValue = actionData.GetAsString("StateValue");
         var quantity = actionData.GetAsInteger("Quantity");
         _ticketService.UpdateTicketState(ticket, stateName, currentState, state, stateValue, quantity);
     }
 }
예제 #9
0
 public override void Process(ActionData actionData)
 {
     var entityId = actionData.GetAsInteger("EntityId");
     var entity = entityId > 0 ? _cacheService.GetEntityById(entityId) : actionData.GetDataValue<Entity>("Entity");
     if (entity == null) return;
     var printerName = actionData.GetAsString("PrinterName");
     var printerTemplateName = actionData.GetAsString("PrinterTemplateName");
     var printer = _cacheService.GetPrinters().FirstOrDefault(x => x.Name == printerName);
     var printerTemplate = _cacheService.GetPrinterTemplates().FirstOrDefault(y => y.Name == printerTemplateName);
     if (printer == null) return;
     if (printerTemplate == null) return;
     _printerService.PrintObject(entity, printer, printerTemplate);
 }
예제 #10
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");

            if (ticket != null)
            {
                var stateName    = actionData.GetAsString("StateName");
                var currentState = actionData.GetAsString("CurrentState");
                var state        = actionData.GetAsString("State");
                var stateValue   = actionData.GetAsString("StateValue");
                var quantity     = actionData.GetAsInteger("Quantity");
                _ticketService.UpdateTicketState(ticket, stateName, currentState, state, stateValue, quantity);
            }
        }
예제 #11
0
 public override void Process(ActionData actionData)
 {
     _emailService.SendEMailAsync(actionData.GetAsString("SMTPServer"),
          actionData.GetAsString("SMTPUser"),
          actionData.GetAsString("SMTPPassword"),
          actionData.GetAsInteger("SMTPPort"),
          actionData.GetAsString("ToEMailAddress"),
          actionData.GetAsString("CCEmailAddresses"),
          actionData.GetAsString("FromEMailAddress"),
          actionData.GetAsString("Subject"),
          actionData.GetAsString("EMailMessage"),
          actionData.GetAsString("FileName"),
          actionData.GetAsBoolean("DeleteFile"),
          actionData.GetAsBoolean("BypassSslErrors"));
 }
예제 #12
0
 public override void Process(ActionData actionData)
 {
     _emailService.SendEMailAsync(actionData.GetAsString("SMTPServer"),
                                  actionData.GetAsString("SMTPUser"),
                                  actionData.GetAsString("SMTPPassword"),
                                  actionData.GetAsInteger("SMTPPort"),
                                  actionData.GetAsString("ToEMailAddress"),
                                  actionData.GetAsString("CCEmailAddresses"),
                                  actionData.GetAsString("FromEMailAddress"),
                                  actionData.GetAsString("Subject"),
                                  actionData.GetAsString("EMailMessage"),
                                  actionData.GetAsString("FileName"),
                                  actionData.GetAsBoolean("DeleteFile"),
                                  actionData.GetAsBoolean("BypassSslErrors"));
 }
예제 #13
0
        public override void Process(ActionData actionData)
        {
            var ticketId = actionData.GetAsInteger("TicketId");

            if (ticketId > 0)
            {
                ExtensionMethods.PublishIdEvent(ticketId, EventTopicNames.DisplayTicket);
            }
            else
            {
                if (_applicationState.IsLocked)
                {
                    EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket);
                }
            }
        }
예제 #14
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");
            var pjName = actionData.GetAsString("PrintJobName");

            if (!string.IsNullOrEmpty(pjName))
            {
                var j = _cacheService.GetPrintJobByName(pjName);
                if (j != null)
                {
                    var copies      = actionData.GetAsInteger("Copies");
                    var printTicket = actionData.GetAsBoolean("PrintTicket", true);
                    var priority    = actionData.GetAsBoolean("HighPriority");
                    if (ticket != null && printTicket)
                    {
                        var orderTagName    = actionData.GetAsString("OrderTagName");
                        var orderTagValue   = actionData.GetAsString("OrderTagValue");
                        var orderStateName  = actionData.GetAsString("OrderStateName");
                        var orderState      = actionData.GetAsString("OrderState");
                        var orderStateValue = actionData.GetAsString("OrderStateValue");

                        Expression <Func <Order, bool> > expression = ex => true;
                        if (!string.IsNullOrWhiteSpace(orderTagName))
                        {
                            expression =
                                ex => ex.OrderTagExists(y => y.TagName == orderTagName && y.TagValue == orderTagValue);
                        }
                        if (!string.IsNullOrWhiteSpace(orderStateName))
                        {
                            expression = expression.And(ex => ex.IsInState(orderStateName, orderState));
                            if (!string.IsNullOrWhiteSpace(orderStateValue))
                            {
                                expression = expression.And(ex => ex.IsAnyStateValue(orderStateValue));
                            }
                        }
                        _ticketService.UpdateTicketNumber(ticket, _applicationState.CurrentTicketType.TicketNumerator);
                        ExecuteByCopies(copies, () => _printerService.PrintTicket(ticket, j, expression.Compile(), priority));
                    }
                    else
                    {
                        ExecuteByCopies(copies, () => _printerService.ExecutePrintJob(j, priority));
                    }
                }
            }
        }
예제 #15
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            var pjName = actionData.GetAsString("PrintJobName");
            if (!string.IsNullOrEmpty(pjName))
            {
                var j = _cacheService.GetPrintJobByName(pjName);
                if (j != null)
                {
                    var copies = actionData.GetAsInteger("Copies");
                    var printTicket = actionData.GetAsBoolean("PrintTicket", true);
                    var priority = actionData.GetAsBoolean("HighPriority");
                    if (ticket != null && printTicket)
                    {
                        var orderTagName = actionData.GetAsString("OrderTagName");
                        var orderTagValue = actionData.GetAsString("OrderTagValue");
                        var orderStateName = actionData.GetAsString("OrderStateName");
                        var orderState = actionData.GetAsString("OrderState");
                        var orderStateValue = actionData.GetAsString("OrderStateValue");

                        Expression<Func<Order, bool>> expression = ex => true;
                        if (!string.IsNullOrWhiteSpace(orderTagName))
                        {
                            expression =
                                ex => ex.OrderTagExists(y => y.TagName == orderTagName && y.TagValue == orderTagValue);
                        }
                        if (!string.IsNullOrWhiteSpace(orderStateName))
                        {
                            expression = expression.And(ex => ex.IsInState(orderStateName, orderState));
                            if (!string.IsNullOrWhiteSpace(orderStateValue))
                                expression = expression.And(ex => ex.IsAnyStateValue(orderStateValue));
                        }
                        _ticketService.UpdateTicketNumber(ticket, _applicationState.CurrentTicketType.TicketNumerator);
                        ExecuteByCopies(copies, () => _printerService.PrintTicket(ticket, j, expression.Compile(), priority));
                    }
                    else
                    {
                        ExecuteByCopies(copies, () => _printerService.ExecutePrintJob(j, priority));
                    }
                }
            }
        }
 public override void Process(ActionData actionData)
 {
     var documentId = actionData.GetAsInteger("DocumentId");
     var document = _accountService.GetAccountTransactionDocumentById(documentId);
     if (document == null) return;
     var printerName = actionData.GetAsString("PrinterName");
     var printerTemplateName = actionData.GetAsString("PrinterTemplateName");
     var printer = _cacheService.GetPrinters().FirstOrDefault(x => x.Name == printerName);
     var printerTemplate = _cacheService.GetPrinterTemplates().FirstOrDefault(y => y.Name == printerTemplateName);
     if (printer == null)
     {
         printer = _applicationState.GetTransactionPrinter();
     }
     if (printerTemplate == null)
     {
         var documentType = _cacheService.GetAccountTransactionDocumentTypeById(document.DocumentTypeId);
         printerTemplate = _cacheService.GetPrinterTemplates().First(x => x.Id == documentType.PrinterTemplateId);
     }
     if (printer == null) return;
     if (printerTemplate == null) return;
     _printerService.PrintObject(document, printer, printerTemplate);
 }
예제 #17
0
        public override void Process(ActionData actionData)
        {
            Account account = null;
            var accountId = actionData.GetAsInteger("AccountId");
            if (accountId > 0)
            {
                account = _accountService.GetAccountById(accountId);
            }

            if (account == null)
            {
                var accountName = actionData.GetAsString("AccountName");
                if (!string.IsNullOrEmpty(accountName))
                {
                    account = _accountService.GetAccountByName(accountName);
                }
            }

            if (account != null)
            {
                _reportServiceClient.PrintAccountTransactions(account, actionData.GetAsString("AccountTransactionsFilter"));
            }
        }
        public override void Process(ActionData actionData)
        {
            Account account   = null;
            var     accountId = actionData.GetAsInteger("AccountId");

            if (accountId > 0)
            {
                account = _accountService.GetAccountById(accountId);
            }

            if (account == null)
            {
                var accountName = actionData.GetAsString("AccountName");
                if (!string.IsNullOrEmpty(accountName))
                {
                    account = _accountService.GetAccountByName(accountName);
                }
            }

            if (account != null)
            {
                _reportServiceClient.PrintAccountTransactions(account, actionData.GetAsString("AccountTransactionsFilter"));
            }
        }
예제 #19
0
        public override void Process(ActionData actionData)
        {
            var entityId = actionData.GetAsInteger("EntityId");
            var entity   = entityId > 0 ? _cacheService.GetEntityById(entityId) : actionData.GetDataValue <Entity>("Entity");

            if (entity == null)
            {
                return;
            }
            var printerName         = actionData.GetAsString("PrinterName");
            var printerTemplateName = actionData.GetAsString("PrinterTemplateName");
            var printer             = _cacheService.GetPrinters().FirstOrDefault(x => x.Name == printerName);
            var printerTemplate     = _cacheService.GetPrinterTemplates().FirstOrDefault(y => y.Name == printerTemplateName);

            if (printer == null)
            {
                return;
            }
            if (printerTemplate == null)
            {
                return;
            }
            _printerService.PrintObject(entity, printer, printerTemplate);
        }
        public override void Process(ActionData actionData)
        {
            var settingName = actionData.GetAsString("SettingName");
            var updateType  = actionData.GetAsString("UpdateType");

            if (!string.IsNullOrEmpty(settingName))
            {
                var isLocal = actionData.GetAsBoolean("IsLocal");
                var setting = isLocal
                    ? _settingService.ReadLocalSetting(settingName)
                    : _settingService.ReadGlobalSetting(settingName);

                if (updateType == Resources.Increase)
                {
                    var settingValue = actionData.GetAsInteger("SettingValue");
                    if (string.IsNullOrEmpty(setting.StringValue))
                    {
                        setting.IntegerValue = settingValue;
                    }
                    else
                    {
                        setting.IntegerValue = setting.IntegerValue + settingValue;
                    }
                }
                else if (updateType == Resources.Decrease)
                {
                    var settingValue = actionData.GetAsInteger("SettingValue");
                    if (string.IsNullOrEmpty(setting.StringValue))
                    {
                        setting.IntegerValue = settingValue;
                    }
                    else
                    {
                        setting.IntegerValue = setting.IntegerValue - settingValue;
                    }
                }
                else if (updateType == Resources.Toggle)
                {
                    var settingValue = actionData.GetAsString("SettingValue");
                    var parts        = settingValue.Split(',');
                    if (string.IsNullOrEmpty(setting.StringValue))
                    {
                        setting.StringValue = parts[0];
                    }
                    else
                    {
                        for (var i = 0; i < parts.Length; i++)
                        {
                            if (parts[i] == setting.StringValue)
                            {
                                setting.StringValue = (i + 1) < parts.Length ? parts[i + 1] : parts[0];
                                break;
                            }
                        }
                    }
                }
                else
                {
                    var settingValue = actionData.GetAsString("SettingValue");
                    setting.StringValue = settingValue;
                }
                if (!isLocal)
                {
                    _settingService.SaveProgramSettings();
                }
            }
        }