Example #1
0
        private static void CLoseAccount(IBankCustomer bankCustomer)
        {
            int option   = 0;
            var accounts = bankCustomer.CustomerAccounts;

            if (accounts.Count == 0)
            {
                Console.Write("\nYOU HAVE NO OPEN BANK ACCOUNTS AT THIS TIME!\nPress ENTER to continue...");
                Console.ReadKey();
                return;
            }
            Console.Clear();
            Console.WriteLine("   " + bankCustomer.FirstName + " " + bankCustomer.LastName + "\n");
            Console.WriteLine("===========================================");
            Console.WriteLine("║                                         ║");
            Console.WriteLine("║   PICK AN OPTION FROM THE MENU          ║");
            Console.WriteLine("║                                         ║");
            Console.WriteLine("===========================================\n");


            for (int i = 0; i < accounts.Count; i++)
            {
                Console.WriteLine((i + 1) + ")" + " " + accounts[i].Type + " with Account Number: " + accounts[i].AccountNumber);
            }
            while (true)
            {
                try
                {
                    Console.Write("\nWhich Account would you like to close?: ");
                    option = Convert.ToInt32(Console.ReadLine());
                    if (option > 0 && option <= accounts.Count + 1)
                    {
                        break;
                    }
                    else
                    {
                        ErrorHandler();
                    }
                }
                catch (Exception e)
                {
                    CatchHandler(e);
                }
            }
            Console.WriteLine("\n");
            Console.Write(accounts[option - 1].Type.ToUpper() + " " + accounts[option - 1].AccountNumber + " WAS SUCCESSFULLY CLOSED!\nPress ENTER to continue..");
            AdministrativeOperations.CloseAccount(bankCustomer, accounts[option - 1]);
            Console.ReadKey();
        }
Example #2
0
        private static void SingIn()
        {
            string        userName, password;
            IBankCustomer customer;

            while (true)
            {
                Console.Clear();
                Console.WriteLine("======================================================================================");
                Console.WriteLine("║                                                                                    ║");
                Console.WriteLine("║                                 ENTER LOGIN INFORMATION                            ║");
                Console.WriteLine("║                                                                                    ║");
                Console.WriteLine("======================================================================================\n\n");
                Console.Write(" Enter User Name: ");
                userName = Console.ReadLine();
                Console.WriteLine("\n");
                Console.Write(" Enter Password: "******"\nTHE USER NAME AND/OR PASSWORD YOU ENTERED IS INVALID!\n");
                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Press ENTER to return to the Main Menu...");
                    Console.ReadKey();
                    break;
                }
            }
        }
Example #3
0
        private static void Register()
        {
            int           zip;
            IBankCustomer customer;

            Console.Clear();
            Console.WriteLine("==================================================================================");
            Console.WriteLine("║                                                                                ║");
            Console.WriteLine("║                        FILL OUT REGISTRATION INFORMATION                       ║");
            Console.WriteLine("║                                                                                ║");
            Console.WriteLine("==================================================================================\n\n");
            Console.Write(" Enter First Name: ");
            string fName = Console.ReadLine();

            Console.WriteLine("\n");
            Console.Write(" Enter Last Name: ");
            string lName = Console.ReadLine();

            Console.WriteLine("\n");
            Console.Write(" Enter User Name: ");
            string uName = Console.ReadLine();

            Console.WriteLine("\n");
            Console.Write(" Enter Password: "******"\n");
            Console.Write(" Enter Email Address: ");
            string email = Console.ReadLine();

            Console.WriteLine("\n");
            Console.Write(" Enter Home Address: ");
            string address = Console.ReadLine();

            Console.WriteLine("\n");
            Console.Write(" Enter City: ");
            string city = Console.ReadLine();

            Console.WriteLine("\n");
            Console.Write(" Enter State: ");
            string state = Console.ReadLine();

            Console.WriteLine("\n");
            while (true)
            {
                try
                {
                    Console.Write(" Enter ZIPCODE(must be a number): ");
                    string zipcode = Console.ReadLine();
                    zip = Convert.ToInt32(zipcode);
                    break;
                }
                catch (Exception e)
                {
                    CatchHandler(e);
                }
            }
            Console.WriteLine("\n");
            Console.Write(" Enter Gender(M/F): ");
            string gender = Console.ReadLine();

            Console.WriteLine("\n");
            Console.Write(" Enter Mobile Phone Number((xxx) xxx xxxx): ");
            string phone = Console.ReadLine();

            customer = new BankCustomer()
            {
                FirstName   = fName,
                LastName    = lName,
                UserName    = uName,
                Password    = password,
                Email       = email,
                Address     = address,
                City        = city,
                State       = state,
                ZipCode     = zip,
                Gender      = gender,
                MobilePhone = phone
            };

            AdministrativeOperations.Register(customer);
            Console.WriteLine("\nThanks for registering with us! Press Enter to continue\n");
            Console.ReadKey();
            MainMenu();
        }
