public void furtherAction() { IUserActions userActions = new UserActions(); string decision = commonMethods.ReadString("Do you want to continue >> 1. Yes 2. No : "); Console.Clear(); if (decision == "Yes" || decision == "Y" || decision == "yes" || decision == "1") { if (LoginMethods.CurrentUser.Type == "staff") { StaffActions staff = new StaffActions(); staff.DisplayMethods(); } else { userActions.SelectAction(); } } else { Console.WriteLine("You are logged out"); login.ValidateUser(); } }
public void ValidateUser() { Console.Clear(); Console.WriteLine("<----------WELCOME TO LOGIN PAGE---------->"); string userName = commonMethods.ReadString("Enter your username : "******"Incorrect UserName, Please enter a valid username"); userName = commonMethods.ReadString("Enter a valid username : "******"Enter your password : "******"admin") { Console.Clear(); AdminMethods adminMethods = new AdminMethods(); adminMethods.AdminActions(); } GetBank(userName); List <Account> accounts = accountService.GetAllAccountsByName(userName); if (accounts.Count == 0 && CurrentUser.Type == "staff") { CurrentAccount = null; StaffActions staff = new StaffActions(); staff.DisplayMethods(); } else if (accounts.Count == 1) { CurrentAccount = accounts[0]; if (CurrentUser.Type == "staff") { StaffActions staff = new StaffActions(); staff.DisplayMethods(); } UserActions user = new UserActions(); user.SelectAction(); } else { Console.Write("Enter the account you want to login into : "); int i = 1; foreach (Account account in accounts) { Console.Write(i + " " + Enum.GetName(typeof(AccountType), account.Type) + " "); i += 1; } Console.WriteLine(); int choice = commonMethods.ValidateInt("Please enter your account choice : "); while ((!accounts.Exists(obj => Convert.ToInt32(obj.Type) == choice)) || choice > accounts.Count || choice < 0) { Console.Write("Please enter a valid choice : "); choice = Int32.Parse(Console.ReadLine()); } CurrentAccount = accounts[choice - 1]; if (CurrentUser.Type == "staff") { StaffActions staff = new StaffActions(); staff.DisplayMethods(); } UserActions user = new UserActions(); user.SelectAction(); } } else { Console.WriteLine("Sorry!! You've entered invalid credentials.."); Console.WriteLine("Please enter valid credentials "); System.Threading.Thread.Sleep(1500); ValidateUser(); } }