public string[] StringArray(int HowMany = 0, string message = "Please Enter Next Item") { string[] newArray = new string[HowMany]; for (int i = 0; HowMany > i; i++) { newArray[i] = Validations.Words(message, 3, 1); } return(newArray); }
public static bool GetBool(string message = "Enter Yes or No :") { bool answer = false; string input = null; bool needAValidResponse = true; int w = 0; while (needAValidResponse) { if (w == 1) { message = $"Invalid Response\r\nPlease Re Enter : YES OR NO \r\n" + message; } input = Validations.Words(message, 1, 1, false).ToLower(); switch (input) { case "yes": case "y": case "true": case "t": { answer = true; needAValidResponse = false; } break; case "no": case "n": case "false": case "f": { answer = false; needAValidResponse = false; } break; default: { needAValidResponse = true; } break; } } return(answer); }
public void runRestaurantReveiws() { //Database Location //string cs = @"server= 127.0.0.1;userid=root;password=root;database=SampleRestaurantDatabase;port=8889"; //Output Location //string _directory = @"../../output/"; bool running = true; string RestaurantProfiles = @"Select * from `RestaurantProfiles`;"; string RestaurantReviewers = @"Select * from RestaurantReviewers;"; string RestaurantReviews = @"Select * from RestaurantReviews;"; string collection = "Reataurant Profiles"; MySqlConnection conn = _conn(); string capture; string message = $"Welcome to the restaurant reviews \r\nPlease select which file you want to convert \r\n \r\n" + $"Enter 1. Restaurant Profiles\r\n" + $"Enter 2. Restaurant Reviewers\r\n" + $"Enter 3. Restaurant Reviews \r\n" + $"Enter 4. Exit Program\r\n" + $"Your Entry :"; do { Console.Clear(); string selection = Validations.Words(message, 3, 1, false); switch (selection.ToLower()) { case "1": case "restaurant profiles": { capture = GetRestaurantInfo(conn, RestaurantProfiles, collection); Writer(capture, "restaurantProfiles.json"); Console.WriteLine("Restaurant Profiles has been converted to Json"); Utility.Pause(); }; break; case "2": case "restaurant reviewers": { capture = GetRestaurantInfo(conn, RestaurantReviewers, "Restaurant Reviewers"); Writer(capture, "restaurantReviewers.json"); Console.WriteLine("Restaurant Reviewers has been converted to Json"); Utility.Pause(); }; break; case "3": case "restaurant reviews": { capture = GetRestaurantInfo(conn, RestaurantReviews, "Restaurant Reviews"); Writer(capture, "restaurantReviews.json"); Console.WriteLine("Restaurant Reviews has been converted to Json"); Utility.Pause(); }; break; case "4": case "exit program": { running = false; } break; default: { Console.WriteLine("Invalid Entry "); Utility.Pause(); } break; } } while (running); }