/// <summary> /// Gets the field type cache used for the given registration field type if it is supported /// </summary> /// <param name="fieldType"></param> /// <returns></returns> public static FieldTypeCache GetSupportedFieldTypeCache(RegistrationPersonFieldType fieldType) { switch (fieldType) { case RegistrationPersonFieldType.Gender: return(FieldTypeCache.Get(SystemGuid.FieldType.GENDER)); default: return(null); } }
/// <summary> /// Gets a person field value. /// </summary> /// <param name="template">The template.</param> /// <param name="personFieldType">Type of the person field.</param> /// <returns></returns> public object GetPersonFieldValue(RegistrationTemplate template, RegistrationPersonFieldType personFieldType) { if (template != null && template.Forms != null) { var fieldId = template.Forms .SelectMany(t => t.Fields .Where(f => f.FieldSource == RegistrationFieldSource.PersonField && f.PersonFieldType == personFieldType) .Select(f => f.Id)) .FirstOrDefault(); return(FieldValues.ContainsKey(fieldId) ? FieldValues[fieldId].FieldValue : null); } return(null); }
/// <summary> /// Determines if the registration field type is supported for conditional field visibility /// </summary> /// <param name="fieldType"></param> /// <returns></returns> public static bool IsFieldSupported(RegistrationPersonFieldType fieldType) { return(GetSupportedFieldTypeCache(fieldType) != null); }
/// <summary> /// Gets a person field value. /// </summary> /// <param name="settings">The settings.</param> /// <param name="registrantInfo">The registrant information.</param> /// <param name="personFieldType">Type of the person field.</param> /// <returns></returns> public object GetPersonFieldValue(RegistrationSettings settings, Rock.ViewModel.Blocks.Event.RegistrationEntry.RegistrantInfo registrantInfo, RegistrationPersonFieldType personFieldType) { if (settings != null && settings.Forms != null) { var fieldGuid = settings.Forms .SelectMany(t => t.Fields .Where(f => f.FieldSource == RegistrationFieldSource.PersonField && f.PersonFieldType == personFieldType) .Select(f => f.Guid)) .FirstOrDefault(); return(registrantInfo.FieldValues.GetValueOrNull(fieldGuid)); } return(null); }