public void Apply(NewAccountCreated @event) { Id = @event.AccountId; ClientId = @event.ClientId; Number = @event.Number; Balance = 100; }
public void Project(NewAccountCreated @event, IDocumentOperations operations) { var issue = operations.Load <AllAccountsSummaryView>(Guid.Empty) ?? new AllAccountsSummaryView(); issue.Apply(@event); operations.Store(issue); }
/// <summary> /// Restores session or tries to establish a new one. /// Invokes <see cref="ConnectionSucceed"/> or <see cref="ConnectionFailed"/>. /// </summary> /// <returns></returns> public async Task <AuthenticationResponse> ConnectAsync(string username = null) { var response = await RestoreTokenAsync(username); switch (response) { case AuthenticationResponse.Authenticated: case AuthenticationResponse.UserInfoUpdated: ConnectionSucceed?.Invoke(); break; case AuthenticationResponse.NewAccountCreated: NewAccountCreated?.Invoke(); ConnectionSucceed?.Invoke(); break; case AuthenticationResponse.ErrorUsernameAlreadyExists: case AuthenticationResponse.ErrorInternal: ConnectionFailed?.Invoke(); break; default: Debug.LogError("Unhandled response received: " + response); break; } return(response); }
/// <summary> /// Restores session or tries to establish a new one. /// Invokes <see cref="ConnectionSucceed"/> or <see cref="ConnectionFailed"/>. /// </summary> /// <returns></returns> public async Task <(bool success, string message)> ConnectAsync(string email, string password, bool create = false, string ip = "localhost", int p = 7350) { ipAddress = ip; port = p; try { session = await client.AuthenticateEmailAsync(email, password, create : create); account = await GetAccountAsync(); } catch (ApiResponseException ex) { ConnectionFailed?.Invoke(); return(false, ex.Message); } Debug.LogFormat("New user: {0}, {1}", session.Created, session); ConnectionSucceed?.Invoke(); if (session.Created) { NewAccountCreated?.Invoke(); } return(true, session.Created ? "Account created, connecting ..." : "Connecting"); }
public void ApplyEvent(NewAccountCreated @event) { AccountId = @event.AccountId; Balance = 0; ClientId = @event.ClientId; Number = @event.Number; TransactionsCount = 0; }
private void NewAccount_Add() { _commonSettings.Humans2.Add(NewAccount.Model); UpdateHumanPlayers(); HumanPlayer = NewAccount.Model; NewAccount = null; NewAccountCreated?.Invoke(); }
public async Task <IActionResult> CreateAccount([FromBody] AccountModel model) { var domainEvent = new NewAccountCreated( model.FirstName, model.LastName, model.AccountNumber); await _messaging.PublishAsync(domainEvent); return(Ok(_exampleLog.GetLogs())); }
public Account(Guid clientId, IAccountNumberGenerator accountNumberGenerator) { var @event = new NewAccountCreated( Guid.NewGuid(), clientId, accountNumberGenerator.Generate() ); Apply(@event); Enqueue(@event); }
public Account(Guid clientId) { var @event = new NewAccountCreated { AccountId = Guid.NewGuid(), ClientId = clientId }; Apply(@event); Append(@event); }
public Task EstablishCreditWhen(NewAccountCreated command) { _log.AddResult("Account Handler was Called."); if (command.AccountNumber == null) { throw new InvalidOperationException("Account number can't be null."); } return(Task.Delay(5)); }
public Account(Guid clientId, IAccountNumberGenerator accountNumberGenerator) { var @event = new NewAccountCreated { AccountId = Guid.NewGuid(), ClientId = clientId, Number = accountNumberGenerator.Generate() }; Apply(@event); Append(@event); }
private void NewAccount_Edit() { var currentAccount = NewAccount.CurrentAccount; var newAccount = this.newAccount.Model; currentAccount.Name = newAccount.Name; currentAccount.IsMale = newAccount.IsMale; currentAccount.BirthDate = newAccount.BirthDate; currentAccount.Picture = newAccount.Picture; NewAccount = null; NewAccountCreated?.Invoke(); }
public void MailLastCatalogWhen(NewAccountCreated domainEvent) { _log.AddResult("Mailing Handler Called."); if (domainEvent.AccountNumber == null) { throw new InvalidOperationException("Catalog count not be mailed."); } if (domainEvent.FirstName != null && domainEvent.FirstName == "Sam") { Console.WriteLine("Sam's Club Catalog"); } }
internal void ApplyEvent(ClientView view, NewAccountCreated @event) { view.AccountsNumbers.Add(@event.Number); }
public void Apply(NewAccountCreated @event, ClientView view) { view.AccountsNumbers.Add(@event.Number); }
public void Apply(NewAccountCreated @event) { TotalCount++; }
private void Persist(AccountSummaryView view, NewAccountCreated @event) { view.ApplyEvent(@event); }
private void Apply(NewAccountCreated @event) { Id = @event.AccountId; ClientId = @event.ClientId; }