示例#1
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="groupType">The groupType.</param>
        private void ShowEditDetails(GroupType groupType)
        {
            if (groupType != null)
            {
                if (groupType.Id == 0)
                {
                    lReadOnlyTitle.Text = ActionTitle.Add("Check-in Configuration").FormatAsHtmlTitle();
                }
                else
                {
                    lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();
                }

                SetEditMode(true);

                tbName.Text        = groupType.Name;
                tbDescription.Text = groupType.Description;

                var rockContext = new RockContext();

                groupType.LoadAttributes(rockContext);

                cbAgeRequired.Checked             = groupType.GetAttributeValue("core_checkin_AgeRequired").AsBoolean(true);
                cbGradeRequired.Checked           = groupType.GetAttributeValue("core_checkin_GradeRequired").AsBoolean(true);
                cbHidePhotos.Checked              = groupType.GetAttributeValue("core_checkin_HidePhotos").AsBoolean(true);
                cbPreventDuplicateCheckin.Checked = groupType.GetAttributeValue("core_checkin_PreventDuplicateCheckin").AsBoolean(true);
                cbPreventInactivePeople.Checked   = groupType.GetAttributeValue("core_checkin_PreventInactivePeople").AsBoolean(true);
                ddlType.SetValue(groupType.GetAttributeValue("core_checkin_CheckInType"));
                cbDisplayLocCount.Checked = groupType.GetAttributeValue("core_checkin_DisplayLocationCount").AsBoolean(true);
                cbEnableManager.Checked   = groupType.GetAttributeValue("core_checkin_EnableManagerOption").AsBoolean(true);
                cbEnableOverride.Checked  = groupType.GetAttributeValue("core_checkin_EnableOverride").AsBoolean(true);
                nbMaxPhoneLength.Text     = groupType.GetAttributeValue("core_checkin_MaximumPhoneSearchLength");
                nbMaxResults.Text         = groupType.GetAttributeValue("core_checkin_MaxSearchResults");
                nbMinPhoneLength.Text     = groupType.GetAttributeValue("core_checkin_MinimumPhoneSearchLength");
                cbUseSameOptions.Checked  = groupType.GetAttributeValue("core_checkin_UseSameOptions").AsBoolean(false);
                ddlPhoneSearchType.SetValue(groupType.GetAttributeValue("core_checkin_PhoneSearchType"));
                nbRefreshInterval.Text = groupType.GetAttributeValue("core_checkin_RefreshInterval");
                tbSearchRegex.Text     = groupType.GetAttributeValue("core_checkin_RegularExpressionFilter");
                cbReuseCode.Checked    = groupType.GetAttributeValue("core_checkin_ReuseSameCode").AsBoolean(false);

                var searchType = DefinedValueCache.Read(groupType.GetAttributeValue("core_checkin_SearchType").AsGuid());
                if (searchType != null)
                {
                    ddlSearchType.SetValue(searchType.Id.ToString());
                }

                nbCodeAlphaNumericLength.Text = groupType.GetAttributeValue("core_checkin_SecurityCodeLength");
                nbCodeAlphaLength.Text        = groupType.GetAttributeValue("core_checkin_SecurityCodeAlphaLength");
                nbCodeNumericLength.Text      = groupType.GetAttributeValue("core_checkin_SecurityCodeNumericLength");
                cbCodeRandom.Checked          = groupType.GetAttributeValue("core_checkin_SecurityCodeNumericRandom").AsBoolean(true);
                cbAllowCheckout.Checked       = groupType.GetAttributeValue("core_checkin_AllowCheckout").AsBoolean(true);
                nbAutoSelectDaysBack.Text     = groupType.GetAttributeValue("core_checkin_AutoSelectDaysBack");
                ddlAutoSelectOptions.SetValue(groupType.GetAttributeValue("core_checkin_AutoSelectOptions"));

                BuildAttributeEdits(groupType, true);

                SetFieldVisibility();
            }
        }
        /// <summary>
        /// Creates the group type editor controls.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        private void CreateGroupTypeEditorControls(GroupType groupType, Control parentControl, bool forceGroupTypeEditorVisible = false)
        {
            CheckinGroupTypeEditor groupTypeEditor = new CheckinGroupTypeEditor();

            groupTypeEditor.ID = "GroupTypeEditor_" + groupType.Guid.ToString("N");
            groupTypeEditor.SetGroupType(groupType);
            groupTypeEditor.AddGroupClick           += groupTypeEditor_AddGroupClick;
            groupTypeEditor.AddGroupTypeClick       += groupTypeEditor_AddGroupTypeClick;
            groupTypeEditor.DeleteCheckinLabelClick += groupTypeEditor_DeleteCheckinLabelClick;
            groupTypeEditor.AddCheckinLabelClick    += groupTypeEditor_AddCheckinLabelClick;
            groupTypeEditor.DeleteGroupTypeClick    += groupTypeEditor_DeleteGroupTypeClick;
            groupTypeEditor.CheckinLabels            = null;
            groupTypeEditor.ForceContentVisible      = forceGroupTypeEditorVisible;

            if (GroupTypeCheckinLabelAttributesState.ContainsKey(groupType.Guid))
            {
                groupTypeEditor.CheckinLabels = GroupTypeCheckinLabelAttributesState[groupType.Guid];
            }

            if (groupTypeEditor.CheckinLabels == null)
            {
                // load CheckInLabels from Database if they haven't been set yet
                groupTypeEditor.CheckinLabels = new List <CheckinGroupTypeEditor.CheckinLabelAttributeInfo>();

                groupType.LoadAttributes();
                List <string>     labelAttributeKeys = CheckinGroupTypeEditor.GetCheckinLabelAttributes(groupType).Select(a => a.Key).ToList();
                BinaryFileService binaryFileService  = new BinaryFileService(new RockContext());

                foreach (string key in labelAttributeKeys)
                {
                    var attributeValue = groupType.GetAttributeValue(key);
                    int binaryFileId   = attributeValue.AsInteger() ?? 0;
                    var binaryFile     = binaryFileService.Get(binaryFileId);
                    if (binaryFile != null)
                    {
                        groupTypeEditor.CheckinLabels.Add(new CheckinGroupTypeEditor.CheckinLabelAttributeInfo {
                            AttributeKey = key, BinaryFileId = binaryFileId, FileName = binaryFile.FileName
                        });
                    }
                }
            }

            parentControl.Controls.Add(groupTypeEditor);

            foreach (var childGroup in groupType.Groups.OrderBy(a => a.Order).ThenBy(a => a.Name))
            {
                // get the GroupType from the control just in case it the InheritedFrom changed
                childGroup.GroupType = groupTypeEditor.GetCheckinGroupType();

                CreateGroupEditorControls(childGroup, groupTypeEditor, false);
            }

            foreach (var childGroupType in groupType.ChildGroupTypes.OrderBy(a => a.Order).ThenBy(a => a.Name))
            {
                CreateGroupTypeEditorControls(childGroupType, groupTypeEditor);
            }
        }
