Exemplo n.º 1
0
        /// <summary>
        /// Modifies the given forum with the information given
        /// </summary>
        /// <param name="forumId">ID of forum to modify</param>
        /// <param name="sectionId">ID of section to locate this forum in</param>
        /// <param name="forumName">Name of the forum</param>
        /// <param name="forumDescription">Short description of the forum.</param>
        /// <param name="hasRSSFeed">True if the forum has an RSS feed.</param>
        /// <param name="defaultSupportQueueId">The ID of the default support queue for this forum. Can be null.</param>
        /// <param name="orderNo">The order no for the section. Sections are sorted ascending on orderno.</param>
        /// <param name="maxAttachmentSize">Max. size of an attachment.</param>
        /// <param name="maxNoOfAttachmentsPerMessage">The max no of attachments per message.</param>
        /// <param name="newThreadWelcomeText">The new thread welcome text, as shown when a new thread is created. Can be null.</param>
        /// <param name="newThreadWelcomeTextAsHTML">The new thread welcome text as HTML, is null when newThreadWelcomeText is null or empty.</param>
        /// <returns>True if succeeded, false otherwise</returns>
        public static async Task <bool> ModifyForumAsync(int forumId, int sectionId, string forumName, string forumDescription, bool hasRSSFeed, int?defaultSupportQueueId,
                                                         short orderNo, int maxAttachmentSize, short maxNoOfAttachmentsPerMessage,
                                                         string newThreadWelcomeText, string newThreadWelcomeTextAsHTML)
        {
            var forum = await ForumGuiHelper.GetForumAsync(forumId);

            if (forum == null)
            {
                // not found
                return(false);                // doesn't exist
            }

            forum.SectionID             = sectionId;
            forum.ForumDescription      = forumDescription;
            forum.ForumName             = forumName;
            forum.HasRSSFeed            = hasRSSFeed;
            forum.DefaultSupportQueueID = defaultSupportQueueId;
            forum.OrderNo                      = orderNo;
            forum.MaxAttachmentSize            = maxAttachmentSize;
            forum.MaxNoOfAttachmentsPerMessage = maxNoOfAttachmentsPerMessage;
            forum.NewThreadWelcomeText         = newThreadWelcomeText;
            forum.NewThreadWelcomeTextAsHTML   = newThreadWelcomeTextAsHTML;
            using (var adapter = new DataAccessAdapter())
            {
                return(await adapter.SaveEntityAsync(forum).ConfigureAwait(false));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Modifies the given forum with the information given
        /// </summary>
        /// <param name="forumID">ID of forum to modify</param>
        /// <param name="sectionID">ID of section to locate this forum in</param>
        /// <param name="forumName">Name of the forum</param>
        /// <param name="forumDescription">Short description of the forum.</param>
        /// <param name="hasRSSFeed">True if the forum has an RSS feed.</param>
        /// <param name="defaultSupportQueueID">The ID of the default support queue for this forum. Can be null.</param>
        /// <param name="defaultThreadListInterval">The default thread list interval.</param>
        /// <param name="orderNo">The order no for the section. Sections are sorted ascending on orderno.</param>
        /// <param name="maxAttachmentSize">Max. size of an attachment.</param>
        /// <param name="maxNoOfAttachmentsPerMessage">The max no of attachments per message.</param>
        /// <param name="newThreadWelcomeText">The new thread welcome text, as shown when a new thread is created. Can be null.</param>
        /// <param name="newThreadWelcomeTextAsHTML">The new thread welcome text as HTML, is null when newThreadWelcomeText is null or empty.</param>
        /// <returns>True if succeeded, false otherwise</returns>
        public static bool ModifyForum(int forumID, int sectionID, string forumName, string forumDescription, bool hasRSSFeed, int?defaultSupportQueueID,
                                       int defaultThreadListInterval, short orderNo, int maxAttachmentSize, short maxNoOfAttachmentsPerMessage,
                                       string newThreadWelcomeText, string newThreadWelcomeTextAsHTML)
        {
            ForumEntity forum = ForumGuiHelper.GetForum(forumID);

            if (forum == null)
            {
                // not found
                return(false);                  // doesn't exist
            }
            forum.SectionID                 = sectionID;
            forum.ForumDescription          = forumDescription;
            forum.ForumName                 = forumName;
            forum.HasRSSFeed                = hasRSSFeed;
            forum.DefaultSupportQueueID     = defaultSupportQueueID;
            forum.DefaultThreadListInterval = Convert.ToByte(defaultThreadListInterval);
            forum.OrderNo                      = orderNo;
            forum.MaxAttachmentSize            = maxAttachmentSize;
            forum.MaxNoOfAttachmentsPerMessage = maxNoOfAttachmentsPerMessage;
            forum.NewThreadWelcomeText         = newThreadWelcomeText;
            forum.NewThreadWelcomeTextAsHTML   = newThreadWelcomeTextAsHTML;
            return(forum.Save());
        }