コード例 #1
0
        private bool CreatePost()
        {
            int  newID    = -1;
            bool approved = false;

            if (
                (ConfigurationManager.AppSettings["PostsApprovedByDefault"] != null) &&
                (string.Equals(ConfigurationManager.AppSettings["PostsApprovedByDefault"], "true", StringComparison.InvariantCultureIgnoreCase))
                )
            {
                approved = true;
            }

            this.mostRecentPostDate = DateTime.UtcNow;

            if (postGuid == Guid.Empty)
            {
                postGuid = Guid.NewGuid();
            }

            newID = DBForums.ForumPostCreate(
                this.threadID,
                this.postSubject,
                this.postMessage,
                approved,
                this.PostUserId,
                this.mostRecentPostDate,
                this.postGuid,
                this.approvedBy,
                this.approvedUtc,
                this.userIp,
                this.notificationSent,
                this.postModStatus);

            this.postID = newID;
            Forum.IncrementPostCount(this.forumID, this.postUserID, this.mostRecentPostDate);
            SiteUser.IncrementTotalPosts(this.postUserID);
            //IndexHelper.IndexItem(this);

            bool result = (newID > -1);

            //if (result)
            //{
            //    ContentChangedEventArgs e = new ContentChangedEventArgs();
            //    OnContentChanged(e);
            //}

            return(result);
        }