public void runRestaurantReviews()
        {
            bool   running            = true;
            string RestaurantProfiles = @"Select * from `RestaurantProfiles`;";
            string menustring         = " Hello user, How would you like to sort the data:\r\n" +
                                        "1. List Restaurants Alphabetically(Show Rating Next To Name)\r\n" +
                                        "2. List Restaurants in Reverse Alphabetical(Show Rating Next To Name)\r\n" +
                                        "3. Sort Restaurants From Best to Worst(Show Rating Next To Name)\r\n" +
                                        "4. Sort Restaurants From Worst to Best(Show Rating Next To Name)\r\n" +
                                        "5. Show Only X stars and Up\r\n" +
                                        "6. Exit \r\n";
            string menuSub = "" +
                             "1. Show the Best(5 Stars)\r\n" +
                             "2. Show 4 Stars and Up\r\n" +
                             "3. Show 3 Stars and Up\r\n" +
                             "4. Show the Worst(1 Stars)\r\n" +
                             "5. Show Unrated\r\n" +
                             "6. Back\r\n" +
                             "7. Exit \r\n";

            do
            {
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.Clear();
                int selection = Validations.GetInt(menustring + "Make A Selection 1 through 5 : ");

                Console.ForegroundColor = ConsoleColor.Gray;
                switch (selection)
                {
                case 1:
                {
                    RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles order by RestaurantName ASC ;";
                    List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                    RestaurantsReviews.ColorStarPrinter(reviews);
                }; break;

                case 2:
                {
                    RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles order by RestaurantName DESC ;";
                    List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                    RestaurantsReviews.ColorStarPrinter(reviews);
                }
                break;

                case 3:
                {
                    RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles order by OverallRating DESC ;";
                    List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                    RestaurantsReviews.ColorStarPrinter(reviews);
                }
                break;

                case 4:
                {
                    RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles order by OverallRating ASC ;";
                    List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                    RestaurantsReviews.ColorStarPrinter(reviews);
                }
                break;

                case 5:
                {
                    int selectionSub = Validations.GetInt(menuSub + "Make A Selection 1 through 7 : ");
                    switch (selectionSub)
                    {
                    case 1:
                    {
                        RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles where OverallRating >= 4.50  order by OverallRating DESC ;";
                        List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                        RestaurantsReviews.ColorStarPrinter(reviews);
                    } break;

                    case 2:
                    {
                        RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles where OverallRating >= 3.50  order by OverallRating DESC ;";
                        List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                        RestaurantsReviews.ColorStarPrinter(reviews);
                    } break;

                    case 3:
                    {
                        RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles where OverallRating >= 2.50  order by OverallRating DESC ;";
                        List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                        RestaurantsReviews.ColorStarPrinter(reviews);
                    } break;

                    case 4:
                    {
                        RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles where OverallRating <= 1.49 and OverallRating >=.50  order by OverallRating DESC ;";
                        List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                        RestaurantsReviews.ColorStarPrinter(reviews);
                    } break;

                    case 5:
                    {
                        RestaurantProfiles = @"Select RestaurantName, OverallRating from RestaurantProfiles where OverallRating <=> 0.00 or OverallRating <=> NULL  order by OverallRating DESC ;";
                        List <RestaurantsReviews> reviews = ReviewsQuery(RestaurantProfiles);
                        RestaurantsReviews.ColorStarPrinter(reviews);
                    } break;

                    case 6: { } break;

                    case 7: { running = false; } break;

                    default: { Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("YOU BROKE ME"); } break;
                    }
                }
                break;

                case 6: { running = false; } break;

                default:
                { }
                break;
                }

                Utility.Pause("PRESS R TO CONTINUE");
            } while (running);
        }
        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);
        }
