/// <summary> /// Creating a List of ProductReview and Adding values into List /// UC1 /// </summary> /// <param name="args"></param> static void Main(string[] args) { Console.WriteLine(" Welcome to Product Review Management System"); List <ProductReview> productReviewList = new List <ProductReview>() { new ProductReview() { productId = 1, userId = 1, rating = 1, review = "Low", isLike = true }, new ProductReview() { productId = 2, userId = 2, rating = 2, review = "Low", isLike = true }, new ProductReview() { productId = 3, userId = 3, rating = 3, review = "Average", isLike = true }, new ProductReview() { productId = 4, userId = 4, rating = 4, review = "Average", isLike = true }, new ProductReview() { productId = 5, userId = 5, rating = 5, review = "Good", isLike = true }, new ProductReview() { productId = 6, userId = 6, rating = 6, review = "Good", isLike = true }, new ProductReview() { productId = 1, userId = 7, rating = 1, review = "Low", isLike = true }, new ProductReview() { productId = 1, userId = 8, rating = 2, review = "Low", isLike = true }, new ProductReview() { productId = 2, userId = 9, rating = 3, review = "Average", isLike = true }, new ProductReview() { productId = 5, userId = 10, rating = 4, review = "Good", isLike = true }, new ProductReview() { productId = 6, userId = 11, rating = 5, review = "Good", isLike = true }, }; foreach (var productReview in productReviewList) { Console.WriteLine($"ProductId : {productReview.productId}, UserId : {productReview.userId}, Rating : {productReview.rating}, Review : {productReview.review}, isLike :{productReview.isLike}"); } ProductManagement productManagement = new ProductManagement(); Console.WriteLine(); productManagement.AddDataTable(); }
static void Main(string[] args) { Console.WriteLine("Welcome to product review management!\n"); //UC 1 List <ProductReview> productReviewList = new List <ProductReview>() { new ProductReview() { ProductID = 1, UserID = 1, Rating = 5, Review = "Excellent", IsLike = true }, new ProductReview() { ProductID = 5, UserID = 10, Rating = 1, Review = "Poor ", IsLike = false }, new ProductReview() { ProductID = 3, UserID = 3, Rating = 3, Review = "Average ", IsLike = true }, new ProductReview() { ProductID = 3, UserID = 6, Rating = 5, Review = "Excellent", IsLike = true }, new ProductReview() { ProductID = 2, UserID = 2, Rating = 4, Review = "Good ", IsLike = true }, new ProductReview() { ProductID = 4, UserID = 7, Rating = 4, Review = "Good ", IsLike = true }, new ProductReview() { ProductID = 2, UserID = 8, Rating = 3, Review = "Average ", IsLike = true }, new ProductReview() { ProductID = 4, UserID = 4, Rating = 2, Review = "Satisfactory", IsLike = false }, new ProductReview() { ProductID = 1, UserID = 9, Rating = 2, Review = "Satisfactory", IsLike = false }, new ProductReview() { ProductID = 9, UserID = 5, Rating = 1, Review = "Poor ", IsLike = false } }; //Printing all contents of the list foreach (var v in productReviewList) { Console.WriteLine($"ProductID:{v.ProductID}\tUserID:{v.UserID}\tRating:{v.Rating}\tReview:{v.Review}\tIsLike:{v.IsLike}"); } //UC 2 ProductManagement.RetrieveTopThreeHighRatedRecords(productReviewList); //UC 3 ProductManagement.RetrieveRecordsWithGreaterThanThreeRating(productReviewList); //UC 4 ProductManagement.RetrieveCountOfReviewsForEachProductID(productReviewList); //UC 5 ProductManagement.RetrieveOnlyProductIDAndReviewOfAllRecords(productReviewList); //UC 6 ProductManagement.SkipTopFiveRecordsAndDisplayOthers(productReviewList); //UC 7 ProductManagement.RetrieveOnlyProductIDAndReviewOfAllRecordsUsingSelect(productReviewList); //UC 8 ProductReviewDataTable.AddDataIntoDataTable(); //UC 9 ProductReviewDataTable.RetrieveAllRecordsWhoseIsLikeIsTrue(); //UC 10 ProductReviewDataTable.FindAverageRatingForEachProductId(); //UC 11 ProductReviewDataTable.RetrieveRecordsWithParticularReviewMessage(); //UC 12 ProductReviewDataTable.RetrieveRecordsForGivenUserIdSortedByRating(); Console.ReadLine(); }
static void Main(string[] args) { ProductManagement productManagement = new ProductManagement(); DataTableForProductManagement dataTableForProductManagement = new DataTableForProductManagement(); //master Console.WriteLine("Welcome to Product Review Management"); //UC1 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 = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 3, UserId = 3, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 4, UserId = 4, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 5, UserId = 02, Rating = 3, Review = "Average", isLike = false }, new ProductReview() { ProductId = 6, UserId = 03, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 7, UserId = 14, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 8, UserId = 13, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 9, UserId = 9, Rating = 2, Review = "Bad", isLike = false }, new ProductReview() { ProductId = 10, UserId = 10, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 11, UserId = 05, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 12, UserId = 08, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 13, UserId = 06, Rating = 3, Review = "Average", isLike = true }, new ProductReview() { ProductId = 14, UserId = 08, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 15, UserId = 02, Rating = 3, Review = "Average", isLike = false }, new ProductReview() { ProductId = 16, UserId = 01, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 17, UserId = 07, Rating = 2, Review = "Bad", isLike = false }, new ProductReview() { ProductId = 18, UserId = 03, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 19, UserId = 10, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 20, UserId = 10, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 21, UserId = 10, Rating = 3, Review = "Average", isLike = true }, new ProductReview() { ProductId = 22, UserId = 13, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 23, UserId = 15, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 24, UserId = 12, Rating = 2, Review = "Bad", isLike = false }, new ProductReview() { ProductId = 25, UserId = 11, Rating = 4, Review = "nice", isLike = true }, }; bool check = true; dataTableForProductManagement.AddDataTable(); while (check) { Console.WriteLine("\nPlease enter 1 to print all the product details"); Console.WriteLine("Please enter 2 to get top records of data based on product ratings"); Console.WriteLine("Pleae enter 3 to get records with rating greater than 3 and product id in 1,4,9."); Console.WriteLine("please press 4 to get count of reviews grouped by user id"); Console.WriteLine("Please enter 5 to get product id and review from data"); Console.WriteLine("Please enter 6 to skip top 5 records"); Console.WriteLine("Please enter 7 to retrieve records where is like is true using data table"); Console.WriteLine("Please enter 8 to get average ratings based on user id using data table "); Console.WriteLine("Please enter 9 to get all the records for average review"); Console.WriteLine("Please enter 10 to get all records sorted for user id =10"); Console.WriteLine("Please press any other key to exit"); string option = Console.ReadLine(); switch (option) { case "1": foreach (var list in productReviewList) { Console.WriteLine("ProductId:-" + list.ProductId + " UserId:-" + list.UserId + " Ratings:-" + list.Rating + " Review:-" + list.Review + " IsLike:-" + list.isLike); } break; case "2": //UC2 productManagement.TopRecords(productReviewList); break; case "3": //UC3 productManagement.SelectedRecords(productReviewList); break; case "4": //UC4 productManagement.countOfReviews(productReviewList); break; case "5": //UC5 productManagement.retrieveProductIDandreview(productReviewList); break; case "6": //UC6 productManagement.SkippingRecords(productReviewList); break; case "7": //UC9 //dataTableForProductManagement.AddDataTable(); dataTableForProductManagement.CallForRetrievingData(); break; case "8": //UC10 productManagement.AverageRatingForUserId(productReviewList); //dataTableForProductManagement.AddDataTable(); dataTableForProductManagement.CallForAverageRatings(); break; case "9": //UC11 //dataTableForProductManagement.AddDataTable(); dataTableForProductManagement.CallForReviewRetrieval(); break; case "10": //UC12 //dataTableForProductManagement.AddDataTable(); dataTableForProductManagement.CallForSpecificUserId(); break; default: check = false; break; } } //LinqToDataTable linqToDataTable = new LinqToDataTable(); //linqToDataTable.AddDataTable(); }
static void Main(string[] args) { Console.WriteLine("Welcome to product review management!\n"); //UC 1 List <ProductReview> productReviewList = new List <ProductReview>() { new ProductReview() { ProductID = 1, UserID = 1, Rating = 5, Review = "Excellent", IsLike = true }, new ProductReview() { ProductID = 5, UserID = 10, Rating = 1, Review = "Poor ", IsLike = false }, new ProductReview() { ProductID = 3, UserID = 3, Rating = 3, Review = "Average ", IsLike = true }, new ProductReview() { ProductID = 3, UserID = 6, Rating = 5, Review = "Excellent", IsLike = true }, new ProductReview() { ProductID = 2, UserID = 2, Rating = 4, Review = "Good ", IsLike = true }, new ProductReview() { ProductID = 4, UserID = 7, Rating = 4, Review = "Good ", IsLike = true }, new ProductReview() { ProductID = 2, UserID = 8, Rating = 3, Review = "Average ", IsLike = true }, new ProductReview() { ProductID = 4, UserID = 4, Rating = 2, Review = "Satisfactory", IsLike = false }, new ProductReview() { ProductID = 1, UserID = 9, Rating = 2, Review = "Satisfactory", IsLike = false }, new ProductReview() { ProductID = 9, UserID = 5, Rating = 1, Review = "Poor ", IsLike = false } }; //Printing contents of the list foreach (var v in productReviewList) { Console.WriteLine($"ProductID:{v.ProductID}\tUserID:{v.UserID}\tRating:{v.Rating}\tReview:{v.Review}\tIsLike:{v.IsLike}"); } //UC 2 ProductManagement.RetrieveTopThreeHighRatedRecords(productReviewList); //UC 3 ProductManagement.RetrieveRecordsWithGreaterThanThreeRating(productReviewList); //UC 4 ProductManagement.RetrieveCountOfReviewsForEachProductID(productReviewList); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Product Review Management Program"); /// UC 1 /// Creating list and adding data to it List <ProductReview> productReviewList = new List <ProductReview>() { new ProductReview() { ProductID = 1, UserID = 2, Rating = 6, Review = "Average", isLike = true }, new ProductReview() { ProductID = 2, UserID = 5, Rating = 7, Review = "Good", isLike = false }, new ProductReview() { ProductID = 3, UserID = 10, Rating = 2, Review = "Bad", isLike = true }, new ProductReview() { ProductID = 3, UserID = 2, Rating = 10, Review = "Average", isLike = true }, new ProductReview() { ProductID = 3, UserID = 2, Rating = 5, Review = "Average", isLike = false }, new ProductReview() { ProductID = 3, UserID = 2, Rating = 0, Review = "Good", isLike = true }, new ProductReview() { ProductID = 1, UserID = 2, Rating = 0, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 1, UserID = 2, Rating = 8, Review = "Bad", isLike = true }, new ProductReview() { ProductID = 1, UserID = 2, Rating = 10, Review = "Excellent", isLike = true }, new ProductReview() { ProductID = 10, UserID = 2, Rating = 10, Review = "Average", isLike = true }, new ProductReview() { ProductID = 10, UserID = 2, Rating = 1, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 22, UserID = 2, Rating = 1, Review = "Bad", isLike = true }, new ProductReview() { ProductID = 1, UserID = 2, Rating = 1, Review = "Average", isLike = true }, new ProductReview() { ProductID = 4, UserID = 2, Rating = 8, Review = "Average", isLike = false }, new ProductReview() { ProductID = 22, UserID = 2, Rating = 9, Review = "Good", isLike = false }, new ProductReview() { ProductID = 16, UserID = 2, Rating = 10, Review = "Good", isLike = false }, new ProductReview() { ProductID = 18, UserID = 2, Rating = 0, Review = "Average", isLike = true }, new ProductReview() { ProductID = 18, UserID = 2, Rating = 10, Review = "Average", isLike = true }, new ProductReview() { ProductID = 18, UserID = 2, Rating = 6, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 20, UserID = 2, Rating = 6, Review = "Good", isLike = true }, new ProductReview() { ProductID = 21, UserID = 2, Rating = 8, Review = "Good", isLike = false }, new ProductReview() { ProductID = 22, UserID = 2, Rating = 8, Review = "Bad", isLike = true }, new ProductReview() { ProductID = 23, UserID = 2, Rating = 3, Review = "Average", isLike = true }, new ProductReview() { ProductID = 24, UserID = 2, Rating = 2, Review = "Average", isLike = false }, new ProductReview() { ProductID = 25, UserID = 2, Rating = 1, Review = "Average", isLike = true } }; ProductManagement productManagement = new ProductManagement(); ProductManagementDataTable productManagementDataTable = new ProductManagementDataTable(); ///Calling the TopThreeRecords method from ProductManagement class Console.WriteLine("\nTop three records with highest rating"); productManagement.TopThreeRecords(productReviewList); /// Calling the RetrieveByCondition method from ProductManagement class Console.WriteLine("\nRecords with the provided conditions"); productManagement.RetrieveByCondition(productReviewList); /// Calling the CountByProductID method from ProductManagement class Console.WriteLine("\nCount of product id--"); productManagement.CountByProductID(productReviewList); /// Calling the RetrieveProductIDAndReview method from ProductManagement class Console.WriteLine("\nProduct ID and Review of every product"); productManagement.RetrieveProductIDAndReview(productReviewList); /// Calling the SkipTopFive method from ProductManagement class Console.WriteLine("\nSkipped the top 5 entries from the list"); productManagement.SkipTopFive(productReviewList); /// Calling the RetrieveProductIDAndReviewWithSelect method from ProductManagement class Console.WriteLine("\nProduct ID and Review of every product using select"); productManagement.RetrieveProductIDAndReviewWithSelect(productReviewList); /// Calling CreateDataTable method from ProductManagementDataTable class Console.WriteLine("\nAdding data to data table...."); productManagementDataTable.CreateDataTable(); /// Calling RetrieveDataWithIsLike method from ProductManagementDataTable class Console.WriteLine("\nRetrieving data with isLike condition"); productManagementDataTable.RetrieveDataWithIsLike(); /// Calling AverageRatingByProductID method from ProductManagementDataTable class Console.WriteLine("\nAverage ratings"); productManagementDataTable.AverageRatingByProductID(); /// Calling RetrieveDataWithReview method from ProductManagementDataTable class Console.WriteLine("Retrieving data with review condition"); productManagementDataTable.RetrieveDataWithReview(); /// Calling RetrieveDataWithUserID method from ProductManagementDataTable class Console.WriteLine("Retrieving data with user id condition sorted by rating"); productManagementDataTable.RetrieveDataWithUserID(); }
static void Main(string[] args) { //master Console.WriteLine("Welcome to Product Review Management"); //UC1 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 = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 3, UserId = 3, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 4, UserId = 4, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 5, UserId = 02, Rating = 3, Review = "Average", isLike = false }, new ProductReview() { ProductId = 6, UserId = 03, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 7, UserId = 14, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 8, UserId = 13, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 9, UserId = 9, Rating = 2, Review = "Bad", isLike = false }, new ProductReview() { ProductId = 10, UserId = 10, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 11, UserId = 05, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 12, UserId = 08, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 13, UserId = 06, Rating = 3, Review = "Average", isLike = true }, new ProductReview() { ProductId = 14, UserId = 08, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 15, UserId = 02, Rating = 3, Review = "Average", isLike = false }, new ProductReview() { ProductId = 16, UserId = 01, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 17, UserId = 07, Rating = 2, Review = "Bad", isLike = false }, new ProductReview() { ProductId = 18, UserId = 03, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 19, UserId = 10, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 20, UserId = 10, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 21, UserId = 10, Rating = 3, Review = "Average", isLike = true }, new ProductReview() { ProductId = 22, UserId = 13, Rating = 5, Review = "Good", isLike = true }, new ProductReview() { ProductId = 23, UserId = 15, Rating = 4, Review = "nice", isLike = true }, new ProductReview() { ProductId = 24, UserId = 12, Rating = 2, Review = "Bad", isLike = false }, new ProductReview() { ProductId = 24, UserId = 12, Rating = 4, Review = "Bad", isLike = false }, new ProductReview() { ProductId = 24, UserId = 12, Rating = 3, Review = "Bad", isLike = false }, new ProductReview() { ProductId = 25, UserId = 11, Rating = 4, Review = "nice", isLike = true }, }; //foreach (var list in productReviewList) //{ // Console.WriteLine("ProductId:-" + list.ProductId + " UserId:-" + list.UserId + " Ratings:-" + list.Rating + " Review:-" + list.Review + " IsLike:-" + list.isLike); //} ProductManagement productManagement = new ProductManagement(); //UC2 //productManagement.TopRecords(productReviewList); //UC3 //productManagement.SelectedRecords(productReviewList); //UC4 //productManagement.countOfReviews(productReviewList); //UC5_UC7 //productManagement.retrieveProductIDandreview(productReviewList); //UC6 //productManagement.SkippingRecords(productReviewList); //UC8 //Query //UC9 DataTableForProductManagement dataTableForProductManagement = new DataTableForProductManagement(); dataTableForProductManagement.AddDataTable(); //dataTableForProductManagement.RetrievingRecords(); //UC10 //dataTableForProductManagement.AverageRatingForUserIDUsingDataTable(); //UC11 //dataTableForProductManagement.ReviewMessageRetrieval(); //UC12 dataTableForProductManagement.SelectRecordsForUserId(); }
static void Main(string[] args) { Console.WriteLine("Product Review Management Program"); /// UC 1 /// Creating list and adding data to it List <ProductReview> productReviewList = new List <ProductReview>() { new ProductReview() { ProductID = 1, UserID = 2, Rating = 6, Review = "Average", isLike = true }, new ProductReview() { ProductID = 2, UserID = 5, Rating = 7, Review = "Good", isLike = false }, new ProductReview() { ProductID = 3, UserID = 10, Rating = 2, Review = "Bad", isLike = true }, new ProductReview() { ProductID = 4, UserID = 2, Rating = 10, Review = "Average", isLike = true }, new ProductReview() { ProductID = 5, UserID = 2, Rating = 5, Review = "Average", isLike = false }, new ProductReview() { ProductID = 6, UserID = 2, Rating = 0, Review = "Good", isLike = true }, new ProductReview() { ProductID = 7, UserID = 2, Rating = 0, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 8, UserID = 2, Rating = 8, Review = "Bad", isLike = true }, new ProductReview() { ProductID = 9, UserID = 2, Rating = 10, Review = "Excellent", isLike = true }, new ProductReview() { ProductID = 10, UserID = 2, Rating = 10, Review = "Average", isLike = true }, new ProductReview() { ProductID = 11, UserID = 2, Rating = 1, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 12, UserID = 2, Rating = 1, Review = "Bad", isLike = true }, new ProductReview() { ProductID = 13, UserID = 2, Rating = 1, Review = "Average", isLike = true }, new ProductReview() { ProductID = 14, UserID = 2, Rating = 8, Review = "Average", isLike = false }, new ProductReview() { ProductID = 15, UserID = 2, Rating = 9, Review = "Good", isLike = false }, new ProductReview() { ProductID = 16, UserID = 2, Rating = 10, Review = "Good", isLike = false }, new ProductReview() { ProductID = 17, UserID = 2, Rating = 0, Review = "Average", isLike = true }, new ProductReview() { ProductID = 18, UserID = 2, Rating = 10, Review = "Average", isLike = true }, new ProductReview() { ProductID = 19, UserID = 2, Rating = 6, Review = "Bad", isLike = false }, new ProductReview() { ProductID = 20, UserID = 2, Rating = 6, Review = "Good", isLike = true }, new ProductReview() { ProductID = 21, UserID = 2, Rating = 8, Review = "Good", isLike = false }, new ProductReview() { ProductID = 22, UserID = 2, Rating = 8, Review = "Bad", isLike = true }, new ProductReview() { ProductID = 23, UserID = 2, Rating = 3, Review = "Average", isLike = true }, new ProductReview() { ProductID = 24, UserID = 2, Rating = 2, Review = "Average", isLike = false }, new ProductReview() { ProductID = 25, UserID = 2, Rating = 1, Review = "Average", isLike = true } }; ProductManagement productManagement = new ProductManagement(); ///Calling the TopThreeRecords method from ProductManagement class Console.WriteLine("Top three records with highest rating"); productManagement.TopThreeRecords(productReviewList); /// Calling the RetrieveByCondition method from ProductManagement class Console.WriteLine("Records with the provided conditions"); productManagement.RetrieveByCondition(productReviewList); /// Calling the RetrieveProductIDAndReview method from ProductManagement class Console.WriteLine("\nProduct ID and Review of every product"); productManagement.RetrieveProductIDAndReview(productReviewList); /// Calling the SkipTopFive method from ProductManagement class Console.WriteLine("\nSkipped the top 5 entries from the list"); productManagement.SkipTopFive(productReviewList); /// Calling the RetrieveProductIDAndReviewWithSelect method from ProductManagement class Console.WriteLine("\nProduct ID and Review of every product using select"); productManagement.RetrieveProductIDAndReviewWithSelect(productReviewList); }