public static Accounts GetAccount(int userID) { var allAccounts = AccountsBL.GetAll(userID); foreach (var i in allAccounts) { if ((i.accountType == "Loan Account") || (i.accountType == "Business Account" && i.balance < 0)) { Console.WriteLine("{0} - {1} currently owe ${2}", i.accountID, i.accountType, -1 * i.balance); } else { Console.WriteLine("{0} - {1} with a balance of ${2}", i.accountID, i.accountType, i.balance); } } Console.WriteLine("0 - Go Back to Main Menu"); Console.Write("Please Choose an Account: "); int userInput = -1; bool cond = true; do { try { userInput = Convert.ToInt32(Console.ReadLine()); if (userInput == 0) { BankingOptions.MainMenu(userID); cond = true; } if (AccountsBL.Get(userID, userInput) == null) { Console.WriteLine("****Please Choose a Valid Account****"); } else { cond = false; } } catch (FormatException) { Console.WriteLine("****Please Choose a Valid Account****"); } catch (NullReferenceException) { Console.WriteLine("****Please Choose a Valid Account****"); } catch (Exception ex) { Console.WriteLine("A fatal error has been logged. Please try again "); } } while (cond); return(AccountsBL.Get(userID, userInput)); }
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); }
public static void FirstAccount(int userID) { Console.WriteLine("We offer a variety of accounts each with their own unique interest options" + "\n\nOur Checking Account has a competitive monthly interest rate of 0.05%" + "\n\nOur Business Account allow you to withdrawl money beyond your \ncurrent balance to allow your business to flourish." + "\nThe overdraft ammount is treated as a loan where we offer several \ndifferent interest rate options to meet your business needs:" + "\n 5% Compounded Annually \n 2.89% Compounded Semi-Annually \n 1.5% Compounded Quarterly" + "\n\nSpeaking about loans we also offer Loan account options which \nallows you to take out even more money than a Business Account does." + "\nWe offer competitive interest rates on loans as well!" + "\n $20000 with a 2.5% Annual Rate \n $50000 with a 5.5% Annual Rate \n $100000 with a 11% Annual Rate" + "\n\nLastly, we offer a Term Deposit Account which allows you to put some cash away and watch it grow:" + "\n 4.5% For 1 Year \n 17.5% For 5 Year \n 25% For 10 Year \n"); Console.WriteLine("------------------------------------------------"); NewAccount(userID); BankingOptions.MainMenu(userID); }
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); }
public static void NewAccount(int userID) { bool cond = true; Accounts accountInfo = new Accounts { userID = userID }; Console.WriteLine("1 - Checking Account \n2 - Business Account \n3 - Loan Account \n4 - Term Deposit Account \n0 - Main Menu"); Console.Write("Which type of account would you like to open: "); do { string userInput = Console.ReadLine(); if (userInput == "1") { accountInfo.accountType = "Checking Account"; accountInfo.interest = 1.0005; cond = false; } else if (userInput == "2") { Console.Clear(); accountInfo.accountType = "Business Account"; do { Console.WriteLine("\nOpening your Business Account...\nPlease choose an interest rate: \n1 - 5% Compounded Annually \n2 - 2.89% Compounded Semi-Annually \n3 - 1.5% Compounded Quarterly"); userInput = Console.ReadLine(); if (userInput == "1") { accountInfo.interest = 1.025; cond = false; } else if (userInput == "2") { accountInfo.interest = 1.055; cond = false; } else if (userInput == "3") { accountInfo.interest = 1.11; cond = false; } else { Console.Clear(); Console.WriteLine("****Please Make a Valid Choice From the Options Above****\n"); } } while (cond); } else if (userInput == "3") { Console.Clear(); accountInfo.accountType = "Loan Account"; do { Console.WriteLine("Opening your Loan Account...\n1 - $20000 with a 2.5% Annual Rate \n2 - $50000 with a 5.5% Annual Rate \n3 - $100000 with a 11% Annual Rate"); Console.Write("\nPlease choose a loan offer: "); userInput = Console.ReadLine(); if (userInput == "1") { accountInfo.interest = 1.05; accountInfo.balance = -20000; cond = false; } else if (userInput == "2") { accountInfo.interest = 1.0289; accountInfo.balance = -50000; cond = false; } else if (userInput == "3") { accountInfo.interest = 1.015; accountInfo.balance = -100000; cond = false; } else { Console.Clear(); Console.WriteLine("PLEASE MAKE A VALID CHOICE"); } } while (cond); } else if (userInput == "4") { Console.Clear(); accountInfo.accountType = "Term Deposit Account"; do { Console.WriteLine("Opening your Term Deposit Account...\nPlease choose an interest rate: \n1 - 4.5% For 1 Year \n2 - 17.5% For 5 Year \n3 - 25% For 10 Year"); userInput = Console.ReadLine(); if (userInput == "1") { accountInfo.interest = 1.045; cond = false; } else if (userInput == "2") { accountInfo.interest = 1.175; cond = false; } else if (userInput == "3") { accountInfo.interest = 1.25; cond = false; } else { Console.Clear(); Console.WriteLine("****Please Make a Valid Choice From the Options Above****\n"); } Console.Write("\nHow much would you like to deposit into your Term Deposit Account: $"); bool cond2 = true; double deposit = 0; do { try { deposit = Convert.ToDouble(Console.ReadLine()); cond2 = false; } catch (FormatException) { Console.Write("\nPlease enter a valid ammount: $"); } catch (Exception ex) { Console.WriteLine("A fatal error has been logged. Please try again "); } } while (cond2); accountInfo.balance = deposit; } while (cond); } else if (userInput == "0") { BankingOptions.MainMenu(userID); } else { Console.WriteLine("\n****Please Make a Valid Choice From the Options Above ****\n"); } } while (cond); Console.WriteLine("\nRegistration Complete! Your {0} is now open and active!", accountInfo.accountType); AccountsBL accountBL = new AccountsBL(); accountBL.CreateABL(accountInfo); Console.WriteLine("\nPress <ENTER> to continue..."); Console.ReadLine(); Console.Clear(); }