Example #1
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            //get login details
            int accountNumber;
            string accountName;
            try
            {
                accountNumber = int.Parse(accNumField.Text.Trim());
            }
            catch { return; }
            accountName = accNameField.Text.Trim();

            //check login details correct (slow linear search)
            for (int j = 0; j < test.BankingCustomers.Count; j++)
            {
                currentUserLogin = (AccountHolder) test.BankingCustomers[j];
                if (currentUserLogin.getName()==accountName &&
                  currentUserLogin.getNumber()==(accountNumber))
                {
                    Select_Account selectAccount = new Select_Account(this, currentUserLogin.getName()); //create next form with this form as parent.
                    selectAccount.Show();

                    //clear input feilds for when reloading
                    accNumField.Text = "";
                    accNameField.Text = "";

                    this.Hide(); //re-show when we close last form.
                    break;//next form is loaded with this form having saved current customer logged in, stop search.

                }

            }
        }
 public Transaction_Value(Transaction parent, string formNm, string type)
 {
     InitializeComponent();
     this.transactionParentForm = parent;
     this.formName = formNm;
     this.transType = type;
     this.user = this.transactionParentForm.SelectAccParentForm.LoginParentForm.currentUserLogin;
 }
Example #3
0
        public ArrayList BankingCustomers = new ArrayList(); //store all AccountHolder objects

        #endregion Fields

        #region Constructors

        //setup and add accountholders to our pseudo database.
        public TestingApp()
        {
            //create first Login
                AccountHolder test1 = new AccountHolder(12345, "Test1");
                //create first account
                Account Savings1 = new Account(test1,"Savings", 1000.00f);
                test1.addAccount(Savings1);
                //create second account
                Account Cheque1 = new Account(test1, "Cheque", 500.00f);
                test1.addAccount(Cheque1);
                //create third account
                Account TermDeposit1 = new Account(test1, "Term Deposit", 5000.00f);
                test1.addAccount(TermDeposit1);

                //add transactions
                TransactionRecord transaction1 = new TransactionRecord(new DateTime(2015, 05, 23), "Cheque", "Deposit", 100.00f);
                test1.addTransaction(transaction1);
                TransactionRecord transaction2 = new TransactionRecord(new DateTime(2015, 05, 23), "Savings", "Withdrawl", 100.00f);
                test1.addTransaction(transaction2);

                //finally add to pseudo database
                this.BankingCustomers.Add(test1);
                ///////////////////////////////////////////////////////////////////////////////////////

                //create second Login
                AccountHolder test2 = new AccountHolder(6789, "Test2");
                //create first account
                Account Savings2 = new Account(test2, "Savings", 7000.00f);
                test2.addAccount(Savings2);
                //create second account
                Account Cheque2 = new Account(test2, "Cheque", 0.00f);
                test2.addAccount(Cheque2);
                //create third account
                Account TermDeposit2 = new Account(test2, "Term Deposit", 2000.00f);
                test2.addAccount(TermDeposit2);

                this.BankingCustomers.Add(test2);

                /* We now have 2 Logins(AccountHolder objects), each with 3 accounts.
                   test1 has transaction history, test2 does not.
                */
        }
Example #4
0
 public Account(AccountHolder ah, string at, float b)
 {
     this.accountHolder = ah;
     this.accountType = at;
     this.balance = b;
 }