예제 #1
0
 public CommodityDetail(Commodity item, string url, List <SpecificationAndSpecificationDetail> Specifications, ListReviewView listReview)
     : base(item, url)
 {
     if (item != null)
     {
         //commodityId = item.commodityId;
         //commodityName = item.commodityName;
         if (!string.IsNullOrWhiteSpace(item.images))
         {
             ListimageUrl = new List <string>();
             string[] sp = item.images.Split(',');
             if (sp.Count() >= 4)
             {
                 for (int i = 3; i < sp.Count(); i++)
                 {
                     ListimageUrl.Add(url + "/" + sp[i]);
                 }
             }
             //for (int i = 0; i < sp.Count();i++ )
             //    ListimageUrl.Add(url + "/CommodityImages/" + sp[i]);
         }
         specifications = Specifications;
         sellQuantity   = item.sellQuantity;
         //commodityPrice = item.commodityPrice;
         commodityInventory = item.commodityInventory;
         commodityFreight   = item.commodityFreight;
         commodityRemark    = item.commodityRemark;
         commodityDetails   = item.commodityDetails.Replace("/MicroMalls/CommodityImages", url);
         ListReview         = listReview;
     }
 }
예제 #2
0
        public ListReviewView GetReview(int commodityId, int PageIndex)
        {
            int userId = 0;
            var user   = _securityHelper.GetCurrentUser();

            if (user != null)
            {
                userId = user.CurrentUser.UserId;
            }
            var request = new ReviewRequest();

            request.CommodityId = commodityId;
            request.PageIndex   = PageIndex;
            request.State       = ReviewStates.Show;
            request.UserId      = userId;
            ListReviewView ListRv = new ListReviewView();
            var            Review = ReviewService.MicroMallQuery(request);

            if (Review != null)
            {
                ListRv.TotalCount = Review.TotalCount;
                int TotalPage = Math.Max((Review.TotalCount + request.PageSize - 1) / request.PageSize, 1);
                if (PageIndex == TotalPage)
                {
                    ListRv.NextPage = 0;
                }
                else if (PageIndex < TotalPage)
                {
                    ListRv.NextPage = PageIndex + 1;
                }
                ListRv.List = Review.ModelList.Select(x => new ReviewView()
                {
                    Content = x.Content, ReviewId = x.ReviewId, SubmitTime = x.SubmitTime.ToString(), UserId = x.UserId, UserName = x.UserName
                }).ToList();
            }
            return(ListRv);
        }