示例#1
0
 private void OnAccountClosed(AccountClosed evt)
 {
     try
     {
         var accountsTracks = new List <AccountTrackInfo>();
         var adGroupIds     = new List <int>();
         AccountTrackInfo accountTrackInfo = null;
         foreach (var pair in evt.AccountsSpends)
         {
             accountTrackInfo = new AccountTrackInfo
             {
                 AccountID   = Utilities.GetAccountID(pair.Key),
                 LastSpend   = pair.Value,
                 SpendDate   = evt.ClosedDate,
                 AccountType = Utilities.GetAccountType(pair.Key)
             };
             accountsTracks.Add(accountTrackInfo);
             if (accountTrackInfo.AccountType == AccountType.AdGroup)
             {
                 adGroupIds.Add(accountTrackInfo.AccountID);
             }
         }
         _repository.PersistAccountTrackInfos(accountsTracks);
         TriggerUpdateAdStatusEvents(adGroupIds, evt.ClosedReason);
     }
     catch (Exception ex)
     {
         _log.Error(ex);
     }
 }
示例#2
0
        private void OnAccountClosed(AccountClosed evt)
        {
            if (AdGroupDeactivated == null)
            {
                return;
            }
            var adgroupsIds = new List <int>();

            foreach (var pair in evt.AccountsSpends)
            {
                var adgroupId = Utilities.TryGetAdgroupId(pair.Key);
                if (adgroupId.HasValue)
                {
                    adgroupsIds.Add(adgroupId.Value);
                }
            }
            AdGroupDeactivated(adgroupsIds);
        }
示例#3
0
        public void EnactCommand(CloseAccount command)
        {
            var created = new AccountClosed();

            RecordEvent(created);
        }
        public void Handle(AccountClosed c)
        {
            var account = _search.SelectAccountSummary(c.AggregateIdentifier);

            _store.UpdateAccountStatus(account.AccountIdentifier, "Closed");
        }
 private void Apply(AccountClosed @event)
 {
     _status = Closed;
 }
示例#6
0
 /// <summary>
 /// Apply account closed state changes.
 /// </summary>
 /// <param name="e">The account closed event.</param>
 protected void Apply(AccountClosed e)
 {
     Status = e.Status;
 }
示例#7
0
 public void Handle(AccountClosed e)
 {
 }
示例#8
0
 private static void accountClosedHandler()
 {
     AccountClosed?.Invoke(account, new EventArgs());
     //if (AccountClosed != null)
     //    AccountClosed(account, new EventArgs());
 }
示例#9
0
 private static void accountClosedHandler()
 {
     AccountClosed?.Invoke(account, new EventArgs());
 }