/// <summary> /// 添加品牌分类到DDL(IsWeb=Y) /// </summary> /// <param name="DDL">品牌分类</param> public static void SetDDLGoo_type(DropDownList DDL) { string StrSql = "select typeNo,typename from goodtype where isnull(visible,'Y')='Y' and isweb='Y' "; string ls_typeid = UserInfo.GetCussaleItem(); if (ls_typeid != "") { StrSql += " and typeNo in (" + ls_typeid + ") "; } string ls_WebType = WebSet.WebGoodType(); if (ls_WebType != "") { StrSql += " and typeNo in (" + ls_WebType + ") "; } StrSql += " order by case when seq is null then 1 else 0 end ,seq"; DataTable dt = SqlHelper.ExecuteDataTable(StrSql); for (int li_Row = 0; li_Row < dt.Rows.Count; li_Row++) { ListItem ListItems = new ListItem(); ListItems.Text = dt.Rows[li_Row]["typename"].ToString().Trim(); ListItems.Value = dt.Rows[li_Row]["typeNo"].ToString().Trim(); DDL.Items.Add(ListItems); } }
/// <summary> /// 返回显示在网站上的商品 /// </summary> /// <param name="as_Type">参数:Cus,admin,all</param> public static string GetShowGood_SQL(String as_Type) { string ls_RelSQL = " and (goodtype.visible='y' or goodtype.visible is null) "; if ("N" != publicfuns.of_GetMySysSet("商城参数" + WebSet.os_WebHost, "ShowGood_GooType")) { ls_RelSQL += " and goodsno.goo_type in (SELECT typeNo FROM goodtype WHERE isnull(visible,'Y')='Y' and isweb='Y') \r\n"; } if ("N" != publicfuns.of_GetMySysSet("商城参数" + WebSet.os_WebHost, "ShowGood_GooMata")) { ls_RelSQL += " and (goodsno.goo_mate is null or goodsno.goo_mate in (SELECT matecode FROM goodmate WHERE isweb='Y') ) \r\n"; } string ls_WebGoodType = WebSet.WebGoodType(); if (ls_WebGoodType != "") { ls_RelSQL += " and goodsno.goo_type in (" + ls_WebGoodType + ") "; } if (as_Type == "Cus" && HttpContext.Current.Session["username"] != null && HttpContext.Current.Session["usercode"] != null) { #region 只显示发过货的商品 string ls_GooLimit_OutTime = publicfuns.of_GetMySysSet("商城参数" + WebSet.os_WebHost, "GooLimit_OutTime"); if ("" != ls_GooLimit_OutTime) { //获取天数 int li_GooLimit_OutTime = Convert.ToInt32(ls_GooLimit_OutTime); //查询出发过货的商品 string ls_Sql_GooLimit = @"select outmany.goods_code from outone ,outmany where outone.Out_No = outmany.Out_No and outone.Cus_Code='" + UserInfo.GetCus_code() + @"' "; if (li_GooLimit_OutTime != 0) { ls_Sql_GooLimit += " and outone.out_date >'" + DateTime.Now.AddMonths(0 - li_GooLimit_OutTime).ToString("yyyy-MM-dd") + "' "; } ls_Sql_GooLimit += " group by outmany.goods_code"; DataTable ldt_GooLimit = SqlHelper.ExecuteDataTable(ls_Sql_GooLimit); //组合SQL string ls_GooCode_GooLimit = ""; for (int li_Rows = 0; li_Rows < ldt_GooLimit.Rows.Count; li_Rows++) { if (ls_GooCode_GooLimit != "") { ls_GooCode_GooLimit += ",'" + ldt_GooLimit.Rows[li_Rows]["goods_code"].ToString() + "'"; } else { ls_GooCode_GooLimit += "'" + ldt_GooLimit.Rows[li_Rows]["goods_code"].ToString() + "'"; } } if (ls_GooCode_GooLimit != "") { ls_RelSQL += "and goodsno.goo_code in (" + ls_GooCode_GooLimit + ") "; } else { //防止报错 ls_RelSQL += "and goodsno.goo_code in ('gysoft12312312white3123') "; } } #endregion //经营范围 string ls_Type = UserInfo.GetCussaleItem(); if (ls_Type != "") { ls_RelSQL += " and goodsno.goo_type in (" + ls_Type + ") "; } } if (as_Type != "all") { if ("N" != publicfuns.of_GetMySysSet("商城参数" + WebSet.os_WebHost, "ShowGood_Goods")) { ls_RelSQL += " and ISNULL(goodsno.isWeb,'" + WebSet.GetMySetGoodsIsWeb() + "')='Y' "; } } return(ls_RelSQL); }