/// <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); } }
/// <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); } }
/// <summary> /// Displays all transactions for a particular account ID. /// </summary> /// <param name="accountID">Uniquely generated account ID.</param> /// <returns>Provides a list of transactions for a particular account ID.</returns> public async Task DisplayTransactionByAccountIDBL(Guid accountID) { try { AccountDAL accountnoexist = new AccountDAL(); if (accountnoexist.AccountIDExists(accountID) == true) { await Task.Run(() => { TransactionDAL transactionDAL = new TransactionDAL(); transactionDAL.DisplayTransactionByAccountIDDAL(accountID); }); } } catch (PecuniaException ex) { throw new TransactionDisplayAccountException(ex.Message); } }
/// <summary> /// Debit type of transaction with mode of transaction as withdrawal slip. /// </summary> /// <param name="accountID">Uniquely generated account ID.</param> /// <param name="amount">Amount to be debited.</param> /// <returns>Determinates whether the amount is debited by withdrawal slip.</returns> public async Task <bool> DebitTransactionByWithdrawalSlipBL(Guid accountID, double amount) { bool transactionWithdrawal = false; try { AccountDAL accountnoexist = new AccountDAL(); if ((amount <= 50000) && (amount > 0) && accountnoexist.AccountIDExists(accountID) == true) { await Task.Run(() => { TransactionDAL transactionDAL = new TransactionDAL(); transactionDAL.DebitTransactionByWithdrawalSlipDAL(accountID, amount); transactionWithdrawal = true; }); } return(transactionWithdrawal); } catch (PecuniaException ex) { throw new InsufficientBalanceException(ex.Message); } }
/// <summary> /// Credit type of transaction with mode of transaction as withdrawal slip. /// </summary> /// <param name="accountID">Uniquely generated account ID.</param> /// <param name="amount">Amount to be credited.</param> /// <returns>Determinates whether the amount is credited by withdrawal slip.</returns> public async Task <bool> CreditTransactionByDepositSlipBL(Guid accountID, double amount) { bool transactionWithdrawal = false; try { AccountDAL accountnoexist = new AccountDAL(); if (accountnoexist.AccountIDExists(accountID) == true && (amount <= 50000) && (amount > 0)) { await Task.Run(() => { TransactionDAL transactionDAL = new TransactionDAL(); transactionDAL.CreditTransactionByDepositSlipDAL(accountID, amount); transactionWithdrawal = true; }); } return(transactionWithdrawal); } catch (PecuniaException ex) { throw new CreditSlipException(ex.Message); } }