Exemple #1
0
        public static void TakeOutLoan()
        {
            Console.Clear();
            Console.WriteLine("You must sign in with your full name and pin before you can take out a loan");
            Console.WriteLine("Please enter your first name: ");
            string firstName = Console.ReadLine();

            UI.StringOnlyCheck(firstName);
            Console.WriteLine("Please enter your last name:");
            string lastName = Console.ReadLine();

            UI.StringOnlyCheck(lastName);
            Console.WriteLine("Please enter your unique pin number");
            string pin       = Console.ReadLine();
            int    pinNumber = UI.CheckPin(pin);

            Console.Clear();
            CheckForCustomer();
            bool     isFound  = false;
            Customer customer = null;

            foreach (var cust in AccountManager.customers)
            {
                if (firstName.ToLower() == cust.FirstName && lastName.ToLower() == cust.LastName && pinNumber == cust.Pin)
                {
                    customer = cust;
                    isFound  = true;
                    break;
                }
            }
            if (isFound == true)
            {
                Console.WriteLine("Please enter the amount you would like to request as a loan. Note: amount must be $1000 or greater.");
                Console.Write("$");
                string  ans = Console.ReadLine();
                decimal output;
                while (!Decimal.TryParse(ans, out output)) // need this condition to continuosly execute if user enters more than 4 numbers
                {
                    Console.WriteLine("Please enter the amount you would like to request as a loan. Note: amount must be $1000 or greater.");
                    Console.Write("$");
                    ans = Console.ReadLine();
                }
                if (output < 1000)
                {
                    Console.WriteLine("Loans must be $1000 or more");
                    OnEnterPress();
                    Program.ExecuteUserInput();
                }
                var loan        = new Loan(0);
                var takeOutLoan = new AccountManager(loan, customer);
                loan.MakeWithdrawal(output, DateTime.Now);
            }
            else
            {
                Console.Clear();
                Console.WriteLine("Sorry, we couldn't find any customers related to the information provided!");
                Program.ExecuteUserInput();
            }
        }
Exemple #2
0
        public static void CreateBusinessAccount()
        {
            Console.Clear();
            Console.WriteLine("You must sign in with your full name and pin before creating an account.");
            Console.WriteLine("Please enter your first name: ");
            string firstName = Console.ReadLine();

            UI.StringOnlyCheck(firstName);
            Console.WriteLine("Please enter your last name:");
            string lastName = Console.ReadLine();

            UI.StringOnlyCheck(lastName);
            Console.WriteLine("Please enter your unique pin number");
            string pin       = Console.ReadLine();
            int    pinNumber = UI.CheckPin(pin);

            if (AccountManager.customers.Count == 0)
            {
                Console.WriteLine("Sorry, we couldn't find any customers related to the information provided!");
                Program.ExecuteUserInput();
            }
            bool     isFound  = false;
            Customer customer = null;

            foreach (var cust in AccountManager.customers)
            {
                if (firstName.ToLower() == cust.FirstName && lastName.ToLower() == cust.LastName && pinNumber == cust.Pin)
                {
                    customer = cust;
                    isFound  = true;
                    break;
                }
            }
            if (isFound == true)
            {
                var businessAccount = new BusinessAccount();
                var generateAccount = new AccountManager(businessAccount, customer);
                Console.WriteLine("You've successfully opened up a business account with us!");
                OnEnterPress();
                Console.Clear();
                Program.ExecuteUserInput();
            }
            else
            {
                Console.Clear();
                Console.WriteLine("Sorry, we couldn't find any customers related to the information provided!");
                Program.ExecuteUserInput();
            }
        }