//************************************************** // Method: login // // Purpose: Logging in. //************************************************** static void login() { Console.Clear(); Account a; string email, password = ""; string[] args = { "true", password }; Console.Write("Email: "); email = Console.ReadLine(); Console.Write("Password: "******"Welcome back!"); string wait = Console.ReadLine(); if (cCheck("email", a.Email)) { MenuC menu = new MenuC((Customer)a, dataStore.Businesses); } else if (bCheck("email", a.Email)) { MenuB menu = new MenuB((Business)a, dataStore.Businesses); } else if (dCheck("email", a.Email)) { MenuD menu = new MenuD((Person)a, dataStore.Customers); } save(); } else { Console.WriteLine("Invalid user."); string wait = Console.ReadLine(); } }
//************************************************** // Method: bRegister // // Purpose: Registering a Business account. //************************************************** static void bRegister() { Business b = new Business(); string[] args = { "false" }; PropertyInfo[] properties = typeof(Business).GetProperties(); foreach (PropertyInfo property in properties) { if (property.Name == "Address") { b.Address = new Address(); PropertyInfo[] ap = typeof(Address).GetProperties(); foreach (PropertyInfo p in ap) { Console.Write(p.Name + ": "); p.SetValue(b.Address, Console.ReadLine()); } } else if (property.Name != "Items") { Console.Write(property.Name + ": "); property.SetValue(b, Console.ReadLine()); } } if (!check("b", b.Email, args)) { dataStore.Businesses.Add(b); save(); MenuB menu = new MenuB(b, dataStore.Businesses); } else { Console.Write("An account was already made with this email."); string wait = Console.ReadLine(); } }