コード例 #1
0
ファイル: BankerController.cs プロジェクト: IBIBank/IBITest
        public string SetBalance(int accountNumber, decimal amount, char accountType, char CreditOrDebit, string remarks)
        {
            BankerDAL objBankerDAL = new BankerDAL();
            if (accountType == 'S')
            {
                if (CreditOrDebit == 'C')//credit
                {
                    objBankerDAL.CreditSavingsAccountByBanker(accountNumber,amount,remarks);
                    return "Credit Successful";
                }
                else//debit
                {
                    if (amount <= objBankerDAL.GetAccountBalance(accountNumber))
                    {
                        objBankerDAL.DebitSavingsAccountByBanker(accountNumber, amount, remarks);
                        return "Debit successful";
                    }
                    else
                    {
                        return "Amount exceeds available balance";
                    }
                }
            }
            else
            {

                decimal loanBalance = objBankerDAL.GetAccountBalance(accountNumber);
                if (amount == loanBalance)
                {
                    objBankerDAL.CreditLoanAccountByBanker(accountNumber, amount, remarks);
                    objBankerDAL.CloseLoanAccount(accountNumber);
                    return "Credit Successful and Closed account";
                }
                else if (amount > loanBalance)
                {
                    return "Amount exceeds available balance";
                }
                else
                {
                    objBankerDAL.CreditLoanAccountByBanker(accountNumber, amount, remarks);
                    return "Credit Successful";
                }
            }
        }