Ejemplo n.º 1
0
        public JsonResult List(DateTime?startDate, DateTime?endDate, long?orderId, string shopName, string userName, int page, int rows)
        {
            var queryModel = new OrderCommentQuery()
            {
                StartDate = startDate,
                EndDate   = endDate,
                OrderId   = orderId,
                ShopName  = shopName,
                UserName  = userName,
                PageSize  = rows,
                PageNo    = page
            };


            ObsoletePageModel <OrderCommentInfo> orderComments = _iTradeCommentService.GetOrderComments(queryModel);

            var orderCommentMode = orderComments.Models.ToArray().Select(item => new
            {
                Id           = item.Id,
                OrderId      = item.OrderId,
                ShopName     = item.ShopName,
                UserName     = item.UserName,
                CommentDate  = item.CommentDate.ToShortDateString(),
                PackMark     = item.PackMark,
                DeliveryMark = item.DeliveryMark,
                ServiceMark  = item.ServiceMark
            });

            return(Json(new { rows = orderCommentMode, total = orderComments.Total }));
        }
Ejemplo n.º 2
0
        public QueryPageModel <UserOrderCommentModel> GetOrderComment(OrderCommentQuery query)
        {
            var model             = DbFactory.Default.Get <OrderCommentInfo>().Where(a => a.UserId == query.UserId).OrderByDescending(item => item.Id).ToPagedList(query.PageNo, query.PageSize);
            var OrderCommentModel = model.Select(a => new UserOrderCommentModel {
                CommentTime = a.CommentDate, OrderId = a.OrderId
            }).ToList();
            QueryPageModel <UserOrderCommentModel> pageModel = new QueryPageModel <UserOrderCommentModel>()
            {
                Models = OrderCommentModel,
                Total  = model.TotalRecordCount
            };

            return(pageModel);
        }
Ejemplo n.º 3
0
        public ObsoletePageModel <UserOrderCommentModel> GetOrderComment(OrderCommentQuery query)
        {
            var model = Context.OrderCommentInfo.Where(a => a.UserId == query.UserId);
            int total = 0;

            model = model.GetPage(out total, query.PageNo, query.PageSize, d => d.OrderByDescending(item => item.Id));
            var OrderCommentModel = model.Select(a => new UserOrderCommentModel {
                CommentTime = a.CommentDate, OrderId = a.OrderId
            }).ToList();
            ObsoletePageModel <UserOrderCommentModel> pageModel = new ObsoletePageModel <UserOrderCommentModel>()
            {
                Models = OrderCommentModel.AsQueryable(),
                Total  = total
            };

            return(pageModel);
        }
Ejemplo n.º 4
0
        public static ShopServiceMarkModel GetShopComprehensiveMark(long shopId)
        {
            ShopServiceMarkModel shopServiceMarkModel = new ShopServiceMarkModel();
            ITradeCommentService create            = Instance <ITradeCommentService> .Create;
            OrderCommentQuery    orderCommentQuery = new OrderCommentQuery()
            {
                ShopId   = new long?(shopId),
                PageNo   = 1,
                PageSize = 100000
            };
            PageModel <OrderCommentInfo> orderComments = create.GetOrderComments(orderCommentQuery);

            shopServiceMarkModel.PackMark          = (orderComments.Models.Count() == 0 ? new decimal(0) : Math.Round(orderComments.Models.ToList().Average((OrderCommentInfo o) => (o.PackMark + o.DeliveryMark) / new decimal(2)), 2));
            shopServiceMarkModel.ServiceMark       = (orderComments.Models.Count() == 0 ? new decimal(0) : Math.Round((decimal)orderComments.Models.ToList().Average((OrderCommentInfo o) => o.ServiceMark), 2));
            shopServiceMarkModel.ComprehensiveMark = Math.Round((shopServiceMarkModel.PackMark + shopServiceMarkModel.ServiceMark) / new decimal(2), 2);
            return(shopServiceMarkModel);
        }
