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(); }
static void Main(string[] args) { Console.WriteLine("Welcome to Product Review Management Project"); List <ProductReview> productReviewList = new List <ProductReview>() { new ProductReview() { ProductID = 1, UserID = 1, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 2, UserID = 2, Rating = 8, Review = "Nice", isLike = true }, new ProductReview() { ProductID = 3, UserID = 3, Rating = 4, Review = "Good", isLike = true }, new ProductReview() { ProductID = 4, UserID = 4, Rating = 1, Review = "Not Good", isLike = false }, new ProductReview() { ProductID = 5, UserID = 5, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 6, UserID = 6, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 7, UserID = 7, Rating = 8, Review = "Nice", isLike = true }, new ProductReview() { ProductID = 8, UserID = 8, Rating = 7, Review = "Good", isLike = true }, new ProductReview() { ProductID = 9, UserID = 9, Rating = 10, Review = "Nice", isLike = true }, new ProductReview() { ProductID = 10, UserID = 10, Rating = 4.7, Review = "Good", isLike = true }, new ProductReview() { ProductID = 10, UserID = 11, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 12, UserID = 12, Rating = 5.6, Review = "Good", isLike = true }, new ProductReview() { ProductID = 12, UserID = 13, Rating = 4, Review = "Good", isLike = true }, new ProductReview() { ProductID = 14, UserID = 14, Rating = 2, Review = "Not Good", isLike = false }, new ProductReview() { ProductID = 14, UserID = 15, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 16, UserID = 16, Rating = 2.5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 17, UserID = 17, Rating = 9, Review = "Nice", isLike = true }, new ProductReview() { ProductID = 18, UserID = 18, Rating = 7, Review = "Good", isLike = true }, new ProductReview() { ProductID = 19, UserID = 19, Rating = 10, Review = "Nice", isLike = true }, new ProductReview() { ProductID = 20, UserID = 20, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 21, UserID = 21, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductID = 22, UserID = 22, Rating = 1.3, Review = "Not Good", isLike = false }, new ProductReview() { ProductID = 22, UserID = 23, Rating = 4, Review = "Good", isLike = true }, new ProductReview() { ProductID = 24, UserID = 24, Rating = 2, Review = "Not Good", isLike = false }, new ProductReview() { ProductID = 25, UserID = 25, Rating = 9, Review = "Nice", isLike = true }, }; foreach (var list in productReviewList) { Console.WriteLine("\n-----------------"); Console.Write("\nProductID " + list.ProductID + "\nUserID " + list.UserID + "\nRating " + list.Rating + "\nReview " + list.Review + "\nisLike " + list.isLike); Console.WriteLine("\n-----------------"); } ProductReviewManagement management = new ProductReviewManagement(); management.TopRecords(productReviewList); management.SelectedRecords(productReviewList); management.RetrieveCountOfRecords(productReviewList); management.RetrieveProductIDAndReviewFromList(productReviewList); management.DisplayUnskippedRecords(productReviewList); Console.WriteLine("\n*****************************DataTable Operations*************************"); ProductReviewDataTable reviewDataTable = new ProductReviewDataTable(); DataTable table = reviewDataTable.CreateDataBleAndAddDefaultValues(); reviewDataTable.DisplayDataTableRecordsWithIsLikeValueTrue(table); reviewDataTable.FindAverageRatingOfEachProductID(table); reviewDataTable.RetrievRecordsWhoseReviewIsNice(table); reviewDataTable.RetrievRecordsOfPerticularUserID(table); }