public static RegisterBlockTypes ( string physWebAppPath, System page, bool refreshAll = false ) : void | ||
physWebAppPath | string | A |
page | System | The |
refreshAll | bool | if set to |
리턴 | void |
/// <summary> /// Loads the block types. /// </summary> private void LoadBlockTypes() { using (new Rock.Data.UnitOfWorkScope()) { Rock.Model.BlockTypeService blockTypeService = new Rock.Model.BlockTypeService(); // Add any unregistered blocks blockTypeService.RegisterBlockTypes(Request.MapPath("~"), Page, CurrentPersonId); ddlBlockType.DataSource = blockTypeService.Queryable().OrderBy(b => b.Name).ToList(); ddlBlockType.DataTextField = "Name"; ddlBlockType.DataValueField = "Id"; ddlBlockType.DataBind(); } }
/// <summary> /// Loads the block types. /// </summary> private void LoadBlockTypes() { using (new Rock.Data.UnitOfWorkScope()) { Rock.Model.BlockTypeService blockTypeService = new Rock.Model.BlockTypeService(); // Add any unregistered blocks blockTypeService.RegisterBlockTypes(Request.MapPath("~"), Page, CurrentPersonId); // Load the block types var blockTypes = blockTypeService.Queryable() .Select(b => new { b.Id, b.Name, b.Category, b.Description }) .ToList(); ddlBlockType.Items.Clear(); // Add the categorized block types foreach (var blockType in blockTypes .Where(b => b.Category != "") .OrderBy(b => b.Category) .ThenBy(b => b.Name)) { var li = new ListItem(blockType.Name, blockType.Id.ToString()); li.Attributes.Add("optiongroup", blockType.Category); li.Attributes.Add("title", blockType.Description); ddlBlockType.Items.Add(li); } // Add the uncategorized block types foreach (var blockType in blockTypes .Where(b => b.Category == null || b.Category == "") .OrderBy(b => b.Name)) { var li = new ListItem(blockType.Name, blockType.Id.ToString()); li.Attributes.Add("optiongroup", "Other (not categorized)"); li.Attributes.Add("title", blockType.Description); ddlBlockType.Items.Add(li); } } }
/// <summary> /// Loads the block types. /// </summary> private void LoadBlockTypes() { using ( new Rock.Data.UnitOfWorkScope() ) { Rock.Model.BlockTypeService blockTypeService = new Rock.Model.BlockTypeService(); // Add any unregistered blocks blockTypeService.RegisterBlockTypes( Request.MapPath( "~" ), Page, CurrentPersonId ); // Load the block types var blockTypes = blockTypeService.Queryable() .Select( b => new { b.Id, b.Name, b.Category, b.Description } ) .ToList(); ddlBlockType.Items.Clear(); // Add the categorized block types foreach ( var blockType in blockTypes .Where( b => b.Category != "" ) .OrderBy( b => b.Category ) .ThenBy( b => b.Name ) ) { var li = new ListItem( blockType.Name, blockType.Id.ToString() ); li.Attributes.Add( "optiongroup", blockType.Category ); li.Attributes.Add( "title", blockType.Description ); ddlBlockType.Items.Add( li ); } // Add the uncategorized block types foreach ( var blockType in blockTypes .Where( b => b.Category == null || b.Category == "" ) .OrderBy( b => b.Name ) ) { var li = new ListItem( blockType.Name, blockType.Id.ToString() ); li.Attributes.Add( "optiongroup", "Other (not categorized)" ); li.Attributes.Add( "title", blockType.Description ); ddlBlockType.Items.Add( li ); } } }