示例#3
0
        /// <summary>
        /// Gets the type of the checkin group.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        public void GetGroupTypeValues(GroupType groupType)
        {
            EnsureChildControls();

            groupType.Name = _tbGroupTypeName.Text;
            groupType.InheritedGroupTypeId = _ddlGroupTypeInheritFrom.SelectedValueAsId();
            groupType.AttendanceRule       = _ddlAttendanceRule.SelectedValueAsEnum <AttendanceRule>();
            groupType.AttendancePrintTo    = _ddlPrintTo.SelectedValueAsEnum <PrintTo>();

            // Reload Attributes
            groupType.Attributes = null;
            groupType.LoadAttributes();

            Rock.Attribute.Helper.GetEditValues(_phGroupTypeAttributes, groupType);
        }
示例#4
0
        /// <summary>
        /// Creates the group type attribute controls.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        private void CreateGroupTypeAttributeControls(RockContext rockContext)
        {
            // make a fakeGroupType to use to get the Attribute Controls based on GroupType id and InheritedGroupTypeId
            GroupType fakeGroupType = new GroupType();

            fakeGroupType.Id = _hfGroupTypeId.ValueAsInt();
            fakeGroupType.InheritedGroupTypeId = this.InheritedGroupTypeId;

            fakeGroupType.LoadAttributes(rockContext);
            _phGroupTypeAttributes.Controls.Clear();

            // exclude checkin labels
            List <string> checkinLabelAttributeNames = GetCheckinLabelAttributes(fakeGroupType.Attributes, rockContext).Select(a => a.Value.Name).ToList();

            Rock.Attribute.Helper.AddEditControls(fakeGroupType, _phGroupTypeAttributes, true, string.Empty, checkinLabelAttributeNames);
        }
示例#5
0
        /// <summary>
        /// Creates the group type attribute controls.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        /// <param name="rockContext">The rock context.</param>
        public void CreateGroupTypeAttributeControls(GroupType groupType, RockContext rockContext)
        {
            EnsureChildControls();

            _phGroupTypeAttributes.Controls.Clear();

            if (groupType != null)
            {
                if (groupType.Attributes == null)
                {
                    groupType.LoadAttributes(rockContext);
                }

                // exclude checkin labels
                List <string> checkinLabelAttributeNames = GetCheckinLabelAttributes(groupType.Attributes).Select(a => a.Value.Name).ToList();
                Rock.Attribute.Helper.AddEditControls(groupType, _phGroupTypeAttributes, true, string.Empty, checkinLabelAttributeNames);
            }
        }
        /// <summary>
        /// Handles the Click event of the lbAddCheckinArea control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void lbAddCheckinArea_Click(object sender, EventArgs e)
        {
            int       parentGroupTypeId = this.PageParameter("groupTypeid").AsInteger() ?? 0;
            GroupType parentGroupType   = new GroupTypeService(new RockContext()).Get(parentGroupTypeId);

            // CheckinArea is GroupType entity
            GroupType checkinArea = new GroupType();

            checkinArea.Guid              = Guid.NewGuid();
            checkinArea.IsSystem          = false;
            checkinArea.TakesAttendance   = true;
            checkinArea.AttendanceRule    = AttendanceRule.AddOnCheckIn;
            checkinArea.AttendancePrintTo = PrintTo.Default;
            checkinArea.ParentGroupTypes  = new List <GroupType>();
            checkinArea.ParentGroupTypes.Add(parentGroupType);
            checkinArea.LoadAttributes();

            CreateGroupTypeEditorControls(checkinArea, phCheckinGroupTypes, true);
        }
        /// <summary>
        /// Handles the AddGroupTypeClick event of the groupTypeEditor control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void groupTypeEditor_AddGroupTypeClick(object sender, EventArgs e)
        {
            CheckinGroupTypeEditor parentEditor = sender as CheckinGroupTypeEditor;

            parentEditor.ForceContentVisible = true;

            // CheckinArea is GroupType entity
            GroupType checkinArea = new GroupType();

            checkinArea.Guid              = Guid.NewGuid();
            checkinArea.IsSystem          = false;
            checkinArea.TakesAttendance   = true;
            checkinArea.AttendanceRule    = AttendanceRule.AddOnCheckIn;
            checkinArea.AttendancePrintTo = PrintTo.Default;
            checkinArea.ParentGroupTypes  = new List <GroupType>();
            checkinArea.ParentGroupTypes.Add(parentEditor.GetCheckinGroupType());
            checkinArea.LoadAttributes();

            CreateGroupTypeEditorControls(checkinArea, parentEditor);
        }
        /// <summary>
        /// Gets the type of the checkin group.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        public void GetGroupTypeValues(GroupType groupType)
        {
            EnsureChildControls();

            groupType.Name = _tbGroupTypeName.Text;

            // ensure checkin area types get additional options
            if (EnableCheckinOptions)
            {
                _rowLabel = "Check-in Area Name";
                groupType.InheritedGroupTypeId = _ddlGroupTypeInheritFrom.SelectedValueAsId();
                groupType.AttendanceRule       = _ddlAttendanceRule.SelectedValueAsEnum <AttendanceRule>();
                groupType.AttendancePrintTo    = _ddlPrintTo.SelectedValueAsEnum <PrintTo>();
            }

            // Reload Attributes
            groupType.Attributes = null;
            groupType.LoadAttributes();

            Rock.Attribute.Helper.GetEditValues(_phGroupTypeAttributes, groupType);
        }
