/// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="eventId">The event identifier.</param>
        public void ShowDetail(int eventId)
        {
            FollowingSuggestionType followingSuggestion = null;

            bool editAllowed = IsUserAuthorized(Authorization.EDIT);

            if (!eventId.Equals(0))
            {
                followingSuggestion = new FollowingSuggestionTypeService(new RockContext()).Get(eventId);
                editAllowed         = editAllowed || followingSuggestion.IsAuthorized(Authorization.EDIT, CurrentPerson);
            }

            if (followingSuggestion == null)
            {
                followingSuggestion = new FollowingSuggestionType {
                    Id = 0, IsActive = true
                };
            }

            SuggestionId = followingSuggestion.Id;

            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;
            if (!editAllowed || !IsUserAuthorized(Authorization.EDIT))
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(FollowingSuggestionType.FriendlyTypeName);
            }

            if (readOnly)
            {
                ShowReadonlyDetails(followingSuggestion);
            }
            else
            {
                ShowEditDetails(followingSuggestion);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="eventId">The event identifier.</param>
        public void ShowDetail( int eventId )
        {
            FollowingSuggestionType followingSuggestion = null;

            bool editAllowed = IsUserAuthorized( Authorization.EDIT );

            if ( !eventId.Equals( 0 ) )
            {
                followingSuggestion = new FollowingSuggestionTypeService( new RockContext() ).Get( eventId );
                editAllowed = editAllowed || followingSuggestion.IsAuthorized( Authorization.EDIT, CurrentPerson );
            }

            if ( followingSuggestion == null )
            {
                followingSuggestion = new FollowingSuggestionType { Id = 0, IsActive = true };
            }

            SuggestionId = followingSuggestion.Id;

            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;
            if ( !editAllowed || !IsUserAuthorized( Authorization.EDIT ) )
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed( FollowingSuggestionType.FriendlyTypeName );
            }

            if ( readOnly )
            {
                ShowReadonlyDetails( followingSuggestion );
            }
            else
            {
                ShowEditDetails( followingSuggestion );
            }
        }