Inheritance: System.Data.Objects.ObjectContext, Acme.Northwind.EFDAL.Interfaces.INorthwindEntities, nHydrate.EFCore.DataAccess.IContext
コード例 #1
0
		private void Populate()
		{
			using (var context = new NorthwindEntities())
			{
				var paging = new nHydrate.EFCore.DataAccess.Paging(this.PagingControl1.PageIndex, this.PagingControl1.RecordsPerPage);
				IEnumerable<Territory> list = null;

				if (this.Request["regionid"] != null)
				{
					int regionId;
					int.TryParse(this.Request["regionid"], out regionId);
					list = context.Territory
					.GetPagedResults(x => x.RegionID == regionId,
					x => x.TerritoryID, 
					paging); 
					
					var region = Region.SelectByPK(regionId);
					lblHeader.Text = "This is a list of all territories for the <a href='/RegionItem.aspx?id=" + region.RegionID + "'>" + region.RegionDescription + "</a> region.";
				}
				else
				{
					list = context.Territory
					.GetPagedResults(x => x.TerritoryID,
					paging);
					lblHeader.Text = "This is a list of all territories.";
				}

				this.PagingControl1.ItemCount = paging.RecordCount;
				grdItem.DataSource = list;
				grdItem.DataBind();
				SessionHelper.LastTerritoryListSearch = this.Request.Url.AbsoluteUri;
			}
		}
コード例 #2
0
		private void Populate()
		{
			using (var context = new NorthwindEntities())
			{
				var paging = new nHydrate.EFCore.DataAccess.Paging(this.PagingControl1.PageIndex, this.PagingControl1.RecordsPerPage);
				var list = context.Product
					.GetPagedResults(x => x.SupplierID, paging);

				this.PagingControl1.ItemCount = paging.RecordCount;
				grdItem.DataSource = list;
				grdItem.DataBind();
				SessionHelper.LastSupplierListSearch = this.Request.Url.AbsoluteUri;
			}
		}
コード例 #3
0
ファイル: RegionList.aspx.cs プロジェクト: nHydrate/nHydrate
		private void Populate()
		{
			using (var context = new NorthwindEntities())
			{
				var paging = new nHydrate.EFCore.DataAccess.Paging(this.PagingControl1.PageIndex, this.PagingControl1.RecordsPerPage);
				var list = context.Region
					.GetPagedResults(x => x.RegionID, paging);

				lblHeader.Text = "This is a list of all regions.";

				this.PagingControl1.ItemCount = paging.RecordCount;
				grdItem.DataSource = list;
				grdItem.DataBind();
				SessionHelper.LastRegionListSearch = this.Request.Url.AbsoluteUri;
			}
		}