Esempio n. 1
0
 public override void Process(ActionData actionData)
 {
     var entityId = actionData.GetDataValueAsInt("EntityId");
     var entityTypeId = actionData.GetDataValueAsInt("EntityTypeId");
     var stateName = actionData.GetAsString("EntityStateName");
     var state = actionData.GetAsString("EntityState");
     var quantityExp = actionData.GetAsString("QuantityExp");
     if (state != null)
     {
         if (entityId > 0 && entityTypeId > 0)
         {
             _entityServiceClient.UpdateEntityState(entityId, entityTypeId, stateName, state, quantityExp);
         }
         else
         {
             var ticket = actionData.GetDataValue<Ticket>("Ticket");
             if (ticket != null)
             {
                 var entityTypeName = actionData.GetAsString("EntityTypeName");
                 foreach (var ticketEntity in ticket.TicketEntities)
                 {
                     var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
                     if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
                         _entityServiceClient.UpdateEntityState(ticketEntity.EntityId, ticketEntity.EntityTypeId, stateName, state, quantityExp);
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public override void Process(ActionData actionData)
 {
     var entityId = actionData.GetDataValueAsInt("EntityId");
     var entityName = actionData.GetAsString("EntityName");
     var fieldName = actionData.GetAsString("FieldName");
     var value = actionData.GetAsString("FieldValue");
     if (entityId > 0)
     {
         _entityServiceClient.UpdateEntityData(entityId, fieldName, value);
     }
     else if (!string.IsNullOrEmpty(entityName))
     {
         var entityTypeName = actionData.GetAsString("EntityTypeName");
         var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
         if (entityType != null)
         {
             _entityServiceClient.UpdateEntityData(entityType, entityName, fieldName, value);
         }
     }
     else
     {
         var ticket = actionData.GetDataValue<Ticket>("Ticket");
         if (ticket != null)
         {
             var entityTypeName = actionData.GetAsString("EntityTypeName");
             foreach (var ticketEntity in ticket.TicketEntities)
             {
                 var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
                 if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
                     _entityServiceClient.UpdateEntityData(ticketEntity.EntityId, fieldName, value);
             }
         }
     }
 }
        public override void Process(ActionData actionData)
        {
            var variableName = actionData.GetAsString("VariableName");
            var find         = actionData.GetAsString("Find");
            var replace      = actionData.GetAsString("Replace");

            if (!string.IsNullOrEmpty(variableName))
            {
                var value = actionData.GetDataValueAsString(variableName);
                if (string.IsNullOrEmpty(find) && !string.IsNullOrEmpty(replace) && replace.Contains("(") && replace.Contains(")") && Regex.IsMatch(value, replace))
                {
                    value = Regex.Replace(value, replace, (match) => match.Groups[1].Value);
                }
                else if (string.IsNullOrEmpty(find) && !string.IsNullOrEmpty(replace))
                {
                    value = replace;
                }
                else if (!string.IsNullOrEmpty(find) && replace != null && Regex.IsMatch(value, find))
                {
                    value = Regex.Replace(value, find, replace);
                }
                else if (!string.IsNullOrEmpty(find) && replace != null)
                {
                    value = value.Replace(find, replace);
                }
                actionData.SetDataValue(variableName, value);
            }
        }
Esempio n. 4
0
 public override void Process(ActionData actionData)
 {
     var priceTag = actionData.GetAsString("PriceTag");
     var departmentName = actionData.GetAsString("DepartmentName");
     _departmentService.UpdatePriceTag(departmentName, priceTag);
     _methodQueue.Queue("ResetCache", () => Helper.ResetCache(_triggerService, _applicationState));
 }
        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);
        }
Esempio n. 6
0
        public override void Process(ActionData actionData)
        {
            var entityId     = actionData.GetDataValueAsInt("EntityId");
            var entityTypeId = actionData.GetDataValueAsInt("EntityTypeId");
            var stateName    = actionData.GetAsString("EntityStateName");
            var state        = actionData.GetAsString("EntityState");
            var quantityExp  = actionData.GetAsString("QuantityExp");

            if (state != null)
            {
                if (entityId > 0 && entityTypeId > 0)
                {
                    _entityServiceClient.UpdateEntityState(entityId, entityTypeId, stateName, state, quantityExp);
                }
                else
                {
                    var ticket = actionData.GetDataValue <Ticket>("Ticket");
                    if (ticket != null)
                    {
                        var entityTypeName = actionData.GetAsString("EntityTypeName");
                        foreach (var ticketEntity in ticket.TicketEntities)
                        {
                            var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
                            if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
                            {
                                _entityServiceClient.UpdateEntityState(ticketEntity.EntityId, ticketEntity.EntityTypeId, stateName, state, quantityExp);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 7
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     var orderTagName = actionData.GetAsString("OrderTagName");
     if (ticket != null && !string.IsNullOrEmpty(orderTagName))
     {
         var orderTagValue = actionData.GetAsString("OrderTagValue");
         if (ticket.Orders.Any(y => y.OrderTagExists(z => z.TagName == orderTagName && z.TagValue == orderTagValue)))
         {
             var tid = ticket.Id;
             EventServiceFactory.EventService.PublishEvent(EventTopicNames.CloseTicketRequested, true);
             ticket = _ticketService.OpenTicket(tid);
             var orders = ticket.Orders.Where(y => y.OrderTagExists(z => z.TagName == orderTagName && z.TagValue == orderTagValue)).ToArray();
             var commitResult = _ticketService.MoveOrders(ticket, orders, 0);
             if (string.IsNullOrEmpty(commitResult.ErrorMessage) && commitResult.TicketId > 0)
             {
                 ExtensionMethods.PublishIdEvent(commitResult.TicketId, EventTopicNames.DisplayTicket);
             }
             else
             {
                 ExtensionMethods.PublishIdEvent(tid, EventTopicNames.DisplayTicket);
             }
         }
     }
 }
Esempio n. 8
0
 public override void Process(ActionData actionData)
 {
     var entityTypeName = actionData.GetAsString("EntityTypeName");
     var entityName = actionData.GetAsString("EntityName");
     var createAccount = actionData.GetAsBoolean("CreateAccount");
     var customData = actionData.GetAsString("CustomData");
     if (!string.IsNullOrEmpty(entityTypeName) && !string.IsNullOrEmpty(entityName))
     {
         var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
         var entity = _entityService.CreateEntity(entityType.Id, entityName);
         if (customData.Contains(":"))
         {
             foreach (var parts in customData.Split('#').Select(data => data.Split('=')))
                 entity.SetCustomData(parts[0], parts[1]);
         }
         if (createAccount)
         {
             var accountName = entityType.GenerateAccountName(entity);
             var accountId = _accountService.CreateAccount(entityType.AccountTypeId, accountName);
             entity.AccountId = accountId;
             actionData.DataObject.AccountName = accountName;
         }
         _entityService.SaveEntity(entity);
         actionData.DataObject.EntityName = entity.Name;
     }
 }
Esempio n. 9
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");

            if (ticket != null)
            {
                var menuItemName = actionData.GetAsString("MenuItemName");
                var menuItem = _cacheService.GetMenuItem(y => y.Name == menuItemName);
                var portionName = actionData.GetAsString("PortionName");
                var quantity = actionData.GetAsDecimal("Quantity");
                var tag = actionData.GetAsString("Tag");
                var orderStateName = actionData.GetAsString("OrderStateName");
                var orderState = actionData.GetAsString("OrderState");

                var osv = orderState.Contains("=") ? orderState : orderStateName + "=" + orderState;
                var order = _ticketService.AddOrder(ticket, menuItem.Id, quantity, portionName, osv);

                if (!string.IsNullOrEmpty(actionData.GetAsString("Price")))
                    order.UpdatePrice(actionData.GetAsDecimal("Price"), "");
                if (!string.IsNullOrEmpty(actionData.GetAsString("IncreaseInventory")))
                    order.IncreaseInventory = actionData.GetAsBoolean("IncreaseInventory");
                if (!string.IsNullOrEmpty(actionData.GetAsString("DecreaseInventory")))
                    order.DecreaseInventory = actionData.GetAsBoolean("DecreaseInventory");
                if (!string.IsNullOrEmpty(actionData.GetAsString("Locked")))
                    order.Locked = actionData.GetAsBoolean("Locked");
                if (!string.IsNullOrEmpty(actionData.GetAsString("CalculatePrice")))
                    order.CalculatePrice = actionData.GetAsBoolean("CalculatePrice");

                if (order != null) order.Tag = tag;
                actionData.DataObject.Order = order;
                order.PublishEvent(EventTopicNames.OrderAdded);
            }
        }
Esempio n. 10
0
        public override void Process(ActionData actionData)
        {
            var fileName = actionData.GetAsString("FileName");
            var arguments = actionData.GetAsString("Arguments");
            if (!string.IsNullOrEmpty(fileName))
            {
                var psi = new ProcessStartInfo(fileName, arguments);
                var isHidden = actionData.GetAsBoolean("IsHidden");
                if (isHidden) psi.WindowStyle = ProcessWindowStyle.Hidden;

                var useShellExecute = actionData.GetAsBoolean("UseShellExecute");
                if (useShellExecute) psi.UseShellExecute = true;

                var workingDirectory = actionData.GetAsString("WorkingDirectory");
                if (!string.IsNullOrEmpty(workingDirectory))
                    psi.WorkingDirectory = workingDirectory;
                try
                {
                    System.Diagnostics.Process.Start(psi);
                }
                catch (Exception e)
                {
                    _logService.LogError(e, string.Format("Start Process action [{0}] generated an error. See log file for details.", actionData.Action.Name));
                }
            }
        }
Esempio n. 11
0
        public override void Process(ActionData actionData)
        {
            var fileName  = actionData.GetAsString("FileName");
            var arguments = actionData.GetAsString("Arguments");

            if (!string.IsNullOrEmpty(fileName))
            {
                var psi      = new ProcessStartInfo(fileName, arguments);
                var isHidden = actionData.GetAsBoolean("IsHidden");
                if (isHidden)
                {
                    psi.WindowStyle = ProcessWindowStyle.Hidden;
                }

                var useShellExecute = actionData.GetAsBoolean("UseShellExecute");
                if (useShellExecute)
                {
                    psi.UseShellExecute = true;
                }

                var workingDirectory = actionData.GetAsString("WorkingDirectory");
                if (!string.IsNullOrEmpty(workingDirectory))
                {
                    psi.WorkingDirectory = workingDirectory;
                }
                try
                {
                    System.Diagnostics.Process.Start(psi);
                }
                catch (Exception e)
                {
                    _logService.LogError(e, string.Format("Start Process action [{0}] generated an error. See log file for details.", actionData.Action.Name));
                }
            }
        }
Esempio n. 12
0
        public override void Process(ActionData actionData)
        {
            var entityTypeName = actionData.GetAsString("EntityTypeName");
            var entityName     = actionData.GetAsString("EntityName");
            var createAccount  = actionData.GetAsBoolean("CreateAccount");
            var customData     = actionData.GetAsString("CustomData");

            if (!string.IsNullOrEmpty(entityTypeName) && !string.IsNullOrEmpty(entityName))
            {
                var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
                var entity     = _entityService.CreateEntity(entityType.Id, entityName);
                if (customData.Contains("="))
                {
                    foreach (var parts in customData.Split(';').Select(data => data.Split('=')))
                    {
                        entity.SetCustomData(parts[0], parts[1]);
                    }
                }
                if (createAccount)
                {
                    var accountName = entityType.GenerateAccountName(entity);
                    var accountId   = _accountService.CreateAccount(entityType.AccountTypeId, accountName);
                    entity.AccountId = accountId;
                    actionData.DataObject.AccountName = accountName;
                }
                _entityService.SaveEntity(entity);
                actionData.DataObject.Entity     = entity;
                actionData.DataObject.EntityName = entity.Name;
                actionData.DataObject.EntityId   = entity.Id;
            }
        }
        public override void Process(ActionData actionData)
        {
            var ticket       = actionData.GetDataValue <Ticket>("Ticket");
            var orderTagName = actionData.GetAsString("OrderTagName");

            if (ticket != null && !string.IsNullOrEmpty(orderTagName))
            {
                var orderTagValue = actionData.GetAsString("OrderTagValue");
                if (ticket.Orders.Any(y => y.OrderTagExists(z => z.TagName == orderTagName && z.TagValue == orderTagValue)))
                {
                    var tid = ticket.Id;
                    EventServiceFactory.EventService.PublishEvent(EventTopicNames.CloseTicketRequested, true);
                    ticket = _ticketService.OpenTicket(tid);
                    var orders       = ticket.Orders.Where(y => y.OrderTagExists(z => z.TagName == orderTagName && z.TagValue == orderTagValue)).ToArray();
                    var commitResult = _ticketService.MoveOrders(ticket, orders, 0);
                    if (string.IsNullOrEmpty(commitResult.ErrorMessage) && commitResult.TicketId > 0)
                    {
                        ExtensionMethods.PublishIdEvent(commitResult.TicketId, EventTopicNames.DisplayTicket);
                    }
                    else
                    {
                        ExtensionMethods.PublishIdEvent(tid, EventTopicNames.DisplayTicket);
                    }
                }
            }
        }
Esempio n. 14
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            var orders = Helper.GetOrders(actionData, ticket);
            if (orders.Any())
            {
                var tagName = actionData.GetAsString("OrderTagName");
                var orderTag = _cacheService.GetOrderTagGroupByName(tagName);

                if (orderTag != null)
                {
                    var tagValue = actionData.GetAsString("OrderTagValue");
                    var oldTagValue = actionData.GetAsString("OldOrderTagValue");
                    var tagNote = actionData.GetAsString("OrderTagNote");
                    var orderTagValue = orderTag.OrderTags.SingleOrDefault(y => y.Name == tagValue);

                    if (orderTagValue != null)
                    {
                        if (!string.IsNullOrEmpty(actionData.GetAsString("OrderTagPrice")))
                        {
                            var price = actionData.GetAsDecimal("OrderTagPrice");
                            orderTagValue.Price = price;
                        }

                        if (!string.IsNullOrEmpty(oldTagValue))
                            orders = orders.Where(o => o.OrderTagExists(y => y.OrderTagGroupId == orderTag.Id && y.TagValue == oldTagValue)).ToList();
                        if (actionData.Action.ActionType == ActionNames.TagOrder)
                            _ticketService.TagOrders(ticket, orders, orderTag, orderTagValue, tagNote);
                        if (actionData.Action.ActionType == ActionNames.UntagOrder)
                            _ticketService.UntagOrders(ticket, orders, orderTag, orderTagValue);
                    }
                }
            }
        }
Esempio n. 15
0
        public override void Process(ActionData actionData)
        {
            var priceTag       = actionData.GetAsString("PriceTag");
            var departmentName = actionData.GetAsString("DepartmentName");

            _departmentService.UpdatePriceTag(departmentName, priceTag);
            _methodQueue.Queue("ResetCache", () => Helper.ResetCache(_triggerService, _applicationState));
        }
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");

            if ((ticket == null || ticket == Ticket.Empty) && actionData.GetAsBoolean("CanCreateTicket") && !_applicationState.IsLocked)
            {
                ticket = _ticketService.OpenTicket(0);
                actionData.DataObject.Ticket = ticket;
                ticket.PublishEvent(EventTopicNames.SetSelectedTicket);
            }

            if (ticket != null)
            {
                var entityTypeName        = actionData.GetAsString("EntityTypeName");
                var entityName            = actionData.GetAsString("EntityName");
                var customDataSearchValue = actionData.GetAsString("EntitySearchValue");
                var entityType            = _cacheService.GetEntityTypeByName(entityTypeName);
                if (entityType != null)
                {
                    if (string.IsNullOrEmpty(entityName) && string.IsNullOrEmpty(customDataSearchValue))
                    {
                        CommonEventPublisher.PublishEntityOperation(Entity.GetNullEntity(entityType.Id), EventTopicNames.SelectEntity, EventTopicNames.EntitySelected);
                        return;
                    }

                    Entity entity = null;
                    if (!string.IsNullOrEmpty(customDataSearchValue))
                    {
                        var entities = _entityService.SearchEntities(entityType,
                                                                     customDataSearchValue,
                                                                     null);
                        if (entities.Count == 1)
                        {
                            entity = entities.First();
                        }
                    }

                    if (entity == null)
                    {
                        entity = _cacheService.GetEntityByName(entityTypeName, entityName);
                    }

                    if (entity == null && string.IsNullOrEmpty(entityName) && string.IsNullOrEmpty(customDataSearchValue))
                    {
                        entity = Entity.GetNullEntity(entityType.Id);
                    }

                    if (entity != null)
                    {
                        _ticketService.UpdateEntity(ticket, entity);
                        actionData.DataObject.EntityName = entity.Name;
                        actionData.DataObject.EntityId   = entity.Id;
                        actionData.DataObject.CustomData = entity.CustomData;
                    }
                }
            }
        }
Esempio n. 17
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            if ((ticket == null || ticket == Ticket.Empty) && actionData.GetAsBoolean("CanCreateTicket") && !_applicationState.IsLocked)
            {
                ticket = _ticketService.OpenTicket(0);
                actionData.DataObject.Ticket = ticket;
                ticket.PublishEvent(EventTopicNames.SetSelectedTicket);
            }

            if (ticket != null)
            {
                var entityTypeName = actionData.GetAsString("EntityTypeName");
                var entityName = actionData.GetAsString("EntityName");
                var customDataSearchValue = actionData.GetAsString("EntitySearchValue");
                var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
                if (entityType != null)
                {
                    if (string.IsNullOrEmpty(entityName) && string.IsNullOrEmpty(customDataSearchValue))
                    {
                        CommonEventPublisher.PublishEntityOperation(Entity.GetNullEntity(entityType.Id), EventTopicNames.SelectEntity, EventTopicNames.EntitySelected);
                        return;
                    }

                    Entity entity = null;
                    if (!string.IsNullOrEmpty(customDataSearchValue))
                    {

                        var entities = _entityService.SearchEntities(entityType,
                                                                    customDataSearchValue,
                                                                    null);
                        if (entities.Count == 1)
                        {
                            entity = entities.First();
                        }
                    }

                    if (entity == null)
                    {
                        entity = _cacheService.GetEntityByName(entityTypeName, entityName);
                    }

                    if (entity == null && string.IsNullOrEmpty(entityName) && string.IsNullOrEmpty(customDataSearchValue))
                    {
                        entity = Entity.GetNullEntity(entityType.Id);
                    }

                    if (entity != null)
                    {
                        _ticketService.UpdateEntity(ticket, entity);
                        actionData.DataObject.EntityName = entity.Name;
                        actionData.DataObject.EntityId = entity.Id;
                        actionData.DataObject.CustomData = entity.CustomData;
                    }
                }
            }
        }
Esempio n. 18
0
 public override void Process(ActionData actionData)
 {
     var widgetName = actionData.GetAsString("WidgetName");
     var value = actionData.GetAsString("Value");
     if (!string.IsNullOrEmpty(widgetName) && !string.IsNullOrEmpty(value))
     {
         var data = new WidgetEventData { WidgetName = widgetName, Value = value };
         data.PublishEvent(EventTopicNames.SetWidgetValue);
     }
 }
Esempio n. 19
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         var tagName = actionData.GetAsString("TagName");
         var tagValue = actionData.GetAsString("TagValue");
         _ticketService.UpdateTag(ticket, tagName, tagValue);
     }
 }
Esempio n. 20
0
        public override void Process(ActionData actionData)
        {
            Ticket dataValue = actionData.GetDataValue <Ticket>("Ticket");

            if (dataValue != null)
            {
                bool asBoolean = actionData.GetAsBoolean("SelectAll", false);
                dataValue.Orders.ToList <Order>().ForEach((Order x) => x.IsSelected = asBoolean);
                IDictionary <string, object> dataObject = (IDictionary <string, object>)((dynamic)actionData.DataObject);
                if (dataObject.ContainsKey("Order"))
                {
                    dataObject.Remove("Order");
                }
                string asString = actionData.GetAsString("OrderIds");
                if (!string.IsNullOrEmpty(asString))
                {
                    char[]     chrArray = new char[] { ',' };
                    List <int> list     = (
                        from x in asString.Split(chrArray)
                        where !string.IsNullOrEmpty(x)
                        select Convert.ToInt32(x)).ToList <int>();
                    foreach (Order order in dataValue.Orders)
                    {
                        order.IsSelected = list.Contains(order.Id);
                    }
                }
                string str = actionData.GetAsString("OrderState");
                if (!string.IsNullOrEmpty(str))
                {
                    string[] strArrays = str.Split(new char[] { ',' });
                    for (int i = 0; i < (int)strArrays.Length; i++)
                    {
                        string str1 = strArrays[i];
                        foreach (Order order1 in dataValue.Orders)
                        {
                            if (!str1.Contains <char>('='))
                            {
                                order1.IsSelected = order1.IsInState(str1);
                            }
                            else
                            {
                                string[] strArrays1 = str1.Split(new char[] { '=' });
                                order1.IsSelected = order1.IsInState(strArrays1[0], strArrays1[1]);
                            }
                        }
                    }
                }
                if (dataValue.Orders.Count <Order>((Order x) => x.IsSelected) == 1)
                {
                    dynamic       obj    = actionData.DataObject;
                    IList <Order> orders = dataValue.Orders;
                    obj.Order = orders.FirstOrDefault <Order>((Order x) => x.IsSelected);
                }
            }
        }
Esempio n. 21
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();
            }
        }
