Example #1
0
        public JsonResult GetItemList(int page, int rows)
        {
            ILimitTimeBuyService limitTimeBuyService = ServiceHelper.Create <ILimitTimeBuyService>();
            LimitTimeQuery       limitTimeQuery      = new LimitTimeQuery()
            {
                ShopId   = new long?(base.CurrentSellerManager.ShopId),
                PageSize = rows,
                PageNo   = page
            };
            PageModel <LimitTimeMarketInfo> itemList = limitTimeBuyService.GetItemList(limitTimeQuery);
            List <LimitTimeMarketModel>     limitTimeMarketModels = new List <LimitTimeMarketModel>();

            foreach (LimitTimeMarketInfo model in itemList.Models)
            {
                if (model.EndTime < DateTime.Now)
                {
                    model.AuditStatus = LimitTimeMarketInfo.LimitTimeMarketAuditStatus.Ended;
                }
                LimitTimeMarketModel limitTimeMarketModel = new LimitTimeMarketModel()
                {
                    Id             = model.Id,
                    StartTime      = model.StartTime.ToString("yyyy-MM-dd HH:mm"),
                    EndTime        = model.EndTime.ToString("yyyy-MM-dd HH:mm"),
                    ProductId      = model.ProductId,
                    SaleCount      = model.SaleCount,
                    ProductName    = model.ProductName,
                    AuditStatusNum = (int)model.AuditStatus,
                    AuditStatus    = model.AuditStatus.ToDescription(),
                    CancelReson    = model.CancelReson,
                    MaxSaleCount   = model.MaxSaleCount
                };
                limitTimeMarketModels.Add(limitTimeMarketModel);
            }
            return(Json(new { rows = limitTimeMarketModels, total = itemList.Total }));
        }