예제 #1
0
        private void DisplaySelectedAccount()
        {
            if (ddlBankAccounts.SelectedValue.ToString() != "")
            {
                ApplicationBankAccountService service  = new ApplicationBankAccountService();
                FindBankAccountResponse       response = service.GetBankAccountBy(new Guid(ddlBankAccounts.SelectedValue.ToString()));
                BankAccountView accView = response.BankAccount;

                this.lblAccountNo.Text   = accView.Balance.ToString();
                this.lblBalance.Text     = accView.Balance.ToString();
                this.lblCustomerRef.Text = accView.CustomerRef;

                rptTransactions.DataSource = accView.Transactions;
                rptTransactions.DataBind();

                FindAllBankAccountResponse allAccountsResponse = service.GetAllBankAccounts();

                ddlBankAccountsToTransferTo.Items.Clear();

                foreach (BankAccountView acc in allAccountsResponse.BankAccountView)
                {
                    if (acc.AccountNo.ToString() != ddlBankAccounts.SelectedValue.ToString())
                    {
                        ddlBankAccountsToTransferTo.Items.Add(new ListItem(acc.CustomerRef, acc.AccountNo.ToString()));
                    }
                }
            }
        }
예제 #2
0
        protected void btCreateAccount_Click(object sender, EventArgs e)
        {
            BankAccountCreateRequest createAccountRequest = new BankAccountCreateRequest();

            createAccountRequest.CustomerName = this.txtCustomerRef.Text;
            ApplicationBankAccountService service = new ApplicationBankAccountService();

            service.CreateBankAccount(createAccountRequest);

            ShowAllAccounts();
        }
예제 #3
0
        protected void btnDeposit_Click(object sender, EventArgs e)
        {
            ApplicationBankAccountService service = new ApplicationBankAccountService();
            DepositRequest request = new DepositRequest();
            Guid           AccId   = new Guid(ddlBankAccounts.SelectedValue.ToString());

            request.AccountId = AccId;
            request.Amount    = Decimal.Parse(txtAmount.Text);
            service.Deposit(request);
            DisplaySelectedAccount();
        }
예제 #4
0
        protected void btnTransfer_Click(object sender, EventArgs e)
        {
            ApplicationBankAccountService service = new ApplicationBankAccountService();
            TransferRequest request = new TransferRequest();

            request.AccountIdFrom = new Guid(ddlBankAccounts.SelectedValue.ToString());
            request.AccountIdTo   = new Guid(ddlBankAccountsToTransferTo.SelectedValue.ToString());
            request.Amount        = Decimal.Parse(txtAmountToTransfer.Text);

            service.Transfer(request);
            DisplaySelectedAccount();
        }
예제 #5
0
        private void ShowAllAccounts()
        {
            ddlBankAccounts.Items.Clear();

            FindAllBankAccountResponse response = new ApplicationBankAccountService().GetAllBankAccounts();

            ddlBankAccounts.Items.Add(new ListItem("Select An Account", ""));

            foreach (BankAccountView accView in response.BankAccountView)
            {
                ddlBankAccounts.Items.Add(new ListItem(accView.CustomerRef, accView.AccountNo.ToString()));
            }
        }
예제 #6
0
 public HomeController(ILogger <HomeController> logger, ApplicationBankAccountService bankService)
 {
     _logger      = logger;
     _bankService = bankService;
 }
예제 #7
0
 public HomeController(ApplicationBankAccountService bankService)
 {
     _bankService = bankService;
 }