Esempio n. 22
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");

            if (ticket != null)
            {
                var tagName  = actionData.GetAsString("TagName");
                var tagValue = actionData.GetAsString("TagValue");
                _ticketService.UpdateTag(ticket, tagName, tagValue);
            }
        }
Esempio n. 23
0
        public override void Process(ActionData actionData)
        {
            string asString  = actionData.GetAsString("TaskName");
            string str       = actionData.GetAsString("Arguments");
            bool   asBoolean = actionData.GetAsBoolean("SkipConfirmation", false);

            if (!string.IsNullOrEmpty(asString))
            {
                this._databaseTaskManager.ExecuteTask(new DatabaseTask(asString, str), asBoolean);
            }
        }
Esempio n. 24
0
 public override void Process(ActionData actionData)
 {
     var name = actionData.GetAsString("Name");
     var values = actionData.GetAsString("Values");
     if (!string.IsNullOrEmpty(values))
     {
         foreach (var value in values.Split(','))
         {
             _applicationState.NotifyEvent(RuleEventNames.ValueLooped, new { Name = name, Value = value });
         }
     }
 }
Esempio n. 25
0
 public override void Process(ActionData actionData)
 {
     if (actionData.Action.ActionType == "DisplayPopup")
     {
         var title = actionData.GetAsString("Title");
         var message = actionData.GetAsString("Message");
         var color = actionData.GetAsString("Color");
         color = string.IsNullOrEmpty(color.Trim()) ? "DarkRed" : color;
         if (!string.IsNullOrEmpty(message.Trim()))
             _userInteraction.DisplayPopup(title, message, color);
     }
 }
