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);
        }
예제 #2
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);
        }