public GetByLayoutAndZone ( int layoutId, string zone ) : IQueryable |
||
layoutId | int | An |
zone | string | A |
return | IQueryable |
/// <summary> /// Binds the grids. /// </summary> private void BindGrids() { using ( var rockContext = new RockContext() ) { BlockService blockService = new BlockService( rockContext ); gLayoutBlocks.DataSource = blockService.GetByLayoutAndZone( _Page.LayoutId, _ZoneName ) .Select( b => new { b.Id, b.Name, BlockTypeName = b.BlockType.Name, BlockTypePath = b.BlockType.Path } ) .ToList(); gLayoutBlocks.DataBind(); gPageBlocks.DataSource = blockService.GetByPageAndZone( _Page.Id, _ZoneName ) .Select( b => new { b.Id, b.Name, BlockTypeName = b.BlockType.Name, BlockTypePath = b.BlockType.Path } ) .ToList(); gPageBlocks.DataBind(); } }
/// <summary> /// Handles the GridReorder event of the gLayoutBlocks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gLayoutBlocks_GridReorder( object sender, GridReorderEventArgs e ) { using ( var rockContext = new RockContext() ) { BlockService blockService = new BlockService( rockContext ); var blocks = blockService.GetByLayoutAndZone( _Page.LayoutId, _ZoneName ).ToList(); blockService.Reorder( blocks, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); } Rock.Web.Cache.PageCache.FlushLayoutBlocks( _Page.LayoutId ); PageUpdated = true; BindGrids(); }
/// <summary> /// Handles the GridReorder event of the gLayoutBlocks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gLayoutBlocks_GridReorder( object sender, GridReorderEventArgs e ) { int pageId = PageParameter( "EditPage" ).AsInteger(); Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read( pageId ); string zoneName = this.PageParameter( "ZoneName" ); var rockContext = new RockContext(); BlockService blockService = new BlockService( rockContext ); var blocks = blockService.GetByLayoutAndZone( page.LayoutId, zoneName ).ToList(); blockService.Reorder( blocks, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); Rock.Web.Cache.PageCache.FlushLayoutBlocks( page.LayoutId ); BindGrids(); }
/// <summary> /// Binds the layout grid. /// </summary> private void BindLayoutGrid() { BlockService blockService = new BlockService( new RockContext() ); int pageId = PageParameter( "EditPage" ).AsInteger(); Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read( pageId ); string zoneName = this.PageParameter( "ZoneName" ); gLayoutBlocks.DataSource = blockService.GetByLayoutAndZone( page.LayoutId, zoneName ).ToList(); gLayoutBlocks.DataBind(); }
/// <summary> /// Handles the GridReorder event of the gLayoutBlocks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gLayoutBlocks_GridReorder( object sender, GridReorderEventArgs e ) { BlockService blockService = new BlockService(); int pageId = PageParameter( "EditPage" ).AsInteger() ?? 0; Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read( pageId ); string zoneName = this.PageParameter( "ZoneName" ); blockService.Reorder( blockService.GetByLayoutAndZone( page.LayoutId, zoneName ).ToList(), e.OldIndex, e.NewIndex, CurrentPersonId ); BindGrids(); }