static void Main(string[] args) { // Uc 1 Adding elements ProductReviewManagement management = new ProductReviewManagement("list"); // UC 2 Retrieves the top three rated products. Console.WriteLine("Retrieves the top three rated products"); management.RetrieveTopThreeRatedProducts(); Console.WriteLine("\n\n"); // UC 3 Retrieve withe the rating greater than three. Console.WriteLine("Retrieve withe the rating greater than three"); management.RetrievewithRatingGreaterThanThree(); Console.WriteLine("\n\n"); // UC 4 Gets the count of each product reviews. Console.WriteLine(" Gets the count of each product reviews"); management.GetCountOfReviews(); Console.WriteLine("\n\n"); // UC 5 Gets the productid and review. Console.WriteLine("Gets the productid and review"); management.GetProductIdAndReview(); Console.WriteLine("\n\n"); // UC 6 Skips the top five. Console.WriteLine("Skips the top five"); management.SkipTopFive(); Console.WriteLine("\n\n"); // UC 7 Gets the productid and review. Console.WriteLine("Gets the productid and review"); management.GetOnlyProductIdAndReview(); Console.WriteLine("\n\n"); // UC 8 Create DataTable ProductReviewManagement managementOne = new ProductReviewManagement("table"); // UC 9 Get products with isLike true Console.WriteLine("Get products with isLike true"); managementOne.GetProductIsLikeTrue(); Console.WriteLine("\n\n"); // UC 10 Get avg rating Console.WriteLine("Get avg rating"); managementOne.GetAvgRatingOfEachProduct(); Console.WriteLine("\n\n"); // UC 11 Get products with review Good Console.WriteLine(" Get products with review Good"); managementOne.GetProductsWithReviewNice(); Console.WriteLine("\n\n"); // UC UC 12 Gets the records of user id 10 Console.WriteLine("UC 12 Gets the records of user id 10"); managementOne.GetRecordsOfUserId10(); Console.WriteLine("\n\n"); }
/// <summary> /// Defines the entry point of the application. /// </summary> /// <param name="args">The arguments.</param> static void Main(string[] args) { Console.WriteLine("Welcome to Product Review Management Problem."); /// List for Products. List <ProductReview> productReviewList = new List <ProductReview>() { new ProductReview() { ProductID = 1, UserID = 1, Rating = 2, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 2, UserID = 1, Rating = 4, Review = "Good", isLike = true }, new ProductReview() { ProductID = 3, UserID = 2, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 1, UserID = 2, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 2, UserID = 3, Rating = 2, Review = "Nice", isLike = true }, new ProductReview() { ProductID = 2, UserID = 4, Rating = 1, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 4, UserID = 3, Rating = 1, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 6, UserID = 5, Rating = 4, Review = "Good", isLike = true }, new ProductReview() { ProductID = 2, UserID = 6, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 4, UserID = 1, Rating = 4, Review = "Good", isLike = true }, new ProductReview() { ProductID = 5, UserID = 2, Rating = 3, Review = "Nice", isLike = true } }; /// UC1 Iterating the list and printing product ratings. foreach (var list in productReviewList) { Console.WriteLine("ProductId: " + list.ProductID + " UserId: " + list.UserID + " Rating: " + list.Rating + " Review: " + list.Review + " IsLike: " + list.isLike); } /// UC2 Console.WriteLine("\n Top 3 rated products."); ProductReviewManagement product = new ProductReviewManagement(); product.TopRecords(productReviewList); /// UC3 Console.WriteLine("\n Ratings greater than three of specific products: "); product.RatingsGreaterThanThreeOfSpecificProducts(productReviewList); /// UC4 Console.WriteLine("\n Review count for each product Id."); product.GetReviewsCount(productReviewList); /// UC5 Console.WriteLine("\nProduct id and reviews from the list"); product.GetProductIdAndReview(productReviewList); /// UC6 Console.WriteLine("\nSkiping top 5 records."); product.SkipTopFiveRecords(productReviewList); /// UC8 product.InsertValuesInDataTable(productReviewList); Console.WriteLine("\nValues inserted in DataTable."); /// UC9 Console.WriteLine("\nRecords with isLike True: "); product.GetRecordsWithIsLikeTrue(); /// UC10 Console.WriteLine("\nAverage Rating for each product."); product.GetAverageRating(); /// UC11 Console.WriteLine("\nRecords with Nice Reviews"); product.GetProductWithReviewNice(); /// UC12 Console.WriteLine("\nRecords of UserId 10:-"); product.GetRecordsWithUserId(); }