Exemplo n.º 1
0
        public ActionResult Add()
        {
            List <SelectListItem> items = new List <SelectListItem>();
            var cateArray = _iLimitTimeBuyService.GetServiceCategories();

            foreach (var cate in cateArray)
            {
                items.Add(new SelectListItem {
                    Selected = false, Text = cate, Value = cate
                });
            }
            ViewBag.Cate = items;
            return(View());
        }
Exemplo n.º 2
0
        public ActionResult EditLimitItem(long id)
        {
            List <SelectListItem> items = new List <SelectListItem>();
            var cateArray = _iLimitTimeBuyService.GetServiceCategories();

            foreach (var cate in cateArray)
            {
                items.Add(new SelectListItem {
                    Selected = false, Text = cate, Value = cate
                });
            }
            var i = _iLimitTimeBuyService.GetLimitTimeMarketItem(id);

            //状态修正
            // if (i.EndTime>DateTime.Now) i.AuditStatus = Himall.Model.LimitTimeMarketInfo.LimitTimeMarketAuditStatus.Ended;

            items.FirstOrDefault(c => c.Text.Equals(i.CategoryName)).Selected = true;
            ViewBag.Cate = items;
            var model = new LimitTimeMarketModel
            {
                Title        = i.Title,
                CategoryName = i.CategoryName,
                StartTime    = i.StartTime.ToString("yyyy-MM-dd HH:mm"),
                EndTime      = i.EndTime.ToString("yyyy-MM-dd HH:mm"),
                ProductId    = i.ProductId,
                MaxSaleCount = i.MaxSaleCount,
                ProductName  = i.ProductName,
                ProductPrice = _iProductService.GetProduct(i.ProductId).MinSalePrice,
                AuditStatus  = i.AuditStatus.ToDescription(),
                CancelReson  = i.CancelReson,
                Price        = i.Price,
                Stock        = i.Stock
            };

            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Home(string catename = "")
        {
            List <SelectListItem> CateSelItem = new List <SelectListItem>();
            var cateArray = _iLimitTimeBuyService.GetServiceCategories();

            foreach (var cate in cateArray)
            {
                CateSelItem.Add(new SelectListItem {
                    Selected = false, Text = cate, Value = cate
                });
            }
            if (!string.IsNullOrWhiteSpace(catename))
            {
                var _tmp = CateSelItem.FirstOrDefault(c => c.Text.Equals(catename));
                if (_tmp != null)
                {
                    _tmp.Selected = true;
                }
            }
            var flashSaleConfig = _iLimitTimeBuyService.GetConfig();

            ViewBag.Preheat = flashSaleConfig.Preheat;
            ViewBag.Cate    = CateSelItem;
            #region 初始化查询Model
            FlashSaleQuery query = new FlashSaleQuery()
            {
                CategoryName       = catename,
                OrderKey           = 5, /* 排序项(1:默认,2:销量,3:价格,4 : 结束时间,5:状态 开始排前面) */
                IsPreheat          = true,
                PageNo             = 1,
                PageSize           = 14,
                AuditStatus        = FlashSaleInfo.FlashSaleStatus.Ongoing,
                CheckProductStatus = true
            };

            #endregion
            var model = _iLimitTimeBuyService.GetAll(query);

            ViewBag.Products = ProductManagerApplication.GetProducts(model.Models.Select(p => p.ProductId));
            return(View(model));
        }
Exemplo n.º 4
0
        // GET: Web/LimitTimeBuy
        public ActionResult Home(
            string keywords = "", /* 搜索关键字 */
            string catename = "", /* 分类名*/
            int orderKey    = 5,  /* 排序项(1:默认,2:销量,3:价格,4 : 结束时间,5:状态) */
            int orderType   = 1,  /* 排序方式(1:升序,2:降序) */
            int isStart     = 0,  /*是否开始( 1 : 开始 , 2 : 未开始 )*/
            int pageNo      = 1,  /*页码*/
            int pageSize    = 60  /*每页显示数据量*/
            )
        {
            #region 初始化查询Model
            FlashSaleQuery model = new FlashSaleQuery()
            {
                ItemName           = keywords,
                OrderKey           = orderKey,
                OrderType          = orderType,
                CategoryName       = catename,
                IsStart            = isStart,
                IsPreheat          = true,
                PageNo             = pageNo,
                PageSize           = pageSize,
                AuditStatus        = FlashSaleInfo.FlashSaleStatus.Ongoing,
                CheckProductStatus = true
            };

            #endregion

            #region ViewBag

            List <SelectListItem> CateSelItem = new List <SelectListItem>();
            var cateArray = _iLimitTimeBuyService.GetServiceCategories();
            foreach (var cate in cateArray)
            {
                CateSelItem.Add(new SelectListItem {
                    Selected = false, Text = cate, Value = cate
                });
            }
            if (!string.IsNullOrWhiteSpace(catename))
            {
                var _tmp = CateSelItem.FirstOrDefault(c => c.Text.Equals(catename));
                if (_tmp != null)
                {
                    _tmp.Selected = true;
                }
            }

            ViewBag.Cate      = CateSelItem;
            ViewBag.keywords  = keywords;
            ViewBag.orderKey  = orderKey;
            ViewBag.orderType = orderType;
            ViewBag.catename  = catename;
            ViewBag.Logined   = (null != CurrentUser) ? 1 : 0;
            ViewBag.isStart   = isStart;
            ViewBag.Slide     = _iSlideAdsService.GetSlidAds(0, Entities.SlideAdInfo.SlideAdType.PlatformLimitTime);

            #endregion


            #region 查询商品

            //var itemsModel = _iLimitTimeBuyService.GetItemList(model);
            var itemsModel = _iLimitTimeBuyService.GetAll(model);
            int total      = itemsModel.Total;
            var items      = itemsModel.Models.ToArray();


            if (itemsModel.Total == 0)
            {
                ViewBag.keywords = keywords;
                return(View());
            }

            ViewBag.Products = ProductManagerApplication.GetProducts(items.Select(p => p.ProductId));
            #endregion


            #region 分页控制
            PagingInfo info = new PagingInfo
            {
                CurrentPage  = model.PageNo,
                ItemsPerPage = pageSize,
                TotalItems   = total
            };
            ViewBag.pageInfo = info;
            #endregion

            return(View(items ?? new FlashSaleInfo[] { }));
        }