public DataSet getShopListByAddressId(int aid, int sid, int did, string orderType) { ShopsBLL bll = new ShopsBLL(); DataSet ds = null; if (did > 0) { ds = bll.GetListByDistrictId(did); //根据楼宇搜索 } else if (sid > 0) { ds = bll.GetListByStreetId(sid); //根据街道搜索 } else { ds = bll.GetListByAreaIdSort(aid, orderType); //搜索所有的数据 } foreach (DataTable dt in ds.Tables) { foreach (DataRow dr in dt.Rows) { foreach (DataColumn dc in dt.Columns) { return(ds); } } } return(null); }
private void shopinit() { PagedDataSource pdsdata = new PagedDataSource(); // 获取数据 DataSet ds = bll.GetListByAreaId(aid); if (sid > 0) { ds = bll.GetListByStreetId(sid); } if (did > 0) { ds = bll.GetListByDistrictId(did); } DataView dv = ds.Tables[0].DefaultView; if (TypeId > 0) { dv.RowFilter = "shoptype=" + TypeId; } switch (sortstr) { case "time": dv.Sort = "id desc"; break; case "hit": dv.Sort = "addtime desc"; break; case "point": dv.Sort = "sumpoint desc"; break; default: dv.Sort = "hit desc"; break; } pdsdata.DataSource = dv; pdsdata.AllowPaging = true; pdsdata.PageSize = WebPager.PageSize; pdsdata.CurrentPageIndex = WebPager.CurrentPageIndex - 1; //设置PagedDataSource的当前页数据(PagedDataSource的页数索引是从0开始) WebPager.RecordCount = pdsdata.DataSourceCount; rpt_shoplist.DataSource = pdsdata; rpt_shoplist.DataBind(); }