public void CreateNewUser() { bool validInput = true; string username; do { username = ExtraUtilities.GetStringAnswer("Choose Username"); validInput = sqlAccess.ValidUsername(username); } while (validInput == false); string password = ExtraUtilities.GetStringAnswer("Choose Password"); string name = ExtraUtilities.GetStringAnswer("Choose display name"); int age = ExtraUtilities.GetIntAnswer("Age"); string sex = ExtraUtilities.GetStringAnswer("What sex do you identify as?"); string attractedTo = ExtraUtilities.GetStringAnswer("What sex/sexes are you attracted to? Seperate by \", \"", true); int height = ExtraUtilities.GetIntAnswer("How tall are you? In cm"); string skinColor = ExtraUtilities.GetStringAnswer("What is your ethnicity?"); string hairColor = ExtraUtilities.GetStringAnswer("What is your hair color?"); string eyeColor = ExtraUtilities.GetStringAnswer("What color are your eyes?"); string interest = ExtraUtilities.GetStringAnswer("What are your interest? Seperate by \", \"", true); sqlAccess.RunNonquery($"INSERT INTO [Security] VALUES ('{username}', '{password}')"); sqlAccess.RunNonquery($"INSERT INTO [Profile] VALUES ('{username}', '{name}', {age}, '{sex}', '{attractedTo}', {height}, '{skinColor}', '{hairColor}', '{eyeColor}', '{interest}')"); age = ExtraUtilities.GetIntAnswer("What age people are you looking for, minimum will be set to 18"); sex = attractedTo; attractedTo = sex; height = ExtraUtilities.GetIntAnswer("How tall should they be? In cm"); skinColor = ExtraUtilities.GetStringAnswer("What ethnicity? Seperate by \", \"", true); hairColor = ExtraUtilities.GetStringAnswer("What hair colors? Seperate by \", \"", true); eyeColor = ExtraUtilities.GetStringAnswer("What color eyes? Seperate by \", \"", true); interest = ExtraUtilities.GetStringAnswer("What interest shoudl they have? Seperate by \", \"", true); sqlAccess.RunNonquery($"INSERT INTO [Preferences] VALUES ('{username}', {age}, '{sex}', '{attractedTo}', {height}, '{skinColor}', '{hairColor}', '{eyeColor}', '{interest}')"); }
public void EditUserInfo(Security security, string username) { Console.Clear(); Console.WriteLine("Choose an option"); Profile profile = security.GetUserInfo(username); string[] options = { "Name", "Age", "Sex", "Sexual Orientation", "Height", "Skin color", "Hair color", "Eye color", "Interest" }; ExtraUtilities.MenuOptions(options); Console.WriteLine("0 -> Exit"); string editString; int editInt; char menuChoice = Console.ReadKey().KeyChar; switch (menuChoice) { case '1': editString = ExtraUtilities.GetStringAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {profile.Name}. What do you want to change it to? -> "); sqlAccess.RunNonquery($"UPDATE [Profile] SET [Name] = '{editString}' WHERE Username = '******'"); break; case '2': editInt = ExtraUtilities.GetIntAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {profile.Age}. What do you want to change it to? -> "); sqlAccess.RunNonquery($"UPDATE [Profile] SET Age = {editInt} WHERE Username = '******'"); break; case '3': editString = ExtraUtilities.GetStringAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {profile.Sex}. What do you want to change it to? -> "); sqlAccess.RunNonquery($"UPDATE [Profile] SET [Sex] = '{editString}' WHERE Username = '******'"); break; case '4': editString = ExtraUtilities.GetStringAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {ExtraUtilities.StringFromList(profile.AttractedTo)}. What do you want to change it to? Seperate by \", \" -> ", true); sqlAccess.RunNonquery($"UPDATE [Profile] SET [AttractedTo] = '{editString}' WHERE Username = '******'"); break; case '5': editInt = ExtraUtilities.GetIntAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {profile.Heigth}. What do you want to change it to? -> "); sqlAccess.RunNonquery($"UPDATE [Profile] SET [Height] = {editInt} WHERE Username = '******'"); break; case '6': editString = ExtraUtilities.GetStringAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {ExtraUtilities.StringFromList(profile.SkinColor)}. What do you want to change it to? -> "); sqlAccess.RunNonquery($"UPDATE [Profile] SET [SkinColor] = '{editString}' WHERE Username = '******'"); break; case '7': editString = ExtraUtilities.GetStringAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {ExtraUtilities.StringFromList(profile.HairColor)}. What do you want to change it to? Seperate by \", \" -> ", true); sqlAccess.RunNonquery($"UPDATE [Profile] SET [HairColor] = '{editString}' WHERE Username = '******'"); break; case '8': editString = ExtraUtilities.GetStringAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {ExtraUtilities.StringFromList(profile.EyeColor)}. What do you want to change it to? Seperate by \", \" -> ", true); sqlAccess.RunNonquery($"UPDATE [Profile] SET [EyeColor] = '{editString}' WHERE Username = '******'"); break; case '9': editString = ExtraUtilities.GetStringAnswer($"Your current {options[int.Parse(menuChoice.ToString()) - 1]} is set to {ExtraUtilities.StringFromList(profile.Interest)}. What do you want to change it to? Seperate by \", \" -> ", true); sqlAccess.RunNonquery($"UPDATE [Profile] SET [Interest] = '{editString}' WHERE Username = '******'"); break; case 'e': break; } Console.Clear(); Console.WriteLine("Changes Saved!"); Console.ReadKey(); }