Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new forum in the system, and locates this forum in the section iSectionID.
        /// </summary>
        /// <param name="sectionID">The section ID.</param>
        /// <param name="forumName">Name of the forum.</param>
        /// <param name="forumDescription">The forum description.</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>
        /// ForumID of new forum or 0 if something went wrong.
        /// </returns>
        public static int CreateNewForum(int sectionID, string forumName, string forumDescription, bool hasRSSFeed, int?defaultSupportQueueID,
                                         int defaultThreadListInterval, short orderNo, int maxAttachmentSize, short maxNoOfAttachmentsPerMessage,
                                         string newThreadWelcomeText, string newThreadWelcomeTextAsHTML)
        {
            ForumEntity newForum = new ForumEntity();

            newForum.SectionID                 = sectionID;
            newForum.ForumDescription          = forumDescription;
            newForum.ForumName                 = forumName;
            newForum.HasRSSFeed                = hasRSSFeed;
            newForum.DefaultSupportQueueID     = defaultSupportQueueID;
            newForum.DefaultThreadListInterval = Convert.ToByte(defaultThreadListInterval);
            newForum.OrderNo                      = orderNo;
            newForum.MaxAttachmentSize            = maxAttachmentSize;
            newForum.MaxNoOfAttachmentsPerMessage = maxNoOfAttachmentsPerMessage;
            newForum.NewThreadWelcomeText         = newThreadWelcomeText;
            newForum.NewThreadWelcomeTextAsHTML   = newThreadWelcomeTextAsHTML;
            bool result = newForum.Save();

            if (result)
            {
                // succeeded
                return(newForum.ForumID);
            }
            else
            {
                return(0);
            }
        }
Ejemplo 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());
        }