示例#9
0
        /// <summary>
        /// Gets the type of the checkin group.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <returns></returns>
        public GroupType GetCheckinGroupType(RockContext rockContext)
        {
            EnsureChildControls();
            GroupType result = new GroupType();

            //// NOTE:  A GroupType that was added will have an Id of 0 since it hasn't been saved to the database.
            //// So, we'll use Guid to uniquely identify in this Control since that'll work in both Saved and Unsaved cases.
            //// If it is saved, we do need the Id so that Attributes will work

            result.Id   = _hfGroupTypeId.ValueAsInt();
            result.Guid = new Guid(_hfGroupTypeGuid.Value);

            result.Name = _tbGroupTypeName.Text;
            result.InheritedGroupTypeId = _ddlGroupTypeInheritFrom.SelectedValueAsId();

            result.LoadAttributes(rockContext);
            Rock.Attribute.Helper.GetEditValues(_phGroupTypeAttributes, result);

            result.ChildGroupTypes = new List <GroupType>();
            int childGroupTypeOrder = 0;

            foreach (CheckinGroupTypeEditor checkinGroupTypeEditor in this.Controls.OfType <CheckinGroupTypeEditor>())
            {
                GroupType childGroupType = checkinGroupTypeEditor.GetCheckinGroupType(rockContext);
                childGroupType.Order = childGroupTypeOrder++;
                result.ChildGroupTypes.Add(childGroupType);
            }

            result.Groups = new List <Group>();
            int childGroupOrder = 0;

            foreach (CheckinGroupEditor checkinGroupEditor in this.Controls.OfType <CheckinGroupEditor>())
            {
                Group childGroup = checkinGroupEditor.GetGroup(rockContext);
                childGroup.Order = childGroupOrder++;
                result.Groups.Add(childGroup);
            }

            return(result);
        }
