示例#1
0
        public ActionResult ProductList()
        {
            //数据验证
            Parameters param = new Parameters();

            param.productNO = Request.Form["productNo"];
            if (string.IsNullOrEmpty(Request.Form["categoryNo"]))
            {
                TempData["tip"] = "<script>alert('商品分类不存在')</script>";
                return(Redirect("/productflat/product/ProductList?categoryNO=" + Request.QueryString["categoryNO"] + "&ProductNo=" + Request.QueryString["ProductNo"] + "&ProductName=" + Request.QueryString["ProductName"] + "&brandNO=" + Request.QueryString["brandNO"] + "&colorId=" + Request.QueryString["colorId"] + "&shelfType=" + Request.QueryString["shelfType"] + "&ShelfDate=" + Request.QueryString["ShelfDate"] + "&MinPrice=" + Request.QueryString["MinPrice"] + "&MaxPrice=" + Request.QueryString["MaxPrice"] + "&MinStock=" + Request.QueryString["MinStock"] + "&MaxStock=" + Request.QueryString["MaxStock"] + "&MinDiscountRate=" + Request.QueryString["MinDiscountRate"] + "&MaxDiscountRate=" + Request.QueryString["MaxDiscountRate"]));
            }
            if (string.IsNullOrEmpty(param.productNO))
            {
                TempData["tip"] = "<script>alert('请选择加入排序的商品')</script>";
                return(Redirect("/productflat/product/ProductList?categoryNO=" + Request.QueryString["categoryNO"] + "&ProductNo=" + Request.QueryString["ProductNo"] + "&ProductName=" + Request.QueryString["ProductName"] + "&brandNO=" + Request.QueryString["brandNO"] + "&colorId=" + Request.QueryString["colorId"] + "&shelfType=" + Request.QueryString["shelfType"] + "&ShelfDate=" + Request.QueryString["ShelfDate"] + "&MinPrice=" + Request.QueryString["MinPrice"] + "&MaxPrice=" + Request.QueryString["MaxPrice"] + "&MinStock=" + Request.QueryString["MinStock"] + "&MaxStock=" + Request.QueryString["MaxStock"] + "&MinDiscountRate=" + Request.QueryString["MinDiscountRate"] + "&MaxDiscountRate=" + Request.QueryString["MaxDiscountRate"]));
            }
            ProductSortService  tian = new ProductSortService();
            List <SortProduct>  searchProductList = tian.GetXMLProductByProductNo(param);
            ProductRulesService zhao = new ProductRulesService();

            for (int i = 0; i < searchProductList.Count; i++)
            {
                //searchProductList.ElementAt(i).RuleType
                zhao.AddProductToSort(Request.Form["categoryNo"], "", Request.QueryString["categoryType"], searchProductList.ElementAt(i));
                //zhao.AddProductToSort(Request.Form["categoryNo"], Request.Form["categoryName"], searchProductList.ElementAt(i));
            }
            TempData["tip"] = "<script>alert('操作成功')</script>";
            return(Redirect("/productflat/product/ProductList?categoryNO=" + Request.QueryString["categoryNO"] + "&ProductNo=" + Request.QueryString["ProductNo"] + "&ProductName=" + Request.QueryString["ProductName"] + "&brandNO=" + Request.QueryString["brandNO"] + "&colorId=" + Request.QueryString["colorId"] + "&shelfType=" + Request.QueryString["shelfType"] + "&ShelfDate=" + Request.QueryString["ShelfDate"] + "&MinPrice=" + Request.QueryString["MinPrice"] + "&MaxPrice=" + Request.QueryString["MaxPrice"] + "&MinStock=" + Request.QueryString["MinStock"] + "&MaxStock=" + Request.QueryString["MaxStock"] + "&MinDiscountRate=" + Request.QueryString["MinDiscountRate"] + "&MaxDiscountRate=" + Request.QueryString["MaxDiscountRate"] + "&pageindex=" + Request.QueryString["pageindex"] + "&categoryType=" + Request.QueryString["categoryType"] + "&isLast=" + Request.QueryString["isLast"] + "&CategoryPath=" + Request.QueryString["CategoryPath"]));
        }
