예제 #1
0
        private void OnAutomationCommandSelected(AccountScreenAutmationCommandMap obj)
        {
            object value = null;

            if (obj.AutomationCommandValueType == 0) // Account Id
            {
                var account = _accountService.GetAccountById(SelectedAccount.AccountId);
                if (account == null)
                {
                    return;
                }
                value = account.Id;
            }

            if (obj.AutomationCommandValueType == 1) //Entity Id
            {
                var entities = _entityService.GetEntitiesByAccountId(SelectedAccount.AccountId).ToList();
                if (!entities.Any())
                {
                    return;
                }
                value = entities.Select(x => x.Id).First();
            }

            if (obj.AutomationCommandValueType == 2) //Entity Id List
            {
                value = string.Join(",", _entityService.GetEntitiesByAccountId(SelectedAccount.AccountId).Select(x => x.Id));
            }

            _applicationState.NotifyEvent(RuleEventNames.AutomationCommandExecuted, new
            {
                obj.AutomationCommandName,
                CommandValue = value
            });
        }
 public AccountScreenAutmationCommandMapViewModel(AccountScreenAutmationCommandMap model, ICacheService cacheService)
     : this(model)
 {
     _cacheService     = cacheService;
     AutomationCommand = _cacheService.GetAutomationCommandByName(model.AutomationCommandName);
 }
 public AccountScreenAutmationCommandMapViewModel(AccountScreenAutmationCommandMap model)
 {
     _model = model;
 }