示例#10
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="groupType">The groupType.</param>
        private void ShowEditDetails(GroupType groupType)
        {
            if (groupType != null)
            {
                if (groupType.Id == 0)
                {
                    lReadOnlyTitle.Text = ActionTitle.Add("Check-in Configuration").FormatAsHtmlTitle();
                }
                else
                {
                    lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();
                }

                SetEditMode(true);

                tbName.Text         = groupType.Name;
                tbDescription.Text  = groupType.Description;
                tbIconCssClass.Text = groupType.IconCssClass;
                var rockContext = new RockContext();

                groupType.LoadAttributes(rockContext);

                cbAgeRequired.Checked             = groupType.GetAttributeValue("core_checkin_AgeRequired").AsBoolean(true);
                cbGradeRequired.Checked           = groupType.GetAttributeValue("core_checkin_GradeRequired").AsBoolean(true);
                cbHidePhotos.Checked              = groupType.GetAttributeValue("core_checkin_HidePhotos").AsBoolean(true);
                cbPreventDuplicateCheckin.Checked = groupType.GetAttributeValue("core_checkin_PreventDuplicateCheckin").AsBoolean(true);
                cbPreventInactivePeople.Checked   = groupType.GetAttributeValue("core_checkin_PreventInactivePeople").AsBoolean(true);
                ddlType.SetValue(groupType.GetAttributeValue("core_checkin_CheckInType"));
                cbDisplayLocCount.Checked = groupType.GetAttributeValue("core_checkin_DisplayLocationCount").AsBoolean(true);
                rblAbilityLevelDetermination.SelectedValue = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_GROUPTYPE_ABILITY_LEVEL_DETERMINATION);
                cbEnableManager.Checked  = groupType.GetAttributeValue("core_checkin_EnableManagerOption").AsBoolean(true);
                cbEnableOverride.Checked = groupType.GetAttributeValue("core_checkin_EnableOverride").AsBoolean(true);
                listboxAchievementTypes.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_GROUPTYPE_ACHIEVEMENT_TYPES).SplitDelimitedValues());
                nbMaxPhoneLength.Text    = groupType.GetAttributeValue("core_checkin_MaximumPhoneSearchLength");
                nbMaxResults.Text        = groupType.GetAttributeValue("core_checkin_MaxSearchResults");
                nbMinPhoneLength.Text    = groupType.GetAttributeValue("core_checkin_MinimumPhoneSearchLength");
                cbUseSameOptions.Checked = groupType.GetAttributeValue("core_checkin_UseSameOptions").AsBoolean(false);
                ddlPhoneSearchType.SetValue(groupType.GetAttributeValue("core_checkin_PhoneSearchType"));
                nbRefreshInterval.Text = groupType.GetAttributeValue("core_checkin_RefreshInterval");
                tbSearchRegex.Text     = groupType.GetAttributeValue("core_checkin_RegularExpressionFilter");
                cbReuseCode.Checked    = groupType.GetAttributeValue("core_checkin_ReuseSameCode").AsBoolean(false);

                var searchType = DefinedValueCache.Get(groupType.GetAttributeValue("core_checkin_SearchType").AsGuid());
                if (searchType != null)
                {
                    ddlSearchType.SetValue(searchType.Id.ToString());
                }

                nbCodeAlphaNumericLength.Text = groupType.GetAttributeValue("core_checkin_SecurityCodeLength");
                nbCodeAlphaLength.Text        = groupType.GetAttributeValue("core_checkin_SecurityCodeAlphaLength");
                nbCodeNumericLength.Text      = groupType.GetAttributeValue("core_checkin_SecurityCodeNumericLength");
                cbCodeRandom.Checked          = groupType.GetAttributeValue("core_checkin_SecurityCodeNumericRandom").AsBoolean(true);
                cbAllowCheckout.Checked       = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_GROUPTYPE_ALLOW_CHECKOUT).AsBoolean(true);
                cbEnablePresence.Checked      = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_GROUPTYPE_ENABLE_PRESENCE).AsBoolean();
                nbAutoSelectDaysBack.Text     = groupType.GetAttributeValue("core_checkin_AutoSelectDaysBack");
                ddlAutoSelectOptions.SetValue(groupType.GetAttributeValue("core_checkin_AutoSelectOptions"));

                // Registration Settings
                cbRegistrationDisplayAlternateIdFieldForAdults.Checked   = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_DISPLAYALTERNATEIDFIELDFORADULTS).AsBoolean();
                cbRegistrationDisplayAlternateIdFieldForChildren.Checked = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_DISPLAYALTERNATEIDFIELDFORCHILDREN).AsBoolean();

                cbRegistrationDisplaySmsEnabled.Checked   = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_DISPLAYSMSBUTTON).AsBoolean();
                cbRegistrationSmsEnabledByDefault.Checked = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_DEFAULTSMSENABLED).AsBoolean();

                lbRegistrationRequiredAttributesForAdults.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_REQUIREDATTRIBUTESFORADULTS).SplitDelimitedValues());
                lbRegistrationOptionalAttributesForAdults.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_OPTIONALATTRIBUTESFORADULTS).SplitDelimitedValues());

                lbRegistrationRequiredAttributesForChildren.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_REQUIREDATTRIBUTESFORCHILDREN).SplitDelimitedValues());
                lbRegistrationOptionalAttributesForChildren.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_OPTIONALATTRIBUTESFORCHILDREN).SplitDelimitedValues());

                lbRegistrationRequiredAttributesForFamilies.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_REQUIREDATTRIBUTESFORFAMILIES).SplitDelimitedValues());
                lbRegistrationOptionalAttributesForFamilies.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_OPTIONALATTRIBUTESFORFAMILIES).SplitDelimitedValues());

                int? defaultPersonConnectionStatusValueId   = null;
                Guid?defaultPersonConnectionStatusValueGuid = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_DEFAULTPERSONCONNECTIONSTATUS).AsGuidOrNull();
                if (defaultPersonConnectionStatusValueGuid.HasValue)
                {
                    var defaultPersonRecordStatusValue = DefinedValueCache.Get(defaultPersonConnectionStatusValueGuid.Value);
                    if (defaultPersonRecordStatusValue != null)
                    {
                        defaultPersonConnectionStatusValueId = defaultPersonRecordStatusValue.Id;
                    }
                }

                dvpRegistrationDefaultPersonConnectionStatus.DefinedTypeId = DefinedTypeCache.Get(Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS.AsGuid()).Id;
                dvpRegistrationDefaultPersonConnectionStatus.SetValue(defaultPersonConnectionStatusValueId);

                var workflowTypeService = new WorkflowTypeService(rockContext);
                wftpRegistrationAddFamilyWorkflowTypes.SetValues(workflowTypeService.GetByGuids(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_ADDFAMILYWORKFLOWTYPES).SplitDelimitedValues().AsGuidList()));
                wftpRegistrationAddPersonWorkflowTypes.SetValues(workflowTypeService.GetByGuids(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_ADDPERSONWORKFLOWTYPES).SplitDelimitedValues().AsGuidList()));

                cbEnableCheckInAfterRegistration.Checked = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_ENABLECHECKINAFTERREGISTRATION).AsBoolean();

                lbKnownRelationshipTypes.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_KNOWNRELATIONSHIPTYPES).SplitDelimitedValues());
                lbSameFamilyKnownRelationshipTypes.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_SAMEFAMILYKNOWNRELATIONSHIPTYPES).SplitDelimitedValues());
                lbCanCheckInKnownRelationshipTypes.SetValues(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_REGISTRATION_CANCHECKINKNOWNRELATIONSHIPTYPES).SplitDelimitedValues());

                ceActionSelectHeaderTemplate.Text         = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_ACTION_SELECT_HEADER_LAVA_TEMPLATE);
                ceCheckoutPersonSelectHeaderTemplate.Text = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_CHECKOUT_PERSON_SELECT_HEADER_LAVA_TEMPLATE);
                cePersonSelectHeaderTemplate.Text         = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_PERSON_SELECT_HEADER_LAVA_TEMPLATE);
                ceMultiPersonSelectHeaderTemplate.Text    = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_MULTI_PERSON_SELECT_HEADER_LAVA_TEMPLATE);
                ceGroupTypeSelectHeaderTemplate.Text      = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_GROUP_TYPE_SELECT_HEADER_LAVA_TEMPLATE);
                ceTimeSelectHeaderTemplate.Text           = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_TIME_SELECT_HEADER_LAVA_TEMPLATE);
                ceAbilityLevelSelectHeaderTemplate.Text   = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_ABILITY_LEVEL_SELECT_HEADER_LAVA_TEMPLATE);
                ceLocationSelectHeaderTemplate.Text       = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_LOCATION_SELECT_HEADER_LAVA_TEMPLATE);
                ceGroupSelectHeaderTemplate.Text          = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_GROUP_SELECT_HEADER_LAVA_TEMPLATE);

                ceStartTemplate.Text        = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_START_LAVA_TEMPLATE);
                ceFamilySelectTemplate.Text = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_FAMILYSELECT_LAVA_TEMPLATE);
                cePersonSelectTemplate.Text = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_PERSON_SELECT_ADDITIONAL_INFORMATION_LAVA_TEMPLATE);

                ddlSuccessTemplateOverrideDisplayMode.SetValue(groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_SUCCESS_LAVA_TEMPLATE_OVERRIDE_DISPLAY_MODE));
                ceSuccessTemplate.Text = groupType.GetAttributeValue(Rock.SystemKey.GroupTypeAttributeKey.CHECKIN_SUCCESS_LAVA_TEMPLATE);

                // Other GroupType Attributes
                BuildAttributeEdits(groupType, true);

                SetFieldVisibility();
            }
        }
