예제 #1
0
        private static void CreateAccount(Customer cust)
        {
            string pw     = "";
            string pwConf = "";

            Console.WriteLine("Let me get some basic information from you...");

            //get name
            Console.WriteLine("What is your first name?");
            cust.SetCustomerFirstName(Console.ReadLine());
            Console.WriteLine("What is your last name?");
            cust.SetCustomerLastName(Console.ReadLine());

            //set Username
            Console.WriteLine("What would you like your User Name to be?");
            cust.SetCustomerUserName(Console.ReadLine().Trim());

            //check if Username exists in accounts table, stay in loop until a unique username is entered
            while (SQL_Data.UserNameExist(cust.GetCustomerUserName()))
            {
                Console.WriteLine("That Username has already been used, please try a different User Name");
                cust.SetCustomerUserName(Console.ReadLine().Trim());
            }

            //Set Password
            Console.WriteLine("Please enter a password:"******"Please confirm your password:"******"Your password confirmation did not match, please try again.");
                Console.WriteLine("Please enter a password:"******"Please confirm your password:"******"There was a problem creating your account, please try again later.");
            }
            else
            {
                Console.WriteLine("Congratulations " + cust.GetCustomerFirstName() + ", your account has been successfuly created!");
                Console.WriteLine("You may now login to the Worlds Greatest Banking Ledger!");
                Console.WriteLine("--------------------------------------------------------------------------");
                Console.WriteLine("");
                Login(cust);
            }
        }
예제 #2
0
        private static void RecordWithdrawal(Customer cust)//option 2 on main menu
        {
            decimal amount = 0;

            Console.WriteLine("You chose to Record a Withdrawal, how much? ");
            string response = Console.ReadLine();

            try
            {
                amount = Convert.ToDecimal(response);
            }
            catch
            {
                Console.WriteLine("you entered an invalid value, please try again and use decimal values only.");
                RecordWithdrawal(cust);
            }
            SQL_Data.SetData(cust, "withdraw", amount);
            Console.WriteLine("Your withdrawal of $" + amount + " was recorded");
            Console.WriteLine("");
            WhatNow(cust);
        }