Example #4
0
        private static void OpenNewAccount(IBankCustomer bankCustomer)
        {
            while (true)
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("   " + bankCustomer.FirstName + " " + bankCustomer.LastName + "\n");
                    Console.WriteLine("==========================================================================================");
                    Console.WriteLine("║                                                                                        ║");
                    Console.WriteLine("║                       PICK AN OPTION FROM THE NEW ACOUNTS MENU                         ║");
                    Console.WriteLine("║                                                                                        ║");
                    Console.WriteLine("==========================================================================================\n");
                    Console.WriteLine("1) Open Checking Account  2) Open Business Account 3) Request Loan  4) Open Term Deposit 5) back  6) Logout\n\n");
                    Console.Write("Enter:");
                    int option = Convert.ToInt32(Console.ReadLine());
                    if (option == 1)
                    {
                        IAccount account = AdministrativeOperations.OpenAccount(bankCustomer, "Checking Account");
                        if (account != null)
                        {
                            Console.WriteLine("CHECKING ACCOUNT WITH ACCOUNT NUMBER " + account.AccountNumber + " WAS SUCCESSFULLY CREATED!\n");
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("CHECKING ACCOUNT CREATION FAILED!!!\n");
                            Console.ForegroundColor = ConsoleColor.Green;
                        }
                        Console.WriteLine("\nPress any key to continue...");
                        Console.ReadKey();
                    }
                    else if (option == 2)
                    {
                        IAccount account = AdministrativeOperations.OpenAccount(bankCustomer, "Business Account");
                        if (account != null)
                        {
                            Console.WriteLine("BUSINESS ACCOUNT WITH ACCOUNT NUMBER " + account.AccountNumber + " WAS SUCCESSFULLY CREATED!\n");
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("BUSINESS ACCOUNT CREATION FAILED!!!\n");
                            Console.ForegroundColor = ConsoleColor.Green;
                        }
                        Console.WriteLine("\nPress any key to continue...");
                        Console.ReadKey();
                    }
                    else if (option == 3)
                    {
                        ILoan loan = null;
                        while (true)
                        {
                            try
                            {
                                Console.Write("1) Personal Loan\n2) Business loan");
                                Console.Write("\n\nEnter Choice:");
                                int value = Convert.ToInt32(Console.ReadLine());
                                Console.Write("\n\nEnter loan amount (must be greater zero):");
                                double amount = Convert.ToDouble(Console.ReadLine());
                                if (value == 1 && amount > 0)
                                {
                                    loan = AdministrativeOperations.RequestLoan(bankCustomer, amount, "personal loan");
                                    break;
                                }
                                else if (value == 2 && amount > 0)
                                {
                                    loan = AdministrativeOperations.RequestLoan(bankCustomer, amount, "business loan");
                                    break;
                                }
                                else
                                {
                                    ErrorHandler();
                                }
                            }
                            catch (Exception e)
                            {
                                CatchHandler(e);
                            }
                        }

                        if (loan != null)
                        {
                            Console.WriteLine("\nLOAN REQUEST FOR $" + loan.Amount + " WAS APPROVED!\nTHE INTEREST RATE ON THE LOAN IS :" + (loan.InterestRate * 100) + "% APR\n");
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("LOAN REQUEST FAILED!!!\n");
                            Console.ForegroundColor = ConsoleColor.Green;
                        }
                        Console.WriteLine("\nPress any key to continue...");
                        Console.ReadKey();
                    }
                    else if (option == 4)
                    {
                        double amount = 0;
                        try
                        {
                            Console.Write("\n\nEnter Term Deposit amount:");
                            amount = Convert.ToDouble(Console.ReadLine());
                        }
                        catch (Exception e)
                        {
                            CatchHandler(e);
                        }
                        ITermDeposit termDeposit = AdministrativeOperations.OpenTermDeposit(bankCustomer, amount);
                        if (termDeposit != null)
                        {
                            Console.WriteLine("\nTERM DEPOSIT OF $" + String.Format("{0:n}", amount) + " WAS APPROVED!\nTHE YIELD ON THE ACCOUNT IS " + (termDeposit.InterestRate * 100) + "% APR\n");
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("TERM DEPOSIT REQUEST FAILED!!!\n");
                            Console.ForegroundColor = ConsoleColor.Green;
                        }
                        Console.WriteLine("\nPress any key to continue...");
                        Console.ReadKey();
                    }
                    else if (option == 5)
                    {
                        break;
                    }
                    else if (option == 6)
                    {
                        Logout();
                    }
                    else
                    {
                        ErrorHandler();
                    }
                }
                catch (Exception e)
                {
                    CatchHandler(e);
                }
            }
        }