示例#11
0
        /// <summary>
        /// Creates the group type editor controls.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        private void CreateGroupTypeEditorControls( GroupType groupType, Control parentControl, bool forceGroupTypeEditorVisible = false )
        {
            CheckinGroupTypeEditor groupTypeEditor = new CheckinGroupTypeEditor();
            groupTypeEditor.ID = "GroupTypeEditor_" + groupType.Guid.ToString( "N" );
            groupTypeEditor.SetGroupType( groupType );
            groupTypeEditor.AddGroupClick += groupTypeEditor_AddGroupClick;
            groupTypeEditor.AddGroupTypeClick += groupTypeEditor_AddGroupTypeClick;
            groupTypeEditor.DeleteCheckinLabelClick += groupTypeEditor_DeleteCheckinLabelClick;
            groupTypeEditor.AddCheckinLabelClick += groupTypeEditor_AddCheckinLabelClick;
            groupTypeEditor.DeleteGroupTypeClick += groupTypeEditor_DeleteGroupTypeClick;
            groupTypeEditor.CheckinLabels = null;
            groupTypeEditor.ForceContentVisible = forceGroupTypeEditorVisible;

            if ( GroupTypeCheckinLabelAttributesState.ContainsKey( groupType.Guid ) )
            {
                groupTypeEditor.CheckinLabels = GroupTypeCheckinLabelAttributesState[groupType.Guid];
            }

            if ( groupTypeEditor.CheckinLabels == null )
            {
                // load CheckInLabels from Database if they haven't been set yet
                groupTypeEditor.CheckinLabels = new List<CheckinGroupTypeEditor.CheckinLabelAttributeInfo>();

                groupType.LoadAttributes();
                List<string> labelAttributeKeys = CheckinGroupTypeEditor.GetCheckinLabelAttributes( groupType ).Select( a => a.Key ).ToList();
                BinaryFileService binaryFileService = new BinaryFileService();

                foreach ( string key in labelAttributeKeys )
                {
                    var attributeValue = groupType.GetAttributeValue( key );
                    int binaryFileId = attributeValue.AsInteger() ?? 0;
                    var binaryFile = binaryFileService.Get( binaryFileId );
                    if ( binaryFile != null )
                    {
                        groupTypeEditor.CheckinLabels.Add( new CheckinGroupTypeEditor.CheckinLabelAttributeInfo { AttributeKey = key, BinaryFileId = binaryFileId, FileName = binaryFile.FileName } );
                    }
                }
            }

            parentControl.Controls.Add( groupTypeEditor );

            foreach ( var childGroup in groupType.Groups.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
            {
                // get the GroupType from the control just in case it the InheritedFrom changed
                childGroup.GroupType = groupTypeEditor.GetCheckinGroupType();

                CreateGroupEditorControls( childGroup, groupTypeEditor, false );
            }

            foreach ( var childGroupType in groupType.ChildGroupTypes.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
            {
                CreateGroupTypeEditorControls( childGroupType, groupTypeEditor );
            }
        }
示例#12
0
        /// <summary>
        /// Gets the type of the checkin group.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        public void GetGroupTypeValues( GroupType groupType )
        {
            EnsureChildControls();

            groupType.Name = _tbGroupTypeName.Text;
            groupType.InheritedGroupTypeId = _ddlGroupTypeInheritFrom.SelectedValueAsId();
            groupType.AttendanceRule = _ddlAttendanceRule.SelectedValueAsEnum<AttendanceRule>();
            groupType.AttendancePrintTo = _ddlPrintTo.SelectedValueAsEnum<PrintTo>();

            // Reload Attributes
            groupType.Attributes = null;
            groupType.LoadAttributes();

            Rock.Attribute.Helper.GetEditValues( _phGroupTypeAttributes, groupType );
        }
示例#13
0
        /// <summary>
        /// Handles the AddGroupTypeClick event of the groupTypeEditor control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void groupTypeEditor_AddGroupTypeClick( object sender, EventArgs e )
        {
            CheckinGroupTypeEditor parentEditor = sender as CheckinGroupTypeEditor;
            parentEditor.ForceContentVisible = true;

            // CheckinArea is GroupType entity
            GroupType checkinArea = new GroupType();
            checkinArea.Guid = Guid.NewGuid();
            checkinArea.IsSystem = false;
            checkinArea.TakesAttendance = true;
            checkinArea.AttendanceRule = AttendanceRule.AddOnCheckIn;
            checkinArea.AttendancePrintTo = PrintTo.Default;
            checkinArea.ParentGroupTypes = new List<GroupType>();
            checkinArea.ParentGroupTypes.Add( parentEditor.GetCheckinGroupType() );
            checkinArea.LoadAttributes();

            CreateGroupTypeEditorControls( checkinArea, parentEditor );
        }
示例#14
0
        /// <summary>
        /// Handles the Click event of the lbAddCheckinArea control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void lbAddCheckinArea_Click( object sender, EventArgs e )
        {
            int parentGroupTypeId = this.PageParameter( "groupTypeid" ).AsInteger() ?? 0;
            GroupType parentGroupType = new GroupTypeService().Get( parentGroupTypeId );

            // CheckinArea is GroupType entity
            GroupType checkinArea = new GroupType();
            checkinArea.Guid = Guid.NewGuid();
            checkinArea.IsSystem = false;
            checkinArea.TakesAttendance = true;
            checkinArea.AttendanceRule = AttendanceRule.AddOnCheckIn;
            checkinArea.AttendancePrintTo = PrintTo.Default;
            checkinArea.ParentGroupTypes = new List<GroupType>();
            checkinArea.ParentGroupTypes.Add( parentGroupType );
            checkinArea.LoadAttributes();

            CreateGroupTypeEditorControls( checkinArea, phCheckinGroupTypes, true );
        }
示例#15
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="groupType">The groupType.</param>
        private void ShowReadonlyDetails( GroupType groupType )
        {
            SetEditMode( false );

            if ( groupType != null )
            {
                hfGroupTypeId.SetValue( groupType.Id );
                lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();

                lDescription.Text = groupType.Description;

                groupType.LoadAttributes();

                hlType.Text = groupType.GetAttributeValue( "CheckInType" );
                hlType.Visible = true;

                DescriptionList mainDetailsDescList = new DescriptionList();
                DescriptionList leftDetailsDescList = new DescriptionList();
                DescriptionList rightDetailsDescList = new DescriptionList();

                string scheduleList = string.Empty;
                using ( var rockContext = new RockContext() )
                {
                    var descendantGroupTypeIds = new GroupTypeService( rockContext ).GetAllAssociatedDescendents( groupType.Id ).Select( a => a.Id );
                    scheduleList = new GroupLocationService( rockContext )
                        .Queryable().AsNoTracking()
                        .Where( a =>
                            a.Group.GroupType.Id == groupType.Id ||
                            descendantGroupTypeIds.Contains( a.Group.GroupTypeId ) )
                        .SelectMany( a => a.Schedules )
                        .Select( s => s.Name )
                        .Distinct()
                        .OrderBy( s => s )
                        .ToList()
                        .AsDelimited( ", " );
                }

                if ( !string.IsNullOrWhiteSpace( scheduleList ) )
                {
                    mainDetailsDescList.Add( "Scheduled Times", scheduleList );
                }

                groupType.LoadAttributes();

                if ( groupType.AttributeValues.ContainsKey( "core_checkin_CheckInType" ) )
                {
                    leftDetailsDescList.Add( "Check-in Type", groupType.AttributeValues["core_checkin_CheckInType"].ValueFormatted );
                }
                if ( groupType.AttributeValues.ContainsKey( "core_checkin_SecurityCodeLength" ) )
                {
                    leftDetailsDescList.Add( "Security Code Length", groupType.AttributeValues["core_checkin_SecurityCodeLength"].ValueFormatted );
                }
                if ( groupType.AttributeValues.ContainsKey( "core_checkin_SearchType" ) )
                {
                    rightDetailsDescList.Add( "Search Type", groupType.AttributeValues["core_checkin_SearchType"].ValueFormatted );
                }
                if ( groupType.AttributeValues.ContainsKey( "core_checkin_PhoneSearchType" ) )
                {
                    rightDetailsDescList.Add( "Phone Number Compare", groupType.AttributeValues["core_checkin_PhoneSearchType"].ValueFormatted );
                }

                lblMainDetails.Text = mainDetailsDescList.Html;
                lblLeftDetails.Text = leftDetailsDescList.Html;
                lblRightDetails.Text = rightDetailsDescList.Html;
            }
        }
        /// <summary>
        /// Creates the group type editor controls.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        /// <param name="parentControl">The parent control.</param>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="createExpanded">if set to <c>true</c> [create expanded].</param>
        private void CreateGroupTypeEditorControls( GroupType groupType, Control parentControl, RockContext rockContext, bool createExpanded = false )
        {
            CheckinGroupTypeEditor groupTypeEditor = new CheckinGroupTypeEditor();
            groupTypeEditor.ID = "GroupTypeEditor_" + groupType.Guid.ToString( "N" );
            groupTypeEditor.SetGroupType( groupType.Id, groupType.Guid, groupType.Name, groupType.InheritedGroupTypeId );
            groupTypeEditor.AddGroupClick += groupTypeEditor_AddGroupClick;
            groupTypeEditor.AddGroupTypeClick += groupTypeEditor_AddGroupTypeClick;
            groupTypeEditor.DeleteCheckinLabelClick += groupTypeEditor_DeleteCheckinLabelClick;
            groupTypeEditor.AddCheckinLabelClick += groupTypeEditor_AddCheckinLabelClick;
            groupTypeEditor.DeleteGroupTypeClick += groupTypeEditor_DeleteGroupTypeClick;
            groupTypeEditor.CheckinLabels = null;
            if ( createExpanded )
            {
                groupTypeEditor.Expanded = true;
            }

            if ( GroupTypeCheckinLabelAttributesState.ContainsKey( groupType.Guid ) )
            {
                groupTypeEditor.CheckinLabels = GroupTypeCheckinLabelAttributesState[groupType.Guid];
            }

            if ( groupTypeEditor.CheckinLabels == null )
            {
                // load CheckInLabels from Database if they haven't been set yet
                groupTypeEditor.CheckinLabels = new List<CheckinGroupTypeEditor.CheckinLabelAttributeInfo>();

                groupType.LoadAttributes( rockContext );
                List<string> labelAttributeKeys = CheckinGroupTypeEditor.GetCheckinLabelAttributes( groupType.Attributes, rockContext ).Select( a => a.Key ).ToList();
                BinaryFileService binaryFileService = new BinaryFileService( rockContext );

                foreach ( string key in labelAttributeKeys )
                {
                    var attributeValue = groupType.GetAttributeValue( key );
                    Guid binaryFileGuid = attributeValue.AsGuid();
                    var fileName = binaryFileService.Queryable().Where( a => a.Guid == binaryFileGuid ).Select( a => a.FileName ).FirstOrDefault();
                    if ( fileName != null )
                    {
                        groupTypeEditor.CheckinLabels.Add( new CheckinGroupTypeEditor.CheckinLabelAttributeInfo { AttributeKey = key, BinaryFileGuid = binaryFileGuid, FileName = fileName } );
                    }
                }
            }

            parentControl.Controls.Add( groupTypeEditor );

            // get the GroupType from the control just in case the InheritedFrom changed
            var childGroupGroupType = groupTypeEditor.GetCheckinGroupType( rockContext );

            foreach ( var childGroup in groupType.Groups.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
            {
                childGroup.GroupType = childGroupGroupType;
                CreateGroupEditorControls( childGroup, groupTypeEditor, rockContext, false );
            }

            foreach ( var childGroupType in groupType.ChildGroupTypes
                .Where( t => t.Guid != groupType.Guid )
                .OrderBy( a => a.Order )
                .ThenBy( a => a.Name ) )
            {
                CreateGroupTypeEditorControls( childGroupType, groupTypeEditor, rockContext );
            }
        }
示例#17
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="groupType">The groupType.</param>
        private void ShowEditDetails( GroupType groupType )
        {
            if ( groupType != null )
            {
                if ( groupType.Id == 0 )
                {
                    lReadOnlyTitle.Text = ActionTitle.Add( "Check-in Configuration" ).FormatAsHtmlTitle();
                }
                else
                {
                    lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();
                }

                SetEditMode( true );

                tbName.Text = groupType.Name;
                tbDescription.Text = groupType.Description;

                var rockContext = new RockContext();

                groupType.LoadAttributes( rockContext );

                cbAgeRequired.Checked = groupType.GetAttributeValue( "core_checkin_AgeRequired" ).AsBoolean( true );
                cbGradeRequired.Checked = groupType.GetAttributeValue( "core_checkin_GradeRequired" ).AsBoolean( true );
                cbHidePhotos.Checked = groupType.GetAttributeValue( "core_checkin_HidePhotos" ).AsBoolean( true );
                cbPreventDuplicateCheckin.Checked = groupType.GetAttributeValue( "core_checkin_PreventDuplicateCheckin" ).AsBoolean( true );
                cbPreventInactivePeople.Checked = groupType.GetAttributeValue( "core_checkin_PreventInactivePeople" ).AsBoolean( true );
                ddlType.SetValue( groupType.GetAttributeValue( "core_checkin_CheckInType" ) );
                cbDisplayLocCount.Checked = groupType.GetAttributeValue( "core_checkin_DisplayLocationCount" ).AsBoolean( true );
                cbEnableManager.Checked = groupType.GetAttributeValue( "core_checkin_EnableManagerOption" ).AsBoolean( true );
                cbEnableOverride.Checked = groupType.GetAttributeValue( "core_checkin_EnableOverride" ).AsBoolean( true );
                nbMaxPhoneLength.Text = groupType.GetAttributeValue( "core_checkin_MaximumPhoneSearchLength" );
                nbMaxResults.Text = groupType.GetAttributeValue( "core_checkin_MaxSearchResults" );
                nbMinPhoneLength.Text = groupType.GetAttributeValue( "core_checkin_MinimumPhoneSearchLength" );
                cbUseSameOptions.Checked = groupType.GetAttributeValue( "core_checkin_UseSameOptions" ).AsBoolean( false );
                ddlPhoneSearchType.SetValue( groupType.GetAttributeValue( "core_checkin_PhoneSearchType" ) );
                nbRefreshInterval.Text = groupType.GetAttributeValue( "core_checkin_RefreshInterval" );
                tbSearchRegex.Text = groupType.GetAttributeValue( "core_checkin_RegularExpressionFilter" );
                cbReuseCode.Checked = groupType.GetAttributeValue( "core_checkin_ReuseSameCode" ).AsBoolean( false );

                var searchType = DefinedValueCache.Read( groupType.GetAttributeValue( "core_checkin_SearchType" ).AsGuid() );
                if ( searchType != null )
                {
                    ddlSearchType.SetValue( searchType.Id.ToString() );
                }

                nbSecurityCodeLength.Text = groupType.GetAttributeValue( "core_checkin_SecurityCodeLength" );
                nbAutoSelectDaysBack.Text = groupType.GetAttributeValue( "core_checkin_AutoSelectDaysBack" );

                BuildAttributeEdits( groupType, true );

                SetFieldVisibility();
            }
        }
示例#18
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="groupType">The groupType.</param>
        private void ShowReadonlyDetails(GroupType groupType)
        {
            SetEditMode(false);

            if (groupType != null)
            {
                hfGroupTypeId.SetValue(groupType.Id);
                lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();

                lDescription.Text = groupType.Description;

                groupType.LoadAttributes();

                hlType.Text    = groupType.GetAttributeValue("CheckInType");
                hlType.Visible = true;

                DescriptionList mainDetailsDescList  = new DescriptionList();
                DescriptionList leftDetailsDescList  = new DescriptionList();
                DescriptionList rightDetailsDescList = new DescriptionList();

                string scheduleList = string.Empty;
                using (var rockContext = new RockContext())
                {
                    var descendantGroupTypeIds = new GroupTypeService(rockContext).GetCheckinAreaDescendants(groupType.Id).Select(a => a.Id);
                    scheduleList = new GroupLocationService(rockContext)
                                   .Queryable().AsNoTracking()
                                   .Where(a =>
                                          a.Group.GroupType.Id == groupType.Id ||
                                          descendantGroupTypeIds.Contains(a.Group.GroupTypeId))
                                   .SelectMany(a => a.Schedules)
                                   .Select(s => s.Name)
                                   .Distinct()
                                   .OrderBy(s => s)
                                   .ToList()
                                   .AsDelimited(", ");
                }

                if (!string.IsNullOrWhiteSpace(scheduleList))
                {
                    mainDetailsDescList.Add("Scheduled Times", scheduleList);
                }

                groupType.LoadAttributes();

                if (groupType.AttributeValues.ContainsKey("core_checkin_CheckInType"))
                {
                    leftDetailsDescList.Add("Check-in Type", groupType.AttributeValues["core_checkin_CheckInType"].ValueFormatted);
                }

                if (groupType.AttributeValues.ContainsKey("core_checkin_SearchType"))
                {
                    var searchType = groupType.AttributeValues["core_checkin_SearchType"];
                    rightDetailsDescList.Add("Search Type", searchType.ValueFormatted);

                    var searchTypeGuid = searchType.Value.AsGuid();
                    if (searchTypeGuid.Equals(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_NAME_AND_PHONE.AsGuid()) ||
                        searchTypeGuid.Equals(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_PHONE_NUMBER.AsGuid()))
                    {
                        rightDetailsDescList.Add("Phone Number Compare", groupType.AttributeValues["core_checkin_PhoneSearchType"].ValueFormatted);
                    }
                }

                lblMainDetails.Text  = mainDetailsDescList.Html;
                lblLeftDetails.Text  = leftDetailsDescList.Html;
                lblRightDetails.Text = rightDetailsDescList.Html;
            }
        }
示例#19
0
        /// <summary>
        /// Creates the group type attribute controls.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        /// <param name="rockContext">The rock context.</param>
        public void CreateGroupTypeAttributeControls( GroupType groupType,  RockContext rockContext )
        {
            EnsureChildControls();

            _phGroupTypeAttributes.Controls.Clear();

            if ( groupType != null )
            {
                if ( groupType.Attributes == null )
                {
                    groupType.LoadAttributes( rockContext );
                }

                // exclude checkin labels
                List<string> checkinLabelAttributeNames = GetCheckinLabelAttributes( groupType.Attributes ).Select( a => a.Value.Name ).ToList();
                Rock.Attribute.Helper.AddEditControls( groupType, _phGroupTypeAttributes, true, string.Empty, checkinLabelAttributeNames );
            }
        }
示例#20
0
        /// <summary>
        /// Creates the group type attribute controls.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        private void CreateGroupTypeAttributeControls( RockContext rockContext )
        {
            // make a fakeGroupType to use to get the Attribute Controls based on GroupType id and InheritedGroupTypeId
            GroupType fakeGroupType = new GroupType();
            fakeGroupType.Id = _hfGroupTypeId.ValueAsInt();
            fakeGroupType.InheritedGroupTypeId = this.InheritedGroupTypeId;

            fakeGroupType.LoadAttributes( rockContext );
            _phGroupTypeAttributes.Controls.Clear();

            // exclude checkin labels
            List<string> checkinLabelAttributeNames = GetCheckinLabelAttributes( fakeGroupType.Attributes, rockContext ).Select( a => a.Value.Name ).ToList();
            Rock.Attribute.Helper.AddEditControls( fakeGroupType, _phGroupTypeAttributes, true, string.Empty, checkinLabelAttributeNames );
        }
示例#21
0
        /// <summary>
        /// Gets the type of the checkin group.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <returns></returns>
        public GroupType GetCheckinGroupType( RockContext rockContext )
        {
            EnsureChildControls();
            GroupType result = new GroupType();

            //// NOTE:  A GroupType that was added will have an Id of 0 since it hasn't been saved to the database.
            //// So, we'll use Guid to uniquely identify in this Control since that'll work in both Saved and Unsaved cases.
            //// If it is saved, we do need the Id so that Attributes will work

            result.Id = _hfGroupTypeId.ValueAsInt();
            result.Guid = new Guid( _hfGroupTypeGuid.Value );

            result.Name = _tbGroupTypeName.Text;
            result.InheritedGroupTypeId = _ddlGroupTypeInheritFrom.SelectedValueAsId();

            result.LoadAttributes( rockContext );
            Rock.Attribute.Helper.GetEditValues( _phGroupTypeAttributes, result );

            result.ChildGroupTypes = new List<GroupType>();
            int childGroupTypeOrder = 0;
            foreach ( CheckinGroupTypeEditor checkinGroupTypeEditor in this.Controls.OfType<CheckinGroupTypeEditor>() )
            {
                GroupType childGroupType = checkinGroupTypeEditor.GetCheckinGroupType( rockContext );
                childGroupType.Order = childGroupTypeOrder++;
                result.ChildGroupTypes.Add( childGroupType );
            }

            result.Groups = new List<Group>();
            int childGroupOrder = 0;
            foreach ( CheckinGroupEditor checkinGroupEditor in this.Controls.OfType<CheckinGroupEditor>() )
            {
                Group childGroup = checkinGroupEditor.GetGroup( rockContext );
                childGroup.Order = childGroupOrder++;
                result.Groups.Add( childGroup );
            }

            return result;
        }