/// <summary> /// Prompts the user for input. /// Calls ValidateInput() to check for 4 digits. /// Then looks up Entries in PINS.txt /// </summary> /// <returns>Returns True for a Valid PIN that is found in PINS.txt</returns> private string[] CheckPIN() { string Input = _t.GetString(); if (IsValidInput(Input)) { { string[] users = filer.GetListOfUsers(); foreach (var item in users) { User tmp = JSONConverter.JSONToGeneric <User>(item); if (tmp.GetType() == typeof(User)) { if (Input.GetHashCode().ToString().Equals(tmp.PIN)) { return(new string[2] { tmp.Status, tmp.FirstName }); } } } } _t.Display("No matching PIN found\n"); } else { _t.Display("Invalid Input\n"); } return(new string[2] { "error", "error" }); }
public void Routine(string mode) { switch (mode) { case "ADMIN": ShowAdminOptions(); AdminMode(_t.GetString()); break; case "USER": ShowUserOptions(); UserMode(_t.GetString()); break; case "LOCKED": _t.Display("Your user is locked contact your local admin"); System.Environment.Exit(1); break; } }
public void Routine(string mode) { switch (mode) //Sortiert Nutzer ins richtige MenĂ¼ ein basierend auf seinem Status { case "ADMIN": ShowAdminOptions(); AdminMode(_t.GetString()); break; case "USER": ShowUserOptions(); UserMode(_t.GetString()); break; case "LOCKED": _t.Display("Your user is locked contact your local admin"); System.Environment.Exit(1); break; } }
/// <summary> /// Prompts the user for input. /// Calls ValidateInput() to check for 4 digits. /// Then looks up Entries in PINS.txt /// </summary> /// <returns>Returns True for a Valid PIN that is found in PINS.txt</returns> private string[] CheckPIN() { string Input = _t.GetString(); if (IsValidInput(Input)) { { List <User> Employs; using (var context = new thistimeitwillworkforsure.DBContext()) { Employs = context.Users.ToList(); } List <User> tmpUsers = new List <User>(); foreach (var User in Employs) { tmpUsers.Add(JsonConvert.DeserializeObject <User>(User.JSON)); } bool matchingPIN = tmpUsers.Any(User => User.PIN == Input); try { User currentuser = tmpUsers.Single(x => x.PIN == Input); //from User in Employs.Single //where User.PIN == Input //select User; return(new string[2] { currentuser.Status, currentuser.FirstName }); } catch (Exception) { throw; } } } else { _t.Display("Invalid Input<br />"); } return(new string[2] { "error", "error" }); }