Ejemplo n.º 1
0
        public override void Up()
        {
            var dc = ApplicationContext as DbContext;

            var closeTicketAutomation = new AutomationCommand { Name = Resources.CloseTicket, ButtonHeader = Resources.Close, SortOrder = -1, Color = "#FFFF0000",FontSize = 40};
            closeTicketAutomation.AutomationCommandMaps.Add(new AutomationCommandMap { EnabledStates = string.Format("{0},{1},{2},{3},IsClosed", Resources.New, Resources.NewOrders, Resources.Unpaid, Resources.Locked), VisibleStates = "*", DisplayUnderTicket = true });
            dc.Set<AutomationCommand>().Add(closeTicketAutomation);

            var settleAutomation = new AutomationCommand { Name = Resources.Settle, ButtonHeader = Resources.Settle, SortOrder = -2 ,FontSize = 40};
            settleAutomation.AutomationCommandMaps.Add(new AutomationCommandMap { EnabledStates = "*", VisibleStates = "*", DisplayUnderTicket = true });
            dc.Set<AutomationCommand>().Add(settleAutomation);

            dc.SaveChanges();

            var displayPaymentScreenAction = new AppAction { ActionType = ActionNames.DisplayPaymentScreen, Name = Resources.DisplayPaymentScreen, Parameter = "", SortOrder = -1 };
            dc.Set<AppAction>().Add(displayPaymentScreenAction);

            var closeTicketAction = dc.Set<AppAction>().FirstOrDefault(x => x.ActionType == ActionNames.CloseActiveTicket);

            if (closeTicketAction == null)
            {
                closeTicketAction = new AppAction { ActionType = ActionNames.CloseActiveTicket, Name = Resources.CloseTicket, Parameter = "", SortOrder = -1 };
                dc.Set<AppAction>().Add(closeTicketAction);
            }
            dc.SaveChanges();

            var closeTicketRule = new AppRule { Name = string.Format(Resources.Rule_f, Resources.CloseTicket), EventName = "AutomationCommandExecuted", EventConstraints = "AutomationCommandName;=;" + Resources.CloseTicket, SortOrder = -1 };
            closeTicketRule.Actions.Add(new ActionContainer(closeTicketAction));
            closeTicketRule.AddRuleMap();
            dc.Set<AppRule>().Add(closeTicketRule);

            var settleTicketRule = new AppRule { Name = string.Format(Resources.Rule_f, Resources.Settle), EventName = "AutomationCommandExecuted", EventConstraints = "AutomationCommandName;=;" + Resources.Settle, SortOrder = -1 };
            settleTicketRule.Actions.Add(new ActionContainer(displayPaymentScreenAction));
            settleTicketRule.AddRuleMap();
            dc.Set<AppRule>().Add(settleTicketRule);

            dc.SaveChanges();
        }
 private void SetSelectedAutomationCommand(AutomationCommand command)
 {
     SelectedAutomationCommand = command;
     RaisePropertyChanged(() => SelectedAutomationCommand);
 }
 public AccountScreenAutmationCommandMapViewModel(AccountScreenAutmationCommandMap model, ICacheService cacheService)
     : this(model)
 {
     _cacheService = cacheService;
     AutomationCommand = _cacheService.GetAutomationCommandByName(model.AutomationCommandName);
 }
Ejemplo n.º 4
0
        private void ExecuteAutomationCommand(AutomationCommand automationCommand, string selectedValue)
        {
            if (!string.IsNullOrEmpty(automationCommand.Values) && !automationCommand.ToggleValues)
                automationCommand.PublishEvent(EventTopicNames.SelectAutomationCommandValue);
            else
            {
                if (SelectedOrders.Any())
                {
                    foreach (var selectedOrder in SelectedOrders.ToList())
                    {
                        _applicationState.NotifyEvent(RuleEventNames.AutomationCommandExecuted,
                                                      new
                                                          {
                                                              Ticket = SelectedTicket,
                                                              Order = selectedOrder,
                                                              AutomationCommandName = automationCommand.Name,
                                                              Value = selectedValue
                                                          });
                    }
                }
                else
                {
                    _applicationState.NotifyEvent(RuleEventNames.AutomationCommandExecuted,
                                                  new
                                                      {
                                                          Ticket = SelectedTicket,
                                                          AutomationCommandName = automationCommand.Name,
                                                          Value = selectedValue
                                                      });
                }

                _ticketOrdersViewModel.SelectedTicket = SelectedTicket;
                ClearSelectedItems();
                ClearSelection = true;
                RefreshVisuals();
            }
        }
Ejemplo n.º 5
0
 private void ExecuteAutomationCommand(AutomationCommand automationCommand, string selectedValue, string nextValue)
 {
     if (!string.IsNullOrEmpty(automationCommand.Values) && !automationCommand.ToggleValues)
         automationCommand.PublishEvent(EventTopicNames.SelectAutomationCommandValue);
     else
     {
         ExecuteAutomationCommand(automationCommand.Name, selectedValue, nextValue);
         RefreshVisuals();
     }
 }