public static void OpenSelectedAccount(Customer customer)
        {
            Console.WriteLine("What kind of account you want to open?" +
                              "\nex: checking account, business account, loan account, term deposit.");
            //Account a = new CheckingAccount();
            string act = Console.ReadLine();

            if (act.Equals("Checking account", StringComparison.OrdinalIgnoreCase))
            {
                CheckingAccount ck = new CheckingAccount();
                OpenAccount(customer, ck);
                ck.PrintInfor();
            }
            else if (act.Equals("Business account", StringComparison.OrdinalIgnoreCase))
            {
                BusinessAccount ba = new BusinessAccount();
                OpenAccount(customer, ba);
                ba.PrintInfor();
            }
            else if (act.Equals("Term deposit", StringComparison.OrdinalIgnoreCase))
            {
                TermDeposit tm = new TermDeposit();
                OpenAccount(customer, tm);
                tm.PrintInfor();
            }
            else
            {
                Console.WriteLine("Invalid account!");
            }
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            Customer customer = new Customer()
            {
                FirstName = "Joe",
                LastName  = "Zeng",
                Email     = "*****@*****.**",
                DOB       = "09/12/1993"
            };
            BankBL bankBL = new BankBL();

            BankBL.Register(customer);

            CheckingAccount account = new CheckingAccount();

            BankBL.OpenAccount(customer, account);
            account.PrintInfor();
            BankBL.Deposit(account.AccountNum, 300.0);

            BusinessAccount ba = new BusinessAccount();

            BankBL.OpenAccount(customer, ba);
            ba.PrintInfor();
            BankBL.Deposit(ba.AccountNum, 500.0);

            BankBL.DisplayListAccount();

            BankBL.Withdraw(account.AccountNum, 100.0);
            BankBL.Withdraw(ba.AccountNum, 300.0);

            BankBL.DisplayListAccount();

            BankBL.DisplayTranction(10000);
            BankBL.DisplayTranction(ba.AccountNum);

            BankBL.Transfer(account.AccountNum, ba.AccountNum, 100.0);
            BankBL.DisplayListAccount();


            BankBL.Withdraw(ba.AccountNum, 400.0);

            BankBL.DisplayListAccount();
            BankBL.PayLoan(10000, 10002, 50.0);

            BankBL.DisplayListAccount();

            TermDeposit tp = new TermDeposit();

            tp.PrintInfor();
            BankBL.OpenAccount(customer, tp);
            //BankBL.Deposit(10003, 2000);
            // tp.termEnded = true;
            //BankBL.Withdraw(10003, 2000);

            BankBL.ClosedAccount(tp.AccountNum);
            BankBL.DisplayListAccount();


            try
            {
                while (true)
                {
                    BankBL.CustomerOptions();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error! " + ex.Message);
            }
        }