public HttpResponseMessage add(ProductReview post) { // Check for errors if (post == null) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null"); } else if (Product.MasterPostExists(post.product_id) == false) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The product does not exist"); } else if (Customer.MasterPostExists(post.customer_id) == false) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The customer does not exist"); } else if (Language.MasterPostExists(post.language_id) == false) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The language does not exist"); } // Make sure that the data is valid post.review_date = AnnytabDataValidation.TruncateDateTime(post.review_date); post.rating = AnnytabDataValidation.TruncateDecimal(post.rating, 0, 999999.99M); // Add the post ProductReview.Add(post); // Return the success response return Request.CreateResponse<string>(HttpStatusCode.OK, "The post has been added"); } // End of the add method
public void Put(ProductReview review) { review = repository.Update(review); if (review == null) { throw new HttpResponseException(HttpStatusCode.InternalServerError); } }
public ProductReview Add(ProductReview review) { SqlConnection conn = null; int newIdent = -1; try { //Log.WriteDataToLog("AddProductReviewInDB", "Values IN: [owner]: " + owner.ToString() + " [productid]: " + productId.ToString() + " [comment]: " + comment + " [rating]: " + rating.ToString()); conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DataServices"].ConnectionString); conn.Open(); //Log.WriteDataToLog("AddProductReviewInDB", "connection opened."); SqlCommand cmd; if (review.reviewId > 0) { cmd = new SqlCommand("AddProductReviewInstance", conn); cmd.Parameters.Add(new SqlParameter("@reviewId", review.reviewId)); } else { cmd = new SqlCommand("AddProductReview", conn); cmd.Parameters.Add(new SqlParameter("@owner", review.owner)); } cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@productId", review.productId)); cmd.Parameters.Add(new SqlParameter("@comment", review.comment.Trim())); cmd.Parameters.Add(new SqlParameter("@rating", review.rating)); //Log.WriteDataToLog("AddProductReviewInDB", "parameters added to cmd object."); SqlParameter outval = new SqlParameter(); outval.ParameterName = "@id"; outval.Direction = ParameterDirection.Output; outval.Value = newIdent; cmd.Parameters.Add(outval); //Log.WriteDataToLog("AddProductReviewInDB", "parameters added to cmd object."); cmd.ExecuteNonQuery(); //Log.WriteDataToLog("AddProductReviewInDB", "query executed."); newIdent = (int)outval.Value; //Log.WriteDataToLog("AddProductReviewInDB", "retrieve new id."); return Get(newIdent); } catch (Exception e) { //Dimmi.Data.Log.WriteDataToLog("AddProductReviewInDB", e); return null; } finally { if (conn != null) { conn.Close(); } } }
// PUT api/awbuildversion/5 public void Put(ProductReview value) { var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault(); if (GetActionType.Key != null) { if (GetActionType.Value.ToList()[0].Equals("DELETE")) adventureWorks_BC.ProductReviewDelete(value); if (GetActionType.Value.ToList()[0].Equals("UPDATE")) adventureWorks_BC.ProductReviewUpdate(value); } }
public HttpResponseMessage Post(ProductReview review) { review = repository.Add(review); if (review == null) { throw new HttpResponseException(HttpStatusCode.InternalServerError); } var response = Request.CreateResponse<ProductReview>(HttpStatusCode.Created, review); string uri = Url.Link("DefaultApi", new { id = review.reviewId }); response.Headers.Location = new Uri(uri); return response; }
} // End of the constructor #endregion #region Insert methods /// <summary> /// Add one product review post /// </summary> /// <param name="post">A reference to a product review</param> public static long Add(ProductReview post) { // Create the long to return long idOfInsert = 0; // Create the connection and the sql statement string connection = Tools.GetConnectionString(); string sql = "INSERT INTO dbo.product_reviews (product_id, customer_id, language_id, review_date, " + "review_text, rating) " + "VALUES (@product_id, @customer_id, @language_id, @review_date, @review_text, @rating);" + "SELECT SCOPE_IDENTITY();"; // The using block is used to call dispose automatically even if there are is a exception. using (SqlConnection cn = new SqlConnection(connection)) { // The using block is used to call dispose automatically even if there are is a exception. using (SqlCommand cmd = new SqlCommand(sql, cn)) { // Add parameters cmd.Parameters.AddWithValue("@product_id", post.product_id); cmd.Parameters.AddWithValue("@customer_id", post.customer_id); cmd.Parameters.AddWithValue("@language_id", post.language_id); cmd.Parameters.AddWithValue("@review_date", post.review_date); cmd.Parameters.AddWithValue("@review_text", post.review_text); cmd.Parameters.AddWithValue("@rating", post.rating); // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to // avoid having our application crash in such cases try { // Open the connection cn.Open(); // Execute the insert idOfInsert = Convert.ToInt64(cmd.ExecuteScalar()); } catch (Exception e) { throw e; } } } // Return the id of the inserted item return idOfInsert; } // End of the Add method
// Create or Update public override string PostAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata) { string data = string.Empty; string bvin = FirstParameter(parameters); ApiResponse <ProductReviewDTO> response = new ApiResponse <ProductReviewDTO>(); ProductReviewDTO postedItem = null; try { postedItem = MerchantTribe.Web.Json.ObjectFromJson <ProductReviewDTO>(postdata); } catch (Exception ex) { response.Errors.Add(new ApiError("EXCEPTION", ex.Message)); return(MerchantTribe.Web.Json.ObjectToJson(response)); } ProductReview item = new ProductReview(); item.FromDto(postedItem); if (bvin == string.Empty) { if (MTApp.CatalogServices.ProductReviews.Create(item)) { bvin = item.Bvin; } } else { MTApp.CatalogServices.ProductReviews.Update(item); } ProductReview resultItem = MTApp.CatalogServices.ProductReviews.Find(bvin); if (resultItem != null) { response.Content = resultItem.ToDto(); } data = MerchantTribe.Web.Json.ObjectToJson(response); return(data); }
private void PrepareProductReviewModel(ProductReviewModel model, ProductReview productReview, bool excludeProperties, bool formatReviewText) { if (model == null) { throw new ArgumentNullException("model"); } if (productReview == null) { throw new ArgumentNullException("productReview"); } model.Id = productReview.Id; model.ProductId = productReview.ProductId; model.ProductName = productReview.Product.Name; model.ProductTypeName = productReview.Product.GetProductTypeLabel(_localizationService); model.ProductTypeLabelHint = productReview.Product.ProductTypeLabelHint; model.CustomerId = productReview.CustomerId; model.CustomerName = productReview.Customer.GetFullName(); model.IpAddress = productReview.IpAddress; model.Rating = productReview.Rating; model.CreatedOn = _dateTimeHelper.ConvertToUserTime(productReview.CreatedOnUtc, DateTimeKind.Utc); if (string.IsNullOrWhiteSpace(model.CustomerName) && !productReview.Customer.IsRegistered()) { model.CustomerName = _localizationService.GetResource("Admin.Customers.Guest"); } if (!excludeProperties) { model.Title = productReview.Title; if (formatReviewText) { model.ReviewText = Core.Html.HtmlUtils.FormatText(productReview.ReviewText, false, true, false, false, false, false); } else { model.ReviewText = productReview.ReviewText; } model.IsApproved = productReview.IsApproved; } }
public ActionResult Update(int id, [FromBody] ProductReview productReview) { ProductReview existingReview = dao.Get(id); if (existingReview == null) { return(NotFound()); } //Copy over the fields we want to update existingReview.Name = productReview.Name; existingReview.Title = productReview.Title; existingReview.Review = productReview.Review; //Save existing review back dao.Update(existingReview); return(NoContent()); }
protected void Page_Load(object sender, EventArgs e) { ReviewerProfile profile = AbleContext.Current.User.ReviewerProfile; _ProductReviewId = AlwaysConvert.ToInt(Request.QueryString["ReviewId"]); _ProductReview = ProductReviewDataSource.Load(_ProductReviewId); if (_ProductReview == null || _ProductReview.ReviewerProfileId != profile.Id) { Response.Redirect("~/Members/MyProductReviews.aspx"); } _Product = ProductDataSource.Load(_ProductReview.ProductId); if (_Product == null) { Response.Redirect("~/Members/MyProductReviews.aspx"); } ProductName.Text = _Product.Name; ProductReviewForm1.ReviewCancelled += new EventHandler(ProductReviewForm1_ReviewCancelled); ProductReviewForm1.ReviewSubmitted += new EventHandler(ProductReviewForm1_ReviewSubmitted); }
public ProductReview CreateProductReview(ProductReview entity) { DataCommand dc = DataCommandManager.GetDataCommand("ProductReview_CreateProductReview"); dc.SetParameterValue("@ProductSysNo", entity.ProductSysNo); dc.SetParameterValue("@CustomerSysNo", entity.CustomerSysNo); dc.SetParameterValue("@Service", entity.Service); dc.SetParameterValue("@Title", entity.Title); dc.SetParameterValue("@Prons", entity.Prons); dc.SetParameterValue("@Cons", entity.Cons); dc.SetParameterValue("@Score1", entity.Score1); dc.SetParameterValue("@Score2", entity.Score2); dc.SetParameterValue("@Score3", entity.Score3); dc.SetParameterValue("@Score4", entity.Score4); dc.SetParameterValue("@Score", entity.Score); dc.SetParameterValueAsCurrentUserSysNo("@InUser"); entity.SysNo = dc.ExecuteScalar <int>(); return(entity); }
protected virtual void PrepareProductReviewModel(ProductReviewModel model, ProductReview productReview, bool excludeProperties, bool formatReviewAndReplyText) { if (model == null) { throw new ArgumentNullException("model"); } if (productReview == null) { throw new ArgumentNullException("productReview"); } model.Id = productReview.Id; model.StoreName = productReview.Store.Name; model.ProductId = productReview.ProductId; model.ProductName = productReview.Product.Name; model.CustomerId = productReview.CustomerId; var customer = productReview.Customer; model.CustomerInfo = customer.IsRegistered() ? customer.Email : _localizationService.GetResource("Admin.Customers.Guest"); model.Rating = productReview.Rating; model.CreatedOn = _dateTimeHelper.ConvertToUserTime(productReview.CreatedOnUtc, DateTimeKind.Utc); if (!excludeProperties) { model.Title = productReview.Title; if (formatReviewAndReplyText) { model.ReviewText = Core.Html.HtmlHelper.FormatText(productReview.ReviewText, false, true, false, false, false, false); model.ReplyText = Core.Html.HtmlHelper.FormatText(productReview.ReplyText, false, true, false, false, false, false); } else { model.ReviewText = productReview.ReviewText; model.ReplyText = productReview.ReplyText; } model.IsApproved = productReview.IsApproved; } //a vendor should have access only to his products model.IsLoggedInAsVendor = _workContext.CurrentVendor != null; }
protected void Page_Load(object sender, EventArgs e) { _ProductReviewId = AlwaysConvert.ToInt(Request.QueryString["ReviewId"]); _ProductReview = ProductReviewDataSource.Load(_ProductReviewId); if (_ProductReview != null) { _ProductId = _ProductReview.Product.Id; } else { _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]); } _Product = ProductDataSource.Load(_ProductId); if (_Product == null) { Response.Redirect(NavigationHelper.GetMobileStoreUrl("~/Default.aspx")); } if (!Page.IsPostBack) { InitializeForm(); } //INIT ReviewBody COUNTDOWN AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(ReviewBody, ReviewMessageCharCount); ReviewMessageCharCount.Text = ((int)(ReviewBody.MaxLength - ReviewBody.Text.Length)).ToString(); ProductName.Text = _Product.Name; if (AbleContext.Current.Store.Settings.ProductReviewTermsAndConditions != string.Empty) { ReviewTermsLink.Visible = true; ReviewTermsLink.NavigateUrl = NavigationHelper.GetMobileStoreUrl(string.Format("~/ReviewTerms.aspx?ProductId={0}", _Product.Id)); } else { ReviewTermsLink.Visible = false; reviewInstruction.Visible = false; } }
protected virtual void PrepareProductReviewModel(ProductReviewModel model, ProductReview productReview, bool excludeProperties, bool formatReviewText) { if (model == null) { throw new ArgumentNullException("model"); } if (productReview == null) { throw new ArgumentNullException("productReview"); } var product = _productService.GetProductById(productReview.ProductId); var customer = EngineContext.Current.Resolve <ICustomerService>().GetCustomerById(productReview.CustomerId); var store = _storeService.GetStoreById(productReview.StoreId); model.Id = productReview.Id; model.StoreName = store != null ? store.Name : ""; model.ProductId = productReview.ProductId; model.ProductName = product.Name; model.CustomerId = productReview.CustomerId; model.CustomerInfo = customer != null?customer.IsRegistered() ? customer.Email : _localizationService.GetResource("Admin.Customers.Guest") : ""; model.Rating = productReview.Rating; model.CreatedOn = _dateTimeHelper.ConvertToUserTime(productReview.CreatedOnUtc, DateTimeKind.Utc); model.Signature = productReview.Signature; if (!excludeProperties) { model.Title = productReview.Title; if (formatReviewText) { model.ReviewText = Core.Html.HtmlHelper.FormatText(productReview.ReviewText, false, true, false, false, false, false); model.ReplyText = Core.Html.HtmlHelper.FormatText(productReview.ReplyText, false, true, false, false, false, false); } else { model.ReviewText = productReview.ReviewText; model.ReplyText = productReview.ReplyText; } model.IsApproved = productReview.IsApproved; } }
private void ParseProductReviews(Product product, IEnumerable <SouqProductReview> reviewsNative) { if (product.Reviews == null) { product.Reviews = new List <ProductReview>(); } foreach (var reviewNative in reviewsNative) { HtmlDocument document = new HtmlDocument(); document.LoadHtml(reviewNative.body); var reviewsNodes = document.DocumentNode.Descendants().FindByNameNAttribute("li", "data-review"); foreach (var reviewNode in reviewsNodes) { var reviewId = reviewNode.Attributes["data-review"].Value; var headerNode = reviewNode.ChildNodes.SingleByName("header"); var articleNode = reviewNode.ChildNodes.SingleByName("article"); var purchasedNode = reviewNode.Descendants() .SingleOrDefaultByNameNContainClass("div", new[] { "purchasedBadge" }); var headerInfoNode = headerNode.Descendants() .SingleByNameNContainClass("div", new[] { "clearfix", "space", "by-date" }); var reviewerNameNode = headerInfoNode.Descendants().SingleByName("strong"); var reviewerDateNode = headerInfoNode.ChildNodes.SingleByNameNClass("span", "date"); var review = new ProductReview() { Id = Guid.NewGuid(), Product = product, IsPurchased = purchasedNode != null, Username = reviewerNameNode.InnerText.TrimStart().TrimEnd(), Comment = articleNode.InnerText.TrimStart().TrimEnd(), Timestamp = DateTime.Parse(reviewerDateNode.InnerText.TrimStart().TrimEnd()) }; product.Reviews.Add(review); } } product.ReviewsCount = product.Reviews.Count; }
public ActionResult Reviews(FormCollection form) { System.Diagnostics.Debug.WriteLine(lId); ProductCatVM vm = new ProductCatVM(db.Products.Where(s => s.ProductID == lId).FirstOrDefault(), db.ProductDescriptions.Where(s => s.ProductDescriptionID == (db.ProductModelProductDescriptionCultures.Where(d => d.ProductModelID == (db.Products.Where(f => f.ProductID == lId).FirstOrDefault().ProductModelID)).FirstOrDefault().ProductDescriptionID)).FirstOrDefault(), db.ProductProductPhotoes.Where(g => g.ProductID == lId).FirstOrDefault().ProductPhoto); ViewBag.RequestMethod = "POST"; //int Rating = int.Parse(Request.Form["rating"]); string ReviewerName = Request.Form["name"]; string EmailAddress = Request.Form["email"]; string Comments = Request.Form["message"]; int Rating = int.Parse(Request.Form["rating"]); var review = new ProductReview(); review.ProductID = lId; review.ReviewerName = ReviewerName; review.EmailAddress = EmailAddress; review.Rating = Rating; review.Comments = Comments; review.ReviewDate = DateTime.Today; review.ModifiedDate = DateTime.Today; db.ProductReviews.Add(review); db.SaveChanges(); foreach (ProductReview p in db.ProductReviews.Where(s => s.ProductID == lId)) { vm.tmpReview.message = p.Comments; vm.tmpReview.rating = p.Rating; vm.tmpReview.name = p.ReviewerName; vm.tmpReview.email = p.EmailAddress; vm.reviews.Add(vm.tmpReview); } return(View(vm)); }
private void BindData() { ProductReview productReview = ProductManager.GetProductReviewByID(this.ProductReviewID); if (productReview != null) { this.txtTitle.Text = productReview.Title; this.lblProduct.Text = GetProductInfo(productReview.ProductID); this.lblCustomer.Text = GetCustomerInfo(productReview.CustomerID); //this.txtReviewText.Value = productReview.ReviewText; this.txtReviewText.Text = productReview.ReviewText; this.productRating.CurrentRating = productReview.Rating; this.cbIsApproved.Checked = productReview.IsApproved; this.lblCreatedOn.Text = DateTimeHelper.ConvertToUserTime(productReview.CreatedOn).ToString(); } else { Response.Redirect("ProductReviews.aspx"); } }
public async Task AddReview(AddReviewInputModel inputModel) { var curretnUser = await this.db.Users.FirstOrDefaultAsync(x => x.UserName == inputModel.Username); var review = new ProductReview { ApplicationUserId = curretnUser?.Id, Email = inputModel.Email, PhoneNumber = inputModel.PhoneNumber, ProductId = inputModel.ProductId, CreatedOn = DateTime.UtcNow, UserFullName = inputModel.FullName, Content = inputModel.SanitizedContent, Stars = inputModel.Stars, }; await this.db.ProductReviews.AddAsync(review); await this.db.SaveChangesAsync(); }
public async Task <ActionResult> RateReview(ReviewRating reviewRating) { // Get the whole review from the database based on the id from the reviewRating parameter ProductReview review = await unitOfWork.ProductReviews.Get(reviewRating.ReviewId); if (review != null) { // Increment the likes or dislikes based on the reviewRating parameter review.Likes += reviewRating.Likes; review.Dislikes += reviewRating.Dislikes; // Update and save unitOfWork.ProductReviews.Update(review); await unitOfWork.Save(); return(Ok()); } return(BadRequest()); }
private void SetHelpful(bool WasHelpful) { ProductReview productReview = ProductManager.GetProductReviewByID(this.ProductReviewID); if (productReview != null) { if (NopContext.Current.User == null || NopContext.Current.User.IsGuest) { string loginURL = CommonHelper.GetLoginPageURL(true); Response.Redirect(loginURL); } ProductManager.SetProductRatingHelpfulness(productReview.ProductReviewID, WasHelpful); BindData(); } else { Response.Redirect("~/Default.aspx"); } }
void LoadEditor(int reviewID) { ToggleGrid(false); btnPerm.Attributes.Add("onclick", "CheckDelete()"); // Load the product reader ProductReview review = new ProductReview(reviewID); // Load up the form lblID.Text = reviewID.ToString(); txtTitle.Text = review.Title; txtBody.Text = review.Body; ddlRating.Items.FindByValue(review.Rating.ToString()).Selected = true; thxAuthor.Text = review.AuthorName; thxAuthor.Enabled = false; txtPostDate.Text = review.PostDate.ToString(); ckbApproved.Checked = review.IsApproved; //lblHelpful.Text = review.IsHelpfulVotesNo.ToString() + "/" + review.TotalHelpfulVotesNo.ToString(); }
public IActionResult GenerateProductReview() { var productReviewModel = new ProductReview(); Random rnd = new Random(); var randomNumber = rnd.Next(1, 100); var responseMsg = GenerateReviewAsync(randomNumber).Result; //Checking the response is successful or not which is sent using HttpClient if (responseMsg.IsSuccessStatusCode) { //Storing the response details recieved from web api var EmpResponse = responseMsg.Content.ReadAsStringAsync().Result; //Deserializing the response recieved from web api and storing into the Employee list productReviewModel = JsonConvert.DeserializeObject <ProductReview>(EmpResponse); } return(PartialView("_ProductReview", productReviewModel)); }
public ActionResult AddProductReview(int productId, AddProductReviewModel model) { if (_workContext.CurrentProfile.IsAnonymous) { return(new HttpUnauthorizedResult()); } var product = _productService.GetProductOverviewModelById(productId); //TODO: I think we should redirect to a page that recommends other related products instead. // If the product is offline, then return 404 if (product == null || product.Enabled == false || product.VisibleIndividually == false) { return(InvokeHttp404()); } if (ModelState.IsValid) { var review = new ProductReview { ProductId = product.Id, ProfileId = _workContext.CurrentProfile.Id, Alias = model.Alias, Title = model.Title, Comment = model.Comment, Score = model.Rating, TimeStamp = DateTime.Now, ProductName = product.Name }; _productService.InsertProductReview(review); model = PrepareAddProductReviewModel(product); model.SuccessfullyAdded = true; model.Result = "You will see the product review after approving by a store administrator."; return(View(model)); } return(View(model)); }
public IActionResult AddReview(string id, int productId, [FromBody] ProductReview value) { try { var user = _context.ProductReviews.Where(u => u.UserId == id).Select(u => u.UserId).SingleOrDefault(); var product = _context.ProductReviews.Where(u => u.ProductId == productId).Select(u => u.ProductId).SingleOrDefault(); var reviewRating = _context.ProductReviews.Where(u => (u.UserId == id && u.ProductId == productId)).Select(u => u.ReviewRating).SingleOrDefault(); var review = _context.ProductReviews.Where(u => (u.UserId == id && u.ProductId == productId)).SingleOrDefault(); if (user == null | product == 0) { ProductReview newReview = new ProductReview() { UserId = id, ProductId = productId, ReviewRating = 0, ReviewText = value.ReviewText, }; _context.ProductReviews.Add(newReview); _context.SaveChanges(); return(StatusCode(201, value)); } else { ProductReview updateReview = new ProductReview() { UserId = id, ProductId = productId, ReviewRating = System.Convert.ToInt32(reviewRating), ReviewText = value.ReviewText }; _context.ProductReviews.Remove(review); _context.ProductReviews.Add(updateReview); _context.SaveChanges(); return(StatusCode(201, updateReview)); } } catch { return(NotFound()); } }
} // End of the Add method #endregion #region Update methods /// <summary> /// Update a product review post /// </summary> /// <param name="post">A reference to a product review post</param> public static void Update(ProductReview post) { // Create the connection and the sql statement string connection = Tools.GetConnectionString(); string sql = "UPDATE dbo.product_reviews SET product_id = @product_id, customer_id = @customer_id, " + "language_id = @language_id, review_date = @review_date, review_text = @review_text, rating = @rating WHERE id = @id;"; // The using block is used to call dispose automatically even if there is a exception. using (SqlConnection cn = new SqlConnection(connection)) { // The using block is used to call dispose automatically even if there is a exception. using (SqlCommand cmd = new SqlCommand(sql, cn)) { // Add parameters cmd.Parameters.AddWithValue("@id", post.id); cmd.Parameters.AddWithValue("@product_id", post.product_id); cmd.Parameters.AddWithValue("@customer_id", post.customer_id); cmd.Parameters.AddWithValue("@language_id", post.language_id); cmd.Parameters.AddWithValue("@review_date", post.review_date); cmd.Parameters.AddWithValue("@review_text", post.review_text); cmd.Parameters.AddWithValue("@rating", post.rating); // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to // avoid having our application crash in such cases. try { // Open the connection. cn.Open(); // Execute the update cmd.ExecuteNonQuery(); } catch (Exception e) { throw e; } } } } // End of the Update method
public async Task <IActionResult> Create(int id, [Bind("Comment,UserId,ProductId")] ProductReview productReview) { ModelState.Remove("User"); ModelState.Remove("UserId"); productReview.ProductId = id; var user = await GetCurrentUserAsync(); if (ModelState.IsValid) { productReview.UserId = user.Id; _context.Add(productReview); await _context.SaveChangesAsync(); return(RedirectToAction("Details", "Products", new { id = id })); } ViewData["ProductId"] = new SelectList(_context.Product, "Id", "Id", productReview.ProductId); return(View(productReview)); }
public HttpResponseMessage update(ProductReview post) { // Check for errors if (post == null) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null"); } else if (Product.MasterPostExists(post.product_id) == false) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The product does not exist"); } else if (Customer.MasterPostExists(post.customer_id) == false) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The customer does not exist"); } else if (Language.MasterPostExists(post.language_id) == false) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The language does not exist"); } // Make sure that the data is valid post.review_date = AnnytabDataValidation.TruncateDateTime(post.review_date); post.rating = AnnytabDataValidation.TruncateDecimal(post.rating, 0, 999999.99M); // Get the saved post ProductReview savedPost = ProductReview.GetOneById(post.id); // Check if the post exists if (savedPost == null) { return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The record does not exist"); } // Update the post ProductReview.Update(post); // Return the success response return Request.CreateResponse<string>(HttpStatusCode.OK, "The update was successful"); } // End of the update method
public static void InitializeData(this CarvedRockContext context) { for (int i = 0; i < 99; i++) { var product = new Product { Name = $"Product {i}", Price = i }; if (i % 3 == 2) { product.Type = ProductType.Backpack; } else if (i % 3 == 1) { product.Type = ProductType.Boots; } else { product.Type = ProductType.Kayak; } context.Products.Add(product); var review = new ProductReview { Title = $"Product {i} Review", ProductId = i }; if (i % 2 == 1) { review.Review = "Good Product"; } else { review.Review = "Bad Product"; } context.ProductReviews.Add(review); } context.SaveChanges(); }
/// <summary> /// Chỉnh sửa sản phẩm /// </summary> /// <param name="product">Update Product Entity</param> /// <param name="productDetails">Update ProductDetail Entity</param> /// <param name="images">Update Image Entity</param> /// <param name="noUpdateDetail">Create New ProductDetail Entity</param> /// <returns> /// return the number of rows affected /// 0 = Error /// </returns> public int Update(Product product, History history) { try { int isReturn = 0; _unitOfWork.ProductRepository.Update(product); _unitOfWork.ProductRepository.Save(); // Save entity to GetID ProductReview review = new ProductReview() { ProductID = product.Id, }; _unitOfWork.ProductReviewRepository.Update(review); foreach (var item in product.ProductDetails) { int detailID = item.Id; ProductPrice priceNav = item.PriceNavigation; priceNav.ProductDetailId = detailID; _unitOfWork.ProductPriceRepository.Update(priceNav); // Commit transaction } isReturn = _unitOfWork.Commit(); if (isReturn != 0) { history.Detail = product.Id; _unitOfWork.HistoryRepository.Update(history); isReturn = _unitOfWork.Commit(); } return(isReturn); } catch (Exception) { _unitOfWork.Rollback(); return(0); // => Lỗi } }
public LikeStats(string id, Type contentType) { switch (contentType) { case ActivityModel.Type.NewsPost: case ActivityModel.Type.BusinessPost: var post = Central_Post.getData(Guid.Parse(id)); Dislikes = post.Dislikes.Count(); Likes = post.Likes.Count(); break; case ActivityModel.Type.BusinessReview: var breview = BizReview.getItem(int.Parse(id)); Dislikes = breview.Dislikes.Count(); Likes = breview.Likes.Count(); break; case ActivityModel.Type.MovieReview: var mreview = Movie_Customer_Review.getItem(int.Parse(id)); Dislikes = mreview.Dislikes.Count(); Likes = mreview.Likes.Count(); break; case ActivityModel.Type.ProductReview: var preview = ProductReview.getItem(Guid.Parse(id)); Dislikes = preview.Dislikes.Count(); Likes = preview.Likes.Count(); break; case ActivityModel.Type.Image: var img = Image.getItem(Guid.Parse(id)); Dislikes = img.Dislikes.Count(); Likes = img.Likes.Count(); break; default: Likes = Dislikes = 0; break; } }
public ActionResult Update(int id, ProductReview updatedReview) { // Get the existing review var existingReview = dal.Get(id); // If that review does not exists, return 404 if (existingReview == null) { return(NotFound()); } // Copy over the fields we want to change existingReview.Name = updatedReview.Name; existingReview.Title = updatedReview.Title; existingReview.Review = updatedReview.Review; // Save back to the database dal.Update(existingReview); // return a 204 return(NoContent()); }
public bool UpdateProductReview(ProductReview entity) { var productReview = dbContext.ProductReviews.Find(entity.Id); if (productReview == null) { throw new ArgumentNullException(nameof(productReview)); } productReview.CustomerId = entity.CustomerId; productReview.ProductId = entity.ProductId; productReview.IsApproved = entity.IsApproved; productReview.Title = entity.Title; productReview.ReviewText = entity.ReviewText; productReview.ReplyText = entity.ReplyText; productReview.Rating = entity.Rating; productReview.HelpfulYesTotal = entity.HelpfulYesTotal; productReview.HelpfulNoTotal = entity.HelpfulNoTotal; dbContext.SaveChanges(); return(true); }
public void Can_save_productReview_with_helpfulness() { var customer = SaveAndLoadEntity <Customer>(GetTestCustomer(), false); var product = SaveAndLoadEntity <Product>(GetTestProduct(), false); var productReview = new ProductReview { Customer = customer, Product = product, Title = "Test", ReviewText = "A review", IpAddress = "192.168.1.1", IsApproved = true, CreatedOnUtc = new DateTime(2010, 01, 01), UpdatedOnUtc = new DateTime(2010, 01, 02) }; productReview.ProductReviewHelpfulnessEntries.Add ( new ProductReviewHelpfulness { Customer = customer, WasHelpful = true, IpAddress = "192.168.1.1", IsApproved = true, CreatedOnUtc = new DateTime(2010, 01, 03), UpdatedOnUtc = new DateTime(2010, 01, 04) } ); var fromDb = SaveAndLoadEntity(productReview); fromDb.ShouldNotBeNull(); fromDb.ReviewText.ShouldEqual("A review"); fromDb.ProductReviewHelpfulnessEntries.ShouldNotBeNull(); (fromDb.ProductReviewHelpfulnessEntries.Count == 1).ShouldBeTrue(); fromDb.ProductReviewHelpfulnessEntries.First().WasHelpful.ShouldEqual(true); }
public object InsertRating(ProductReview ReviewObj) { OperationsStatusViewModel OperationsStatusViewModelObj = null; try { ReviewObj.commonObj = new LogDetails(); ReviewObj.commonObj.CreatedBy = _commonBusiness.GetUA().UserName; ReviewObj.commonObj.CreatedDate = _commonBusiness.GetCurrentDateTime(); OperationsStatusViewModelObj = Mapper.Map <OperationsStatus, OperationsStatusViewModel>(_productBusiness.InsertRating(ReviewObj)); if (ReviewObj.Review != null) { OperationsStatusViewModelObj = Mapper.Map <OperationsStatus, OperationsStatusViewModel>(_productBusiness.InsertReview(ReviewObj)); } return(JsonConvert.SerializeObject(new { Result = true, Records = OperationsStatusViewModelObj })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = false, Message = ex.Message })); } }
public IActionResult EditReview(int productId, [FromBody] ProductReview value) { var userId = User.FindFirstValue("id"); var user = _context.Users.Find(userId); if (user == null) { return(NotFound("User not found")); } try { var review = _context.ProductReviews.Where(u => (u.ProductId == productId && u.UserId == userId)).SingleOrDefault(); _context.ProductReviews.Remove(review); _context.ProductReviews.Add(value); _context.SaveChanges(); return(StatusCode(201, value)); } catch { return(NotFound("Review not found")); } }
public async Task <ActionResult> Create(int id) { var user = await GetCurrentUserAsync(); var product = await _context.Product.FirstOrDefaultAsync(b => b.Id == id); var view = new ProductReview { ProductId = product.Id }; if (user != null) { return(View(view)); } else { return(RedirectToAction(nameof(Index))); } }
public HttpResponseMessage update(ProductReview post) { // Check for errors if (post == null) { return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The post is null")); } else if (Product.MasterPostExists(post.product_id) == false) { return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The product does not exist")); } else if (Customer.MasterPostExists(post.customer_id) == false) { return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The customer does not exist")); } else if (Language.MasterPostExists(post.language_id) == false) { return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The language does not exist")); } // Make sure that the data is valid post.review_date = AnnytabDataValidation.TruncateDateTime(post.review_date); post.rating = AnnytabDataValidation.TruncateDecimal(post.rating, 0, 999999.99M); // Get the saved post ProductReview savedPost = ProductReview.GetOneById(post.id); // Check if the post exists if (savedPost == null) { return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The record does not exist")); } // Update the post ProductReview.Update(post); // Return the success response return(Request.CreateResponse <string>(HttpStatusCode.OK, "The update was successful")); } // End of the update method
public IEnumerable<ProductReview> GetByProductId(int productId) { SqlConnection conn = null; SqlDataReader dr = null; List<ProductReview> results = new List<ProductReview>(); try { conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DataServices"].ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("GetProductReviewsByProduct", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@productid", productId); dr = cmd.ExecuteReader(); while (dr.Read()) { ProductReview l = new ProductReview(); l.reviewId = dr.GetInt32(0); l.reviewInstanceId = dr.GetInt32(1); l.owner = dr.GetInt32(2); l.productId = dr.GetInt32(3); l.productName = dr.GetString(4); l.productDescription = dr.GetString(5); l.created = dr.GetDateTime(6); l.lastUpdated = dr.GetDateTime(7); l.comment = dr.GetString(8); l.rating = (double)dr.GetDouble(9); l.ownerName = dr.GetString(10); l.latestReviewInstanceId = dr.GetInt32(11); object x = dr.GetValue(12); if (x != null) { l.image = Convert.ToBase64String((byte[])dr.GetValue(12)); l.imageFileType = dr.GetValue(13).ToString(); } l.fBFeedPostId = (String)DataUtil.CheckForNullValReturnEmptyString(dr.GetValue(14)); l.fBTimelinePostId = (String)DataUtil.CheckForNullValReturnEmptyString(dr.GetValue(15)); l.compositeRating = dr.GetDouble(16); results.Add(l); } return results; } catch (Exception e) { //Dimmi.Data.Log.WriteDataToLog("GetProductReviewsByProduct", e); return null; } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }
public ProductReviewApprovedEvent(ProductReview productReview) { this.ProductReview = productReview; }
public static void FillDictionary(ProductReview.Bayesian.Node Positive, ProductReview.Bayesian.Node Negative) { // train the indexes Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Like"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Love"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Love"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Awesome"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_hate"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("want"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("great"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("best"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Simple"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Simple"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Informative"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Informative"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Well Priced"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Priced"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("fine"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("finest"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_finest"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Perfect"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("good"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("EASY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_EASY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Never Let Down"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_good"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_like"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Hated"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_want"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_great"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_best"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AFFORDABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_AFFORDABLE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AWESOME"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_AWESOME"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AMAZING"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_AMAZING"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AWSOME"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_AWSOME"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AMAZE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_AMAZE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Abnormal"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Convenient"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Convenient"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Abnormal"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Abandoned"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Abandoned"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Accurate"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Accurate"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Acknowledge"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Acknowledge"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Achievement"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Achievement"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ADAPTABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ADAPTABLE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ADMIRE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ADMIRE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ADVICE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ADVISABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ ADVICE "))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ ADVISABLE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_AFRAID"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_AGAINST"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AFRAID"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AGAINST"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ALARMING"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ALARMING"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AMBIGUITY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ AMBIGUITY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ANGRY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ANGRY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ANNOY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ANNOY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("APPRECIATE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_APPRECIATE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("APPROPRIATE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_APPROPRIATE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("AWFUL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_AWFUL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BEAUTIFUL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BEAUTY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BEAUTIFUL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BEAUTY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BENEFICENT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BENEFICIAL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BENEFICENT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BENEFICIAL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BENEFIT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BENEFIT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BRAVE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BRAVE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BRILLIANT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BRILLIANT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BAD"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BAD"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("CAPABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_CAPABLE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("CHAMP"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_CHAMP"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("CONSISTENT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_CONSISTENT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("USEFUL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_USEFUL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("CLASSIC"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_CLASSIC"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("COMFORT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_COMFORT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("COMPLETE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_COMPLETE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("CONFIDENCE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_CONFIDENCE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("CORRECT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_CORRECT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("CORRUPT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_CORRUPT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("COURAGE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_COURAGE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DANGER"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DANGER"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DEADLY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DEADLY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DEFFECT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DELICIOUS"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DELICIOUS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DELIGHTFUL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DELIGHTFUL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DEFFECT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DEPRESS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DEPRESS"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DISAPPOINT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DISAPPOINT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DISASTER"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DISASTER"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DISASTROUS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DISASTROUS"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("DOUBT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_DOUBT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("EFFECTIVE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("EFFICIENT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_EFFECTIVE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_EFFICIENT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ENCOURAGE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ENCOURAGE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("EXCITE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_EXCITE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("EXPENSIVE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_EXPENSIVE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ENERGETIC"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ENERGETIC"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("EXCELLENT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_EXCELLENT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("EXTRAORDINARY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_EXTRAORDINARY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FAIL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FAIL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FALSE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FALSE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FANTASTIC"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FANTASTIC"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FATAL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FATAL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FLAWLESS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FLAWLESS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FORWARD"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FORWARD"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FRAUD"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FRAUD"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FRIENDLY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FRIENDLY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FUSSY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_FUSSY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("GAIN"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_GAIN"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("GREAT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_GREAT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("HAPPY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_HAPPY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("HARMFUL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_HARMFUL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("BOTHER"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_BOTHER"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("HATE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_HATE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("HEALTHY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_HEALTHY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("HONEST"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_HONEST"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("IDIOT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("INEXPERIENCED"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("INCOMPITENT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("FRUSTRATING"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("INCOMPETENT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_IDIOT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("IGNORE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("ILLNESS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_IGNORE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_ILLNESS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("INCREDIBLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_INCREDIBLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("INJURIOUS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_INJURIOUS"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("INSUFFICIENT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_INSUFFICIENT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("INTERESTED"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_INTERESTED"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("KILL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_KILL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("LIAR"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_LIAR"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("MAD"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_MAD"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("MARVELOUS"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_MARVELOUS"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("MISLED"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_MISLED"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("MISTAKE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_MISTAKE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("MOTIVATE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_MOTIVATE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NATURAL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_NATURAL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NEGATIVE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_NEGATIVE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NICE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_NICE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("PAIN"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_PAIN"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("PATIENCE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_PATIENCE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("PERFECT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_PERFECT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("PLEASE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_PLEASE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("POOR"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("STAY AWAY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_POOR"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("POPULAR"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_POPULAR"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("PROFIT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_PROFIT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("PROFESSIONAL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("UNPROFESSIONAL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("PUNISH"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_PUNISH"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("QUIT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_QUIT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("REAL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_REAL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("REASONABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_REASONABLE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("REFINE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_REFINE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("REGRET"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_REGRET"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("RELAXATION"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_RELAXATION"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("RELIABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_RELIABLE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("REMARKABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_REMARKABLE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("REPAIR"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_REPAIR"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("RESOLVE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("RESPECT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_RESOLVE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_RESPECT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_RESTRICT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("RESTRICT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("RETURN"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_RETURN"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("RELIABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_RELIABLE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("RIDICULOUS"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_RIDICULOUS"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SAD"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SAD"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SAFE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SAFE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SATISFY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SATISFY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SATISFACTION"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SAVE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SAVE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SCARE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SCARE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SCREW"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SCREW"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SENSATIONAL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SENSATIONAL"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SENSE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SENSE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SHAME"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SHAME"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SHOCK"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SHOCK"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SHORT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SHORT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SICK"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SICK"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SIGNIFICANT"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SIGNIFICANT"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SMART"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SMART"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SMILE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SMILE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SORRY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("SORRY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_WRONG"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("WRONG"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("WORTH"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_WORTH"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_WORRY"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("WORRY"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_WORSE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("WORSE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("WONDER"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_WONDER"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_VAGUE"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("VAGUE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("USEFUL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_USEFUL"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("UPSET"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_UPSET"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Crap"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Disgusting"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Slow"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Congested"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Terrible"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("Dislike"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_Dislike"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_SLOW"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_PROBLEM"))); Negative.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("HORRIBLE"))); Positive.AddContent(Initializer.GetStringsFrom(Dictionary.ModifyInputString("NOT_HORRIBLE"))); }
public void AddToProductReview(ProductReview productReview) { base.AddObject("ProductReview", productReview); }
public static ProductReview CreateProductReview(int productId, int reviewId, string revisionId) { ProductReview productReview = new ProductReview(); productReview.ProductId = productId; productReview.ReviewId = reviewId; productReview.RevisionId = revisionId; return productReview; }
partial void InsertProductReview(ProductReview instance);
// POST api/awbuildversion public void Post(ProductReview value) { adventureWorks_BC.ProductReviewAdd(value); }
/// <summary> /// Create a new ProductReview object. /// </summary> /// <param name="productReviewID">Initial value of ProductReviewID.</param> /// <param name="reviewerName">Initial value of ReviewerName.</param> /// <param name="reviewDate">Initial value of ReviewDate.</param> /// <param name="emailAddress">Initial value of EmailAddress.</param> /// <param name="rating">Initial value of Rating.</param> /// <param name="modifiedDate">Initial value of ModifiedDate.</param> public static ProductReview CreateProductReview(int productReviewID, string reviewerName, global::System.DateTime reviewDate, string emailAddress, int rating, global::System.DateTime modifiedDate) { ProductReview productReview = new ProductReview(); productReview.ProductReviewID = productReviewID; productReview.ReviewerName = reviewerName; productReview.ReviewDate = reviewDate; productReview.EmailAddress = emailAddress; productReview.Rating = rating; productReview.ModifiedDate = modifiedDate; return productReview; }
private void detach_ProductReviews(ProductReview entity) { this.SendPropertyChanging(); entity.Product = null; }
private void attach_ProductReviews(ProductReview entity) { this.SendPropertyChanging(); entity.Product = this; }
partial void DeleteProductReview(ProductReview instance);
partial void UpdateProductReview(ProductReview instance);
public ActionResult add_review(FormCollection collection) { // Make sure that the customer is signed in Customer customer = Customer.GetSignedInCustomer(); // Get the current domain Domain domain = Tools.GetCurrentDomain(); // Get the translated texts KeyStringList tt = StaticText.GetAll(domain.front_end_language, "id", "ASC"); // Check if the post request is valid if (customer == null || collection == null) { return RedirectToAction("login", "customer"); } // Get the form data Int32 productId = Convert.ToInt32(collection["hiddenProductId"]); decimal userVote = 0; decimal.TryParse(collection["userVote"], NumberStyles.Any, CultureInfo.InvariantCulture, out userVote); string reviewText = collection["txtReviewText"]; // Modify the review text reviewText = reviewText.Replace(Environment.NewLine, "<br />"); // Get the product Product product = Product.GetOneById(productId, domain.front_end_language); // Create a new product review ProductReview review = new ProductReview(); review.product_id = productId; review.customer_id = customer.id; review.language_id = domain.front_end_language; review.review_date = DateTime.UtcNow; review.rating = AnnytabDataValidation.TruncateDecimal(userVote, 0, 999999.99M); review.review_text = reviewText; // Add the product review Int64 insertId = ProductReview.Add(review); // Send a email to the administrator of the website string subject = tt.Get("review") + " - " + domain.webshop_name; string message = tt.Get("id") + ": " + insertId.ToString() + "<br />" + tt.Get("product") + ": " + review.product_id.ToString() + "<br />" + tt.Get("customer") + ": " + customer.invoice_name + "<br />" + tt.Get("rating") + ": " + review.rating.ToString() + "<br /><br />" + review.review_text; Tools.SendEmailToHost("", subject, message); // Update the product rating Product.UpdateRating(product.id, domain.front_end_language); // Redirect the user to the same product page return RedirectToAction("product", "home", new { id = product.page_name }); } // End of the add_review method
} // End of the MasterPostExists method /// <summary> /// Get one product review based on id /// </summary> /// <param name="id">The id</param> /// <returns>A reference to a product review post</returns> public static ProductReview GetOneById(Int32 id) { // Create the post to return ProductReview post = null; // Create the connection and the sql statement string connection = Tools.GetConnectionString(); string sql = "SELECT * FROM dbo.product_reviews WHERE id = @id;"; // The using block is used to call dispose automatically even if there are an exception. using (SqlConnection cn = new SqlConnection(connection)) { // The using block is used to call dispose automatically even if there are an exception. using (SqlCommand cmd = new SqlCommand(sql, cn)) { // Add parameters cmd.Parameters.AddWithValue("@id", id); // Create a MySqlDataReader SqlDataReader reader = null; // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to // avoid having our application crash in such cases. try { // Open the connection. cn.Open(); // Fill the reader with one row of data. reader = cmd.ExecuteReader(); // Loop through the reader as long as there is something to read and add values while (reader.Read()) { post = new ProductReview(reader); } } catch (Exception e) { throw e; } finally { // Call Close when done reading to avoid memory leakage. if (reader != null) reader.Close(); } } } // Return the post return post; } // End of the GetOneById method
public ProductReview Update(ProductReview productReview) { SqlConnection conn = null; List<ProductReview> results = new List<ProductReview>(); try { conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DataServices"].ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("UpdateProductReviewInstance", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@reviewInstanceId", productReview.reviewInstanceId); cmd.Parameters.AddWithValue("@comment", productReview.comment); cmd.Parameters.AddWithValue("@rating", productReview.rating); cmd.Parameters.AddWithValue("@fBFeedPostId", productReview.fBFeedPostId); cmd.Parameters.AddWithValue("@fBTimelinePostId", productReview.fBTimelinePostId); cmd.ExecuteNonQuery(); return Get(productReview.reviewInstanceId); } catch (Exception e) { //Dimmi.Data.Log.WriteDataToLog("GetProductReviewsByProduct", e); return null; } finally { if (conn != null) { conn.Close(); } } }
public ProductReview Get(int reviewInstanceId) { SqlConnection conn = null; SqlDataReader dr = null; //List<Lookup> results = new List<Lookup>(); ProductReview lup = null; try { conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DataServices"].ConnectionString); conn.Open(); //Log.WriteDataToLog("GetProductReviewByReviewId", "Opened Connection"); SqlCommand cmd = new SqlCommand("GetProductReviewByReviewInstanceId", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@reviewInstanceId", reviewInstanceId); dr = cmd.ExecuteReader(); //Log.WriteDataToLog("GetProductReviewByReviewId", "Executed Reader"); while (dr.Read()) { lup = new ProductReview(); //Log.WriteDataToLog("GetProductReviewByReviewId", "Reading row"); lup.reviewId = dr.GetInt32(0); lup.reviewInstanceId = dr.GetInt32(1); lup.owner = dr.GetInt32(2); lup.productId = dr.GetInt32(3); lup.productName = dr.GetString(4); lup.productDescription = dr.GetString(5); lup.created = dr.GetDateTime(6); lup.lastUpdated = dr.GetDateTime(7); lup.comment = dr.GetString(8); lup.rating = (double)dr.GetDouble(9); lup.ownerName = dr.GetString(10); lup.latestReviewInstanceId = dr.GetInt32(11); object x = dr.GetValue(12); if (x != null) { lup.image = Convert.ToBase64String((byte[])dr.GetValue(12)); lup.imageFileType = dr.GetValue(13).ToString(); } lup.fBFeedPostId = (String)DataUtil.CheckForNullValReturnEmptyString(dr.GetValue(14)); lup.fBTimelinePostId = (String)DataUtil.CheckForNullValReturnEmptyString(dr.GetValue(15)); object test = dr.GetValue(16); lup.compositeRating = Convert.ToDouble(test); } return lup; } catch (Exception e) { // Dimmi.Data.Log.WriteDataToLog("GetProductReviewByReviewId", e); return null; } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }