public void DisplayBalance() //to display current user balance. { MainBLL bll = new MainBLL(); CustomerBO ub = bll.GetCurrentUser(null, null, cbo.AccountNo); WriteLine($"\nAccount #{ub.AccountNo}\nDate: {DateTime.Now}\nBalance: {ub.Balance}"); }
public void PrintReceipt(Transactions ts, CustomerBO ub) { MainBLL bll = new MainBLL(); ub = bll.GetCurrentUser(null, null, ub.AccountNo); WriteLine($"\nAccount #{ub.AccountNo}\nDate: {ts.DT}\n\n{ts.Type.ToUpper()}: {ts.Balance}\nBalance: {ub.Balance}"); }
public void MainScreen() //main screen with which the user interact very firstly. It also validate login credentials { //in case of wrong login id just displays error message and ask for input again, but in case of int wrongs = 0; //wrong pin code it displays counter for 3 wrong pins validation. in case of admins after 3 wrong Clear(); //pins it will say admin to try again later but in case of customer it will send request too bll WriteLine("\t\t*** Welcome To ATM Management System ***\n\n"); //to disable that customer account. d2: Write("Enter Login: "******"\n=> Login ID only contain numbers or characters\n"); goto d2; } l1: Write("\nEnter Pin: "); string code = ReadLine(); bool isPinValid = bll.DigitValidation(code); if (code == "" || code.Length != 5 || !isPinValid) { WriteLine("\n=> Pin code only contains numbers - Pin must have 5 digits"); } AdminBO bo = new AdminBO { Login = login, pin = code }; int who = -1; //for differetiation between customer and admin; 0 for customer and 1 for admin bool isUserFileExist = true; bool isCorrect = bll.IsLoginMatched(login, code, ref wrongs, ref who, ref isUserFileExist); bool isUserExist = bll.isLoginUseridExist(login, null); bool isAdminExist = bll.isAdminIDExist(login); if (isCorrect && who == -1) //success scenerio of admin { int AdminChoice = 0; AdminChoice = DisplayAdminMenu(); CheckAdminChoice(AdminChoice); } else if (!isCorrect && !isAdminExist && who == -1) //failure scenerio of admin { WriteLine($"\n=> No Account exist with the Login ID: {login}\n"); wrongs--; goto d2; } else if (!isCorrect && who == -1 && wrongs == 3) //failure scenerio as wrong inputs are now 3. so admin { //now should try next time or after a while. Console.WriteLine("\n=> Invalid Username or Password - Try Again Later\n"); System.Environment.Exit(1); } else if (isCorrect && who == 0) //success scenerio of customer { bool isDisable = bll.IsAccountDisable(login); //check whether account is disables or not if (isDisable) { WriteLine($"\n=> Account is against Login ID: {login} is unfortunately Disabled\n"); goto d2; } int choice = 0; cbo = bll.GetCurrentUser(login, null, 0); choice = DisplayUserMenu(); CheckUserChoice(choice); } else if (!isUserFileExist) { WriteLine("\n=> We Have No Records !\n"); wrongs--; goto d2; } else if (!isCorrect && who == 0 && wrongs == 3) //if wrong entries of pin are 3 now so make account disable { Console.WriteLine($"\n=> Multiple Wrong Pins - Account against Login ID: {login} is Disabled Now\n"); bll.MakeAccountDisable(login); System.Environment.Exit(1); } else if (!isCorrect && !isUserExist && who == 0) { WriteLine($"\n=> No Account exist with the Login ID: {login}\n"); wrongs--; goto d2; } else { WriteLine($"\n=> Wrong Pin - Try Again - {3 - wrongs} tries left"); goto l1; } }