Esempio n. 26
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);
     }
 }
Esempio n. 27
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         var category = actionData.GetAsString("Category");
         var log = actionData.GetAsString("Log");
         if (!string.IsNullOrEmpty(log))
         {
             ticket.AddLog(_applicationState.CurrentLoggedInUser.Name, category, log);
         }
     }
 }
Esempio n. 28
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);
 }
Esempio n. 29
0
        public override void Process(ActionData actionData)
        {
            var name   = actionData.GetAsString("Name");
            var values = actionData.GetAsString("Values");

            if (!string.IsNullOrEmpty(values))
            {
                foreach (var value in values.Split(','))
                {
                    _applicationState.NotifyEvent(RuleEventNames.ValueLooped, new { Name = name, Value = value });
                }
            }
        }
        public override void Process(ActionData actionData)
        {
            var widgetName = actionData.GetAsString("WidgetName");
            var value      = actionData.GetAsString("Value") ?? "";

            if (!string.IsNullOrEmpty(widgetName))
            {
                var data = new WidgetEventData {
                    WidgetName = widgetName, Value = value
                };
                data.PublishEvent(EventTopicNames.SetWidgetValue);
            }
        }
Esempio n. 31
0
 public override void Process(ActionData actionData)
 {
     if (actionData.Action.ActionType == "DisplayPopup")
     {
         var title   = actionData.GetAsString("Title");
         var message = actionData.GetAsString("Message");
         var color   = actionData.GetAsString("Color");
         color = string.IsNullOrEmpty(color.Trim()) ? "DarkRed" : color;
         if (!string.IsNullOrEmpty(message.Trim()))
         {
             _userInteraction.DisplayPopup(title, message, color);
         }
     }
 }
        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.GetAsString("QuantityExp");
                _ticketService.UpdateTicketState(ticket, stateName, currentState, state, stateValue, quantity);
            }
        }
 public override void Process(ActionData actionData)
 {
     var documentName = actionData.GetAsString("AccountTransactionDocumentName");
     var documentType = _cacheService.GetAccountTransactionDocumentTypeByName(documentName);
     var accountName = actionData.GetAsString("AccountName");
     var description = actionData.GetAsString("Description");
     var amount = actionData.GetAsDecimal("Amount");
     if (amount > 0)
     {
         var account = _accountService.GetAccountByName(accountName);
         var document = _accountService.CreateTransactionDocument(account, documentType, description, amount, null);
         actionData.DataObject.DocumentId = document.Id;
     }
 }
