当前位置: 首页>>代码示例>>C#>>正文


C# IDnaDataReader.GetByteNullAsZero方法代码示例

本文整理汇总了C#中IDnaDataReader.GetByteNullAsZero方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.GetByteNullAsZero方法的具体用法?C# IDnaDataReader.GetByteNullAsZero怎么用?C# IDnaDataReader.GetByteNullAsZero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDnaDataReader的用法示例。


在下文中一共展示了IDnaDataReader.GetByteNullAsZero方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CommentForumCreateFromReader

        /// <summary>
        /// Creates the commentforumdata from a given reader
        /// </summary>
        /// <param name="reader">The database reaser</param>
        /// <returns>A Filled comment forum object</returns>
        private CommentForum CommentForumCreateFromReader(IDnaDataReader reader)
        {
            var closingDate = reader.GetDateTime("forumclosedate");
            //if (closingDate == null)
            //{
            //    closingDate = DateTime.MaxValue;
            //}
            var site = SiteList.GetSite(reader.GetStringNullAsEmpty("sitename"));

            var commentForum = new CommentForum();

            commentForum.Title = reader.GetStringNullAsEmpty("Title");
            commentForum.Id = reader.GetStringNullAsEmpty("UID");
            commentForum.CanRead = reader.GetByteNullAsZero("canRead") == 1;
            commentForum.CanWrite = reader.GetByteNullAsZero("canWrite") == 1;
            commentForum.ParentUri = reader.GetStringNullAsEmpty("Url");
            commentForum.SiteName = reader.GetStringNullAsEmpty("sitename");
            commentForum.CloseDate = closingDate;
            commentForum.LastUpdate = reader.GetDateTime("LastUpdated");
            if (reader.GetDateTime("lastposted") > commentForum.LastUpdate)
            {
//use last posted as it is newer
                commentForum.LastUpdate = reader.GetDateTime("lastposted");
            }
            commentForum.Updated = new DateTimeHelper(commentForum.LastUpdate);
            commentForum.Created = new DateTimeHelper(reader.GetDateTime("DateCreated"));
            commentForum.commentSummary = new CommentsSummary
                                              {
                                                  Total = reader.GetInt32NullAsZero("ForumPostCount"),
                                                  EditorPicksTotal = reader.GetInt32NullAsZero("editorpickcount")
                                              };
            commentForum.ForumID = reader.GetInt32NullAsZero("forumid");
            commentForum.isClosed = !commentForum.CanWrite || site.IsEmergencyClosed ||
                                    site.IsSiteScheduledClosed(DateTime.Now) ||
                                    (DateTime.Now > closingDate);
            //MaxCharacterCount = siteList.GetSiteOptionValueInt(site.SiteID, "CommentForum", "'MaxCommentCharacterLength")
            var replacements = new Dictionary<string, string>();
            replacements.Add("commentforumid", reader.GetStringNullAsEmpty("uid"));
            replacements.Add("sitename", site.SiteName);

            if (reader.Exists("IsContactForm") && !reader.IsDBNull("IsContactForm"))
            {
                commentForum.isContactForm = true;
                commentForum.Uri = UriDiscoverability.GetUriWithReplacments(BasePath,
                                                                            UriDiscoverability.UriType.ContactFormById,
                                                                            replacements);
                commentForum.commentSummary.Uri = UriDiscoverability.GetUriWithReplacments(BasePath,
                                                                                           UriDiscoverability.UriType.ContactFormById,
                                                                                           replacements);
            }
            else
            {
                commentForum.Uri = UriDiscoverability.GetUriWithReplacments(BasePath,
                                                                            UriDiscoverability.UriType.CommentForumById,
                                                                            replacements);
                commentForum.commentSummary.Uri = UriDiscoverability.GetUriWithReplacments(BasePath,
                                                                                           UriDiscoverability.UriType.CommentsByCommentForumId,
                                                                                           replacements);
            }

            //get moderation status
            commentForum.ModerationServiceGroup = ModerationStatus.ForumStatus.Unknown;
            if (!reader.IsDBNull("moderationstatus"))
            {
//if it is set for the specific forum
                commentForum.ModerationServiceGroup =
                    (ModerationStatus.ForumStatus) (reader.GetTinyIntAsInt("moderationstatus"));
            }
            if (commentForum.ModerationServiceGroup == ModerationStatus.ForumStatus.Unknown)
            {
//else fall back to site moderation status
                switch (site.ModerationStatus)
                {
                    case ModerationStatus.SiteStatus.UnMod:
                        commentForum.ModerationServiceGroup = ModerationStatus.ForumStatus.Reactive;
                        break;
                    case ModerationStatus.SiteStatus.PreMod:
                        commentForum.ModerationServiceGroup = ModerationStatus.ForumStatus.PreMod;
                        break;
                    case ModerationStatus.SiteStatus.PostMod:
                        commentForum.ModerationServiceGroup = ModerationStatus.ForumStatus.PostMod;
                        break;
                    default:
                        commentForum.ModerationServiceGroup = ModerationStatus.ForumStatus.Reactive;
                        break;
                }
            }

            commentForum.NotSignedInUserId = reader.GetInt32NullAsZero("NotSignedInUserId");
            commentForum.allowNotSignedInCommenting = commentForum.NotSignedInUserId != 0;

            return commentForum;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:98,代码来源:Comments.cs

示例2: AddCommentForumListXML

        /// <summary>
        /// Generates the individual Comment CommentBoxForum Xml within the Comment CommentBoxForum List xml page
        /// </summary>
        /// <param name="dataReader">SP containing the comment forums</param>
        /// <param name="commentForumList">Parent node to attach to</param>
        private void AddCommentForumListXML(IDnaDataReader dataReader, XmlNode commentForumList)
        {
            // start creating the comment forum structure
            XmlNode commentForum = CreateElementNode("COMMENTFORUM");
            AddAttribute(commentForum, "UID", dataReader.GetStringNullAsEmpty("uid"));
            AddAttribute(commentForum, "FORUMID", dataReader.GetInt32NullAsZero("forumID").ToString());
            AddAttribute(commentForum, "FORUMPOSTCOUNT", dataReader.GetInt32NullAsZero("forumpostcount").ToString());
            AddAttribute(commentForum, "FORUMPOSTLIMIT", InputContext.GetSiteOptionValueInt("Forum", "PostLimit"));
            AddAttribute(commentForum, "CANWRITE", dataReader.GetByteNullAsZero("CanWrite").ToString());
            AddAttribute(commentForum, "NOTSIGNEDINUSERID", dataReader.GetInt32NullAsZero("NotSignedInUserID").ToString());

            AddTextTag(commentForum, "HOSTPAGEURL", dataReader.GetStringNullAsEmpty("url"));
            AddTextTag(commentForum, "TITLE", dataReader.GetStringNullAsEmpty("title"));
            AddTextTag(commentForum, "MODSTATUS", dataReader.GetByteNullAsZero("ModerationStatus"));
            AddTextTag(commentForum, "SITEID", dataReader.GetInt32NullAsZero("siteid"));
            AddTextTag(commentForum, "FASTMOD", dataReader.GetInt32NullAsZero("fastmod"));

            if (dataReader.DoesFieldExist("DateCreated") && !dataReader.IsDBNull("DateCreated"))
            {
                DateTime dateCreated = dataReader.GetDateTime("DateCreated");
                AddElement(commentForum, "DATECREATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateCreated));
            }

            if (dataReader.DoesFieldExist("ForumCloseDate") && !dataReader.IsDBNull("ForumCloseDate"))
            {
                DateTime closeDate = dataReader.GetDateTime("ForumCloseDate");
                AddElement(commentForum, "CLOSEDATE", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, closeDate));
            }

            if (dataReader.DoesFieldExist("LastUpdated") && !dataReader.IsDBNull("LastUpdated"))
            {
                DateTime dateLastUpdated = dataReader.GetDateTime("LastUpdated");
                AddElement(commentForum, "LASTUPDATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateLastUpdated));
            }

            int forumId = dataReader.GetInt32NullAsZero("forumID");
            //get terms admin object
            TermsFilterAdmin termsAdmin = TermsFilterAdmin.CreateForumTermAdmin(InputContext.CreateDnaDataReaderCreator(), _cache, forumId);
            XmlDocument termNodeDoc = SerialiseToXmlDoc(termsAdmin);
            string termNodeText = termNodeDoc.DocumentElement.InnerXml.ToString();
            AddXmlTextTag(commentForum, "TERMS", termNodeText);

            commentForumList.AppendChild(commentForum);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:49,代码来源:CommentForumListBuilder.cs

示例3: MostCommentedCommentForumCreateFromReader

        private MostCommentedCommentForum MostCommentedCommentForumCreateFromReader(IDnaDataReader reader)
        {
            var mostCommentedCommentForum = new MostCommentedCommentForum();
            mostCommentedCommentForum.UID = reader.GetStringNullAsEmpty("Uid");

            var site = SiteList.GetSite(reader.GetInt32NullAsZero("SiteID"));
            mostCommentedCommentForum.SiteName = (site != null) && (false == string.IsNullOrEmpty(site.SiteName)) ? site.SiteName : string.Empty;
            
            mostCommentedCommentForum.ForumId = reader.GetInt32NullAsZero("ForumID");
            mostCommentedCommentForum.Url = reader.GetStringNullAsEmpty("Url");
            mostCommentedCommentForum.Title = reader.GetStringNullAsEmpty("Title");
            mostCommentedCommentForum.CanWrite = reader.GetByteNullAsZero("CanWrite") == 1;
            mostCommentedCommentForum.ForumPostCount = reader.GetInt32NullAsZero("ForumPostCount");
            mostCommentedCommentForum.DateCreated = reader.GetDateTime("DateCreated");
            mostCommentedCommentForum.ForumCloseDate = reader.GetDateTime("ForumCloseDate");
            mostCommentedCommentForum.CommentForumListCount = reader.GetInt32NullAsZero("CommentForumListCount");
            mostCommentedCommentForum.LastPosted = reader.GetDateTime("LastPosted");
            return mostCommentedCommentForum;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:19,代码来源:Comments.cs

示例4: CreateContributionInternal

        private static Contribution CreateContributionInternal(IDnaDataReader reader)
        {
            Contribution contribution = new Contribution();

            // Make sure we got something back
            if (reader.HasRows && reader.Read()) 
            {
                contribution.Body = reader.GetStringNullAsEmpty("Body");
                contribution.PostIndex = reader.GetLongNullAsZero("PostIndex");
                contribution.SiteName = reader.GetStringNullAsEmpty("SiteName");
                contribution.SiteType = (SiteType)Enum.Parse(typeof(SiteType), reader.GetStringNullAsEmpty("SiteType"));
                contribution.SiteDescription = reader.GetStringNullAsEmpty("SiteDescription");
                contribution.SiteUrl = reader.GetStringNullAsEmpty("UrlName");
                contribution.FirstSubject = reader.GetStringNullAsEmpty("FirstSubject");
                contribution.Subject = reader.GetStringNullAsEmpty("Subject");
                contribution.Timestamp = new DateTimeHelper(reader.GetDateTime("TimeStamp"));
                contribution.Title = reader.GetStringNullAsEmpty("ForumTitle");
                contribution.ThreadEntryID = reader.GetInt32("ThreadEntryID");
                contribution.CommentForumUrl = reader.GetStringNullAsEmpty("CommentForumUrl");
                contribution.GuideEntrySubject = reader.GetStringNullAsEmpty("GuideEntrySubject");

                contribution.TotalPostsOnForum = reader.GetInt32NullAsZero("TotalPostsOnForum");
                contribution.AuthorUserId = reader.GetInt32NullAsZero("AuthorUserId");
                contribution.AuthorUsername = reader.GetStringNullAsEmpty("AuthorUsername");
                contribution.AuthorIdentityUsername = reader.GetStringNullAsEmpty("AuthorIdentityUsername");

                bool forumCanWrite = reader.GetByteNullAsZero("ForumCanWrite") == 1;
                bool isEmergencyClosed = reader.GetInt32NullAsZero("SiteEmergencyClosed") == 1;
                //bool isSiteScheduledClosed = reader2.GetByteNullAsZero("SiteScheduledClosed") == 1;

                DateTime closingDate = DateTime.MaxValue;
                if (reader.DoesFieldExist("forumclosedate") && !reader.IsDBNull("forumclosedate"))
                {
                    closingDate = reader.GetDateTime("forumclosedate");
                    contribution.ForumCloseDate = new DateTimeHelper(closingDate);
                }
                contribution.isClosed = (!forumCanWrite || isEmergencyClosed || (closingDate != null && DateTime.Now > closingDate));
            }
            else
            {
                throw ApiException.GetError(ErrorType.ThreadPostNotFound);
            }

            return contribution;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:45,代码来源:Contribution.cs

示例5: AddCommentForumListXML

        private void AddCommentForumListXML(IDnaDataReader dataReader, XmlNode commentForumList)
        {
            // start creating the comment forum structure
            XmlNode commentForum = CreateElementNode("COMMENTFORUM");
            AddAttribute(commentForum, "UID", dataReader.GetStringNullAsEmpty("uid"));
            AddAttribute(commentForum, "FORUMID", dataReader.GetInt32NullAsZero("forumID").ToString());
            AddAttribute(commentForum, "FORUMPOSTCOUNT", dataReader.GetInt32NullAsZero("forumpostcount").ToString());
            AddAttribute(commentForum, "FORUMPOSTLIMIT", InputContext.GetSiteOptionValueInt("Forum", "PostLimit"));
            AddAttribute(commentForum, "CANWRITE", dataReader.GetByteNullAsZero("CanWrite").ToString());
            AddAttribute(commentForum, "NOTSIGNEDINUSERID", dataReader.GetInt32NullAsZero("NotSignedInUserID").ToString());

            AddTextTag(commentForum, "HOSTPAGEURL", dataReader.GetStringNullAsEmpty("url"));
            AddTextTag(commentForum, "TITLE", dataReader.GetStringNullAsEmpty("title"));
            AddTextTag(commentForum, "MODSTATUS", dataReader.GetByteNullAsZero("ModerationStatus"));
            AddTextTag(commentForum, "SITEID", dataReader.GetInt32NullAsZero("siteid"));
            AddTextTag(commentForum, "FASTMOD", dataReader.GetInt32NullAsZero("fastmod"));
            AddTextTag(commentForum, "CONTACTEMAIL", dataReader.GetStringNullAsEmpty("encryptedcontactemail"));

            if (dataReader.DoesFieldExist("DateCreated") && !dataReader.IsDBNull("DateCreated"))
            {
                DateTime dateCreated = dataReader.GetDateTime("DateCreated");
                AddElement(commentForum, "DATECREATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateCreated));
            }

            if (dataReader.DoesFieldExist("ForumCloseDate") && !dataReader.IsDBNull("ForumCloseDate"))
            {
                DateTime closeDate = dataReader.GetDateTime("ForumCloseDate");
                AddElement(commentForum, "CLOSEDATE", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, closeDate));
            }

            if (dataReader.DoesFieldExist("LastUpdated") && !dataReader.IsDBNull("LastUpdated"))
            {
                DateTime dateLastUpdated = dataReader.GetDateTime("LastUpdated");
                AddElement(commentForum, "LASTUPDATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateLastUpdated));
            }

            int forumId = dataReader.GetInt32NullAsZero("forumID");
 
            AddXmlTextTag(commentForum, "TERMS", "");

            commentForumList.AppendChild(commentForum);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:42,代码来源:ContactFormListBuilder.cs

示例6: CreateForumThreadPosts

        /// <summary>
        /// Creates the XML fragment for the CommentBoxForum Thread Posts
        /// </summary>
        /// <param name="uid">The unique identifier for the Comment CommentBoxForum</param>
        /// <param name="fromPostIndex">Start Post Index</param>
        /// <param name="toPostIndex">Finish Post Index</param>
        /// <param name="dataReader">Dna Data Reader object</param>
        /// <param name="show">Number of Posts requested</param>
        /// <param name="forumPostCount">Total number of Posts</param>
        /// <param name="parent">Parent node of FORUMTHREADPOSTS element.</param>
        /// <returns>Actual number of posts returned</returns>
        private int CreateForumThreadPosts(string uid, int fromPostIndex, int toPostIndex, IDnaDataReader dataReader, int show, int forumPostCount, XmlNode parent)
        {
            XmlNode forumPosts = CreateElementNode("FORUMTHREADPOSTS");
            AddAttribute(forumPosts, "GUESTBOOK", "1");
            AddAttribute(forumPosts, "FORUMID", dataReader.GetInt32NullAsZero("forumID").ToString());
            AddAttribute(forumPosts, "ALERTINSTANTLY", dataReader.GetInt32NullAsZero("alertInstantly").ToString());

            int returnedFrom = dataReader.GetInt32NullAsZero("from");
            if (returnedFrom < 0)
            {
                returnedFrom = 0;
            }
            int returnedTo = dataReader.GetInt32NullAsZero("to");

            AddAttribute(forumPosts, "FROM", returnedFrom.ToString());
            AddAttribute(forumPosts, "TO", returnedTo.ToString());
            AddAttribute(forumPosts, "SHOW", show.ToString());

            AddAttribute(forumPosts, "FORUMPOSTCOUNT", forumPostCount.ToString());
            AddAttribute(forumPosts, "FORUMPOSTLIMIT", InputContext.GetSiteOptionValueInt("Forum", "PostLimit"));
            AddAttribute(forumPosts, "SITEID", dataReader.GetInt32NullAsZero("siteID").ToString());

            AddAttribute(forumPosts, "CANREAD", dataReader.GetByteNullAsZero("ForumCanRead").ToString());
            AddAttribute(forumPosts, "CANWRITE", dataReader.GetByteNullAsZero("ForumCanWrite").ToString());
			AddAttribute(forumPosts, "DEFAULTCANREAD", dataReader.GetByteNullAsZero("ForumCanRead").ToString());
			AddAttribute(forumPosts, "DEFAULTCANWRITE", dataReader.GetByteNullAsZero("ForumCanWrite").ToString());
			AddAttribute(forumPosts, "UID", uid);

            string hostpageurl = dataReader.GetStringNullAsEmpty("URL");
            hostpageurl = StringUtils.EscapeAllXml(hostpageurl);

            AddAttribute(forumPosts, "HOSTPAGEURL", hostpageurl);

            byte moderationStatus = dataReader.GetByteNullAsZero("moderationStatus");
            AddAttribute(forumPosts, "MODERATIONSTATUS", moderationStatus.ToString());

            //Worked out the number of posts from the returned to and from
            int returnedCount = (returnedTo - returnedFrom) + 1;

            int actualPostCount = 0;
            if (forumPostCount > 0)
            {
                do
                {
                    ForumPost.AddPostXml(dataReader, this, forumPosts, InputContext);
                    actualPostCount++;
                    returnedCount--;
                } while (returnedCount > 0 && dataReader.Read());
            }

            parent.AppendChild(forumPosts);
            return actualPostCount;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:64,代码来源:CommentBoxForum.cs

示例7: AddPostXml

        /// <summary>
        /// Method to generate POST XML and add to a parent node 
        /// </summary>
        /// <param name="reader">DataReader result of stored procedure returning forum post data.</param>
        /// <param name="component">DnaComponent to add posts to.</param>
        /// <param name="parentNode">Parent Node to xml the generated xml to.</param>
        /// <param name="context">The Input Context</param>
        public static void AddPostXml(IDnaDataReader reader, DnaComponent component, XmlNode parentNode, IInputContext context)
        {
            int hidden = 0;
            int inReplyTo = 0;
            int prevSibling = 0;
            int nextSibling = 0;
            int firstChild = 0;
            int userID = 0;
            int entryId = 0;
            int threadId = 0;
            int postIndex = 0;

            string subject = String.Empty;
            string datePosted = String.Empty;
            string bodyText = String.Empty;
            string hostPageUrl = String.Empty;
            string commentForumTitle = String.Empty;

            //get from db
            if (reader.DoesFieldExist("parent"))
            {
                inReplyTo = reader.GetInt32NullAsZero("parent");
            }
            if (reader.DoesFieldExist("prevSibling"))
            {
                prevSibling = reader.GetInt32NullAsZero("prevSibling");
            }
            if (reader.DoesFieldExist("nextSibling"))
            {
                nextSibling = reader.GetInt32NullAsZero("nextSibling");
            }
            if (reader.DoesFieldExist("firstChild"))
            {
                firstChild = reader.GetInt32NullAsZero("firstChild");
            }
            if (reader.DoesFieldExist("userID"))
            {
                userID = reader.GetInt32NullAsZero("userID");
            }
            if (reader.DoesFieldExist("hidden"))
            {
                hidden = reader.GetInt32NullAsZero("hidden");
            }

            subject = String.Empty;
            if (hidden == 3) // 3 means premoderated! - hidden!
            {
                subject = "Hidden";
            }
            else if (hidden > 0)
            {
                subject = "Removed";
            }
            else
            {
                subject = reader["subject"] as string;
                subject = StringUtils.EscapeAllXml(subject);
            }

            datePosted = String.Empty;
            if (reader["datePosted"] != DBNull.Value)
            {
                datePosted = reader["datePosted"].ToString();
            }

            bodyText = String.Empty;
            if (hidden == 3) // 3 means premoderated! - hidden!
            {
                bodyText = "This post has been hidden";
            }
            else if (hidden > 0)
            {
                bodyText = "This post has been Removed";
            }
            else
            {
                bodyText = reader.GetStringNullAsEmpty("text");
            }

            byte postStyle = reader.GetByteNullAsZero("postStyle");

            if (postStyle != 1)
            {
                bodyText = StringUtils.ConvertPlainText(bodyText);
            }
            else
            {
                //TODO Do we need Rich Post stuff for the post style??
                string temp = "<RICHPOST>" + bodyText.Replace("\r\n", "<BR />").Replace("\n", "<BR />") + "</RICHPOST>";
                //Regex regex = new Regex(@"(<[^<>]+)<BR \/>");
                //while (regex.Match(temp).Success)
                //{
                //    temp = regex.Replace(temp,@"$1 ");
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:ForumPost.cs

示例8: CreateThreadPostFromReader

        /// <summary>
        /// Creates a threadpost from a given reader
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="prefix">The data base name prefix</param>
        /// <param name="postId">postId to get</param>
        /// <param name="post">The post in question to load with data</param>
        /// <param name="applySkin">Whether we need to process the text into html for output</param>
        /// <returns></returns>
        static public ThreadPost CreateThreadPostFromReader(IDnaDataReader reader, 
                                                            string prefix, 
                                                            int postId, 
                                                            ThreadPost post, 
                                                            bool applySkin)
        {
            if (post == null)
            {
                post = new ThreadPost() { PostId = postId };
            }
            
            if (reader.DoesFieldExist(prefix +"threadid"))
            {
                post.ThreadId = reader.GetInt32NullAsZero(prefix +"threadid");
            }
            if (reader.DoesFieldExist(prefix +"parent"))
            {
                post.InReplyTo = reader.GetInt32NullAsZero(prefix +"parent");
            }

            if (reader.DoesFieldExist(prefix +"replypostindex"))
            {
                post.InReplyToIndex = reader.GetInt32NullAsZero(prefix + "replypostindex");
            }

            if (reader.DoesFieldExist(prefix +"postindex"))
            {
                post.Index = reader.GetInt32NullAsZero(prefix + "postindex");
            }
            
            if (reader.DoesFieldExist(prefix +"prevSibling"))
            {
                post.PrevSibling = reader.GetInt32NullAsZero(prefix +"prevSibling");
            }
            if (reader.DoesFieldExist(prefix +"nextSibling"))
            {
                post.NextSibling = reader.GetInt32NullAsZero(prefix +"nextSibling");
            }
            if (reader.DoesFieldExist(prefix +"firstChild"))
            {
                post.FirstChild = reader.GetInt32NullAsZero(prefix +"firstChild");
            }
            if (reader.DoesFieldExist(prefix +"hidden"))
            {
                post.Hidden = (byte)reader.GetInt32NullAsZero(prefix +"hidden");
            }
            if (reader.DoesFieldExist(prefix +"subject"))
            {
                post.Subject = FormatSubject(reader.GetStringNullAsEmpty("subject"), (CommentStatus.Hidden)post.Hidden);
            }
            if (reader.DoesFieldExist(prefix + "datePosted") && reader[prefix + "datePosted"] != DBNull.Value)
            {
                post.DatePosted = new DateElement(reader.GetDateTime(prefix + "datePosted".ToString()));
            }
            if (reader.DoesFieldExist(prefix +"postStyle"))
            {
                post.Style =  (PostStyle.Style)reader.GetByteNullAsZero(prefix + "postStyle");
            }
            if (reader.DoesFieldExist(prefix +"text"))
            {
                post.Text = ThreadPost.FormatPost(reader.GetStringNullAsEmpty(prefix + "text"), (CommentStatus.Hidden)post.Hidden, true, applySkin);
            }
            if (reader.DoesFieldExist(prefix +"hostpageurl"))
            {
                post.HostPageUrl = reader.GetStringNullAsEmpty(prefix + "hostpageurl");
            }
            if (reader.DoesFieldExist(prefix +"commentforumtitle"))
            {
                post.CommentForumTitle = reader.GetStringNullAsEmpty(prefix + "commentforumtitle");
            }

            post.User = BBC.Dna.Objects.User.CreateUserFromReader(reader);

            #region Depreciated code
            /*
             * This code has been depreciated from forum.cpp ln 1066 as the functionality is no longer in use.
             // Add the event date if it has one!
		        bOk = bOk && AddDBXMLDateTag("eventdate",NULL,false,true);

		        // Get the Type of post we're looking at
		        bOk = bOk && AddDBXMLTag("type",NULL,false,true,&sPostType);

		        // Now see if we are an event or notice, if so put the taginfo in for the post
		        if (sPostType.CompareText("Notice") || sPostType.CompareText("Event"))
		        {
			        // We've got a notice or event! Get all the tag info
			        CTagItem TagItem(m_InputContext);
			        if (TagItem.InitialiseFromThreadId(ThreadID,m_SiteID,pViewer) && TagItem.GetAllNodesTaggedForItem())
			        {
				        TagItem.GetAsString(sPosts);
			        }
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:ThreadPost.cs


注:本文中的IDnaDataReader.GetByteNullAsZero方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。