Пример #1
0
        public ActionResult AppRecommendProductList()
        {
            XMLReturnClassLists             result          = new XMLReturnClassLists();
            Parameters                      param           = new Parameters();
            AppRecommendService             zhao            = new AppRecommendService();
            List <AppRecommendProductModle> saveProductList = zhao.GetAppRecommendProductList();

            for (int i = 0; i < saveProductList.Count; i = i + 10)
            {
                string productNoStr = "";
                for (int j = 0; j < 10; j++)
                {
                    if (i + j < saveProductList.Count)
                    {
                        productNoStr = productNoStr + saveProductList[i + j].ProductNo + ",";
                    }
                }

                if (productNoStr != "")
                {
                    productNoStr.TrimEnd(',');
                }
                param.productNO = productNoStr;
                XMLReturnClassLists model = zhao.GetLists(param);//接口查询 商品列表
                foreach (InterfaceProductInfo item in model.ListProducts)
                {
                    if (item.stock == 0)
                    {
                        zhao.DelAppRecommendProductById(item.ProductNo);
                    }
                    else
                    {
                        result.ListProducts.Add(item);
                    }
                }

                for (int j = 0; j < productNoStr.Split(',').Length; j++)
                {
                    if (model.ListProducts.Where(p => p.ProductNo == productNoStr.Split(',')[j]).Count() == 0)
                    {
                        zhao.DelAppRecommendProductById(productNoStr.Split(',')[j]);
                    }
                }
            }

            return(View(result));
        }
Пример #2
0
        //移除推荐产品通过Id
        public string DelProductById(string productNo)
        {
            string result = "";

            if (productNo + "" != "")
            {
                for (int i = 0; i < productNo.Split(',').Length; i++)
                {
                    AppRecommendService zhao = new AppRecommendService();
                    result = zhao.DelAppRecommendProductById(productNo.Split(',')[i]) + "";
                }
            }
            return(result);
        }
Пример #3
0
        //把商品加入推荐池
        public ActionResult AddProductToAppRecommondAjax()
        {
            string productNO = Request.Form["productNo"];

            if (string.IsNullOrEmpty(productNO))
            {
                TempData["tip"] = "<script>alert('添加失败')</script>";
                return(Redirect("/Shangpin/AppRecommendProductManger/Index?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"] + "&hot=" + Request.QueryString["hot"] + "&sevenHot=" + Request.QueryString["sevenHot"]));
            }
            SWfsSortHistoryService sshsDal = new SWfsSortHistoryService();
            Passport passport = PresentationHelper.GetPassport();

            AppRecommendService             zhao            = new AppRecommendService();
            List <AppRecommendProductModle> saveProductList = zhao.GetAppRecommendProductList();

            if ((saveProductList.Count + productNO.Split(',').Length) > 50)
            {
                int remoteIndex = 0;
                remoteIndex = (saveProductList.Count + productNO.Split(',').Length) - 50;
                for (int i = 0; i < saveProductList.Count; i++)
                {
                    if (i < remoteIndex)
                    {
                        zhao.DelAppRecommendProductById(saveProductList[i].ProductNo);
                    }
                }
            }
            int result = 0;

            for (int i = 0; i < productNO.Split(',').Length; i++)
            {
                AppRecommendProductModle DTO = new AppRecommendProductModle()
                {
                    ProductNo = productNO.Split(',')[i],
                    Creator   = passport.UserName
                };
                result = zhao.AddAppRecommendProduct(DTO);
            }

            sshsDal         = null;
            TempData["tip"] = "<script>alert('添加成功')</script>";
            return(Redirect("/Shangpin/AppRecommendProductManger/Index?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"] + "&hot=" + Request.QueryString["hot"] + "&sevenHot=" + Request.QueryString["sevenHot"]));
        }