private void BuildDynamicControls(FollowingSuggestionType followingSuggestion, bool SetValues)
        {
            if (SetValues)
            {
                SuggestionEntityTypeId = followingSuggestion.EntityTypeId;
                if (followingSuggestion.EntityTypeId.HasValue)
                {
                    var SuggestionComponentEntityType = EntityTypeCache.Get(followingSuggestion.EntityTypeId.Value);
                    var SuggestionEntityType          = EntityTypeCache.Get("Rock.Model.FollowingSuggestionType");
                    if (SuggestionComponentEntityType != null && SuggestionEntityType != null)
                    {
                        using (var rockContext = new RockContext())
                        {
                            Rock.Attribute.Helper.UpdateAttributes(SuggestionComponentEntityType.GetEntityType(), SuggestionEntityType.Id, "EntityTypeId", SuggestionComponentEntityType.Id.ToString(), rockContext);
                        }
                    }
                }
            }

            if (followingSuggestion.Attributes == null)
            {
                followingSuggestion.LoadAttributes();
            }

            phAttributes.Controls.Clear();
            Rock.Attribute.Helper.AddEditControls(followingSuggestion, phAttributes, SetValues, BlockValidationGroup, new List <string> {
                "Active", "Order"
            });
        }
Пример #2
0
        /// <summary>
        /// Gets the attribute value for the suggestion
        /// </summary>
        /// <param name="followingSuggestion">The following suggestion.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        protected string GetAttributeValue(FollowingSuggestionType followingSuggestion, string key)
        {
            if (followingSuggestion.AttributeValues == null)
            {
                followingSuggestion.LoadAttributes();
            }

            var values = followingSuggestion.AttributeValues;

            if (values != null && values.ContainsKey(key))
            {
                var keyValues = values[key];
                if (keyValues != null)
                {
                    return(keyValues.Value);
                }
            }

            return(string.Empty);
        }
Пример #3
0
        /// <summary>
        /// Gets the attribute value for the suggestion 
        /// </summary>
        /// <param name="followingSuggestion">The following suggestion.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        protected string GetAttributeValue( FollowingSuggestionType followingSuggestion, string key )
        {
            if ( followingSuggestion.AttributeValues == null )
            {
                followingSuggestion.LoadAttributes();
            }

            var values = followingSuggestion.AttributeValues;
            if ( values != null && values.ContainsKey( key ) )
            {
                var keyValues = values[key];
                if ( keyValues != null )
                {
                    return keyValues.Value;
                }
            }

            return string.Empty;
        }
Пример #4
0
 /// <summary>
 /// Loads the attributes for the following suggestion.
 /// </summary>
 /// <param name="followingSuggestion">The following suggestion.</param>
 public void LoadAttributes( FollowingSuggestionType followingSuggestion )
 {
     followingSuggestion.LoadAttributes();
 }
Пример #5
0
 /// <summary>
 /// Loads the attributes for the following suggestion.
 /// </summary>
 /// <param name="followingSuggestion">The following suggestion.</param>
 public void LoadAttributes(FollowingSuggestionType followingSuggestion)
 {
     followingSuggestion.LoadAttributes();
 }
        private void BuildDynamicControls( FollowingSuggestionType followingSuggestion, bool SetValues )
        {
            if ( SetValues )
            {
                SuggestionEntityTypeId = followingSuggestion.EntityTypeId;
                if ( followingSuggestion.EntityTypeId.HasValue )
                {
                    var SuggestionComponentEntityType = EntityTypeCache.Read( followingSuggestion.EntityTypeId.Value );
                    var SuggestionEntityType = EntityTypeCache.Read( "Rock.Model.FollowingSuggestionType" );
                    if ( SuggestionComponentEntityType != null && SuggestionEntityType != null )
                    {
                        using ( var rockContext = new RockContext() )
                        {
                            Rock.Attribute.Helper.UpdateAttributes( SuggestionComponentEntityType.GetEntityType(), SuggestionEntityType.Id, "EntityTypeId", SuggestionComponentEntityType.Id.ToString(), rockContext );
                        }
                    }
                }
            }

            if ( followingSuggestion.Attributes == null )
            {
                followingSuggestion.LoadAttributes();
            }

            phAttributes.Controls.Clear();
            Rock.Attribute.Helper.AddEditControls( followingSuggestion, phAttributes, SetValues, BlockValidationGroup, new List<string> { "Active", "Order" } );
        }