public ProductCommentInfo ReadProductComment(int id, int userID) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.NVarChar), new SqlParameter("@userID", SqlDbType.Int) }; pt[0].Value = id; pt[1].Value = userID; ProductCommentInfo info = new ProductCommentInfo(); using (SqlDataReader reader = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadProductComment", pt)) { if (reader.Read()) { info.ID = reader.GetInt32(0); info.ProductID = reader.GetInt32(1); info.Title = reader[2].ToString(); info.Content = reader[3].ToString(); info.UserIP = reader[4].ToString(); info.PostDate = reader.GetDateTime(5); info.Support = reader.GetInt32(6); info.Against = reader.GetInt32(7); info.Status = reader.GetInt32(8); info.Rank = reader.GetInt32(9); info.ReplyCount = reader.GetInt32(10); info.AdminReplyContent = reader[11].ToString(); info.AdminReplyDate = reader.GetDateTime(12); info.UserID = reader.GetInt32(13); info.UserName = reader[14].ToString(); } } return(info); }
public JsonResult AddComment(long subOrderId, int star, string content) { ProductCommentInfo model = new ProductCommentInfo(); model.ReviewDate = DateTime.Now; model.ReviewContent = content; model.UserId = CurrentUser.Id; model.UserName = CurrentUser.UserName; model.Email = CurrentUser.Email; model.SubOrderId = subOrderId; model.ReviewMark = star; _iCommentService.AddComment(model); //TODO发表评论获得积分 MemberIntegralRecord info = new MemberIntegralRecord(); info.UserName = CurrentUser.UserName; info.MemberId = CurrentUser.Id; info.RecordDate = DateTime.Now; info.TypeId = MemberIntegral.IntegralType.Comment; MemberIntegralRecordAction action = new MemberIntegralRecordAction(); action.VirtualItemTypeId = MemberIntegral.VirtualItemType.Comment; action.VirtualItemId = model.ProductId; info.Himall_MemberIntegralRecordAction.Add(action); var memberIntegral = _iMemberIntegralConversionFactoryService.Create(MemberIntegral.IntegralType.Comment); _iMemberIntegralService.AddMemberIntegral(info, memberIntegral); return(Json(new Result() { success = true, msg = "发表成功" })); }
private void AutoProductComment(List <OrderInfo> orders) { foreach (var order in orders) { foreach (var item in order.OrderItemInfo) { ProductCommentInfo model = new ProductCommentInfo(); model.ReviewDate = DateTime.Now; model.ReviewContent = "好评!"; model.UserId = order.UserId; model.UserName = order.UserName; model.Email = ""; model.SubOrderId = item.Id; model.ReviewMark = 5; model.ShopId = order.ShopId; model.ProductId = item.ProductId; model.ShopName = order.ShopName; model.IsHidden = false; Context.ProductCommentInfo.Add(model); //更新诊疗项目评论数 var searchProduct = Context.SearchProductsInfo.FirstOrDefault(r => r.ProductId == item.ProductId); if (searchProduct != null) { searchProduct.Comments += 1; } } } Context.SaveChanges(); }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); commentID = RequestHelper.GetQueryString <int>("CommentID"); productComment = ProductCommentBLL.ReadProductComment(commentID, 0); product = ProductBLL.ReadProduct(productComment.ProductID); }
/// <summary> /// 添加评论 /// </summary> /// <param name="result"></param> public void AddProductComment(ref string result) { int productID = RequestHelper.GetQueryString <int>("ProductID"); int orderID = RequestHelper.GetQueryString <int>("OrderID"); string commentCookies = CookiesHelper.ReadCookieValue("CommentCookies" + productID.ToString()); if (ShopConfig.ReadConfigInfo().CommentRestrictTime > 0 && commentCookies != string.Empty) { result = "请不要频繁提交"; } else { ProductCommentInfo productComment = new ProductCommentInfo(); productComment.ProductId = productID; productComment.Title = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Title")); productComment.Content = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Content")); productComment.UserIP = ClientHelper.IP; productComment.PostDate = RequestHelper.DateNow; productComment.Support = 0; productComment.Against = 0; productComment.Status = ShopConfig.ReadConfigInfo().CommentDefaultStatus; productComment.Rank = RequestHelper.GetQueryString <int>("Rank"); productComment.ReplyCount = 0; productComment.AdminReplyContent = string.Empty; productComment.AdminReplyDate = RequestHelper.DateNow; productComment.UserId = base.UserId; productComment.UserName = base.UserName; productComment.OrderId = orderID; ProductCommentBLL.Add(productComment); if (ShopConfig.ReadConfigInfo().CommentRestrictTime > 0) { CookiesHelper.AddCookie("CommentCookies" + productID.ToString(), "CommentCookies" + productID.ToString(), ShopConfig.ReadConfigInfo().CommentRestrictTime, TimeType.Second); } } }
public void AddProductComment(ref string result) { int queryString = RequestHelper.GetQueryString <int>("ProductID"); string str = CookiesHelper.ReadCookieValue("CommentCookies" + queryString.ToString()); if ((ShopConfig.ReadConfigInfo().CommentRestrictTime > 0) && (str != string.Empty)) { result = "Ç벻ҪƵ·±Ìá½»"; } else { ProductCommentInfo productComment = new ProductCommentInfo(); productComment.ProductID = queryString; productComment.Title = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Title")); productComment.Content = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Content")); productComment.UserIP = ClientHelper.IP; productComment.PostDate = RequestHelper.DateNow; productComment.Support = 0; productComment.Against = 0; productComment.Status = ShopConfig.ReadConfigInfo().CommentDefaultStatus; productComment.Rank = RequestHelper.GetQueryString <int>("Rank"); productComment.ReplyCount = 0; productComment.AdminReplyContent = string.Empty; productComment.AdminReplyDate = RequestHelper.DateNow; productComment.UserID = base.UserID; productComment.UserName = base.UserName; ProductCommentBLL.AddProductComment(productComment); if (ShopConfig.ReadConfigInfo().CommentRestrictTime > 0) { CookiesHelper.AddCookie("CommentCookies" + queryString.ToString(), "CommentCookies" + queryString.ToString(), ShopConfig.ReadConfigInfo().CommentRestrictTime, TimeType.Second); } } }
public void SetCommentEmpty(long id) { ProductCommentInfo productCommentInfo = context.ProductCommentInfo.First <ProductCommentInfo>((ProductCommentInfo p) => p.Id == id); productCommentInfo.ReviewContent = ""; productCommentInfo.ReplyContent = ""; context.SaveChanges(); }
public JsonResult AddOrderEvaluationAndComment(int PackMark, int DeliveryMark, int ServiceMark, long OrderId, string productCommentsJSON) { using (TransactionScope transactionScope = new TransactionScope()) { if (PackMark != 0 || DeliveryMark != 0 || ServiceMark != 0) { OrderCommentInfo orderCommentInfo = new OrderCommentInfo() { UserId = base.CurrentUser.Id, PackMark = PackMark, DeliveryMark = DeliveryMark, ServiceMark = ServiceMark, OrderId = OrderId }; List <ProductCommentsModel> productCommentsModels = JsonConvert.DeserializeObject <List <ProductCommentsModel> >(productCommentsJSON); ServiceHelper.Create <ITradeCommentService>().AddOrderComment(orderCommentInfo); foreach (ProductCommentsModel productCommentsModel in productCommentsModels) { ProductCommentInfo productCommentInfo = new ProductCommentInfo() { ReviewDate = DateTime.Now, ReviewContent = productCommentsModel.content, UserId = base.CurrentUser.Id, UserName = base.CurrentUser.UserName, Email = base.CurrentUser.Email, SubOrderId = new long?(productCommentsModel.subOrderId), ReviewMark = productCommentsModel.star }; ServiceHelper.Create <ICommentService>().AddComment(productCommentInfo); } } else { foreach (ProductCommentsModel productCommentsModel1 in JsonConvert.DeserializeObject <List <ProductCommentsModel> >(productCommentsJSON)) { ProductCommentInfo productCommentInfo1 = new ProductCommentInfo() { ReviewDate = DateTime.Now, ReviewContent = productCommentsModel1.content, UserId = base.CurrentUser.Id, UserName = base.CurrentUser.UserName, Email = base.CurrentUser.Email, SubOrderId = new long?(productCommentsModel1.subOrderId), ReviewMark = productCommentsModel1.star }; ServiceHelper.Create <ICommentService>().AddComment(productCommentInfo1); } } transactionScope.Complete(); } Result result = new Result() { success = true, msg = "Evaluated Success" }; return(Json(result)); }
public static int Add(ProductCommentInfo entity) { entity.Id = dal.Add(entity); if (entity.Status == (int)CommentStatus.Show) { ProductBLL.ChangeProductCommentCountAndRank(entity.ProductId, entity.Rank, ChangeAction.Plus); } return(entity.Id); }
public void UpdateProductComment(ProductCommentInfo productComment) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@status", SqlDbType.Int), new SqlParameter("@adminReplyContent", SqlDbType.NVarChar), new SqlParameter("@adminReplyDate", SqlDbType.DateTime) }; pt[0].Value = productComment.ID; pt[1].Value = productComment.Status; pt[2].Value = productComment.AdminReplyContent; pt[3].Value = productComment.AdminReplyDate; ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateProductComment", pt); }
public static void UpdateProductComment(ProductCommentInfo productComment) { ProductCommentInfo info = ReadProductComment(productComment.ID, 0); dal.UpdateProductComment(productComment); if (productComment.ProductID != info.ProductID) { ProductBLL.ChangeProductCommentCountAndRank(info.ProductID, info.Rank, ChangeAction.Minus); ProductBLL.ChangeProductCommentCountAndRank(productComment.ProductID, productComment.Rank, ChangeAction.Plus); } }
public void ReplyComment(long id, string replyContent, long shopId) { ProductCommentInfo nullable = context.ProductCommentInfo.FindBy((ProductCommentInfo item) => item.Id == id && item.ShopId == shopId).FirstOrDefault(); if (shopId == 0 || nullable == null) { throw new HimallException("不存在该产品评论"); } nullable.ReplyContent = replyContent; nullable.ReplyDate = new DateTime?(DateTime.Now); context.SaveChanges(); }
public static void Update(ProductCommentInfo entity, int oldStatus) { dal.Update(entity); if (oldStatus != entity.Status) { if (entity.Status == (int)CommentStatus.Show) { ProductBLL.ChangeProductCommentCountAndRank(entity.ProductId, entity.Rank, ChangeAction.Plus); } else { ProductBLL.ChangeProductCommentCountAndRank(entity.ProductId, entity.Rank, ChangeAction.Minus); } } }
void AddProductsComment(long orderId, IEnumerable <ProductCommentModel> productComments) { var commentService = ServiceProvider.Instance <ICommentService> .Create; foreach (var productComment in productComments) { ProductCommentInfo model = new ProductCommentInfo(); model.ReviewDate = DateTime.Now; model.ReviewContent = productComment.Content; model.UserId = CurrentUser.Id; model.UserName = CurrentUser.UserName; model.Email = CurrentUser.Email; model.SubOrderId = productComment.OrderItemId; model.ReviewMark = productComment.Mark; model.ProductId = productComment.ProductId; if (productComment.Images != null && productComment.Images.Length > 0) { foreach (var img in productComment.Images) { var p = new ProductCommentsImagesInfo(); p.CommentType = 0;//0代表默认的表示评论的图片 p.CommentImage = MoveImages(img, CurrentUser.Id); model.Himall_ProductCommentsImages.Add(p); } } #region APP中 微信图片可以去除掉 //else if (productComment.WXmediaId != null && productComment.WXmediaId.Length > 0) //{ // foreach (var img in productComment.WXmediaId) // { // var p = new ProductCommentsImagesInfo(); // p.CommentType = 0;//0代表默认的表示评论的图片 // p.CommentImage = DownloadWxImage(img); // if (!string.IsNullOrEmpty(p.CommentImage)) // { // model.Himall_ProductCommentsImages.Add(p); // } // } //} #endregion commentService.AddComment(model); } }
/// <summary> /// 提交按钮点击方法 /// </summary> protected void SubmitButton_Click(object sender, EventArgs e) { string alertMessage = ShopLanguage.ReadLanguage("AddOK"); int id = RequestHelper.GetQueryString <int>("Id"); if (id > 0) { ProductCommentInfo productComment = ProductCommentBLL.Read(id); int oldStatus = productComment.Status; productComment.Status = Convert.ToInt32(Status.Text); productComment.AdminReplyContent = AdminReplyContent.Text; productComment.AdminReplyDate = RequestHelper.DateNow; CheckAdminPower("UpdateProductComment", PowerCheckType.Single); ProductCommentBLL.Update(productComment, oldStatus); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("ProductComment"), productComment.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); }
protected void SubmitButton_Click(object sender, EventArgs e) { ProductCommentInfo productComment = new ProductCommentInfo(); productComment.ID = RequestHelper.GetQueryString <int>("ID"); productComment.Status = Convert.ToInt32(this.Status.Text); productComment.AdminReplyContent = this.AdminReplyContent.Text; productComment.AdminReplyDate = RequestHelper.DateNow; string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (productComment.ID > 0) { base.CheckAdminPower("UpdateProductComment", PowerCheckType.Single); ProductCommentBLL.UpdateProductComment(productComment); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("ProductComment"), productComment.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl); }
public ActionResult AddProductComment(int productID, int orderID) { string commentCookies = CookiesHelper.ReadCookieValue("CommentCookies" + productID.ToString()); if (ShopConfig.ReadConfigInfo().CommentRestrictTime > 0 && commentCookies != string.Empty) { return(Content("请不要频繁提交")); } else { var procomList = ProductCommentBLL.SearchProductCommentList(new ProductCommentSearchInfo() { OrderID = orderID, ProductId = productID, UserId = uid }); if (procomList.Count > 0) { return(Content("已经提交过相关评论")); } ProductCommentInfo productComment = new ProductCommentInfo(); productComment.ProductId = productID; productComment.Title = StringHelper.AddSafe(RequestHelper.GetForm <string>("Title")); productComment.Content = StringHelper.AddSafe(RequestHelper.GetForm <string>("Content")); productComment.UserIP = ClientHelper.IP; productComment.PostDate = RequestHelper.DateNow; productComment.Support = 0; productComment.Against = 0; productComment.Status = ShopConfig.ReadConfigInfo().CommentDefaultStatus; productComment.Rank = RequestHelper.GetForm <int>("Rank"); productComment.ReplyCount = 0; productComment.AdminReplyContent = string.Empty; productComment.AdminReplyDate = RequestHelper.DateNow; productComment.UserId = uid; productComment.UserName = user.UserName; productComment.OrderId = orderID; int pcid = ProductCommentBLL.Add(productComment); if (ShopConfig.ReadConfigInfo().CommentRestrictTime > 0) { CookiesHelper.AddCookie("CommentCookies" + productID.ToString(), "CommentCookies" + productID.ToString(), ShopConfig.ReadConfigInfo().CommentRestrictTime, TimeType.Second); } return(Content("ok|" + pcid)); } }
public int AddProductComment(ProductCommentInfo productComment) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@productID", SqlDbType.Int), new SqlParameter("@title", SqlDbType.NVarChar), new SqlParameter("@content", SqlDbType.NText), new SqlParameter("@userIP", SqlDbType.NVarChar), new SqlParameter("@postDate", SqlDbType.DateTime), new SqlParameter("@support", SqlDbType.Int), new SqlParameter("@against", SqlDbType.Int), new SqlParameter("@status", SqlDbType.Int), new SqlParameter("@rank", SqlDbType.Int), new SqlParameter("@replyCount", SqlDbType.Int), new SqlParameter("@adminReplyContent", SqlDbType.NVarChar), new SqlParameter("@adminReplyDate", SqlDbType.DateTime), new SqlParameter("@userID", SqlDbType.Int), new SqlParameter("@userName", SqlDbType.NVarChar) }; pt[0].Value = productComment.ProductID; pt[1].Value = productComment.Title; pt[2].Value = productComment.Content; pt[3].Value = productComment.UserIP; pt[4].Value = productComment.PostDate; pt[5].Value = productComment.Support; pt[6].Value = productComment.Against; pt[7].Value = productComment.Status; pt[8].Value = productComment.Rank; pt[9].Value = productComment.ReplyCount; pt[10].Value = productComment.AdminReplyContent; pt[11].Value = productComment.AdminReplyDate; pt[12].Value = productComment.UserID; pt[13].Value = productComment.UserName; return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddProductComment", pt))); }
private void AddProductsComment(long orderId, IEnumerable <ProductCommentModel> productComments) { ICommentService commentService = ServiceHelper.Create <ICommentService>(); foreach (ProductCommentModel productComment in productComments) { ProductCommentInfo productCommentInfo = new ProductCommentInfo() { ProductId = productComment.ProductId, ReviewMark = productComment.Mark, ReviewContent = productComment.Content, UserId = base.CurrentUser.Id, SubOrderId = new long?(productComment.OrderItemId), ReviewDate = DateTime.Now, UserName = base.CurrentUser.UserName, Email = base.CurrentUser.Email }; commentService.AddComment(productCommentInfo); } }
public void AddComment(ProductCommentInfo model) { OrderItemInfo orderItemInfo = ( from a in context.OrderItemInfo where a.Id == model.SubOrderId && a.OrderInfo.UserId == model.UserId select a).FirstOrDefault(); if (orderItemInfo == null) { throw new HimallException("不能对此产品进行评价!"); } model.ShopId = orderItemInfo.ShopId; model.ProductId = orderItemInfo.ProductId; model.ShopName = ( from a in context.ShopInfo where a.Id == orderItemInfo.ShopId select a.ShopName).FirstOrDefault(); context.ProductCommentInfo.Add(model); context.SaveChanges(); }
public void AddComment(ProductCommentInfo model, bool IsStartTransaction = false) { var m = DbFactory.Default.Get <OrderItemInfo>().InnerJoin <OrderInfo>((item, o) => item.OrderId == o.Id).Where <OrderItemInfo, OrderInfo>((item, o) => item.Id == model.SubOrderId && o.UserId == model.UserId).FirstOrDefault <OrderItemInfo>(); if (m == null) { throw new Mall.Core.MallException("不能对此商品进行评价!"); } model.ShopId = m.ShopId; model.ProductId = m.ProductId; model.ShopName = DbFactory.Default.Get <ShopInfo>().Where(a => a.Id == m.ShopId).Select(a => a.ShopName).FirstOrDefault <string>(); model.IsHidden = false; //是否外面已开始了事物,如开启了事物这里不要再嵌套事物(嵌套是否会报错) if (IsStartTransaction) { DbFactory.Default.Add(model); //保存评价图片 if (model.ProductCommentImageInfo != null) { model.ProductCommentImageInfo.ForEach(p => p.CommentId = model.Id); DbFactory.Default.AddRange(model.ProductCommentImageInfo); } //更新搜索商品评论数 DbFactory.Default.Set <SearchProductInfo>().Set(n => n.Comments, n => n.Comments + 1).Where(n => n.ProductId == m.ProductId).Succeed(); } else { DbFactory.Default.InTransaction(() => { DbFactory.Default.Add(model); //保存搜索图片 if (model.ProductCommentImageInfo != null) { model.ProductCommentImageInfo.ForEach(p => p.CommentId = model.Id); DbFactory.Default.AddRange(model.ProductCommentImageInfo); } DbFactory.Default.Set <SearchProductInfo>().Set(n => n.Comments, n => n.Comments + 1).Where(n => n.ProductId == m.ProductId).Succeed(); }); } }
protected override void PageLoad() { base.PageLoad(); int queryString = RequestHelper.GetQueryString<int>("CommentID"); this.productComment = ProductCommentBLL.ReadProductComment(queryString, 0); this.product = ProductBLL.ReadProduct(this.productComment.ProductID); int count = -2147483648; int currentPage = 1; int pageSize = 5; ProductCommentSearchInfo productComment = new ProductCommentSearchInfo(); productComment.ProductID = this.product.ID; this.productCommentList = ProductCommentBLL.SearchProductCommentList(currentPage, pageSize, productComment, ref count); string strProductID = base.Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); if (strProductID != string.Empty) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = strProductID; this.tempProductList = ProductBLL.SearchProductList(productSearch); this.tempMemberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID); } }
public List <ProductCommentInfo> SearchProductCommentInnerList(int currentPage, int pageSize, ProductCommentSearchInfo productCommentSearch, ref int count) { List <ProductCommentInfo> list = new List <ProductCommentInfo>(); ShopMssqlPagerClass class2 = new ShopMssqlPagerClass(); class2.TableName = string.Concat(new object[] { ' ', ShopMssqlHelper.TablePrefix, "ProductComment INNER JOIN ", ShopMssqlHelper.TablePrefix, "Product ON ", ShopMssqlHelper.TablePrefix, "ProductComment.[ProductID]=", ShopMssqlHelper.TablePrefix, "Product.[ID] " }); class2.Fields = ShopMssqlHelper.TablePrefix + "ProductComment.[ID],[ProductID],[Title],[UserIP],[PostDate],[Support],[Against],[Status],[Rank],[ReplyCount],[AdminReplyContent],[AdminReplyDate],[UserID],[UserName],[Name]"; class2.CurrentPage = currentPage; class2.PageSize = pageSize; class2.OrderField = ShopMssqlHelper.TablePrefix + "ProductComment.[ID]"; class2.OrderType = OrderType.Desc; this.PrepareCondition(class2.MssqlCondition, productCommentSearch); class2.Count = count; count = class2.Count; using (SqlDataReader reader = class2.ExecuteReader()) { while (reader.Read()) { ProductCommentInfo item = new ProductCommentInfo(); item.ID = reader.GetInt32(0); item.ProductID = reader.GetInt32(1); item.Title = reader[2].ToString(); item.UserIP = reader[3].ToString(); item.PostDate = reader.GetDateTime(4); item.Support = reader.GetInt32(5); item.Against = reader.GetInt32(6); item.Status = reader.GetInt32(7); item.Rank = reader.GetInt32(8); item.ReplyCount = reader.GetInt32(9); item.AdminReplyContent = reader[10].ToString(); item.AdminReplyDate = reader.GetDateTime(11); item.UserID = reader.GetInt32(12); item.UserName = reader[13].ToString(); item.Product.Name = reader[14].ToString(); list.Add(item); } } return(list); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int id = RequestHelper.GetQueryString <int>("Id"); if (id != int.MinValue) { CheckAdminPower("ReadProductComment", PowerCheckType.Single); productComment = ProductCommentBLL.Read(id); Name.Text = ProductBLL.Read(productComment.ProductId).Name; //Name.NavigateUrl = "/ProductDetail-I" + productComment.ProductId + ".html"; //Name.Target = "_blank"; Content.Text = productComment.Content; UserIP.Text = productComment.UserIP; PostDate.Text = productComment.PostDate.ToString(); Status.Text = productComment.Status.ToString(); Rank.Text = productComment.Rank.ToString(); UserName.Text = HttpUtility.UrlDecode(productComment.UserName, Encoding.UTF8); AdminReplyContent.Text = productComment.AdminReplyContent; } } }
public JsonResult AddComment(long subOrderId, int star, string content) { ProductCommentInfo productCommentInfo = new ProductCommentInfo() { ReviewDate = DateTime.Now, ReviewContent = content, UserId = base.CurrentUser.Id, UserName = base.CurrentUser.UserName, Email = base.CurrentUser.Email, SubOrderId = new long?(subOrderId), ReviewMark = star }; ServiceHelper.Create <ICommentService>().AddComment(productCommentInfo); MemberIntegralRecord memberIntegralRecord = new MemberIntegralRecord() { UserName = base.CurrentUser.UserName, MemberId = base.CurrentUser.Id, RecordDate = new DateTime?(DateTime.Now), TypeId = MemberIntegral.IntegralType.Comment }; MemberIntegralRecordAction memberIntegralRecordAction = new MemberIntegralRecordAction() { VirtualItemTypeId = new MemberIntegral.VirtualItemType?(MemberIntegral.VirtualItemType.Comment), VirtualItemId = productCommentInfo.ProductId }; memberIntegralRecord.ChemCloud_MemberIntegralRecordAction.Add(memberIntegralRecordAction); IConversionMemberIntegralBase conversionMemberIntegralBase = ServiceHelper.Create <IMemberIntegralConversionFactoryService>().Create(MemberIntegral.IntegralType.Comment, 0); ServiceHelper.Create <IMemberIntegralService>().AddMemberIntegral(memberIntegralRecord, conversionMemberIntegralBase); Result result = new Result() { success = true, msg = "发表成功" }; return(Json(result)); }
public void PrepareProductCommentModel(SqlDataReader dr, List <ProductCommentInfo> productCommentList) { while (dr.Read()) { ProductCommentInfo item = new ProductCommentInfo(); item.ID = dr.GetInt32(0); item.ProductID = dr.GetInt32(1); item.Title = dr[2].ToString(); item.Content = dr[3].ToString(); item.UserIP = dr[4].ToString(); item.PostDate = dr.GetDateTime(5); item.Support = dr.GetInt32(6); item.Against = dr.GetInt32(7); item.Status = dr.GetInt32(8); item.Rank = dr.GetInt32(9); item.ReplyCount = dr.GetInt32(10); item.AdminReplyContent = dr[11].ToString(); item.AdminReplyDate = dr.GetDateTime(12); item.UserID = dr.GetInt32(13); item.UserName = dr[14].ToString(); productCommentList.Add(item); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { int queryString = RequestHelper.GetQueryString <int>("ID"); if (queryString != -2147483648) { base.CheckAdminPower("ReadProductComment", PowerCheckType.Single); ProductCommentInfo info = ProductCommentBLL.ReadProductComment(queryString, 0); this.Name.Text = ProductBLL.ReadProduct(info.ProductID).Name; this.Title.Text = info.Title; this.Content.Text = info.Content; this.UserIP.Text = info.UserIP; this.PostDate.Text = info.PostDate.ToString(); this.Support.Text = info.Support.ToString(); this.Against.Text = info.Against.ToString(); this.Status.Text = info.Status.ToString(); this.Rank.Text = info.Rank.ToString(); this.ReplyCount.Text = info.ReplyCount.ToString(); this.AdminReplyContent.Text = info.AdminReplyContent; this.UserName.Text = info.UserName; } } }
private void Submit() { string urlPrefix = string.IsNullOrEmpty(isMobile) ? "/user" : "/mobile"; if (base.UserId < 1) { ResponseHelper.Write("error|登录状态已过期,请重新登录|" + urlPrefix + "/login.html"); ResponseHelper.End(); } int orderId = RequestHelper.GetForm <int>("orderId"); if (ProductCommentBLL.HasCommented(orderId, base.UserId)) { ResponseHelper.Write("error|订单已评价|" + urlPrefix + "/userproductcomment.html"); ResponseHelper.End(); } order = OrderBLL.Read(orderId, base.UserId); if (order.Id < 1) { ResponseHelper.Write("error|订单不存在|" + urlPrefix + "/order.html"); ResponseHelper.End(); } orderDetailList = OrderDetailBLL.ReadList(orderId); List <ProductCommentInfo> productCommentList = new List <ProductCommentInfo>(); foreach (OrderDetailInfo orderDetail in orderDetailList) { int rank = RequestHelper.GetForm <int>("rank_" + orderDetail.ProductId); string content = StringHelper.AddSafe(RequestHelper.GetForm <string>("content_" + orderDetail.ProductId)); if (rank >= 1 && rank <= 5 && !string.IsNullOrEmpty(content)) { ProductCommentInfo productComment = new ProductCommentInfo(); productComment.ProductId = orderDetail.ProductId; productComment.Title = ""; productComment.Content = content; productComment.UserIP = ClientHelper.IP; productComment.PostDate = RequestHelper.DateNow; productComment.Support = 0; productComment.Against = 0; productComment.Status = ShopConfig.ReadConfigInfo().CommentDefaultStatus; productComment.Rank = rank; productComment.ReplyCount = 0; productComment.AdminReplyContent = string.Empty; productComment.AdminReplyDate = RequestHelper.DateNow; productComment.UserId = base.UserId; productComment.UserName = base.UserName; productComment.OrderId = order.Id; productComment.BuyDate = order.AddDate; productCommentList.Add(productComment); } else { ResponseHelper.Write("error|评价失败|" + urlPrefix + "/userproductcommentAdd.html?orderid=" + order.Id); ResponseHelper.End(); } } foreach (ProductCommentInfo comment in productCommentList) { ProductCommentBLL.Add(comment); } ResponseHelper.Write("ok|评价成功|" + urlPrefix + "/userproductcomment.html"); ResponseHelper.End(); }
public JsonResult Detail(long id) { ProductCommentInfo comment = ServiceHelper.Create <ICommentService>().GetComment(id); return(Json(new { ConsulationContent = comment.ReviewContent, ReplyContent = comment.ReplyContent })); }
/// <summary> /// 提交数据 /// </summary> protected override void PostBack() { string url = ""; if (Request.RawUrl.ToLower().IndexOf("/mobile/") >= 0) { url = "/mobile/"; } else { url = "/User/"; } if (base.UserId > 0) { int orderID = RequestHelper.GetForm <int>("OrderID"); order = OrderBLL.Read(orderID, base.UserId); orderDetailList = OrderDetailBLL.ReadList(orderID); if (order.Id > 0) { if (ProductCommentBLL.SearchProductCommentList(new ProductCommentSearchInfo { OrderID = order.Id }).Count <= 0) { List <ProductCommentInfo> productCommentList = new List <ProductCommentInfo>(); foreach (OrderDetailInfo orderDetail in orderDetailList) { if (RequestHelper.GetForm <int>("pid_" + orderDetail.ProductId) > 0) { proID = RequestHelper.GetForm <int>("pid_" + orderDetail.ProductId); } } //foreach (OrderDetailInfo orderDetail in orderDetailList) //{ int rank = RequestHelper.GetForm <int>("rank_" + proID); string title = StringHelper.AddSafe(RequestHelper.GetForm <string>("title_" + proID)); string content = StringHelper.AddSafe(RequestHelper.GetForm <string>("content_" + proID)); // ProductInfo product = ProductBLL.ReadProduct(orderDetail.ProductID); ProductInfo product = ProductBLL.Read(proID); if (rank >= 1 && rank <= 5 && content != string.Empty) { ProductCommentInfo productComment = new ProductCommentInfo(); // productComment.ProductID = orderDetail.ProductID; productComment.ProductId = proID; productComment.Title = title; productComment.Content = content; productComment.UserIP = ClientHelper.IP; productComment.PostDate = RequestHelper.DateNow; productComment.Support = 0; productComment.Against = 0; productComment.Status = ShopConfig.ReadConfigInfo().CommentDefaultStatus; productComment.Rank = rank; productComment.ReplyCount = 0; productComment.AdminReplyContent = string.Empty; productComment.AdminReplyDate = RequestHelper.DateNow; productComment.UserId = base.UserId; productComment.UserName = base.UserName; productComment.OrderId = order.Id; productComment.BuyDate = order.AddDate; productCommentList.Add(productComment); } else { ResponseHelper.Redirect(url + "CommentOrderProduct-O" + order.Id + ".html"); } //} foreach (ProductCommentInfo comment in productCommentList) { ProductCommentBLL.Add(comment); } ResponseHelper.Redirect(url + "UserProductComment.html"); } else { ResponseHelper.Redirect(url + "UserProductComment.html"); } } else { ResponseHelper.Redirect(url + "Order.html"); } } else { ResponseHelper.Redirect(url + "Login.html"); } }