Esempio n. 34
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");

            if (ticket != null)
            {
                var category = actionData.GetAsString("Category");
                var log      = actionData.GetAsString("Log");
                if (!string.IsNullOrEmpty(log))
                {
                    ticket.AddLog(_applicationState.CurrentLoggedInUser.Name, category, log);
                }
            }
        }
Esempio n. 35
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");

            if (ticket != null)
            {
                var menuItemName = actionData.GetAsString("MenuItemName");
                var menuItem     = GetMenuItem(menuItemName);
                if (menuItem == null)
                {
                    return;
                }
                var portionName    = actionData.GetAsString("PortionName");
                var quantity       = actionData.GetAsDecimal("Quantity");
                var tag            = actionData.GetAsString("Tag");
                var orderStateName = actionData.GetAsString("OrderStateName");
                var orderState     = actionData.GetAsString("OrderState");

                var osv   = orderState.Contains("=") ? orderState : orderStateName + "=" + orderState;
                var order = _ticketService.AddOrder(ticket, menuItem.Id, quantity, portionName, osv);

                if (!string.IsNullOrEmpty(actionData.GetAsString("Price")))
                {
                    order.UpdatePrice(actionData.GetAsDecimal("Price"), "");
                }
                if (!string.IsNullOrEmpty(actionData.GetAsString("IncreaseInventory")))
                {
                    order.IncreaseInventory = actionData.GetAsBoolean("IncreaseInventory");
                }
                if (!string.IsNullOrEmpty(actionData.GetAsString("DecreaseInventory")))
                {
                    order.DecreaseInventory = actionData.GetAsBoolean("DecreaseInventory");
                }
                if (!string.IsNullOrEmpty(actionData.GetAsString("Locked")))
                {
                    order.Locked = actionData.GetAsBoolean("Locked");
                }
                if (!string.IsNullOrEmpty(actionData.GetAsString("CalculatePrice")))
                {
                    order.CalculatePrice = actionData.GetAsBoolean("CalculatePrice");
                }

                if (order != null)
                {
                    order.Tag = tag;
                }
                actionData.DataObject.Order = order;
                order.PublishEvent(EventTopicNames.OrderAdded);
            }
        }
