protected DataTable BindSSZ() { Hashtable ht = new Hashtable(); ht.Add("CategoryID", 1); PagerData pd = PagerData.GetInstance(); SqlParameterCollection spc = new SqlCommand().Parameters; pd.Conn = AppConfig.Conn_O2O2; pd.Field = @" SysNo,PropertyName "; pd.Table = @" dbo.P_Property "; pd.Where = " WHERE 1=1 And Status = '0'"; pd.SearchWhere = " 1=1 "; pd.Order = " ORDER BY SysNo ASC "; pd.PageSize = PageSize; pd.CurrentPageIndex = PageIndex; if (ht != null && ht.Count > 1) { StringBuilder sb = new StringBuilder(); foreach (string key in ht.Keys) { #region 搜索条件 if (key == "PropertyName") { //sb.Append(" and PropertyName ").Append(" LIKE ").Append(Util.ToSqlLikeString(ht[key].ToString())); sb.Append(" and PropertyName LIKE '%'+@PropertyName+'%' "); spc.Add(new SqlParameter("@PropertyName", ht[key].ToString())); } #endregion } pd.SearchWhere += sb.ToString(); } pd.Collection = spc; DataSet ds = pd.GetPage(PageIndex); //下面是商品类别模版存在的所有组 string sSql = "SELECT DISTINCT a.SysNo,a.GroupDesc FROM dbo.P_Property_Group AS a INNER JOIN dbo.P_CategoryTemplateProperty AS b ON a.SysNo = b.GroupSysNo WHERE b.C3SysNo = @CategoryID ORDER BY a.SysNo ASC"; SqlParameter[] spp = { new SqlParameter("@CategoryID", ht["CategoryID"].ToString()), }; DataSet dsF = SqlHelper.ExecuteDataSet(AppConfig.Conn_O2O2, sSql, spp); DataTable dts = new DataTable("ddd"); dts = dsF.Tables[0]; dts.TableName = "ddd"; dsF.Tables.Clear(); ds.Tables.Add(dts); return(ds.Tables[2]); }
public DataSet GetDs(int sPageIndex, int sPageSize, Hashtable ht) { PagerData pd = PagerData.GetInstance(); SqlParameterCollection spc = new SqlCommand().Parameters; pd.Conn = AppConfig.Conn_O2O2; pd.Field = @" a.SysNo,c.PropertyName,d.GroupDesc,a.IsInAdvSearch,a.WebDisplayStyle,a.IsMustInput,a.SortNo,a.GroupSysNo "; pd.Table = @" dbo.P_CategoryTemplateProperty AS a INNER JOIN dbo.P_Category AS b ON a.C3SysNo = b.SysNo AND ISNULL(b.C3Name,'') != '' INNER JOIN dbo.P_Property AS c ON a.PropertySysNo = c.SysNo INNER JOIN dbo.P_Property_Group AS d ON a.GroupSysNo = d.SysNo "; pd.Where = " WHERE 1=1 "; pd.SearchWhere = " 1=1 "; pd.Order = " ORDER BY a.SysNo ASC "; pd.PageSize = sPageSize; pd.CurrentPageIndex = sPageIndex; if (ht != null && ht.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (string key in ht.Keys) { #region 搜索条件 if (key == "CategoryID") { //sb.Append(" and b.SysNo ").Append(" = ").Append(Util.ToSqlString(ht[key].ToString())); sb.Append(" and b.SysNo=@CategoryID "); spc.Add(new SqlParameter("@CategoryID", ht[key].ToString())); } #endregion } pd.SearchWhere += sb.ToString(); } pd.Collection = spc; DataSet ds = pd.GetPage(PageIndex); return(ds); }