/// <summary> /// 查找子类别 /// </summary> /// <param name="parentNo">父级NO</param> /// <returns></returns> public IList <OCSInfo> SelectCategoryByParentNo(string parentNo) { IList <OCSInfo> CategoryList = DapperUtil.Query <OCSInfo>("ComBeziWfs_WfsCategory_CategoryByParentNO", new { ParentNo = parentNo }).ToList(); foreach (OCSInfo item in CategoryList) { //int ChildCount = DapperUtil.Query<int>("ComBeziWfs_WfsCategory_CategoryByIsParent", new { ParentNo = item.CategoryNo }).First(); item.isParent = true; ProductRulesService prs = new ProductRulesService(); SWfsSortOcsCategory ocsCategory = prs.IsRuleCategory(item.CategoryNo); item.AutoLastFlag = ocsCategory != null?ocsCategory.AutoLastFlag:0; if (ocsCategory != null && ocsCategory.DateUpdate.ToString("yyyy-MM-dd") != "1900-01-01") { item.SortUpdateDate = ocsCategory.DateUpdate.ToString("yyyy-MM-dd"); item.IsUpdateDateOne = IsOne(ocsCategory.DateUpdate, System.DateTime.Now); } } return(CategoryList); }
//根据搜索条件生成搜索参数 private Parameters CreateParam(int pageIndex, int pageSize) { Parameters p = new Parameters(); if (Request.QueryString["childCategoryNO"] != null && Request.QueryString["childCategoryNO"] != "0") { p.categoryNO = Request.QueryString["childCategoryNO"].ToUpper(); p.OCSCategoryName = Server.UrlDecode(Request.QueryString["childCategoryname"]); //p.OCSCategoryName = Request.QueryString["childCategoryname"]; } p.start = ((pageIndex - 1) * pageSize + 1) + ""; p.end = (pageIndex * pageSize) + ""; if (!string.IsNullOrEmpty(Request.QueryString["ProductNo"])) { p.productNO = Request.QueryString["ProductNo"]; } if (!string.IsNullOrEmpty(Request.QueryString["brandNO"]) && Request.QueryString["brandNO"] != "0") { p.brandNO = Request.QueryString["brandNO"].ToUpper(); p.BrandName = Server.UrlDecode(Request.QueryString["brandName"]); //p.BrandName = Request.QueryString["brandName"]; } if (!string.IsNullOrEmpty(Request.QueryString["colorId"]) && Request.QueryString["colorId"] != "0") { p.colorId = Request.QueryString["colorId"].ToUpper(); p.ColorName = Server.UrlDecode(Request.QueryString["colorName"]); //p.ColorName = Request.QueryString["colorName"]; } if (!string.IsNullOrEmpty(Request.QueryString["ProductName"])) { p.productName = Server.UrlEncode(Request.QueryString["ProductName"]); //p.productName = Server.UrlDecode(Request.QueryString["ProductName"]); //p.productName = Url.Encode(Request.QueryString["ProductName"]); } if (Request.QueryString["shelfType"] == "0") { p.shelfType = "0"; if (Request.QueryString["categoryType"] == "1") { ProductRulesService prs = new ProductRulesService(); SWfsSortOcsCategory ocsCategory = prs.IsRuleCategory(Request.QueryString["categoryno"]);//用分类的ID查询 if (ocsCategory != null && ocsCategory.DateUpdate.ToString("yyyy-MM-dd") != "1900-01-01") { p.shelfDate = ocsCategory.DateUpdate.ToString("yyyy-MM-dd HH:mm:ss") + "~" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } } else if (Request.QueryString["categoryType"] == "2") { ProductRulesService prs = new ProductRulesService(); SWfsSortOcsCategory ocsCategory = prs.IsRuleCategory(Request.QueryString["BrandNO"]);//用品牌ID查询 if (ocsCategory != null && ocsCategory.DateUpdate.ToString("yyyy-MM-dd") != "1900-01-01") { p.shelfDate = ocsCategory.DateUpdate.ToString("yyyy-MM-dd HH:mm:ss") + "~" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } } } else if (Request.QueryString["shelfType"] == "1") { if (!string.IsNullOrEmpty(Request.QueryString["shelfDateStart"]) && !string.IsNullOrEmpty(Request.QueryString["shelfDateEnd"])) { p.shelfType = "1"; p.shelfDate = Request.QueryString["shelfDateStart"] + "~" + Request.QueryString["shelfDateEnd"]; p.StartShelfDate = Request.QueryString["shelfDateStart"]; p.EndShelfDate = Request.QueryString["shelfDateEnd"]; } } if (!string.IsNullOrWhiteSpace(Request.QueryString["postArea"])) { p.postArea = Request.QueryString["postArea"]; } if (!string.IsNullOrEmpty(Request.QueryString["MinPrice"])) { p.price = Request.QueryString["MinPrice"] + "~" + (string.IsNullOrEmpty(Request.QueryString["MaxPrice"]) ? "10000000" : Request.QueryString["MaxPrice"]); p.StartPrice = Request.QueryString["MinPrice"]; p.EndPrice = string.IsNullOrEmpty(Request.QueryString["MaxPrice"]) ? "10000000" : Request.QueryString["MaxPrice"]; } else if (!string.IsNullOrEmpty(Request.QueryString["MaxPrice"])) { p.price = "0" + "~" + Request.QueryString["MaxPrice"]; p.StartPrice = "0"; p.EndPrice = Request.QueryString["MaxPrice"]; } if (!string.IsNullOrEmpty(Request.QueryString["MinStock"])) { p.stock = Request.QueryString["MinStock"] + "~" + (string.IsNullOrEmpty(Request.QueryString["MaxStock"]) ? "100000" : Request.QueryString["MaxStock"]); p.StartStock = Request.QueryString["MinStock"]; p.EndStock = string.IsNullOrEmpty(Request.QueryString["MaxStock"]) ? "100000" : Request.QueryString["MaxStock"]; } else if (!string.IsNullOrEmpty(Request.QueryString["MaxStock"])) { p.stock = "0" + "~" + Request.QueryString["MaxStock"]; p.StartStock = "0"; p.EndStock = Request.QueryString["MaxStock"]; } if (Server.UrlDecode(Request.QueryString["MinDiscountRate"]) != null && Server.UrlDecode(Request.QueryString["MinDiscountRate"]) != "") { p.discountRate = Request.QueryString["MinDiscountRate"] + "~" + (string.IsNullOrEmpty(Request.QueryString["MaxDiscountRate"]) ? "100000" : Request.QueryString["MaxDiscountRate"]); p.StartDiscountRate = Request.QueryString["MinDiscountRate"]; p.EndDiscountRate = string.IsNullOrEmpty(Request.QueryString["MaxDiscountRate"]) ? "100000" : Request.QueryString["MaxDiscountRate"]; } else if (Server.UrlDecode(Request.QueryString["MaxDiscountRate"]) != null && Server.UrlDecode(Request.QueryString["MaxDiscountRate"]) != "") { p.discountRate = "0" + "~" + Request.QueryString["MaxDiscountRate"]; p.StartDiscountRate = "0"; p.EndDiscountRate = Request.QueryString["MaxDiscountRate"]; } if (!string.IsNullOrEmpty(Request.QueryString["MinHot"]) && !string.IsNullOrEmpty(Request.QueryString["MaxHot"])) { if (Request.QueryString["HotType"] == "0") { p.hot = Request.QueryString["MinHot"] + "~" + Request.QueryString["MaxHot"]; } else if (Request.QueryString["HotType"] == "1") { p.sevenHot = Request.QueryString["MinHot"] + "~" + Request.QueryString["MaxHot"]; } } return(p); }