예제 #1
0
        private static void CheckBalance(Customer cust)//option 3 on main menu
        {
            string amount = SQL_Data.CheckBalance(cust).ToString();

            amount = amount.Substring(0, amount.Length - 2);
            Console.WriteLine("Your Current Balance is $" + amount);
            Console.WriteLine("");
            WhatNow(cust);
        }
예제 #2
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);
            }
        }
예제 #3
0
        private static void Login(Customer cust)
        {
            Console.WriteLine("Please enter your User Name:");
            cust.SetCustomerUserName(Console.ReadLine().Trim());
            Console.WriteLine("Please enter your Password:"******"The Credentials you entered were incorrect, please try again.");
                Login(cust);
            }
        }
예제 #4
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);
        }
예제 #5
0
        private static void DisplayTranHist(Customer cust)//option 4 on main menu
        {
            DataTable table = SQL_Data.TranHist(cust);

            Console.WriteLine("-------------------------------------------------------------------------");
            for (int i = 0; i < table.Rows.Count; i++)
            {
                string date       = table.Rows[i][0].ToString().Substring(0, 10);
                int    spaceIndex = date.IndexOf(" ");
                date = date.Substring(0, spaceIndex);

                string withdraw = table.Rows[i][1].ToString();
                withdraw = withdraw.Substring(0, withdraw.Length - 2);

                string deposit = table.Rows[i][2].ToString();
                deposit = deposit.Substring(0, deposit.Length - 2);

                Console.WriteLine("Date: " + date + " Withdraw = $" + withdraw + " Deposit = $" + deposit);
                Console.WriteLine("-------------------------------------------------------------------------");
            }
            CheckBalance(cust);
        }