Esempio n. 1
0
 internal override void UpdateBalance(decimal transactionAmountDecimal)
 {
     decimal balanceDecimal = Balance + transactionAmountDecimal;
     if (balanceDecimal < 0)
     {
         TransactionOutOfRangeException ex = new TransactionOutOfRangeException(
             "Transaction amount causes an overflow condition. Transaction is rejected.\n");
         ex.CustomerAccount = this;
         ex.TransactionAmount = transactionAmountDecimal;
         throw ex;
     }
     else
     {
         Balance = balanceDecimal;
     }
 }
Esempio n. 2
0
 internal override void UpdateBalance(decimal transactionAmountDecimal)
 {
     decimal balanceDecimal = Balance + transactionAmountDecimal;
     if ((transactionAmountDecimal < 0) || (transactionAmountDecimal > MaximumTransactionAmount))
     {
         TransactionOutOfRangeException ex = new TransactionOutOfRangeException(
             "Transaction amount must be greater than 0 and less than or equal to " +
             MaximumTransactionAmount.ToString("C0") + ". Transaction is rejected.\n");
         ex.CustomerAccount = this;
         ex.TransactionAmount = transactionAmountDecimal;
         throw ex;
     }
     else
     {
         Balance = balanceDecimal;
     }
 }