示例#2
0
        //验证是否已经加入
        public ActionResult AddProductAjax()
        {
            Parameters param = new Parameters();

            param.productNO = Request.Form["productNo"];
            if (string.IsNullOrEmpty(Request.Form["categoryNo"]))
            {
                return(Json(new
                {
                    error = 1,
                    msg = "商品分类不存在"
                }));
            }
            if (string.IsNullOrEmpty(param.productNO))
            {
                return(Json(new
                {
                    error = 1,
                    msg = "商品编号不存在"
                }));
            }
            if (string.IsNullOrEmpty(Request.Form["categoryType"]))
            {
                return(Json(new
                {
                    error = 1,
                    msg = "请选择左侧的分类或则品牌"
                }));
            }
            ProductSortService tian = new ProductSortService();
            List <SortProduct> searchProductList = tian.GetXMLProductByProductNo(param);
            SWfsSortProduct    saveProductObj    = tian.GetSortProductByProductNo(Request.Form["productNo"], Request.Form["categoryNo"]);

            if (saveProductObj != null)
            {
                if (searchProductList.Count(p => p.ProductNo == saveProductObj.ProductNo) > 0)
                {
                    return(Json(new
                    {
                        error = 1,
                        msg = "该商品已加入排序"
                    }));
                }
            }
            ProductRulesService zhao = new ProductRulesService();

            for (int i = 0; i < searchProductList.Count; i++)
            {
                zhao.AddProductToSort(Request.Form["categoryNo"].ToUpper(), "", Request.Form["categoryType"], searchProductList.ElementAt(i));
            }
            return(Json(new
            {
                error = 0,
                msg = "加入成功"
            }));
        }
        public ActionResult Index()
        {
            List <ProductSort> Sorts = ProductSortService.GetEntityes(x => true).ToList();

            ViewBag.Sortresult = Sorts;
            var s = ProductInfoService.GetEntityes(y => y.ProductSortId == Sorts[0].code);

            ViewBag.s = s;
            return(View());
        }
示例#4
0
 public AnswersController(
     ChallengeConfig challengeConfig,
     ProductSortService productSortService,
     HelperResourceService helperResourceService,
     TrolleyTotalService trolleyTotalService,
     ILogger <AnswersController> logger)
     : base()
 {
     _challengeConfig       = challengeConfig;
     _productSortService    = productSortService;
     _helperResourceService = helperResourceService;
     _trolleyTotalService   = trolleyTotalService;
     _logger = logger;
 }
示例#5
0
        //排序页面
        public ActionResult SortProductIndex(string allCount)
        {
            string categoryNo = "";

            if (Request.QueryString["categoryNO"] != null && Request.QueryString["categoryNO"] != "")
            {
                categoryNo = Request.QueryString["categoryNO"].ToUpper();
            }
            else
            {
                if (Request.QueryString["BrandNO"] != null && Request.QueryString["BrandNO"] != "")
                {
                    categoryNo = Request.QueryString["BrandNO"].ToUpper();
                }
            }
            ProductSortService SortService = new ProductSortService();
            SearchProductInfo  PageData    = SortService.GetSortResult(categoryNo, Request.QueryString["categoryType"]);//先用模拟数据

            ViewBag.CategoryNo = categoryNo;
            ViewBag.AllCount   = allCount;
            return(View(PageData));
        }
