Exemple #1
0
 private void GetGroupTypeLabels(GroupType groupType, List <CheckInLabel> labels, int labelFileTypeId, Dictionary <string, object> mergeObjects)
 {
     //groupType.LoadAttributes();
     foreach (var attribute in groupType.Attributes)
     {
         if (attribute.Value.FieldType.Guid == new Guid(SystemGuid.FieldType.BINARY_FILE) &&
             attribute.Value.QualifierValues.ContainsKey("binaryFileType") &&
             attribute.Value.QualifierValues["binaryFileType"].Value == labelFileTypeId.ToString())
         {
             string attributeValue = groupType.GetAttributeValue(attribute.Key);
             if (attributeValue != null)
             {
                 int fileId = int.MinValue;
                 if (int.TryParse(attributeValue, out fileId))
                 {
                     var labelCache = KioskLabel.Read(fileId);
                     if (labelCache != null)
                     {
                         var checkInLabel = new CheckInLabel(labelCache, mergeObjects);
                         checkInLabel.FileId = fileId;
                         labels.Add(checkInLabel);
                     }
                 }
             }
         }
     }
 }
        /// <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);
            }
        }
Exemple #3
0
 private void GetGroupTypeLabels(GroupType groupType, List <CheckInLabel> labels, Dictionary <string, object> mergeObjects)
 {
     //groupType.LoadAttributes();
     foreach (var attribute in groupType.Attributes.OrderBy(a => a.Value.Order))
     {
         if (attribute.Value.FieldType.Guid == SystemGuid.FieldType.BINARY_FILE.AsGuid() &&
             attribute.Value.QualifierValues.ContainsKey("binaryFileType") &&
             attribute.Value.QualifierValues["binaryFileType"].Value.Equals(SystemGuid.BinaryFiletype.CHECKIN_LABEL, StringComparison.OrdinalIgnoreCase))
         {
             Guid?binaryFileGuid = groupType.GetAttributeValue(attribute.Key).AsGuidOrNull();
             if (binaryFileGuid != null)
             {
                 var labelCache = KioskLabel.Read(binaryFileGuid.Value);
                 if (labelCache != null)
                 {
                     var checkInLabel = new CheckInLabel(labelCache, mergeObjects);
                     checkInLabel.FileGuid = binaryFileGuid.Value;
                     labels.Add(checkInLabel);
                 }
             }
         }
     }
 }
        /// <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>
        /// 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();
            }
        }
Exemple #6
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;
            }
        }
Exemple #7
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();
            }
        }
Exemple #8
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();
            }
        }
Exemple #9
0
 private void GetGroupTypeLabels( GroupType groupType, List<CheckInLabel> labels, int labelFileTypeId, Dictionary<string, object> mergeObjects )
 {
     //groupType.LoadAttributes();
     foreach ( var attribute in groupType.Attributes )
     {
         if ( attribute.Value.FieldType.Guid == new Guid( SystemGuid.FieldType.BINARY_FILE ) &&
             attribute.Value.QualifierValues.ContainsKey( "binaryFileType" ) &&
             attribute.Value.QualifierValues["binaryFileType"].Value == labelFileTypeId.ToString() )
         {
             string attributeValue = groupType.GetAttributeValue( attribute.Key );
             if ( attributeValue != null )
             {
                 int fileId = int.MinValue;
                 if ( int.TryParse( attributeValue, out fileId ) )
                 {
                     var labelCache = KioskLabel.Read( fileId );
                     if ( labelCache != null )
                     {
                         var checkInLabel = new CheckInLabel( labelCache, mergeObjects );
                         checkInLabel.FileId = fileId;
                         labels.Add( checkInLabel );
                     }
                 }
             }
         }
     }
 }
        /// <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 );
            }
        }
        /// <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 );
            }
        }
 private void GetGroupTypeLabels( GroupType groupType, List<CheckInLabel> labels, Dictionary<string, object> mergeObjects )
 {
     //groupType.LoadAttributes();
     foreach ( var attribute in groupType.Attributes.OrderBy( a => a.Value.Order ) )
     {
         if ( attribute.Value.FieldType.Guid == SystemGuid.FieldType.BINARY_FILE.AsGuid() &&
             attribute.Value.QualifierValues.ContainsKey( "binaryFileType" ) &&
             attribute.Value.QualifierValues["binaryFileType"].Value.Equals( SystemGuid.BinaryFiletype.CHECKIN_LABEL, StringComparison.OrdinalIgnoreCase ) )
         {
             Guid? binaryFileGuid = groupType.GetAttributeValue( attribute.Key ).AsGuidOrNull();
             if ( binaryFileGuid != null )
             {
                 var labelCache = KioskLabel.Read( binaryFileGuid.Value );
                 if ( labelCache != null )
                 {
                     var checkInLabel = new CheckInLabel( labelCache, mergeObjects );
                     checkInLabel.FileGuid = binaryFileGuid.Value;
                     labels.Add( checkInLabel );
                 }
             }
         }
     }
 }