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); } }
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); }
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; }
/// <summary> /// Apply account closed state changes. /// </summary> /// <param name="e">The account closed event.</param> protected void Apply(AccountClosed e) { Status = e.Status; }
public void Handle(AccountClosed e) { }
private static void accountClosedHandler() { AccountClosed?.Invoke(account, new EventArgs()); //if (AccountClosed != null) // AccountClosed(account, new EventArgs()); }
private static void accountClosedHandler() { AccountClosed?.Invoke(account, new EventArgs()); }