Exemplo n.º 1
0
        /// <summary>
        /// Credit type of transaction with mode of transaction as cheque.
        /// </summary>
        /// <param name="accountID">Uniquely generated account ID.</param>
        /// <param name="amount">Amount to be credited.</param>
        /// <param name="chequeNumber">Cheque Number.</param>
        /// <returns>Determinates whether the amount is credited by cheque.</returns>
        public async Task <bool> CreditTransactionByChequeBL(Guid accountID, double amount, string chequeNumber)
        {
            bool transactionCheque = false;

            try
            {
                AccountDAL accountnoexist = new AccountDAL();
                if (accountnoexist.AccountIDExists(accountID) == true && await ValidateChequeNumber(chequeNumber) == true && (amount <= 50000) && (amount > 0)
                    )
                {
                    await Task.Run(() =>
                    {
                        TransactionDAL transactionDAL = new TransactionDAL();
                        transactionDAL.CreditTransactionByChequeDAL(accountID, amount, chequeNumber);
                        transactionCheque = true;
                    });
                }
                return(transactionCheque);
            }

            catch (PecuniaException ex)
            {
                throw new CreditChequeException(ex.Message);
            }
        }
Exemplo n.º 2
0
 public bool CreditTransactionByChequeBL(long AccountNo, double Amount, string ChequeNo)
 {
     if ((AccountNo > 50000 && AccountNo < 59999) || (AccountNo > 40000 && AccountNo < 49999) || (AccountNo > 30000 && AccountNo < 39999) && Amount <= 50000 && ChequeNo.Length == 10 && (Regex.IsMatch(ChequeNo, "^[A-Z0-9]$") == true))
     {
         TransactionDAL Cheque = new TransactionDAL();
         return(Cheque.CreditTransactionByChequeDAL(AccountNo, Amount, ChequeNo));
     }
     else
     {
         throw new CreditChequeException("Invalid Account Credentials or Amount");
     }
 }