Exemplo n.º 1
0
        /// <summary>
        /// 获取末级分类
        /// </summary>
        /// <returns></returns>
        public JsonResult AjaxLoadLeafCategory()
        {
            string categoryCode = Request.Params["code"].Trim();

            return(new JsonResult()
            {
                Data = ProductMaintainService.GetFrontProductCategoryByParentCode(categoryCode)
            });
        }
Exemplo n.º 2
0
        public JsonResult AjaxLoadLeafCategory()
        {
            List <FrontProductCategoryInfo> categories = new List <FrontProductCategoryInfo>();;

            string categoryCode = Request.Form["categoryCode"];

            if (categoryCode != null && categoryCode.Trim() != "0")
            {
                categories = ProductMaintainService.GetFrontProductCategoryByParentCode(categoryCode.Trim());
            }

            return(Json(categories));
        }
Exemplo n.º 3
0
        public ActionResult AjaxQuery()
        {
            ProductQueryFilter queryFilter = BuildQueryFilterEntity <ProductQueryFilter>();

            int currentSellerSysNoValue = UserAuthHelper.GetCurrentUser().SellerSysNo;

            if (currentSellerSysNoValue > 0)
            {
                queryFilter.VendorSysNo = currentSellerSysNoValue.ToString();
            }

            if (queryFilter.CategorySysNo == "0")
            {
                queryFilter.CategorySysNo = string.Empty;
            }

            if (queryFilter.StatusCondition == -1)
            {
                queryFilter.StatusCondition = 0;
                queryFilter.Status          = string.Empty;
            }
            //假设我拿到的是类别的CategoryCode,我需要根据他的值“CategoryCode-层级数-CategorySysNo” 拿到对应的三级CategorySysNo字符列表
            if ((!string.IsNullOrWhiteSpace(queryFilter.CategoryCode)) && queryFilter.CategoryCode != "0")
            {
                string CategoryCode  = queryFilter.CategoryCode.Split('-')[0].Trim();
                string CategorySysNo = queryFilter.CategoryCode.Split('-')[2];
                string IsLeaf        = queryFilter.CategoryCode.Split('-')[3];
                switch (queryFilter.CategoryCode.Split('-')[1])
                {
                case "1":
                    if (IsLeaf == "0")
                    {
                        var CateGory2List_One = ProductMaintainService.GetFrontProductCategoryByParentCode(CategoryCode);
                        foreach (var CateGory2 in CateGory2List_One)
                        {
                            if (CateGory2.IsLeaf == CommonYesOrNo.Yes)
                            {
                                queryFilter.CategorySysNo += CateGory2.SysNo + ",";
                            }
                            var Category3List_One = ProductMaintainService.GetFrontProductCategoryByParentCode(CateGory2.CategoryCode);
                            foreach (var item in Category3List_One)
                            {
                                queryFilter.CategorySysNo += item.SysNo + ",";
                            }
                        }
                        //去掉最后余出来的“,”
                        if (!string.IsNullOrWhiteSpace(queryFilter.CategorySysNo))
                        {
                            int RemoveIndex_One = queryFilter.CategorySysNo.Length - 1;
                            queryFilter.CategorySysNo = queryFilter.CategorySysNo.Remove(RemoveIndex_One);
                        }
                        else
                        {
                            queryFilter.CategorySysNo = CategorySysNo;
                        }
                    }
                    else
                    {
                        queryFilter.CategorySysNo = CategorySysNo;
                    }

                    break;

                case "2":
                    if (IsLeaf == "0")
                    {
                        var Category3List_Two = ProductMaintainService.GetFrontProductCategoryByParentCode(CategoryCode);
                        foreach (var item in Category3List_Two)
                        {
                            queryFilter.CategorySysNo += item.SysNo + ",";
                        }
                        //去掉最后余出来的“,”
                        if (!string.IsNullOrWhiteSpace(queryFilter.CategorySysNo))
                        {
                            int RemoveIndex_One = queryFilter.CategorySysNo.Length - 1;
                            queryFilter.CategorySysNo = queryFilter.CategorySysNo.Remove(RemoveIndex_One);
                        }
                        else
                        {
                            queryFilter.CategorySysNo = CategorySysNo;
                        }
                    }
                    else
                    {
                        queryFilter.CategorySysNo = CategorySysNo;
                    }

                    break;

                case "3":
                    queryFilter.CategorySysNo = CategorySysNo;
                    break;

                default:
                    queryFilter.CategorySysNo = string.Empty;
                    break;
                }
            }


            QueryResult <ProductQueryInfo>
            result = ProductService.QueryProduct(queryFilter);

            return(AjaxGridJson(result));
        }