Beispiel #1
0
        public static void LoginInfo()
        {
            Console.WriteLine("Welcome back to Net Bank!\n");

            Customers user;
            bool      cond2 = true;

            do
            {
                Console.Write("First Name: ");
                string fname = Console.ReadLine();

                Console.Write("Last Name: ");
                string lname = Console.ReadLine();

                bool cond = true;
                int  ssn  = 0;
                do
                {
                    try
                    {
                        Console.Write("Last 4 Digits of SSN: ");
                        ssn  = Convert.ToInt32(Console.ReadLine());
                        cond = false;
                    }
                    catch (FormatException)
                    {
                        Console.WriteLine("***Please Enter a Valid SSN***\n");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("A fatal error has been logged. Please try again\n");
                    }
                } while (cond);

                user = CustomersBL.Get(ssn, fname, lname);
                if (user == null)
                {
                    Console.WriteLine("\nLogin Failed, Profile Was Not Found \nReturning to Home Menu ");
                    Console.WriteLine("\nPress <ENTER> to continue...");
                    Console.ReadLine();
                    Console.Clear();
                    HomePage.LoginMenu();
                }
                else
                {
                    cond2 = false;
                }
            } while (cond2);

            BankingOptions.MainMenu(user.userID);
        }
Beispiel #2
0
        public static void UpdateUser(int userID)
        {
            bool cond = true;

            do
            {
                var cust = CustomersBL.Get(userID);
                Console.WriteLine("Hello {0} {1}\n", cust.fname, cust.lname);
                Console.WriteLine("1 - First Name: " + cust.fname);
                Console.WriteLine("2 - Last Name: " + cust.lname);
                Console.WriteLine("3 - Date of Birth: " + cust.dob);
                Console.WriteLine("4 - 4 Digit SSN: " + cust.ssn);
                Console.WriteLine("5 - Address: " + cust.address);
                Console.WriteLine("0 - Go To Main Menu");

                Console.Write("Please Select the Field You Would Like to Update: ");
                string userChoice = Console.ReadLine();

                Console.Write("\n\nUpdated Information: ");
                string userInput    = Console.ReadLine();
                int    userInputInt = 0;

                switch (userChoice)
                {
                case "1":
                    CustomersBL.UpdateUser(userID, userInput, cust.lname, cust.dob, cust.ssn, cust.address);
                    break;

                case "2":
                    CustomersBL.UpdateUser(userID, cust.fname, userInput, cust.dob, cust.ssn, cust.address);
                    break;

                case "3":
                    do
                    {
                        try
                        {
                            userInputInt = Convert.ToInt32(userInput);
                            cond         = false;
                            if (userInputInt.ToString().Length != 8)
                            {
                                Console.WriteLine("****Please Use Format YYYYMMDD****");
                                userInputInt = Convert.ToInt32(Console.ReadLine());
                                cond         = true;
                            }
                        }
                        catch (FormatException)
                        {
                            Console.WriteLine("Invalid Value. Please Try Again: ");
                            userInputInt = Convert.ToInt32(Console.ReadLine());
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("A fatal error has been logged. Please try again\n");
                        }
                    } while (cond);
                    CustomersBL.UpdateUser(userID, cust.fname, cust.lname, userInputInt, cust.ssn, cust.address);
                    break;

                case "4":
                    do
                    {
                        try
                        {
                            userInputInt = Convert.ToInt32(userInput);
                            cond         = false;
                            if (userInputInt.ToString().Length != 4)
                            {
                                Console.WriteLine("****Please Enter a 4 Digit SSN****");
                                userInputInt = Convert.ToInt32(Console.ReadLine());
                                cond         = true;
                            }
                        }
                        catch (FormatException)
                        {
                            Console.WriteLine("Invalid Value. Please Try Again: ");
                            userInputInt = Convert.ToInt32(Console.ReadLine());
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("A fatal error has been logged. Please try again\n");
                        }
                    } while (cond);
                    CustomersBL.UpdateUser(userID, cust.fname, cust.lname, cust.dob, userInputInt, cust.address);
                    break;

                case "5":
                    CustomersBL.UpdateUser(userID, cust.fname, cust.lname, cust.dob, cust.ssn, userInput);
                    break;

                case "0":
                    cond = false;
                    BankingOptions.MainMenu(userID);
                    break;
                }
            } while (cond);
        }
Beispiel #3
0
        public static void CreateUser()
        {
            Console.WriteLine("Thank you for choosing our service. \nOur goal is to fulfill all of your banking needs! \n\nIn order to begin we are going to need some basic information:");

            Customers customer = new Customers();
            // Asks the customer for basic information to create an account


            bool response = true;

            do
            {
                Console.WriteLine("\nPlease enter your first name");
                customer.fname = Console.ReadLine();
                if (customer.fname != "")
                {
                    response = false;
                }
            } while (response);

            response = true;
            do
            {
                Console.WriteLine("Please enter your last name");
                customer.lname = Console.ReadLine();
                if (customer.lname != "")
                {
                    response = false;
                }
            } while (response);

            response = true;
            do
            {
                try
                {
                    Console.WriteLine("Please enter your date of birth (Use Format YYYYMMDD)");
                    customer.dob = Convert.ToInt32(Console.ReadLine());
                    response     = false;
                    if (customer.dob.ToString().Length != 8)
                    {
                        Console.WriteLine("****Please enter a valid date of birth****"); response = true;
                    }
                }
                catch (FormatException)
                {
                    Console.WriteLine("****Please enter a valid date of birth****");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("A fatal error has been logged. Please try again ");
                }
            } while (response);

            response = true;
            do
            {
                try
                {
                    Console.WriteLine("Please enter the last four digits of your social security number");
                    customer.ssn = Convert.ToInt32(Console.ReadLine());
                    response     = false;
                    if (customer.ssn.ToString().Length != 4)
                    {
                        Console.WriteLine("****Please enter a valid social security number****"); response = true;
                    }
                }
                catch (FormatException)
                {
                    Console.WriteLine("****Please enter a valid social security number****");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("A fatal error has been logged. Please try again ");
                }
            } while (response);

            response = true;
            do
            {
                Console.WriteLine("Please enter your address");
                customer.address = Console.ReadLine();
                if (customer.address != "")
                {
                    response = false;
                }
            } while (response);

            //Ask users if info is ok and give option to update
            CustomersBL customerBL = new CustomersBL();

            customerBL.Create(customer);

            Console.WriteLine("\nPress <ENTER> to continue...");
            Console.ReadLine();
            Console.Clear();

            //Allows a User to Create Their First Account
            CreateAccount.FirstAccount(customer.userID);
        }