コード例 #1
0
        /// <summary>
        /// Gets the type of the thread configuration by.
        /// </summary>
        /// <param name="threadType">Type of the thread.</param>
        /// <returns></returns>
        public static CommentsSettingsElement GetThreadConfigByType(string threadType, string threadKey)
        {
            Type commentsSettingsElementType = Type.GetType("Telerik.Sitefinity.Modules.Comments.Configuration.CommentsSettingsElement, Telerik.Sitefinity");

            object commentsSettingsElementObject = CommentsUtilitiesReflector.Reflect("GetThreadConfigByType", threadType);

            var result = new CommentsSettingsElement()
            {
                AllowComments          = (bool)commentsSettingsElementType.GetProperty("AllowComments").GetValue(commentsSettingsElementObject, null),
                RequiresAuthentication = (bool)commentsSettingsElementType.GetProperty("RequiresAuthentication").GetValue(commentsSettingsElementObject, null),
                RequiresApproval       = (bool)commentsSettingsElementType.GetProperty("RequiresApproval").GetValue(commentsSettingsElementObject, null)
            };

            result.EnableRatings = threadKey.EndsWith("_review", StringComparison.Ordinal);

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Gets the type of the thread configuration by.
        /// </summary>
        /// <param name="threadType">Type of the thread.</param>
        /// <returns></returns>
        public static CommentsSettingsElement GetThreadConfigByType(string threadType, string threadKey)
        {
            Type commentsSettingsElementType = Type.GetType("Telerik.Sitefinity.Modules.Comments.Configuration.CommentsSettingsElement, Telerik.Sitefinity");

            object commentsSettingsElementObject = CommentsUtilitiesReflector.Reflect("GetThreadConfigByType", threadType);

            var result = new CommentsSettingsElement()
            {
                AllowComments = (bool)commentsSettingsElementType.GetProperty("AllowComments").GetValue(commentsSettingsElementObject, null),
                RequiresAuthentication = (bool)commentsSettingsElementType.GetProperty("RequiresAuthentication").GetValue(commentsSettingsElementObject, null),
                RequiresApproval = (bool)commentsSettingsElementType.GetProperty("RequiresApproval").GetValue(commentsSettingsElementObject, null)
            };

            result.EnableRatings = threadKey.EndsWith("_review", StringComparison.Ordinal);

            return result;
        }