/////////// public Boolean AdminVerification(UserObj obj) { Boolean verified = false; parentInput p = new parentInput(); List <UserObj> list = p.ReadData(); foreach (UserObj b in list) { if (obj.ID.Equals(b.ID) && obj.pswd == b.pswd) { if (b.UserType.Equals("admin")) { if (b.status.Equals("active")) { verified = true; break; } else { Console.WriteLine("Your account is not \"active\""); break; } } else { Console.WriteLine("You are not exists in records as \"admin\""); break; } } else { verified = false; } } return(verified); }
public void createNewUser() { UserObj obj = new UserObj(); enterAgain: Console.Write("Login: "******"Please enter right user name"); goto enterAgain; } pinCode: Console.Write("Pin Code: "); try { int pswd = System.Convert.ToInt32(Console.ReadLine()); if (pswd.ToString().Length == 5) { obj.pswd = pswd; } else { Console.WriteLine("Please enter 5-digit pin"); goto pinCode; } } catch (Exception) { Console.Write("You have intered invalid Pin! Please enter 5-digit pin in numbers only"); goto pinCode; } enterAgainName: Console.Write("Holder's Name: "); string name = Console.ReadLine(); if (name.Length > 0) { obj.name = name; } else { Console.WriteLine("Please enter valid logIn Id"); goto enterAgainName; } typeCheck: Console.Write("Type (saving,current): "); string type = Console.ReadLine(); if (type.Equals("saving") || type.Equals("current")) { obj.type = type; } else { Console.WriteLine("You have entered invalid value! Please enter correct account type (saving OR current)"); goto typeCheck; } startingBalance: Console.Write("Starting Balance: "); try { obj.cash = System.Convert.ToDecimal(Console.ReadLine()); } catch { Console.WriteLine("You have entered invalid value! Please enter correct amount"); goto startingBalance; } statusCheck: Console.Write("Status (active/deactive): "); string status = Console.ReadLine(); if (status.Equals("active") || status.Equals("deactive")) { obj.status = status; } else { Console.WriteLine("You have entered invalid value! Please enter correct account status"); goto statusCheck; } obj.UserID = nextUserId(); obj.UserType = "user"; obj.date = DateTime.Today; parentInput p = new parentInput(); p.CreateNewAccount(obj); Console.WriteLine($"\nAccount Successfully Created - the account number assigned is: {obj.UserID}"); }
public UserMenuItems() { p = new parentInput(); list = p.ReadData(); today = DateTime.Today; }