Inheritance: System.Web.UI.WebControls.CompositeControl
Example #1
0
        private void BuildCheckinAreaRow( GroupType groupType, Control parentControl, bool setValues )
        {
            if ( groupType != null && !_groupTypes.Contains( groupType.Guid ) &&
                ( groupType.GroupTypePurposeValue == null || !groupType.GroupTypePurposeValue.Guid.Equals( Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_FILTER.AsGuid() ) ) )
            {
                _groupTypes.Add( groupType.Guid );

                var checkinAreaRow = new CheckinAreaRow();
                checkinAreaRow.ID = "CheckinAreaRow_" + groupType.Guid.ToString( "N" );
                checkinAreaRow.SetGroupType( groupType );
                checkinAreaRow.AddAreaClick += CheckinAreaRow_AddAreaClick;
                checkinAreaRow.AddGroupClick += CheckinAreaRow_AddGroupClick;
                checkinAreaRow.DeleteAreaClick += CheckinAreaRow_DeleteAreaClick;
                parentControl.Controls.Add( checkinAreaRow );

                if ( setValues )
                {
                    checkinAreaRow.Expanded = true; //_expandedRows.Contains( groupType.Guid );
                    checkinAreaRow.Selected = checkinArea.Visible && _currentGroupTypeGuid.HasValue && groupType.Guid.Equals( _currentGroupTypeGuid.Value );
                }

                foreach ( var childGroupType in groupType.ChildGroupTypes
                    .Where( t => t.Id != groupType.Id )
                    .OrderBy( t => t.Order )
                    .ThenBy( t => t.Name ) )
                {
                    BuildCheckinAreaRow( childGroupType, checkinAreaRow, setValues );
                }

                // Find the groups of this type, who's parent is null, or another group type ( "root" groups ).
                var allGroupIds = groupType.Groups.Select( g => g.Id ).ToList();
                foreach ( var childGroup in groupType.Groups
                    .Where( g =>
                        !g.ParentGroupId.HasValue ||
                        !allGroupIds.Contains( g.ParentGroupId.Value ) )
                    .OrderBy( a => a.Order )
                    .ThenBy( a => a.Name ) )
                {
                    BuildCheckinGroupRow( childGroup, checkinAreaRow, setValues );
                }

            }
        }