Esempio n. 36
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);
     }
 }
Esempio n. 37
0
 public override void Process(ActionData actionData)
 {
     var reportName = actionData.GetAsString("ReportName");
     var fileName = actionData.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);
         }
     }
 }
        public override void Process(ActionData actionData)
        {
            var documentName = actionData.GetAsString("AccountTransactionDocumentName");
            var documentType = _cacheService.GetAccountTransactionDocumentTypeByName(documentName);
            var accountName  = actionData.GetAsString("AccountName");
            var description  = actionData.GetAsString("Description");
            var amount       = actionData.GetAsDecimal("Amount");

            if (amount > 0)
            {
                var account  = _accountService.GetAccountByName(accountName);
                var document = _accountService.CreateTransactionDocument(account, documentType, description, amount, null);
                actionData.DataObject.DocumentId = document.Id;
            }
        }
        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);
            }
        }
Esempio n. 40
0
 public override void Process(ActionData actionData)
 {
     var filePath = actionData.GetAsString("FilePath");
     var text = actionData.GetAsString("Text");
     try
     {
         var dir = Path.GetDirectoryName(filePath);
         if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
             Directory.CreateDirectory(dir);
         File.AppendAllText(filePath, text + Environment.NewLine);
     }
     catch (Exception e)
     {
         _logService.LogError(e);
     }
 }