Beispiel #3
0
        static void Main(string[] args)

        {
            int  score;
            int  selection;
            bool running = true;



            do
            {
                Utility.Pause();

                string memu = "Hello Admin, What Would You Like To Do Today?\r\n" +
                              "1. Convert The Restaurant Profile Table From SQL To JSON\r\n" +
                              "2.Showcase Our 5 Star Rating System\r\n" +
                              "3.Showcase Our Animated Bar Graph Review System\r\n" +
                              "4.Play A Card Game\r\n" +
                              "5.Exit\r\n";


                selection = Validations.GetInt(1, 100, memu + "Enter Your Numbered Selection : ");

                switch (selection)
                {
                case 1:
                {
                    restaurantReviewsData Restaurant = new restaurantReviewsData();
                    Restaurant.runRestaurantReveiws();
                } break;

                case 2:
                {
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    RestaurantReviewsDisplay restaurant = new RestaurantReviewsDisplay();
                    restaurant.runRestaurantReviews();
                } break;

                case 3:
                {
                    AnimatedBarGraph animation = new AnimatedBarGraph();
                    string           mess      = "What would you like to do? \r\n1. Show Average of Reviews for Restaurants\r\n2. Dinner Spinner\r\n3. Top 10 Restaurants";
                    int i = 1;
                    int d = Validations.GetInt(mess + "\r\nPlease enter your selection.  : ");
                    RestaurantReviewGraphs[]      Graphs  = restaurantReviewsData.ReviewGraphs();
                    List <RestaurantReviewGraphs> _graphs = new List <RestaurantReviewGraphs>();
                    switch (d)
                    {
                    case 1:

                    {
                        Graphs = restaurantReviewsData.ReviewGraphs();
                        foreach (RestaurantReviewGraphs reviewAvg in Graphs)
                        {
                            Console.WriteLine(i + "\r\n"); reviewAvg.ToString();
                            if (i % 10 == 0)
                            {
                                Utility.Pause("Press Space Bar to See the Next 10 : ");
                            }
                            i++;
                        }
                        Utility.Pause();
                    } break;

                    case 2:
                    {
                        _graphs = restaurantReviewsData.ReviewedGraphs();
                        foreach (RestaurantReviewGraphs reviewAvg in _graphs)
                        {
                            Console.WriteLine(i + "\r\n"); reviewAvg.ToString();
                            if (i % 10 == 0)
                            {
                                Utility.Pause("Press Space Bar to End : ");
                            }
                            i++;
                        }
                    }
                    break;

                    case 3:
                    {
                        _graphs = restaurantReviewsData.ReviewedGraphsTopTen();
                        foreach (RestaurantReviewGraphs reviewAvg in _graphs)
                        {
                            Console.WriteLine(i + "\r\n"); reviewAvg.ToString();
                            if (i % 10 == 0)
                            {
                                Utility.Pause("Press Space Bar to End : ");
                            }
                            i++;
                        }
                    } break;
                    }



                    Dictionary <int, RestaurantReviewGraphs[]> review = restaurantReviewsData.AllReviews();
                } break;

                case 4:
                {
                    bool runs = true;
                    do
                    {
                        List <Players> currentPlayers = new List <Players>();

                        int playnum = 0;

                        CardGame1 currentGame = new CardGame1();
                        int       i           = 1;

                        List <Cards>[] allhands = currentGame.Deal(13, 4);
                        foreach (List <Cards> hands in allhands)
                        {
                            score = currentGame.Score(hands);
                            Players player = new Players(score, hands, i);
                            currentPlayers.Add(player);
                            i++;
                        }

                        foreach (Players player in currentPlayers)
                        {
                            Console.BackgroundColor = ConsoleColor.Black;
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.WriteLine(player.ToString());
                            foreach (Cards card in player.Hand)
                            {
                                Console.Write(card.ToString()); Console.BackgroundColor = ConsoleColor.Black; Console.Write(" ");
                            }
                            Console.BackgroundColor = ConsoleColor.Black;
                            Console.ForegroundColor = ConsoleColor.White;
                        }
                        currentGame.Results(currentPlayers);
                        Utility.Pause("Hit Space Bar to Continue");
                        runs = Validations.GetBool("Do you want to play again? : ");
                    } while (runs);
                } break;



                case 5: { running = false; } break;

                default: { Console.WriteLine("Program Unavailable or invalid selection");
                           Utility.Pause(); } break;
                }
            } while (running);
        }