Пример #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 = "加入成功"
            }));
        }