示例#1
0
        /// <summary>
        /// Returns the post form filled with the reply to information
        /// </summary>
        /// <param name="creator"></param>
        /// <param name="viewingUser"></param>
        /// <param name="inReplyToId"></param>
        /// <returns></returns>
        public static PostThreadForm GetPostThreadFormWithReplyTo(IDnaDataReaderCreator creator, IUser viewingUser, int inReplyToId)
        {
            var postThreadForm = new PostThreadForm();
            using(IDnaDataReader reader = creator.CreateDnaDataReader("getthreadpostcontents"))
            {
                reader.AddParameter("postid", inReplyToId);
                reader.AddParameter("userid", viewingUser.UserId);
                reader.Execute();

                if (reader.Read())
                {
                    postThreadForm.InReplyToId = inReplyToId;
                    postThreadForm.ForumId = reader.GetInt32NullAsZero("forumID");
                    postThreadForm.ThreadId = reader.GetInt32NullAsZero("ThreadID");
                    postThreadForm.PostIndex = reader.GetInt32NullAsZero("PostIndex");
                    postThreadForm.CanWrite = (byte)(reader.GetInt32NullAsZero("CanWrite") == 1? 1:0);
                    if (viewingUser.IsEditor || viewingUser.IsSuperUser)
                    {//these users can always write
                        postThreadForm.CanWrite = 1;
                    }
                    postThreadForm.Style = reader.GetByte("PostStyle");
                    
                    postThreadForm.Subject = reader.GetStringNullAsEmpty("Subject");

                    postThreadForm.InReplyTo = new PostThreadFormInReplyTo();
                    postThreadForm.InReplyTo.UserId = reader.GetInt32NullAsZero("UserID");
                    
                    if (!reader.IsDBNull("SiteSuffix"))
                    {
                        postThreadForm.InReplyTo.Username = reader.GetStringNullAsEmpty("SiteSuffix");
                    }
                    else
                    {
                        postThreadForm.InReplyTo.Username = reader.GetStringNullAsEmpty("UserName");
                    }
                    postThreadForm.InReplyTo.RawBody = reader.GetStringNullAsEmpty("text");
                }

             }
            return postThreadForm;
        }
示例#2
0
 /// <summary>
 /// Returns the post form filled with the reply to information
 /// </summary>
 /// <param name="creator"></param>
 /// <param name="viewingUser"></param>
 /// <param name="inReplyToId"></param>
 /// <returns></returns>
 public static PostThreadForm GetPostThreadFormWithForum(IDnaDataReaderCreator creator, IUser viewingUser, int forumId)
 {
     var postThreadForm = new PostThreadForm();
     
     postThreadForm.InReplyToId = 0;
     postThreadForm.ForumId = forumId;
     postThreadForm.CanWrite = 1;
     
     return postThreadForm;
 }
示例#3
0
 private void getBannedXml(PostThreadForm postToForumBuilder)
 {
     XmlElement postMod = AddElementTag(RootElement, "POSTTHREADUNREG");
     AddAttribute(postMod, "FORUM", _forumId.ToString());
     AddAttribute(postMod, "THREADID", postToForumBuilder.ThreadId.ToString());
     AddAttribute(postMod, "RESTRICTED", "1");
     AddAttribute(postMod, "REGISTERED", "1");
     return;
 }