Esempio n. 41
0
        public override void Process(ActionData actionData)
        {
            var ticketTagName = actionData.GetAsString("TicketTagName");
            var ticketStateName = actionData.GetAsString("TicketStateName");

            if (!string.IsNullOrEmpty(ticketStateName))
            {
                var dt = new TicketStateData { StateName = ticketStateName };
                dt.PublishEvent(EventTopicNames.ActivateTicketList);
            }
            else if (!string.IsNullOrEmpty(ticketTagName))
            {
                var dt = new TicketTagGroup { Name = ticketTagName };
                dt.PublishEvent(EventTopicNames.ActivateTicketList);
            }
        }
Esempio n. 42
0
        public override void Process(ActionData actionData)
        {
            var reportName = actionData.GetAsString("ReportName");
            var fileName   = actionData.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);
                }
            }
        }
Esempio n. 43
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");

            if (ticket != null)
            {
                var menuItemName = actionData.GetAsString("MenuItemName");
                var menuItem = _cacheService.GetMenuItem(y => y.Name == menuItemName);
                var portionName = actionData.GetAsString("PortionName");
                var quantity = actionData.GetAsDecimal("Quantity");
                var tag = actionData.GetAsString("Tag");
                var order = _ticketService.AddOrder(ticket, menuItem.Id, quantity, portionName);
                if (order != null) order.Tag = tag;
                order.PublishEvent(EventTopicNames.OrderAdded);
            }
        }
