Пример #1
0
        /// <summary>
        /// Debit type of transaction with mode of transaction as cheque.
        /// </summary>
        /// <param name="accountID">Uniquely generated account ID.</param>
        /// <param name="amount">Amount to be debited.</param>
        /// <param name="chequeNumber">Cheque Number.</param>
        /// <returns>Determinates whether the amount is debited by withdrawal slip.</returns>
        public async Task <bool> DebitTransactionByChequeBL(Guid accountID, double amount, string chequeNumber)
        {
            bool transactionCheque = false;

            try
            {
                AccountDAL accountnoexist = new AccountDAL();
                if (accountnoexist.AccountIDExists(accountID) == true && (amount <= 50000) && (amount > 0) && chequeNumber.Length == 6 && (Regex.IsMatch(chequeNumber, "[A-Z0-9]$") == true))
                {
                    await Task.Run(() =>
                    {
                        TransactionDAL transactionDAL = new TransactionDAL();
                        transactionDAL.DebitTransactionByChequeDAL(accountID, amount, chequeNumber);
                        transactionCheque = true;
                    });
                }
                return(transactionCheque);
            }


            catch (PecuniaException ex)
            {
                throw new DebitChequeException(ex.Message);
            }
        }
Пример #2
0
 public bool DebitTransactionByChequeBL(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.DebitTransactionByChequeDAL(AccountNo, Amount, ChequeNo));
     }
     else
     {
         throw new DebitChequeException("Invalid Account Credentials or Amount");
     }
 }