当前位置: 首页>>代码示例>>C#>>正文


C# GroupTypeService.LoadAttributes方法代码示例

本文整理汇总了C#中Rock.Model.GroupTypeService.LoadAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# GroupTypeService.LoadAttributes方法的具体用法?C# GroupTypeService.LoadAttributes怎么用?C# GroupTypeService.LoadAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rock.Model.GroupTypeService的用法示例。


在下文中一共展示了GroupTypeService.LoadAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowReadonlyDetails

        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="group">The group.</param>
        private void ShowReadonlyDetails( Group group )
        {
            SetEditMode( false );
            var rockContext = new RockContext();

            string groupIconHtml = !string.IsNullOrWhiteSpace( group.GroupType.IconCssClass ) ?
                groupIconHtml = string.Format( "<i class='{0}' ></i>", group.GroupType.IconCssClass ) : string.Empty;

            hfGroupId.SetValue( group.Id );
            lGroupIconHtml.Text = groupIconHtml;
            lReadOnlyTitle.Text = group.Name.FormatAsHtmlTitle();

            hlInactive.Visible = !group.IsActive;
            hlType.Text = group.GroupType.Name;

            lGroupDescription.Text = group.Description;

            DescriptionList descriptionList = new DescriptionList();

            if ( group.ParentGroup != null )
            {
                descriptionList.Add( "Parent Group", group.ParentGroup.Name );
            }

            if ( group.Campus != null )
            {
                hlCampus.Visible = true;
                hlCampus.Text = group.Campus.Name;
            }
            else
            {
                hlCampus.Visible = false;
            }

            lblMainDetails.Text = descriptionList.Html;

            var attributes = new List<Rock.Web.Cache.AttributeCache>();

            // Get the attributes inherited from group type
            GroupType groupType = new GroupTypeService( rockContext ).Get( group.GroupTypeId );
            groupType.LoadAttributes();
            attributes = groupType.Attributes.Select( a => a.Value ).OrderBy( a => a.Order ).ThenBy( a => a.Name ).ToList();

            // Combine with the group attributes
            group.LoadAttributes();
            attributes.AddRange( group.Attributes.Select( a => a.Value ).OrderBy( a => a.Order ).ThenBy( a => a.Name ) );

            // display attribute values
            var attributeCategories = Helper.GetAttributeCategories( attributes );
            Rock.Attribute.Helper.AddDisplayControls( group, attributeCategories, phAttributes );

            // Get Map Style
            phMaps.Controls.Clear();
            var mapStyleValue = DefinedValueCache.Read( GetAttributeValue( "MapStyle" ) );
            if ( mapStyleValue == null )
            {
                mapStyleValue = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.MAP_STYLE_ROCK );
            }

            if ( mapStyleValue != null )
            {
                string mapStyle = mapStyleValue.GetAttributeValue( "StaticMapStyle" );

                if ( !string.IsNullOrWhiteSpace( mapStyle ) )
                {
                    // Get all the group locations and group all those that have a geo-location into either points or polygons
                    var points = new List<GroupLocation>();
                    var polygons = new List<GroupLocation>();
                    foreach ( GroupLocation groupLocation in group.GroupLocations )
                    {
                        if ( groupLocation.Location != null )
                        {
                            if ( groupLocation.Location.GeoPoint != null )
                            {
                                points.Add( groupLocation );
                            }
                            else if ( groupLocation.Location.GeoFence != null )
                            {
                                polygons.Add( groupLocation );
                            }
                        }
                    }

                    if ( points.Any() )
                    {
                        foreach ( var groupLocation in points )
                        {
                            string markerPoints = string.Format( "{0},{1}", groupLocation.Location.GeoPoint.Latitude, groupLocation.Location.GeoPoint.Longitude );
                            string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", markerPoints );
                            mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", string.Empty );
                            mapLink += "&sensor=false&size=350x200&zoom=13&format=png";
                            var literalcontrol = new Literal()
                            {
                                Text = string.Format(
                                "<div class='group-location-map'>{0}<img src='{1}'/></div>",
                                groupLocation.GroupLocationTypeValue != null ? ( "<h4>" + groupLocation.GroupLocationTypeValue.Name + "</h4>" ) : string.Empty,
//.........这里部分代码省略.........
开发者ID:CentralAZ,项目名称:Rockit-CentralAZ,代码行数:101,代码来源:GroupDetail.ascx.cs

示例2: OnLoad

        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad( EventArgs e )
        {
            base.OnLoad( e );

            if ( !Page.IsPostBack )
            {
                string groupTypeId = PageParameter( "CheckinTypeId" );

                if ( !string.IsNullOrWhiteSpace( groupTypeId ) )
                {
                    wpGeneral.Expanded = true;
                    LoadDropdowns();
                    ShowDetail( groupTypeId.AsInteger() );
                }
                else
                {
                    pnlDetails.Visible = false;
                }
            }
            else
            {
                // Rebuild the attribute controls on postback based on group type
                if ( pnlEditDetails.Visible )
                {
                    int? groupTypeId = PageParameter( "CheckinTypeId" ).AsIntegerOrNull();
                    if ( groupTypeId.HasValue && groupTypeId.Value > 0 )
                    {
                        var groupType = new GroupTypeService( new RockContext() ).Get( groupTypeId.Value );
                        if ( groupType != null )
                        {
                            groupType.LoadAttributes();
                            BuildAttributeEdits( groupType, true );
                        }
                    }

                }
            }
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:42,代码来源:CheckinTypeDetail.ascx.cs

示例3: ShowReadonlyDetails

        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="group">The group.</param>
        private void ShowReadonlyDetails( Group group )
        {
            SetEditMode( false );

            string groupIconHtml = !string.IsNullOrWhiteSpace( group.GroupType.IconCssClass ) ?
                groupIconHtml = string.Format( "<i class='{0}' ></i>", group.GroupType.IconCssClass ) : "";

            hfGroupId.SetValue( group.Id );
            lGroupIconHtml.Text = groupIconHtml;
            lReadOnlyTitle.Text = group.Name.FormatAsHtmlTitle();

            hlInactive.Visible = !group.IsActive;
            hlType.Text = group.GroupType.Name;

            lGroupDescription.Text = group.Description;

            DescriptionList descriptionList = new DescriptionList();

            if ( group.ParentGroup != null )
            {
                descriptionList.Add( "Parent Group", group.ParentGroup.Name );
            }

            if ( group.Campus != null )
            {
                hlCampus.Visible = true;
                hlCampus.Text = group.Campus.Name;
            }
            else
            {
                hlCampus.Visible = false;
            }


            lblMainDetails.Text = descriptionList.Html;

            var attributes = new List<Rock.Web.Cache.AttributeCache>();

            // Get the attributes inherited from group type
            GroupType groupType = new GroupTypeService().Get( group.GroupTypeId );
            groupType.LoadAttributes();
            attributes = groupType.Attributes.Select( a => a.Value ).OrderBy( a => a.Order ).ThenBy( a => a.Name ).ToList();

            // Combine with the group attributes
            group.LoadAttributes();
            attributes.AddRange( group.Attributes.Select( a => a.Value ).OrderBy( a => a.Order ).ThenBy( a => a.Name ) );

            // display attribute values
            var attributeCategories = Helper.GetAttributeCategories( attributes );
            Rock.Attribute.Helper.AddDisplayControls( group, attributeCategories, phAttributes );

            // Get all the group locations and group all those that have a geo-location into either points or polygons
            var points = new List<GroupLocation>();
            var polygons = new List<GroupLocation>();
            foreach ( GroupLocation groupLocation in group.GroupLocations )
            {
                if ( groupLocation.Location != null )
                {
                    if ( groupLocation.Location.GeoPoint != null )
                    {
                        points.Add( groupLocation );
                    }
                    else if ( groupLocation.Location.GeoFence != null )
                    {
                        polygons.Add( groupLocation );
                    }
                }
            }

            var dict = new Dictionary<string, object>();
            if ( points.Any() )
            {
                var pointsList = new List<Dictionary<string, object>>();
                foreach ( var groupLocation in points)
                {
                    var pointsDict = new Dictionary<string, object>();
                    if ( groupLocation.GroupLocationTypeValue != null )
                    {
                        pointsDict.Add( "type", groupLocation.GroupLocationTypeValue.Name );
                    }
                    pointsDict.Add( "latitude", groupLocation.Location.GeoPoint.Latitude );
                    pointsDict.Add( "longitude", groupLocation.Location.GeoPoint.Longitude );
                    pointsList.Add( pointsDict );
                }
                dict.Add( "points", pointsList );
            }

            if ( polygons.Any() )
            {
                var polygonsList = new List<Dictionary<string, object>>();
                foreach ( var groupLocation in polygons )
                {
                    var polygonDict = new Dictionary<string, object>();
                    if ( groupLocation.GroupLocationTypeValue != null )
                    {
                        polygonDict.Add( "type", groupLocation.GroupLocationTypeValue.Name );
//.........这里部分代码省略.........
开发者ID:pkdevbox,项目名称:Rock,代码行数:101,代码来源:GroupDetail.ascx.cs


注:本文中的Rock.Model.GroupTypeService.LoadAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。