Esempio n. 44
0
        public override void Process(ActionData actionData)
        {
            var name   = actionData.GetAsString("Name");
            var values = actionData.GetAsString("Values");

            if (!string.IsNullOrEmpty(values))
            {
                if (!values.Contains(",") && values.StartsWith("(") && values.EndsWith(")"))
                {
                    var endStr = values.Trim(new[] { '(', ')' });
                    int end;
                    var start = 0;
                    if (endStr.Contains("-"))
                    {
                        var parts = endStr.Split('-');
                        int.TryParse(parts[0], out start);
                        int.TryParse(parts[1], out end);
                    }
                    else
                    {
                        int.TryParse(endStr, out end);
                    }

                    if (end > 0)
                    {
                        for (var i = start; i < end; i++)
                        {
                            _applicationState.NotifyEvent(RuleEventNames.ValueLooped, GenerateDataObject(actionData, name, i.ToString(CultureInfo.InvariantCulture)));
                        }
                    }
                }
                else if (values.Contains(":") && File.Exists(values))
                {
                    foreach (var value in File.ReadAllLines(values))
                    {
                        _applicationState.NotifyEvent(RuleEventNames.ValueLooped, GenerateDataObject(actionData, name, value));
                    }
                }
                else
                {
                    foreach (var value in values.Split(','))
                    {
                        _applicationState.NotifyEvent(RuleEventNames.ValueLooped, GenerateDataObject(actionData, name, value));
                    }
                }
            }
        }
Esempio n. 45
0
 public override void Process(ActionData actionData)
 {
     var filePath = actionData.GetAsString("FilePath");
     var text = actionData.GetAsString("Text");
     try
     {
         if (!File.Exists(filePath))
         {
             File.Create(filePath);
         }
         File.AppendAllText(filePath, text + Environment.NewLine);
     }
     catch (Exception e)
     {
         _logService.LogError(e);
     }
 }
Esempio n. 46
0
 public override void Process(ActionData actionData)
 {
     var script = actionData.GetAsString("ScriptName");
     if (!string.IsNullOrEmpty(script))
     {
         _expressionService.EvalCommand(script, "", actionData.DataObject, true);
     }
 }
Esempio n. 47
0
        public override void Process(ActionData actionData)
        {
            var param = actionData.GetAsString("Message");

            if (!string.IsNullOrEmpty(param))
            {
                _userInteraction.GiveFeedback(param);
            }
        }
Esempio n. 48
0
 public override void Process(ActionData actionData)
 {
     var screenName = actionData.GetAsString("AccountScreenName");
     var screen = _cacheService.GetAccountScreens().FirstOrDefault(x => x.Name == screenName);
     if (screen != null)
     {
         _reportServiceClient.PrintAccountScreen(screen);
     }
 }
Esempio n. 49
0
        public override void Process(ActionData actionData)
        {
            var terminalName = actionData.GetAsString("TerminalName");

            if (!string.IsNullOrEmpty(terminalName))
            {
                _applicationStateSetter.SetCurrentTerminal(terminalName);
            }
        }
Esempio n. 50
0
        public override void Process(ActionData actionData)
        {
            var filePath = actionData.GetAsString("FilePath");
            var text     = actionData.GetAsString("Text");

            try
            {
                if (!File.Exists(filePath))
                {
                    File.Create(filePath);
                }
                File.AppendAllText(filePath, text + Environment.NewLine);
            }
            catch (Exception e)
            {
                _logService.LogError(e);
            }
        }
        public override void Process(ActionData actionData)
        {
            var script = actionData.GetAsString("ScriptName");

            if (!string.IsNullOrEmpty(script))
            {
                _expressionService.EvalCommand(script, "", actionData.DataObject, true);
            }
        }
