예제 #1
0
        //change balance and create a record on two accounts.
        public void transfer(float amount, Account transferTo)
        {
            this.balance -= amount;
            TransactionRecord newRecord = new TransactionRecord(DateTime.Now, this.accountType, "Transfer", (amount * -1)); //record is saved as negative value.
            accountHolder.addTransaction(newRecord);

            //update account transfering to...
            transferTo.balance += amount;
            TransactionRecord toAccRecord = new TransactionRecord(DateTime.Now, transferTo.accountType, "Transfer", amount);
            accountHolder.addTransaction(toAccRecord);
        }
예제 #2
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.
                */
        }
예제 #3
0
 //change balance and create a record
 public void withdrawl(float amount)
 {
     this.balance -= amount;
     TransactionRecord newRecord = new TransactionRecord(DateTime.Now, this.accountType, "Withdrawl", (amount * -1)); //record is saved as negative value.
     accountHolder.addTransaction(newRecord);
 }
예제 #4
0
 //change balance and create a record
 public void deposit(float amount)
 {
     this.balance += amount;
     TransactionRecord newRecord = new TransactionRecord(DateTime.Now, this.accountType, "Deposit", amount);
     accountHolder.addTransaction(newRecord);
 }
예제 #5
0
 public void addTransaction(TransactionRecord record)
 {
     transactions.Add(record);
 }