Exemplo n.º 1
0
        /// <summary>
        /// New the account.
        /// </summary>
        /// <param name="personId">The person identifier.</param>
        /// <param name="balance">The balance.</param>
        /// <param name="typeId">The type identifier.</param>
        public void NewAccount(int personId, decimal balance, int typeId)
        {
            AccountBll temp = FactoryAccounts.CreateAccount(typeId, personId, generator.GenerateNumber(personId, balance, typeId), balance);

            accountRepository.Create(temp.ToDalAccount());
            context.Save();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Closes the account.
 /// </summary>
 /// <param name="account">The account.</param>
 public void CloseAccount(AccountBll account)
 {
     Check(account);
     account.Close();
     accountRepository.Update(account.ToDalAccount());
     context.Save();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Transfers the specified account.
 /// </summary>
 /// <param name="account">The account.</param>
 /// <param name="transfer">The transfer.</param>
 /// <param name="count">The count.</param>
 public void Transfer(AccountBll account, AccountBll transfer, decimal count)
 {
     Check(account);
     Check(transfer);
     account.Withdraw(count);
     transfer.Deposit(count);
     accountRepository.Update(account.ToDalAccount());
     accountRepository.Update(transfer.ToDalAccount());
     context.Save();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Withdrawals the specified count.
        /// </summary>
        /// <param name="count">The count.</param>
        /// <param name="account">The account.</param>
        /// <exception cref="ArgumentException">count</exception>
        public void Withdrawal(decimal count, AccountBll account)
        {
            Check(account);
            if (count < 0)
            {
                throw new ArgumentException($"{nameof(count)} is less 0");
            }

            account.Withdraw(count);
            accountRepository.Update(account.ToDalAccount());
            context.Save();
        }