Esempio n. 52
0
        public override void Process(ActionData actionData)
        {
            var entityId   = actionData.GetDataValueAsInt("EntityId");
            var entityName = actionData.GetAsString("EntityName");
            var fieldName  = actionData.GetAsString("FieldName");
            var value      = actionData.GetAsString("FieldValue");

            if (entityId > 0)
            {
                _entityServiceClient.UpdateEntityData(entityId, fieldName, value);
            }
            else if (!string.IsNullOrEmpty(entityName))
            {
                var entityTypeName = actionData.GetAsString("EntityTypeName");
                var entityType     = _cacheService.GetEntityTypeByName(entityTypeName);
                if (entityType != null)
                {
                    _entityServiceClient.UpdateEntityData(entityType, entityName, fieldName, value);
                }
            }
            else
            {
                var ticket = actionData.GetDataValue <Ticket>("Ticket");
                if (ticket != null)
                {
                    var entityTypeName = actionData.GetAsString("EntityTypeName");
                    foreach (var ticketEntity in ticket.TicketEntities)
                    {
                        var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
                        if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
                        {
                            _entityServiceClient.UpdateEntityData(ticketEntity.EntityId, fieldName, value);
                        }
                    }
                }
            }

            var entity = actionData.GetDataValue <Entity>("Entity");

            if (entity != null && entity.Id == entityId)
            {
                entity.SetCustomData(fieldName, value);
            }
        }
Esempio n. 53
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"));
 }
Esempio n. 54
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"));
 }
Esempio n. 55
0
        public override void Process(ActionData actionData)
        {
            var name = actionData.GetAsString("Name");
            var values = actionData.GetAsString("Values");
            if (!string.IsNullOrEmpty(values))
            {
                if (!values.Contains(",") && values.StartsWith("(") && values.EndsWith(")"))
                {
                    var endStr = values.Trim(new[] { '(', ')' });
                    int end;
                    var start = 0;
                    if (endStr.Contains("-"))
                    {
                        var parts = endStr.Split('-');
                        int.TryParse(parts[0], out start);
                        int.TryParse(parts[1], out end);
                    }
                    else int.TryParse(endStr, out end);

                    if (end > 0)
                    {
                        for (var i = start; i < end; i++)
                        {
                            _applicationState.NotifyEvent(RuleEventNames.ValueLooped, GenerateDataObject(actionData, name, i.ToString(CultureInfo.InvariantCulture)));
                        }
                    }
                }
                else if (values.Contains(":") && File.Exists(values))
                {
                    foreach (var value in File.ReadAllLines(values))
                    {
                        _applicationState.NotifyEvent(RuleEventNames.ValueLooped, GenerateDataObject(actionData, name, value));
                    }
                }
                else
                {
                    foreach (var value in values.Split(','))
                    {
                        _applicationState.NotifyEvent(RuleEventNames.ValueLooped, GenerateDataObject(actionData, name, value));
                    }
                }
            }
        }
Esempio n. 56
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");

            if (ticket != null)
            {
                var menuItemName = actionData.GetAsString("MenuItemName");
                var menuItem     = _cacheService.GetMenuItem(y => y.Name == menuItemName);
                var portionName  = actionData.GetAsString("PortionName");
                var quantity     = actionData.GetAsDecimal("Quantity");
                var tag          = actionData.GetAsString("Tag");
                var order        = _ticketService.AddOrder(ticket, menuItem.Id, quantity, portionName);
                if (order != null)
                {
                    order.Tag = tag;
                }
                order.PublishEvent(EventTopicNames.OrderAdded);
            }
        }
Esempio n. 57
0
        public override void Process(ActionData actionData)
        {
            var screenName = actionData.GetAsString("AccountScreenName");
            var screen     = _cacheService.GetAccountScreens().FirstOrDefault(x => x.Name == screenName);

            if (screen != null)
            {
                _reportServiceClient.PrintAccountScreen(screen);
            }
        }
Esempio n. 58
0
        public override void Process(ActionData actionData)
        {
            var filePath = actionData.GetAsString("FilePath");
            var text     = actionData.GetAsString("Text");

            try
            {
                var dir = Path.GetDirectoryName(filePath);
                if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
                File.AppendAllText(filePath, text + Environment.NewLine);
            }
            catch (Exception e)
            {
                _logService.LogError(e);
            }
        }
Esempio n. 59
0
        public override void Process(ActionData actionData)
        {
            var variableName = actionData.GetAsString("VariableName");
            var find = actionData.GetAsString("Find");
            var replace = actionData.GetAsString("Replace");

            if (!string.IsNullOrEmpty(variableName))
            {
                var value = actionData.GetDataValueAsString(variableName);
                if (string.IsNullOrEmpty(find) && !string.IsNullOrEmpty(replace) && replace.Contains("(") && replace.Contains(")") && Regex.IsMatch(value, replace))
                    value = Regex.Replace(value, replace, (match) => match.Groups[1].Value);
                else if (string.IsNullOrEmpty(find) && !string.IsNullOrEmpty(replace))
                    value = replace;
                else if (!string.IsNullOrEmpty(find) && replace != null && Regex.IsMatch(value, find))
                    value = Regex.Replace(value, find, replace);
                else if (!string.IsNullOrEmpty(find) && replace != null)
                    value = value.Replace(find, replace);
                actionData.SetDataValue(variableName, value);
            }
        }
 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);
 }