Пример #1
0
 public void Apply(AccountUpdated e)
 {
     _account.EntityName = e.EntityName;
     _account.TaxNumber = e.TaxNumber;
     _account.AccountType = e.Type;
     Version = e.Version;
 }
Пример #2
0
 public void Apply(AccountUpdated e)
 {
     if (Accounts.ContainsKey(e.AccountId))
     {
         Accounts[e.AccountId] = new AccountIndexItem(e.AccountId, e.EntityName, e.TaxNumber, e.Type);
     }
 }
 public void Apply(AccountUpdated e)
 {
     _account.EntityName  = e.EntityName;
     _account.TaxNumber   = e.TaxNumber;
     _account.AccountType = e.Type;
     Version = e.Version;
 }
Пример #4
0
        public void UpdateAccount(Account account, string currency = null, string type = null, string name = null)
        {
            if (currency == null && type == null && name == null)
            {
                return;
            }
            var result = Data.Find(acc => acc == account);

            if (result != null)
            {
                if (currency != null)
                {
                    result.Currency.Type = currency;
                }
                if (type != null)
                {
                    result.Type = type;
                }
                if (name != null)
                {
                    result.Name = name;
                }
                AccountUpdated?.Invoke(this, new AccountManagerEventArgs(account, AccountManagerEventType.AccountUpdated));
            }
        }
 public void Handle(AccountUpdated @event)
 {
     using (var context = _contextFactory.Invoke())
     {
         var account = context.Find <AccountDetail>(@event.SourceId);
         account.Name = @event.Name;
         context.Save(account);
     }
 }
        public IActionResult Put(int id, AccountUpdated account, [FromServices] AccountApplication accountApplication)
        {
            try
            {
                return(Ok(accountApplication.Updated(id, account)));
            }

            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
        public Account Updated(int id, AccountUpdated accountUpdated)
        {
            _accountRepository.Begin();

            try
            {
                Account account = _accountRepository.Get(new Object[] { id });

                account.Name     = accountUpdated.Name;
                account.StatusId = accountUpdated.StatusId;

                _accountRepository.Save(account);

                _accountRepository.Commit();
                return(account);
            }
            catch (Exception ex)
            {
                _accountRepository.RollBack();
                throw ex;
            }
        }
        async void OnSave(object sender, EventArgs e)
        {
            var account = BindingContext as Account;

            if (String.IsNullOrWhiteSpace(account.Name))
            {
                await DisplayAlert("Error", "Please enter name for entry", "OK");

                return;
            }

            //Check if this is a new account or an edit of existing account
            if (account.Status == null)
            {
                AccountAdded?.Invoke(this, account);
            }
            else
            {
                AccountUpdated?.Invoke(this, account);
            }

            await Navigation.PopAsync();
        }
Пример #9
0
 public void When(AccountUpdated accountUpdated)
 {
 }
 public Task Handle(AccountUpdated request, CancellationToken cancellationToken)
 {
     return(Unit.Task);
 }