Exemplo n.º 1
0
 public BankAccountCollection FetchAll()
 {
     BankAccountCollection coll = new BankAccountCollection();
     Query qry = new Query(BankAccount.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Exemplo n.º 2
0
 // populate comboBox with accounts
 private void PopulateComboBox(BankAccountCollection accounts)
 {
     foreach (BankAccount b in accounts)
     {
         comboBoxAccount.Items.Add(b);
     }
 }
Exemplo n.º 3
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (validateInputs())
            {
                SelectedBankAccount = comboBoxAccounts.SelectedItem as BankAccount;
                ToAccount           = comboBoxToAccounts.SelectedItem as BankAccount;

                BankAccountCollection involvedAccounts = new BankAccountCollection();
                involvedAccounts.Add(SelectedBankAccount);
                involvedAccounts.Add(ToAccount);
                transaction.Accounts = involvedAccounts;
                transaction.Amount   = getAmountEntered();

                try
                {
                    transaction.DoTransaction();
                    SelectedCustomer.AddTransaction(transaction);
                    this.DialogResult = DialogResult.OK;
                }
                catch (Exception ex)
                {
                    errorProviderMain.SetError(textBoxAmount, ex.Message);
                }
            }
        }
Exemplo n.º 4
0
        private void MainForum_Load(object sender, EventArgs e)
        {
            // Create a new accounts collection
            BankAccountCollection accounts = new BankAccountCollection();

            // Add accounts to the accounts collection
            accounts.Add(new SavingsAccount(0));
            accounts.Add(new SavingsAccount(0));
            accounts.Add(new LineOfCreditAccount(0, 10000));

            // Create a new customer with the accounts collection
            this.customer = new Customer(accounts);

            lstAccounts.DataSource = customer.Accounts;
        }
Exemplo n.º 5
0
        private void MainForum_Load(object sender, EventArgs e)
        {
            // Create a new accounts collection
            BankAccountCollection accounts = new BankAccountCollection();

            // Add accounts to the accounts collection
            accounts.Add(new SavingsAccount(0));
            accounts.Add(new SavingsAccount(0));
            accounts.Add(new LineOfCreditAccount(0, 10000));

            // Create a new customer with the accounts collection
            this.customer = new Customer(accounts);
            
            lstAccounts.DataSource = customer.Accounts;
        }
        private void AppendDetails(StringBuilder display, Transaction transaction)
        {
            BankAccountCollection accounts = transaction.Accounts;

            if (accounts.Count == 1)
            {
                display.AppendFormat("      Account: {0}\r\n", accounts.ElementAt(0).Number);
            }

            else
            {
                display.AppendFormat("      From Account: {0}\r\n", accounts.ElementAt(0).Number);
                display.AppendFormat("      To Account: {0}\r\n", accounts.ElementAt(1).Number);
            }

            display.AppendFormat("      Amount: {0:N2}\r\n", transaction.Amount);
        }
        private void processRequest()
        {
            if (validateInput())
            {
                BankAccountCollection involvedAccounts = new BankAccountCollection();
                involvedAccounts.Add(selectedBankAccount);
                transaction.Accounts = involvedAccounts;
                transaction.Amount   = Amount;

                try
                {
                    transaction.DoTransaction();
                    selectedCustomer.AddTransaction(transaction);
                    this.DialogResult = DialogResult.OK;
                }
                catch (Exception ex)
                {
                    errorProviderMain.SetError(textBoxAmount, ex.Message);
                    textBoxAmount.Focus();
                    textBoxAmount.SelectAll();
                }
            }
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            ContainerContext.Load();

            IBankAccountService productService = BankAccountServiceFactory.CreateTransparentProxy();

            int branchCode = 1, accountNumber = 1000;

            //servis üzerinden normal şekilde veriler gelecek
            BankAccountCollection bankAccounts = productService.GetBankAccounts(branchCode);

            foreach (var bankAccount in bankAccounts)
            {
                Console.WriteLine(bankAccount.ToString());
            }

            //cache üzerinden gelecek
            bankAccounts = productService.GetBankAccounts(branchCode);
            foreach (var bankAccount in bankAccounts)
            {
                Console.WriteLine(bankAccount.ToString());
            }

            Run(() =>
            {
                //[Authorize] içerinde Admin userı çalıştırabilir sadece
                productService.WithDraw(accountNumber, 200000);
            });

            Run(() =>
            {
                //[Exception] attribute için hata fırlatıyoruz içeride
                productService.Deposit(accountNumber, 200000);
            });

            Console.ReadLine();
        }
Exemplo n.º 9
0
 public BankAccountCollection FetchByQuery(Query qry)
 {
     BankAccountCollection coll = new BankAccountCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Exemplo n.º 10
0
 public BankAccountCollection FetchByID(object BankAccountKey)
 {
     BankAccountCollection coll = new BankAccountCollection().Where("bank_account_key", BankAccountKey).Load();
     return coll;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Creates a new customer, which holds account and transaction information.
 /// </summary>
 /// <param name="accounts">The accounts for this customer.</param>
 public Customer(BankAccountCollection accounts)
 {
     this.accounts = accounts;
     this.transactionHistory = new TransactionCollection();
 }
Exemplo n.º 12
0
 public BalanceForm(Customer customer, int selectedAccount)
 {
     InitializeComponent();
     this.accounts        = customer.Accounts;
     this.selectedAccount = selectedAccount;
 }
Exemplo n.º 13
0
        // TODO: Debug - 500 Internal Server Error
        /*
        public async Task<bool> IsBpayContactValid(string billerCode, string referenceNumber)
        {
            if (await IsLoggedInAsync())
            {
                
                //Go to contacts page
                var newResponse = await HttpClient.GetAsync("https://banking.bendigobank.com.au/banking/contacts/bpay/new");
                
                //Check biller code
                var req2 = new HttpRequestMessage(HttpMethod.Get, "https://banking.bendigobank.com.au/banking/bpay_billers/" + billerCode);
                req2.Headers.Referrer = new Uri("https://banking.bendigobank.com.au/banking/contacts/bpay/new");
                req2.Headers.Add("X-CSRF-Token", CsrfToken);
                var codeResponse = await HttpClient.SendAsync(req2);

                // egbdfgh

                var reqTwo = WebRequest.Create("https://banking.bendigobank.com.au/banking/bpay_billers/" + billerCode);

                //Check reference number
                var req3 = new HttpRequestMessage(HttpMethod.Post, string.Format("https://banking.bendigobank.com.au/banking/bpay_billers/{0}/validate_crn", billerCode));
                req3.Headers.Add("X-CSRF-Token", CsrfToken);
                req3.Headers.Add("X-Requested-With", "XMLHttpRequest");
                req3.Content = new StringContent(string.Format("customer_reference_number={0}", referenceNumber), Encoding.UTF8);
                req3.Content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded");
                var validateResponse = await HttpClient.SendAsync(req3);

                return validateResponse.StatusCode == HttpStatusCode.NoContent;
            }
            return false;
        }
         */

        /// <summary>
        /// Retrieves bank account information for the currently logged in user.
        /// </summary>
        /// <param name="getLineChartData">If true, line chart data is collected for each BankAccount object.</param>
        /// <returns>A collection of BankAccount objects for each of the user's bank accounts.</returns>
        public async Task<BankAccountCollection> GetBankAccountsAsync(bool getLineChartData)
        {
            BankAccountCollection accounts = new BankAccountCollection();
            if (await IsLoggedInAsync())
            {
                // Get the user's accounts page HTML.
                HttpResponseMessage accountsResponse = await HttpClient.GetAsync(ACCOUNTS_URL); 
                HtmlDocument document = new HtmlDocument();
                document.LoadHtml(await accountsResponse.Content.ReadAsStringAsync());
                // Extract the account groups from the HTML (account groups are delineated by holder name e.g. JOHN A SMITH)
                var groupNodes = GetNodesWithAttribute(document.DocumentNode, "li", "class", "grouped-list__group");
                foreach (var groupNode in groupNodes)
                {
                    // Extract the name of the holder for the current group.
                    string holder = groupNode.Descendants("h6").First().InnerText.Trim().Replace("&amp;", "&");
                    // Extract all accounts from the current group.
                    var accountNodes = GetNodesWithAttribute(groupNode, "div", "class", "account panel ");
                    foreach (var accountNode in accountNodes)
                    {
                        // Extract BankAccount member data from select elements and attributes within the account element.
                        string name = GetNodesWithAttribute(accountNode, "span", "class",
                            "overflow-ellipsis account-name-and-number__name h4").First().InnerText.Trim()
                            .Replace(".", string.Empty).Replace("&amp;", "&");
                        string id = accountNode.Id.Substring(8);

                        var numbersNode = GetNodesWithAttribute(
                            accountNode, "span", "class", "account-name-and-number__numbers h6").First();
                        string number = numbersNode.Descendants("span").Where(
                            n => !n.Attributes.Contains("class")).Last().InnerText.Trim();
                        string bsb = numbersNode.Descendants("span").Where(
                            n => !n.Attributes.Contains("class")).First().InnerText.Trim();

                        float available = float.Parse(accountNode.Attributes["data-available-balance"].Value);
                        var currentNode = numbersNode.Descendants("dt").FirstOrDefault(
                            n => n.Attributes.Contains("class") && n.Attributes["class"].Value ==
                            "key-value-list__value");
                        float current = currentNode != null ?
                            float.Parse(currentNode.InnerText.Trim().Replace("$", string.Empty)) :
                            available;

                        if (getLineChartData)
                        {
                            HttpResponseMessage transactionsResponse = await HttpClient.GetAsync(
                                string.Format("{0}{1}/transactions/chart.json?limit=19&available_balance={2}",
                                ACCOUNTS_URL, id, available));
                            string responseContent = await transactionsResponse.Content.ReadAsStringAsync();
                            accounts.Add(new BankAccount(holder, id, name, bsb, number, current, available,
                                JsonConvert.DeserializeObject<BankTransactionCollection>(responseContent)));
                        }
                        accounts.Add(new BankAccount(holder, id, name, bsb, number, current, available));
                    }
                }
            }
            else
                System.Diagnostics.Debug.WriteLine("GetBankAccountsAsync() - Not logged in.", ERROR_HEADER);
            return accounts;
        }
Exemplo n.º 14
0
 private void BankingForm_Load(object sender, EventArgs e)
 {
     accounts = new BankAccountCollection();
     refreshControls();
 }