示例#6
0
        public ActionResult TopShopProductList(int pageIndex = 1, int pageSize = 10)
        {
            Parameters param = CreateParam(pageIndex, pageSize);

            if (Request.QueryString["IsRecord"] != null && Request.QueryString["IsRecord"] == "1")//说明是查询并保存
            {
                SWfsSortHistoryService sshsDal = new SWfsSortHistoryService();
                Passport passport = PresentationHelper.GetPassport();
                if (passport != null && !string.IsNullOrEmpty(passport.UserName))
                {
                    string thisUrl = Request.Url.ToString().Replace("http://" + Request.Url.Host, "").Replace("IsRecord", "IsRecoaddrd");
                    if (!string.IsNullOrEmpty(Request.QueryString["ProductName"]) && Request.QueryString["ProductName"] != "")
                    {
                        string ProductName = Server.UrlDecode(Request.QueryString["ProductName"]);
                        ProductName = ProductName.Replace(" ", "+");
                        thisUrl     = thisUrl.Replace(ProductName, Server.UrlEncode(Request.QueryString["ProductName"]));
                    }
                    sshsDal.InsertHistory(param, thisUrl, passport.UserName);
                    return(Redirect(thisUrl));
                }
            }

            SearchSortService dal = new SearchSortService();
            //param.brandNO = "B1885";
            XMLReturnClassLists model = dal.GetTopShopLists(param);//接口查询 商品列表

            //按品牌编号查询修改热度的商品列表
            if (model.ListProducts.Count() > 0)
            {
                IEnumerable <ProductHot> hotProductList = dal.GetProductListByProductNoList(model.ListProducts.Select(p => p.ProductNo));
                for (int i = 0; i < model.ListProducts.Count; i++)
                {
                    if (hotProductList.Count(p => p.ProductNo == model.ListProducts[i].ProductNo) > 0)
                    {
                        model.ListProducts[i].EditeHot      = model.ListProducts[i].Hot + hotProductList.Where(p => p.ProductNo == model.ListProducts[i].ProductNo).ElementAt(0).ProductHotValue;
                        model.ListProducts[i].EditeSevenHot = model.ListProducts[i].SevenHot + hotProductList.Where(p => p.ProductNo == model.ListProducts[i].ProductNo).ElementAt(0).ProductSevenHotValue;
                    }
                    else
                    {
                        model.ListProducts[i].EditeHot      = model.ListProducts[i].Hot;
                        model.ListProducts[i].EditeSevenHot = model.ListProducts[i].SevenHot;
                    }
                }
            }

            ProductSortService tian       = new ProductSortService();
            string             categoryNo = string.Empty;

            if (!string.IsNullOrEmpty(param.categoryNO))
            {
                categoryNo = param.categoryNO;
            }
            else
            {
                categoryNo = param.brandNO;
            }
            //IEnumerable<SWfsSortProduct> saveProductList = tian.GetSortProductList(categoryNo);
            //if (saveProductList.Count() > 0)
            //{
            //    for (int i = 0; i < model.ListProducts.Count; i++)//对比商品是否已经加入排序池
            //    {
            //        if (saveProductList.Count(q => q.ProductNo == model.ListProducts.ElementAt(i).ProductNo) > 0)
            //        {
            //            model.ListProducts.ElementAt(i).IsSelected = 1;
            //        }
            //    }
            //}
            List <SearchResultCategorys> result = new List <SearchResultCategorys>();

            //分类递归
            if (!string.IsNullOrEmpty(Request.QueryString["categoryNO"]) && Request.QueryString["categoryNO"].Length >= 3)
            {
                List <SearchResultCategorys> first = model.ListCategorys.Where(p => p.CategoryNo.Contains(Request.QueryString["categoryNO"]) && p.CategoryNo.Length == (Request.QueryString["categoryNO"].Length + 3)).ToList();
                List <SearchResultCategorys> second;
                List <SearchResultCategorys> third;
                for (int i = 0; i < first.Count; i++)
                {
                    result.Add(first[i]);
                    second = model.ListCategorys.Where(p => p.PrentNo == first[i].CategoryNo).ToList();
                    for (int j = 0; j < second.Count; j++)
                    {
                        second[j].CateGoryName = "|-" + second[j].CateGoryName;
                        result.Add(second[j]);
                        third = model.ListCategorys.Where(p => p.PrentNo == second[j].CategoryNo).ToList();
                        for (int k = 0; k < third.Count; k++)
                        {
                            third[k].CateGoryName = "|-|-" + third[k].CateGoryName;
                            result.Add(third[k]);
                        }
                    }
                }
                first  = null;
                second = null;
                third  = null;
            }
            else
            {
                List <SearchResultCategorys> first = model.ListCategorys.Where(p => p.CateGoryLevel == 2).ToList();
                List <SearchResultCategorys> second;
                List <SearchResultCategorys> third;
                for (int i = 0; i < first.Count; i++)
                {
                    result.Add(first[i]);
                    second = model.ListCategorys.Where(p => p.PrentNo == first[i].CategoryNo).ToList();
                    for (int j = 0; j < second.Count; j++)
                    {
                        second[j].CateGoryName = "|-" + second[j].CateGoryName;
                        result.Add(second[j]);
                        third = model.ListCategorys.Where(p => p.PrentNo == second[j].CategoryNo).ToList();
                        for (int k = 0; k < third.Count; k++)
                        {
                            third[k].CateGoryName = "|-|-" + third[k].CateGoryName;
                            result.Add(third[k]);
                        }
                    }
                }
                first  = null;
                second = null;
                third  = null;
            }
            model.ListCategorys = result;
            //model.SaveProductCount = saveProductList.Count();
            SWfsSortHistoryService  HistoryDal  = new SWfsSortHistoryService();
            IList <SWfsSortHistory> listHistory = HistoryDal.SelectHistory();

            ViewBag.listHistory = listHistory;
            return(View(model));
        }