예제 #1
0
        public virtual void Execute(Database database, ScopeExecuteConfiguration executeConfiguration, Action <Item, string> scopeAction, IEnumerable <ID> exactAccounts = null)
        {
            Assert.ArgumentNotNull(executeConfiguration, "executeConfiguration");

            if (exactAccounts != null)
            {
                executeConfiguration.AccountIds.Clear();
                executeConfiguration.AccountIds.AddRange(exactAccounts);
            }

            foreach (Item accountItem in executeConfiguration.GetAccountList(database))
            {
                if (AccountManager.IsValidAccount(accountItem))
                {
                    foreach (string scope in executeConfiguration.Scope)
                    {
                        try
                        {
                            RunAction(scopeAction, accountItem, scope);
                        }
                        catch (Exception ex)
                        {
                            LogHelper.Error("Error while executing scope action", this, ex);
                        }
                    }
                }
                else
                {
                    LogHelper.Warn(Translations.AccountItemValidationFailed + " Account Id:" + accountItem.ID, this);
                }
            }
        }
예제 #2
0
        public virtual void Execute(Database database, string name, Action <Item, string> scopeAction, IEnumerable <ID> exactAccounts = null)
        {
            Assert.ArgumentNotNullOrEmpty(name, "name");

            ScopeExecuteConfiguration executeConfiguration = this.GetExecuteConfiguration(name);

            if (executeConfiguration != null)
            {
                this.Execute(database, executeConfiguration, scopeAction, exactAccounts);
            }
        }
예제 #3
0
        public virtual ScopeExecuteConfiguration GetExecuteConfiguration(string name)
        {
            Assert.ArgumentNotNullOrEmpty(name, "name");

            ScopeExecuteConfiguration result = MediaFrameworkContext.GetScopeExecuteConfiguration(name);

            if (result == null)
            {
                LogHelper.Warn("Execute configuration could not be resolved. Name:" + name, this);
            }

            return(result);
        }
 public static void Execute(Database database, ScopeExecuteConfiguration executeConfiguration, Action <Item, string> scopeAction, IEnumerable <ID> exactAccounts = null)
 {
     Provider.Execute(database, executeConfiguration, scopeAction, exactAccounts);
 }