Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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));
                }
            }
        }
Exemplo n.º 3
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            var orders = Helper.GetOrders(actionData, ticket);
            if (orders.Any())
            {
                foreach (var order in orders)
                {
                    if (!string.IsNullOrEmpty(actionData.GetAsString("Quantity")))
                        order.Quantity = actionData.GetAsDecimal("Quantity");
                    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 (!string.IsNullOrEmpty(actionData.GetAsString("AccountTransactionType")))
                        _ticketService.ChangeOrdersAccountTransactionTypeId(ticket, new List<Order> { order },
                                                                           _cacheService.GetAccountTransactionTypeIdByName
                                                                               (actionData.GetAsString("AccountTransactionType")));

                    if (!string.IsNullOrEmpty(actionData.GetAsString("PortionName")) || !string.IsNullOrEmpty(actionData.GetAsString("PriceTag")))
                    {
                        var portionName = actionData.GetAsString("PortionName");
                        var priceTag = actionData.GetAsString("PriceTag");
                        _ticketService.UpdateOrderPrice(order, portionName, priceTag);
                    }
                }
            }
        }
Exemplo n.º 4
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));
                }
            }
        }
Exemplo n.º 5
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");
            var orders = Helper.GetOrders(actionData, ticket);

            if (orders.Any())
            {
                foreach (var order in orders)
                {
                    if (!string.IsNullOrEmpty(actionData.GetAsString("Quantity")))
                    {
                        order.Quantity = actionData.GetAsDecimal("Quantity");
                        order.ResetSelectedQuantity();
                    }
                    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 (!string.IsNullOrEmpty(actionData.GetAsString("AccountTransactionType")))
                    {
                        _ticketService.ChangeOrdersAccountTransactionTypeId(ticket, new List <Order> {
                            order
                        },
                                                                            _cacheService.GetAccountTransactionTypeIdByName
                                                                                (actionData.GetAsString("AccountTransactionType")));
                    }

                    if (!string.IsNullOrEmpty(actionData.GetAsString("PortionName")) || !string.IsNullOrEmpty(actionData.GetAsString("PriceTag")))
                    {
                        var portionName = actionData.GetAsString("PortionName");
                        var priceTag    = actionData.GetAsString("PriceTag");
                        _ticketService.UpdateOrderPrice(order, portionName, priceTag);
                    }
                }
            }
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
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"));
 }
Exemplo n.º 8
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"));
 }
Exemplo n.º 9
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;
            }
        }
Exemplo n.º 10
0
        public override async void Process(ActionData actionData)
        {
            string str;

            if (!this._applicationState.IsLocked)
            {
                bool   asBoolean      = actionData.GetAsBoolean("RunInBackground", true);
                string backupLocation = DatabaseToolsSettings.GetBackupLocation();
                string databaseName   = DatabaseToolsSettings.Settings.DatabaseName;
                if (LocalSettings.DatabaseLabel != "SQ" && LocalSettings.DatabaseLabel != "LD")
                {
                    asBoolean = false;
                }
                if (asBoolean)
                {
                    str = await this._backupHelper.CreateBackupAsync(backupLocation, databaseName, 'R');
                }
                else
                {
                    str = this._backupHelper.CreateBackup(backupLocation, databaseName, 'R');
                }
                string str1 = str;
                if (!string.IsNullOrEmpty(str1))
                {
                    MessageBox.Show(str1, "Database Backup Module", MessageBoxButton.OK, MessageBoxImage.Hand);
                }
            }
            else
            {
                IMethodQueue methodQueue = this._methodQueue;
                methodQueue.Queue("BackupDatabase", () => this.Process(actionData));
            }
        }
Exemplo n.º 11
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;
     }
 }
Exemplo n.º 12
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));
                    }
                }
            }
        }
Exemplo n.º 13
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;
                    }
                }
            }
        }
Exemplo n.º 14
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;
                    }
                }
            }
        }
Exemplo n.º 15
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();
            }
        }
Exemplo n.º 16
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);
                }
            }
        }
Exemplo n.º 17
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));
                    }
                }
            }
        }
Exemplo n.º 18
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);
            }
        }
Exemplo n.º 19
0
        public override void Process(ActionData actionData)
        {
            if (this._applicationState.IsLocked)
            {
                this._methodQueue.Queue("ChangeDatabaseConnection", () => this.Process(actionData));
                return;
            }
            string asString = actionData.GetAsString("ConnectionString");

            WorkspaceFactory.UpdateConnection(asString);
            EventServiceFactory.EventService.PublishEvent <EventAggregator>("Reset Cache", true);
            if (actionData.GetAsBoolean("SaveToLocalSettings", false))
            {
                LocalSettings.ConnectionString = asString;
                LocalSettings.SaveSettings();
            }
        }
        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();
                }
            }
        }