예제 #1
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);
        }
예제 #2
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));
        }
예제 #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"]));
        }
예제 #4
0
        public ActionResult Index(int pageIndex = 1, int pageSize = 10)
        {
            Parameters param = CreateParam(pageIndex, pageSize);

            AppRecommendService dal   = new AppRecommendService();
            XMLReturnClassLists model = dal.GetLists(param);//接口查询 商品列表

            AppRecommendService zhao = new AppRecommendService();
            string categoryNo        = string.Empty;

            if (!string.IsNullOrEmpty(param.categoryNO))
            {
                categoryNo = param.categoryNO;
            }
            else
            {
                categoryNo = param.brandNO;
            }
            List <AppRecommendProductModle> saveProductList = zhao.GetAppRecommendProductList();

            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)
                    {
                        //库存为零时删除
                        //if (model.ListProducts.Where(p => p.ProductNo == saveProductList[i].ProductNo && p.stock < 1).Count() > 0)
                        //{
                        //    zhao.DelAppRecommendProductById(saveProductList[i].Id);
                        //}
                        model.ListProducts.ElementAt(i).IsSelected = 1;
                    }
                }
            }
            List <SearchResultCategorys> result = new List <SearchResultCategorys>();

            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();

            return(View(model));
        }