Beispiel #1
0
        private void BuildDynamicControls(FollowingEventType followingEvent, bool SetValues)
        {
            if (SetValues)
            {
                EventEntityTypeId = followingEvent.EntityTypeId;
                if (followingEvent.EntityTypeId.HasValue)
                {
                    var EventComponentEntityType = EntityTypeCache.Get(followingEvent.EntityTypeId.Value);
                    var EventEntityType          = EntityTypeCache.Get("Rock.Model.FollowingEventType");
                    if (EventComponentEntityType != null && EventEntityType != null)
                    {
                        using (var rockContext = new RockContext())
                        {
                            Rock.Attribute.Helper.UpdateAttributes(EventComponentEntityType.GetEntityType(), EventEntityType.Id, "EntityTypeId", EventComponentEntityType.Id.ToString(), rockContext);
                        }
                    }
                }
            }

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

            phAttributes.Controls.Clear();
            Rock.Attribute.Helper.AddEditControls(followingEvent, phAttributes, SetValues, BlockValidationGroup, new List <string> {
                "Active", "Order"
            });
        }
Beispiel #2
0
        /// <summary>
        /// Gets the attribute value for the event
        /// </summary>
        /// <param name="followingEvent">The following event.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        protected string GetAttributeValue(FollowingEventType followingEvent, string key)
        {
            if (followingEvent.AttributeValues == null)
            {
                followingEvent.LoadAttributes();
            }

            var values = followingEvent.AttributeValues;

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

            return(string.Empty);
        }
Beispiel #3
0
        private void BuildDynamicControls( FollowingEventType followingEvent, bool SetValues )
        {
            if ( SetValues )
            {
                EventEntityTypeId = followingEvent.EntityTypeId;
                if ( followingEvent.EntityTypeId.HasValue )
                {
                    var EventComponentEntityType = EntityTypeCache.Read( followingEvent.EntityTypeId.Value );
                    var EventEntityType = EntityTypeCache.Read( "Rock.Model.FollowingEventType" );
                    if ( EventComponentEntityType != null && EventEntityType != null )
                    {
                        using ( var rockContext = new RockContext() )
                        {
                            Rock.Attribute.Helper.UpdateAttributes( EventComponentEntityType.GetEntityType(), EventEntityType.Id, "EntityTypeId", EventComponentEntityType.Id.ToString(), rockContext );
                        }
                    }
                }
            }

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

            phAttributes.Controls.Clear();
            Rock.Attribute.Helper.AddEditControls( followingEvent, phAttributes, SetValues, BlockValidationGroup, new List<string> { "Active", "Order" } );
        }
Beispiel #4
0
 /// <summary>
 /// Loads the attributes for the following event.
 /// </summary>
 /// <param name="followingEvent">The following event.</param>
 public void LoadAttributes(FollowingEventType followingEvent)
 {
     followingEvent.LoadAttributes();
 }
Beispiel #5
0
        /// <summary>
        /// Gets the attribute value for the event 
        /// </summary>
        /// <param name="followingEvent">The following event.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        protected string GetAttributeValue( FollowingEventType followingEvent, string key )
        {
            if ( followingEvent.AttributeValues == null )
            {
                followingEvent.LoadAttributes();
            }

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

            return string.Empty;
        }
Beispiel #6
0
 /// <summary>
 /// Loads the attributes for the following event.
 /// </summary>
 /// <param name="followingEvent">The following event.</param>
 public void LoadAttributes( FollowingEventType followingEvent )
 {
     followingEvent.LoadAttributes();
 }