public ActionResult QueryProductCommentWithPaging([DataSourceRequest] DataSourceRequest request, string statusForSearch, string userName, string productName, string fromDateTime, string toDateTime)
        {
            var service = new ProductCommentService();
            int rowCount, pageCount;
            string searchStr = this.BuildSearchString(statusForSearch, userName, productName, fromDateTime, toDateTime);

            var paging = new Paging(searchStr, request.Page, request.PageSize);
            var list = service.QueryWithPaging(paging, out pageCount, out rowCount);

            if (list == null)
            {
                return this.Json(null);
            }

            var modelList = new List<ProductCommentModel>();

            foreach (var comment in list)
            {
                var cmt = DataTransfer.Transfer<ProductCommentModel>(comment, typeof(Product_Comment));
                modelList.Add(cmt);
            }

            var dataSource = new DataSource() { Data = modelList, Total = rowCount };

            return this.Json(dataSource, JsonRequestBehavior.AllowGet);
        }
        public ActionResult ModifyProductCommentStatus([DataSourceRequest] DataSourceRequest request, ProductCommentModel model)
        {
            var service = new ProductCommentService();

            service.ModifytCommentStatus(DataTransfer.Transfer<Product_Comment>(model, typeof(ProductCommentModel)));

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
        /// <summary>
        /// 商品评论
        /// </summary>
        /// <param name="productIdString">
        /// The product Id String.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public string SimliarProductComments(string productIdString)
        {
            if (!string.IsNullOrEmpty(productIdString))
            {
                var list = new ProductCommentService().SelectCommentsFromBrandInfo(productIdString);
                var sb = new StringBuilder();
                if (list != null && list.Any())
                {
                    foreach (var comment in list)
                    {
                        sb.Append("  <div class=\"bb1d pb10 pt10\"><ul>" + comment.ProductName + "</ul><ul class=\"pl_face fl\"><img src='../Content/images/wine.jpg' width=\"45\" height=\"45\" /></ul>");
                        sb.Append(" <ul class=\"pl_user_say_r fl\"><li>  <dd> <strong>" + comment.UserName + "</strong></dd>");
                        sb.Append("  <dd> <span>" + comment.CreateTime.ToString("yyyy-MM-dd hh:mm:ss") + "</span></dd>   </li>");
                        sb.Append(" <li>" + comment.Content + "</li>    </ul>");
                        sb.Append(" <ul class=\"pl_star_2\"> <li> <dd class=\"s_10 star db fl\">  </dd><div class=\"clear\"> </div>");
                        sb.Append(" </li> </ul> <div class=\"clear\">  </div></div>");
                    }
                    return sb.ToString();
                }

            }
            return "";
        }
        public JsonResult GetProductComment(int productID, int pageIndex, int pageSize)
        {
            try
            {
                var paging = new Paging(
                    "[view_product_Comment]",
                    null,
                    null,
                    "ProductID = " + productID,
                    pageIndex,
                    pageSize,
                    "[CreateTime]",
                    1);
                int pageCount, totalCount;
                var comment = new ProductCommentService().QueryWithPaging(
                    paging,
                    out pageCount,
                    out totalCount);
                if (comment == null)
                {
                    return this.Json(null);
                }

                var commentList = new List<ProductCommentModel>();
                foreach (var productComment in comment)
                {
                    commentList.Add(DataTransfer.Transfer<ProductCommentModel>(productComment, typeof(Product_Comment)));
                }

                foreach (var commentReplt in commentList)
                {
                    var commentReplyList = new ProductCommentReplyService().QueryByCommentID(commentReplt.ID);
                    var replys = new List<ProductCommentReplyModel>();
                    foreach (var commentReply in commentReplyList)
                    {
                        replys.Add(
                             DataTransfer.Transfer<ProductCommentReplyModel>(
                                 commentReply,
                                 typeof(Product_Comment_Reply)));
                    }

                    commentReplt.CommentReplys = replys;
                }

                return this.Json(new { data = commentList, rowsCount = totalCount });
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
        public ActionResult RemoveProductComment([DataSourceRequest] DataSourceRequest request, int id)
        {
            var service = new ProductCommentService();
            service.Remove(id);

            return Json(null);
        }