Ejemplo n.º 5
0
        public ObsoletePageModel <OrderCommentInfo> GetOrderComments(OrderCommentQuery query)
        {
            IQueryable <OrderCommentInfo> orderComments = Context.OrderCommentInfo.AsQueryable();

            #region 条件组合
            if (query.OrderId.HasValue)
            {
                orderComments = orderComments.Where(item => query.OrderId == item.OrderId);
            }
            if (query.StartDate.HasValue)
            {
                orderComments = orderComments.Where(item => item.CommentDate >= query.StartDate.Value);
            }
            if (query.EndDate.HasValue)
            {
                var end = query.EndDate.Value.Date.AddDays(1);
                orderComments = orderComments.Where(item => item.CommentDate < end);
            }
            if (query.ShopId.HasValue)
            {
                orderComments = orderComments.Where(item => query.ShopId == item.ShopId);
            }
            if (query.UserId.HasValue)
            {
                orderComments = orderComments.Where(item => query.UserId == item.UserId);
            }
            if (!string.IsNullOrWhiteSpace(query.ShopName))
            {
                orderComments = orderComments.Where(item => item.ShopName.Contains(query.ShopName));
            }
            if (!string.IsNullOrWhiteSpace(query.UserName))
            {
                orderComments = orderComments.Where(item => item.UserName.Contains(query.UserName));
            }
            #endregion

            int total;
            orderComments = orderComments.GetPage(out total, query.PageNo, query.PageSize);

            ObsoletePageModel <OrderCommentInfo> pageModel = new ObsoletePageModel <OrderCommentInfo>()
            {
                Models = orderComments, Total = total
            };
            return(pageModel);
        }
Ejemplo n.º 6
0
        public QueryPageModel <OrderCommentInfo> GetOrderComments(OrderCommentQuery query)
        {
            var orderComments = DbFactory.Default.Get <OrderCommentInfo>();

            #region 条件组合
            if (query.OrderId.HasValue)
            {
                orderComments.Where(item => query.OrderId == item.OrderId);
            }
            if (query.StartDate.HasValue)
            {
                orderComments.Where(item => item.CommentDate >= query.StartDate.Value);
            }
            if (query.EndDate.HasValue)
            {
                var end = query.EndDate.Value.Date.AddDays(1);
                orderComments.Where(item => item.CommentDate < end);
            }
            if (query.ShopId.HasValue)
            {
                orderComments.Where(item => query.ShopId == item.ShopId);
            }
            if (query.UserId.HasValue)
            {
                orderComments.Where(item => query.UserId == item.UserId);
            }
            if (!string.IsNullOrWhiteSpace(query.ShopName))
            {
                orderComments.Where(item => item.ShopName.Contains(query.ShopName));
            }
            if (!string.IsNullOrWhiteSpace(query.UserName))
            {
                orderComments.Where(item => item.UserName.Contains(query.UserName));
            }
            #endregion

            var rst = orderComments.OrderByDescending(o => o.Id).ToPagedList(query.PageNo, query.PageSize);

            QueryPageModel <OrderCommentInfo> pageModel = new QueryPageModel <OrderCommentInfo>()
            {
                Models = rst, Total = rst.TotalRecordCount
            };
            return(pageModel);
        }
Ejemplo n.º 7
0
        public JsonResult List(DateTime?startDate, DateTime?endDate, long?orderId, string shopName, string userName, int page, int rows)
        {
            OrderCommentQuery orderCommentQuery = new OrderCommentQuery()
            {
                StartDate = startDate,
                EndDate   = endDate,
                OrderId   = orderId,
                ShopName  = shopName,
                UserName  = userName,
                PageSize  = rows,
                PageNo    = page
            };
            PageModel <OrderCommentInfo> orderComments = ServiceHelper.Create <ITradeCommentService>().GetOrderComments(orderCommentQuery);
            var array =
                from item in orderComments.Models.ToArray()
                select new { Id = item.Id, OrderId = item.OrderId, ShopName = item.ShopName, UserName = item.UserName, CommentDate = item.CommentDate.ToShortDateString(), PackMark = item.PackMark, DeliveryMark = item.DeliveryMark, ServiceMark = item.ServiceMark };

            return(Json(new { rows = array, total = orderComments.Total }));
        }
