本文整理汇总了C#中IDnaDataReader.GetLongNullAsZero方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.GetLongNullAsZero方法的具体用法?C# IDnaDataReader.GetLongNullAsZero怎么用?C# IDnaDataReader.GetLongNullAsZero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDnaDataReader
的用法示例。
在下文中一共展示了IDnaDataReader.GetLongNullAsZero方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommentCreateFromReader
/// <summary>
/// Creates a commentinfo object
/// </summary>
/// <param name="reader">A reader with all information</param>
/// <param name="site">site information</param>
/// <returns>Comment info object</returns>
private CommentInfo CommentCreateFromReader(IDnaDataReader reader, ISite site)
{
var commentInfo = new CommentInfo
{
Created =
new DateTimeHelper(DateTime.Parse(reader.GetDateTime("Created").ToString())),
User = UserReadById(reader, site),
ID = reader.GetInt32NullAsZero("id")
};
commentInfo.hidden = (CommentStatus.Hidden) reader.GetInt32NullAsZero("hidden");
if (reader.IsDBNull("poststyle"))
{
commentInfo.PostStyle = PostStyle.Style.richtext;
}
else
{
commentInfo.PostStyle = (PostStyle.Style) reader.GetTinyIntAsInt("poststyle");
}
commentInfo.IsEditorPick = reader.GetBoolean("IsEditorPick");
commentInfo.Index = reader.GetInt32NullAsZero("PostIndex");
//get complainant
var replacement = new Dictionary<string, string>();
replacement.Add("sitename", site.SiteName);
replacement.Add("postid", commentInfo.ID.ToString());
commentInfo.ComplaintUri = UriDiscoverability.GetUriWithReplacments(BasePath,
SiteList.GetSiteOptionValueString(site.SiteID, "General", "ComplaintUrl"),
replacement);
replacement = new Dictionary<string, string>();
replacement.Add("commentforumid", reader.GetString("forumuid"));
replacement.Add("sitename", site.SiteName);
commentInfo.ForumUri = UriDiscoverability.GetUriWithReplacments(BasePath,
UriDiscoverability.UriType.CommentForumById,
replacement);
replacement = new Dictionary<string, string>();
replacement.Add("parentUri", reader.GetString("parentUri"));
replacement.Add("postid", commentInfo.ID.ToString());
commentInfo.Uri = UriDiscoverability.GetUriWithReplacments(BasePath, UriDiscoverability.UriType.Comment,
replacement);
if(reader.DoesFieldExist("nerovalue"))
{
commentInfo.NeroRatingValue = reader.GetInt32NullAsZero("nerovalue");
}
if (reader.DoesFieldExist("neropositivevalue"))
{
commentInfo.NeroPositiveRatingValue = reader.GetInt32NullAsZero("neropositivevalue");
}
if (reader.DoesFieldExist("neronegativevalue"))
{
commentInfo.NeroNegativeRatingValue = reader.GetInt32NullAsZero("neronegativevalue");
}
if (reader.DoesFieldExist("tweetid"))
{
commentInfo.TweetId = reader.GetLongNullAsZero("tweetid");
}
commentInfo.text = CommentInfo.FormatComment(reader.GetStringNullAsEmpty("text"), commentInfo.PostStyle, commentInfo.hidden, commentInfo.User.Editor);
if (reader.DoesFieldExist("twitterscreenname"))
{
commentInfo.TwitterScreenName = reader.GetStringNullAsEmpty("twitterscreenname");
}
if (reader.DoesFieldExist("retweetid"))
{
commentInfo.RetweetId = reader.GetLongNullAsZero("retweetid");
}
if (reader.DoesFieldExist("retweetedby"))
{
commentInfo.RetweetedBy = reader.GetStringNullAsEmpty("retweetedby");
}
if (reader.DoesFieldExist("DmID"))
{
if (reader.IsDBNull("DmID") == false)
{
commentInfo.DistressMessage = IncludeDistressMessage(reader, site);
}
}
return commentInfo;
}
示例2: 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;
}