Ejemplo n.º 1
0
        //添加历史记录
        public int AddSearchHistory(SWfsProductLabelSearchHistory obj)
        {
            Passport passport = PresentationHelper.GetPassport();

            if (passport != null && !string.IsNullOrEmpty(passport.UserName))
            {
                obj.CreateDate = DateTime.Now;
                obj.SearchUser = passport.UserName;
                return(DapperUtil.Insert <SWfsProductLabelSearchHistory>(obj, true));
            }
            return(0);
        }
Ejemplo n.º 2
0
        public ActionResult ProductList(int pageIndex = 1, int pageSize = 20)
        {
            Passport passport = PresentationHelper.GetPassport();

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (passport != null && !string.IsNullOrEmpty(passport.UserName))
            {
                sb.Append(DateTime.Now + " " + passport.UserName + " ");
            }
            int total = 0;

            if (Request.QueryString["keyWord"] != null)
            {
                ViewBag.keyWord = Request.QueryString["keyWord"];
                if (sb.Length > 0 && !string.IsNullOrEmpty(Request.QueryString["keyWord"]))
                {
                    sb.Append("关键字:" + Request.QueryString["keyWord"] + " ");
                }
            }
            if (Request.QueryString["CategoryNo"] != null)
            {
                ViewBag.category = Request.QueryString["CategoryNo"];
                if (sb.Length > 0 && !string.IsNullOrEmpty(Request.QueryString["categoryLevel"]))
                {
                    sb.Append(Request.QueryString["categoryLevel"] + " ");
                }
            }
            if (Request.QueryString["Gender"] != null)
            {
                ViewBag.Gender = Request.QueryString["Gender"];
                if (sb.Length > 0 && !string.IsNullOrEmpty(Request.QueryString["Gender"]))
                {
                    sb.Append("性别:" + (Request.QueryString["Gender"] == "0"?"女":"男") + " ");
                }
            }
            if (Request.QueryString["brandNO"] != null)
            {
                ViewBag.BrandNO = Request.QueryString["brandNO"];
                if (sb.Length > 0 && !string.IsNullOrEmpty(Request.QueryString["brandNO"]))
                {
                    sb.Append("品牌:" + Request.QueryString["BrandName"] + " ");
                }
            }
            if (Request.QueryString["IsShelf"] != null)
            {
                ViewBag.IsShelf = Request.QueryString["IsShelf"];
                if (sb.Length > 0)
                {
                    switch (Request.QueryString["IsShelf"])
                    {
                    case "1":
                        sb.Append("未上架 ");
                        break;

                    case "2":
                        sb.Append("已上架  ");
                        break;

                    case "3":
                        sb.Append("已下架  ");
                        break;
                    }
                }
            }
            if (Request.QueryString["IsPublish"] != null)
            {
                ViewBag.IsPublish = Request.QueryString["IsPublish"];
            }
            if (Request.QueryString["TemplateName"] != null)
            {
                ViewBag.TemplateName = Request.QueryString["TemplateName"];
            }
            if (Request.QueryString["StartDateShelf"] != null)
            {
                ViewBag.StartDateShelf = Request.QueryString["StartDateShelf"];
                if (sb.Length > 0 && !string.IsNullOrEmpty(Request.QueryString["StartDateShelf"]))
                {
                    sb.Append("上架时间:" + Request.QueryString["StartDateShelf"] + "--" + Request.QueryString["EndDateShelf"] + " ");
                }
            }
            if (Request.QueryString["EndDateShelf"] != null)
            {
                ViewBag.EndDateShelf = Request.QueryString["EndDateShelf"];
            }

            if (Request.QueryString["IsRecord"] == "1")
            {
                SWfsProductLabelSearchHistory obj = new SWfsProductLabelSearchHistory()
                {
                    SearchName = sb.ToString(),
                    SearchUser = passport.UserName,
                    SearchUrl  = Request.Url.ToString().Replace("http://" + Request.Url.Host, "").Replace("IsRecord", "IsRecordAdd")
                };
                productLabelService.AddSearchHistory(obj);
                return(Redirect(obj.SearchUrl));
            }
            IEnumerable <ProductListForLabelSelect> list = productLabelService.GetSWfsProductList(ViewBag.StartDateShelf, ViewBag.EndDateShelf, ViewBag.IsShelf, ViewBag.Gender, ViewBag.BrandNO, ViewBag.category, ViewBag.keyWord, ViewBag.IsPublish, ViewBag.TemplateName, pageIndex, pageSize, Request.QueryString["isout"], out total);

            list = list.GroupBy(p => p.ProductNo).Select(p => new ProductListForLabelSelect
            {
                ProductNo            = p.ElementAt(0).ProductNo,
                DateShelf            = p.ElementAt(0).DateShelf,
                GoodsNo              = p.ElementAt(0).GoodsNo,
                ProductModel         = p.ElementAt(0).ProductModel,
                ProductName          = p.ElementAt(0).ProductName,
                ProductPicFile       = p.ElementAt(0).ProductPicFile,
                ProductShowPic       = p.ElementAt(0).ProductShowPic,
                IsShelf              = p.ElementAt(0).IsShelf,
                PcSaleState          = p.ElementAt(0).PcSaleState,
                PcShowState          = p.ElementAt(0).PcShowState,
                BrandCnName          = p.ElementAt(0).BrandCnName,
                BrandEnName          = p.ElementAt(0).BrandEnName,
                IsPublish            = p.ElementAt(0).IsPublish,
                TemplateName         = p.ElementAt(0).TemplateName,
                MarketPriceRegion    = p.Min(a => a.MarketPrice) + "~" + p.Max(a => a.MarketPrice),
                StandardPriceRegion  = p.Min(a => a.StandardPrice) + "~" + p.Max(a => a.StandardPrice),
                PlatinumPriceRegion  = p.Min(a => a.PlatinumPrice) + "~" + p.Max(a => a.PlatinumPrice),
                DiamondPriceRegion   = p.Min(a => a.DiamondPrice) + "~" + p.Max(a => a.DiamondPrice),
                PromotionPriceRegion = p.Min(a => a.PromotionPrice) + "~" + p.Max(a => a.PromotionPrice),
                GoldPriceRegion      = p.Min(a => a.GoldPrice) + "~" + p.Max(a => a.GoldPrice),
                IsOutSide            = p.ElementAt(0).IsOutSide
            }).ToList();

            ViewBag.totalCount  = total;
            ViewBag.pageIndex   = pageIndex;
            ViewBag.pageSize    = pageSize;
            ViewBag.HistoryList = productLabelService.GetSearchHistory(10);
            return(View(list));
        }