Example #1
0
        /// <summary>
        /// Delete an account and associated entries by account GUID.
        /// </summary>
        /// <param name="guid">GUID of the account.</param>
        public void DeleteAccountByGuid(string guid)
        {
            if (String.IsNullOrEmpty(guid))
            {
                throw new ArgumentNullException(nameof(guid));
            }

            Account a = GetAccountByGuidInternal(guid);

            if (a != null)
            {
                try
                {
                    LockAccount(a.GUID);
                    DbExpression e2 = new DbExpression(_ORM.GetColumnName <Entry>(nameof(Entry.AccountGUID)), DbOperators.Equals, a.GUID);
                    _ORM.DeleteMany <Entry>(e2);
                    _ORM.Delete <Account>(a);
                }
                finally
                {
                    UnlockAccount(a.GUID);
                    Task.Run(() => AccountDeleted?.Invoke(this, new AccountEventArgs(a)));
                }
            }
        }
 private void ll_Delete_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to delete the existing account?", "Delete account", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         AppModel.Instance.DeleteMasterAccount();
         AccountDeleted?.Invoke();
     }
 }
Example #3
0
        public void Delete(Guid deletedBy)
        {
            var accountDeleted = new AccountDeleted()
            {
                DeletedBy = deletedBy,
                AccountId = Id
            };

            AddEvent(accountDeleted);
        }
Example #4
0
 public void DeleteAccount(Predicate <Account> predicate)
 {
     if (Data is List <Account> dataList)
     {
         foreach (var item in dataList)
         {
             if (predicate(item))
             {
                 dataList.Remove(item);
                 AccountDeleted?.Invoke(this, new AccountManagerEventArgs(item, AccountManagerEventType.AccountDeleted));
                 return;
             }
         }
     }
 }
Example #5
0
        private void BgwAccountUpdater_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            switch (e.UserState.ToString())
            {
            case "ACCOUNT_CREATED":
                AccountCreated?.Invoke(this, new AccountEventArgs(accountData));
                break;

            case "ACCOUNT_DELETED":
                AccountDeleted?.Invoke(this, new AccountEventArgs(accountData));
                break;

            case "ACCOUNT_INFO_UPDATED":
                AccountInfoUpdated?.Invoke(this, new AccountEventArgs(accountData));
                break;

            default:
                throw (new ArgumentException());
            }
        }
Example #6
0
 private void Apply(AccountDeleted e)
 {
     Status = new AccountStatus(Status.IsApproved, Status.ApprovedBy, true, e.Reason);
 }
Example #7
0
 public void Apply(AccountDeleted @event)
 {
     SoftDelete();
 }
Example #8
0
        public void Handle(AccountDeleted message)
        {
            AccountDto account = _repo.FindByAggregateId(message.Id);

            _repo.Remove(account.UniqueId);
        }
Example #9
0
 public async Task HandleAsync(AccountDeleted @event)
 => await CompleteForAuthenticatedUserAsync(@event);
 public IValidator <AccountAggregate> Apply(AccountDeleted @event)
 {
     MustBeOwner(@event.DeletedBy);
     return(this);
 }