Ejemplo n.º 1
0
        private void DisplaySelectedAccount()
        {
            if (ddlAccounts.SelectedValue.ToString() != "")
            {
                var service     = new ApplicationAccountService();
                var response    = service.GetAccountBy(new Guid(ddlAccounts.SelectedValue.ToString()));
                var accountView = response.AccountView;

                lblAccountNo.Text   = accountView.AccountNo.ToString();
                lblBalance.Text     = accountView.Balance.ToString();
                lblCustomerRef.Text = accountView.CustomerRef;

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

                var allAccountsResponse = service.GetAllAccounts();

                ddlAccountsToTransferTo.Items.Clear();

                foreach (var accView in allAccountsResponse.AccountsViews)
                {
                    if (!accView.AccountNo.Equals(accountView.AccountNo))
                    {
                        ddlAccountsToTransferTo.Items.Add(new ListItem(accView.CustomerRef, accView.AccountNo.ToString()));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnTransfer_Click(object sender, EventArgs e)
        {
            var request = new TransferRequest();

            request.AccountFromNo = new Guid(ddlAccounts.SelectedValue);
            request.AccountToNo   = new Guid(ddlAccountsToTransferTo.SelectedValue);
            request.Amount        = decimal.Parse(txtAmountToTransfer.Text);

            var response = new ApplicationAccountService().Transfer(request);

            DisplaySelectedAccount();
        }
Ejemplo n.º 3
0
        private void ShowAllAccounts()
        {
            ddlAccounts.Items.Clear();

            var response = new ApplicationAccountService().GetAllAccounts();

            ddlAccounts.Items.Add(new ListItem("Select an account", ""));

            foreach (var accView in response.AccountsViews)
            {
                ddlAccounts.Items.Add(new ListItem(accView.CustomerRef, accView.AccountNo.ToString()));
            }
        }
 public AuthenticationAttribute()
 {
     _accountService = new ApplicationAccountService(new DatabaseContext());
 }