日期:2014-05-20 浏览次数:20739 次
/// <summary> /// 获取流动人口租住信息 /// </summary> /// <param name="queryOption">查询选择信息</param> /// <param name="pageindex">当前页的索引编号</param> /// <param name="pagesize">页面的数据条数</param> /// <returns>IEnumerable类型</returns> public IEnumerable<ListUtility.FloatingPopulationDefault> FloatingPopulationInfo(FloatingQueryOption queryOption,int pageindex,int pagesize) { var q = (from p1 in _floatingLeaseInfo join p2 in _floatinginfo on p1.Idnumber equals p2.Idnumber join p3 in _lessorInfo on p1.Lessor equals p3.Code join p4 in _district on p3.District equals p4.Code join p5 in _subdistrict on p3.SubDistrict equals p5.Code where p1.Idnumber.Contains(queryOption.FloatingIdnumber) && p2.Name.Contains(queryOption.FloatingName) && p2.NamePY.Contains(queryOption.FloatingNamePY) select new ListUtility.FloatingPopulationDefault { FloatingName = p2.Name, FloatingNamePY = p2.NamePY, FloatingIdnumber = p2.Idnumber, Age = p2.Age, LessorID = p1.Lessor, LessorName = p3.Name, NativePlace = p2.NativePlace, InDate = p1.InDate, OutDate = p1.LeftDate, Sex = p2.Sex, Address = p4.Name + p5.Name + p3.DoorPlate + "号" + p1.RoomId + "房间" }).Skip(pageindex * pagesize).Take(pagesize); return q.ToList<ListUtility.FloatingPopulationDefault>(); }
//注:rlt是查询出来的所有数据的集合 source.Load(rlt.Take(PageSize)); //第一次加载时候的数据,首次加载的时候只要Take每页的数据 //点击下一页时 source.Load(rlt.Take(PageSize)); //这句也要的 if (CurrentPage <(RecordCount-1 )) //这是我点下页的时候 CurrentPage++; bindingSource.DataSource = rlt.Skip((CurrentPage)* PageSize)).Take(PageSize); //再把这个值赋给数据源,因为我是用bindingSource绑定DataGrideView的