Ejemplo n.º 8
0
        public ActionResult Index(int pageSize = 10, int pageNo = 1)
        {
            OrderCommentQuery query = new OrderCommentQuery();

            query.UserId   = base.CurrentUser.Id;
            query.PageSize = pageSize;
            query.PageNo   = pageNo;

            var model = _iCommentService.GetOrderComment(query);
            //// query.Sort = "PComment";
            // var model = _iCommentService.GetProductEvaluation(query);
            // //var newModel = (from p in
            // //                group p by new { p.BuyTime, p.OrderId, p.EvaluationStatus } into g
            // //                select new ProductEvaluation
            // //         {
            // //             BuyTime = g.Key.BuyTime,
            // //             OrderId = g.Key.OrderId,
            // //             EvaluationStatus = g.Key.EvaluationStatus
            // //         }
            // //           ).ToList();
            // #region 分页控制
            // //PagingInfo info = new PagingInfo
            // //{
            // //    CurrentPage = pageNo,
            // //    ItemsPerPage = pageSize,
            // //    TotalItems = model.Total
            // //};
            PagingInfo info = new PagingInfo
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = model.Total
            };

            ViewBag.pageInfo = info;

            //  #endregion
            //return View(model.Models);
            ViewBag.Keyword  = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords = SiteSettings.HotKeyWords;
            return(View(model.Models));
        }
Ejemplo n.º 9
0
        public PageModel <OrderCommentInfo> GetOrderComments(OrderCommentQuery query)
        {
            int num;
            IQueryable <OrderCommentInfo> orderId = context.OrderCommentInfo.AsQueryable <OrderCommentInfo>();

            if (query.OrderId.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.OrderId == item.OrderId
                    select item;
            }
            if (query.StartDate.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.StartDate <= item.CommentDate
                    select item;
            }
            if (query.EndDate.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.EndDate >= item.CommentDate
                    select item;
            }
            if (query.ShopId.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.ShopId == item.ShopId
                    select item;
            }
            if (query.UserId.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.UserId == item.UserId
                    select item;
            }
            if (!string.IsNullOrWhiteSpace(query.ShopName))
            {
                orderId =
                    from item in orderId
                    where item.ShopName.Contains(query.ShopName)
                    select item;
            }
            if (!string.IsNullOrWhiteSpace(query.UserName))
            {
                orderId =
                    from item in orderId
                    where item.UserName.Contains(query.UserName)
                    select item;
            }

            orderId = orderId.GetPage(out num, query.PageNo, query.PageSize, null);
            foreach (OrderCommentInfo info in orderId.ToList())
            {
                ShopInfo shopInfo = context.ShopInfo.FirstOrDefault((ShopInfo m) => m.Id.Equals(info.ShopId));
                info.CompanyName = (shopInfo == null ? "" : shopInfo.CompanyName);
            }
            return(new PageModel <OrderCommentInfo>()
            {
                Models = orderId,
                Total = num
            });
        }
Ejemplo n.º 10
0
        public PageModel <OrderCommentInfo> GetOrderComments(OrderCommentQuery query)
        {
            int num;
            IQueryable <OrderCommentInfo> orderId = context.OrderCommentInfo.AsQueryable <OrderCommentInfo>();

            if (query.OrderId.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.OrderId == item.OrderId
                    select item;
            }
            if (query.StartDate.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.StartDate <= item.CommentDate
                    select item;
            }
            if (query.EndDate.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.EndDate >= item.CommentDate
                    select item;
            }
            if (query.ShopId.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.ShopId == item.ShopId
                    select item;
            }
            if (query.UserId.HasValue)
            {
                orderId =
                    from item in orderId
                    where query.UserId == item.UserId
                    select item;
            }
            if (!string.IsNullOrWhiteSpace(query.ShopName))
            {
                orderId =
                    from item in orderId
                    where item.ShopName.Contains(query.ShopName)
                    select item;
            }
            if (!string.IsNullOrWhiteSpace(query.UserName))
            {
                orderId =
                    from item in orderId
                    where item.UserName.Contains(query.UserName)
                    select item;
            }
            orderId = orderId.GetPage(out num, query.PageNo, query.PageSize, null);
            return(new PageModel <OrderCommentInfo>()
            {
                Models = orderId,
                Total = num
            });
        }