本文整理汇总了C#中IDnaDataReader.GetTinyIntAsInt方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.GetTinyIntAsInt方法的具体用法?C# IDnaDataReader.GetTinyIntAsInt怎么用?C# IDnaDataReader.GetTinyIntAsInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDnaDataReader
的用法示例。
在下文中一共展示了IDnaDataReader.GetTinyIntAsInt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateLinkFromReader
public static Link CreateLinkFromReader(IDnaDataReader reader)
{
Link link = new Link();
link.Type = reader.GetStringNullAsEmpty("destinationtype");
link.LinkId = reader.GetInt32NullAsZero("linkid");
link.TeamId = reader.GetInt32NullAsZero("teamid");
link.Relationship = reader.GetStringNullAsEmpty("relationship");
link.Private = reader.GetTinyIntAsInt("private");
link.Description = reader.GetStringNullAsEmpty("linkdescription");
link.DateLinked = new DateElement(reader.GetDateTime("DateLinked"));
link.Submitter = new UserElement() { user = BBC.Dna.Objects.User.CreateUserFromReader(reader, "submitter") };
//Create appropriate URL from link type.
int destinationId = reader.GetInt32NullAsZero("DestinationID");
switch (link.Type)
{
case "article":
{
link.DnaUid = "A" + destinationId.ToString();
break;
}
case "userpage":
{
link.DnaUid = "U" + destinationId.ToString();
break;
}
case "category":
{
link.DnaUid = "C" + destinationId.ToString();
break;
}
case "forum":
{
link.DnaUid = "F" + destinationId.ToString();
break;
}
case "thread":
{
link.DnaUid = "T" + destinationId.ToString();
break;
}
case "posting":
{
link.DnaUid = "TP" + destinationId.ToString();
break;
}
default: // "club" )
{
link.DnaUid = "G" + destinationId.ToString();
break;
}
}
return link;
}
示例2: IncludeDistressMessage
private CommentInfo IncludeDistressMessage(IDnaDataReader reader, ISite site)
{
var commentInfo = new CommentInfo();
commentInfo.Created = new DateTimeHelper(DateTime.Parse(reader.GetDateTime("DmCreated").ToString()));
commentInfo.ID = reader.GetInt32NullAsZero("DmId");
commentInfo.User = DmUserFromReader(reader, site);
commentInfo.hidden = (CommentStatus.Hidden)reader.GetInt32NullAsZero("DmHidden");
if (reader.IsDBNull("DmPostStyle"))
{
commentInfo.PostStyle = PostStyle.Style.richtext;
}
else
{
commentInfo.PostStyle = (PostStyle.Style)reader.GetTinyIntAsInt("DmPostStyle");
}
commentInfo.Index = reader.GetInt32NullAsZero("DmPostIndex");
commentInfo.text = CommentInfo.FormatComment(reader.GetStringNullAsEmpty("DmText"),
commentInfo.PostStyle,
commentInfo.hidden,
commentInfo.User.Editor);
var 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);
return commentInfo;
}
示例3: 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;
}
示例4: 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;
}
示例5: RatingDataReaderAdapter
public RatingDataReaderAdapter(IDnaDataReader dataReader)
{
Value = dataReader.GetTinyIntAsInt("Rating");
MaxValue = dataReader.GetInt32("MaxValue");
}
示例6: GetEntryFromDataBase
/// <summary>
/// This method reads in the entry form the database and sets up all the member fields
/// </summary>
/// <param name="safeToCache">A flag to state whether or not this entry is safe to cache. Usually set to false whhen an error occures.</param>
/// <param name="failingGracefully">A flag that states whether or not this method is failing gracefully.</param>
static public ArticleInfo GetEntryFromDataBase(int entryId, IDnaDataReader reader, IDnaDataReaderCreator readerCreator)
{
ArticleInfo articleInfo = null;
// fetch all the lovely intellectual property from the database
// Make sure we got something back
if (reader.HasRows)
{
// Go though the results untill we get the main article
do
{
if (reader.GetInt32("IsMainArticle") == 1 )
{
articleInfo = new ArticleInfo();
// Now start reading in all the values for the entry
articleInfo.H2g2Id = reader.GetInt32("h2g2ID");
articleInfo.ForumId = reader.GetInt32("ForumID");
articleInfo.ModerationStatus = (BBC.Dna.Moderation.Utils.ModerationStatus.ArticleStatus)reader.GetInt32NullAsZero("ModerationStatus");
articleInfo.Status = ArticleStatus.GetStatus(reader.GetInt32("Status"));
articleInfo.DateCreated = new DateElement(reader.GetDateTime("DateCreated"));
articleInfo.LastUpdated = new DateElement(reader.GetDateTime("LastUpdated"));
articleInfo.PreProcessed = reader.GetInt32("PreProcessed");
articleInfo.SiteId = reader.GetInt32("SiteID");
articleInfo.Site = new ArticleInfoSite() { Id = articleInfo.SiteId };
//create children objects
articleInfo.PageAuthor = ArticleInfoPageAuthor.CreateListForArticle(articleInfo.H2g2Id, reader.GetInt32("Editor"), readerCreator);
articleInfo.RelatedMembers = ArticleInfoRelatedMembers.GetRelatedMembers(articleInfo.H2g2Id, readerCreator);
articleInfo.CrumbTrails = CrumbTrails.CreateArticleCrumbtrail(articleInfo.H2g2Id, readerCreator);
if (articleInfo.Status.Type == 3)
{//create Submittable if status = 3...
bool isSubmittable = (reader.GetTinyIntAsInt("Submittable")==1);
articleInfo.Submittable = ArticleInfoSubmittable.CreateSubmittable(readerCreator, articleInfo.H2g2Id, isSubmittable);
}
}
if (articleInfo != null)
{
break;//got the info so run
}
}
while (reader.Read());
}
return articleInfo;
}
示例7: CreateLinkXML
/// <summary>
/// CreateLinkXML from a dataReader.
/// Allows standard Link XML to be generated from different resultsets.
/// </summary>
/// <param name="dataReader"></param>
/// <param name="parent"></param>
/// <param name="createAuthorXML"></param>
/// <param name="createSubmitterXML"></param>
/// <returns></returns>
public void CreateLinkXML(IDnaDataReader dataReader, XmlNode parent, bool createSubmitterXML, bool createAuthorXML )
{
RootElement.RemoveAll();
String type = dataReader.GetStringNullAsEmpty("destinationtype");
XmlNode link = CreateElementNode("LINK");
AddAttribute(link, "TYPE", type);
AddAttribute(link, "LINKID", dataReader.GetInt32NullAsZero("linkid"));
AddAttribute(link, "TEAMID", dataReader.GetInt32NullAsZero("teamid"));
AddAttribute(link, "RELATIONSHIP", dataReader.GetStringNullAsEmpty("relationship"));
AddAttribute(link, "PRIVATE", dataReader.GetTinyIntAsInt("private"));
//Create appropriate URL from link type.
int destinationId = dataReader.GetInt32NullAsZero("DestinationID");
switch (type)
{
case "article" :
{
AddAttribute(link, "DNAUID", "A" + destinationId );
break;
}
case "userpage" :
{
AddAttribute(link, "DNAUID", "U" + destinationId);
break;
}
case "category" :
{
AddAttribute(link, "DNAUID", "C" + destinationId);
break;
}
case "forum" :
{
AddAttribute(link, "DNAUID", "F" + destinationId);
break;
}
case "thread" :
{
AddAttribute(link, "DNAUID", "T" + destinationId);
break;
}
case "posting" :
{
AddAttribute(link, "DNAUID", "TP" + destinationId);
break;
}
default : // "club" )
{
AddAttribute(link, "DNAUID", "G" + destinationId);
break;
}
}
//AddTextTag(link, "TITLE", dataReader.GetStringNullAsEmpty("title"));
AddTextTag(link, "DESCRIPTION", dataReader.GetStringNullAsEmpty("linkdescription"));
//Create Submitter XML if required .
if ( createSubmitterXML )
{
int submitterId = dataReader.GetInt32NullAsZero("submitterid");
if (submitterId > 0)
{
XmlNode submitterXML = AddElementTag(link, "SUBMITTER");
User submitter = new User(InputContext);
submitter.AddPrefixedUserXMLBlock(dataReader, submitterId, "submitter", submitterXML);
}
}
//Create author XML if required.
if (createAuthorXML)
{
int authorId = dataReader.GetInt32NullAsZero("authorid");
if (authorId > 0)
{
XmlNode authorXML = AddElementTag(link, "AUTHOR");
User author = new User(InputContext);
author.AddPrefixedUserXMLBlock(dataReader, authorId, "author", authorXML);
}
}
if (!dataReader.IsDBNull("datelinked"))
AddDateXml(dataReader.GetDateTime("datelinked"),link,"DATELINKED");
if ( !dataReader.IsDBNull("lastupdated") )
AddDateXml(dataReader.GetDateTime("lastupdated"),link,"LASTUPDATED");
XmlNode importXml = parent.OwnerDocument.ImportNode(link, true);
parent.AppendChild(importXml);
}
示例8: GetGroupedLinks
private void GetGroupedLinks(IDnaDataReader dataReader, XmlElement parent, int show)
{
string currentGroup = String.Empty;
string newGroup = String.Empty;
int count = show;
bool groupOpen = false;
XmlElement group = null;
do
{
newGroup = dataReader.GetStringNullAsEmpty("Type");
if (newGroup != currentGroup)
{
groupOpen = false;
}
if (!groupOpen)
{
groupOpen = true;
currentGroup = dataReader.GetStringNullAsEmpty("Type");
group = AddElementTag(parent, "GROUP");
AddAttribute(group, "CURRENT", dataReader.GetInt32NullAsZero("selected"));
AddTextTag(group, "NAME", currentGroup);
}
string type = dataReader.GetStringNullAsEmpty("DestinationType");
int objectID = dataReader.GetInt32NullAsZero("DestinationID");
XmlElement link = AddElementTag(group, "LINK");
AddAttribute(link, "TYPE", type);
AddAttribute(link, "LINKID", dataReader.GetInt32NullAsZero("linkID"));
AddAttribute(link, "TEAMID", dataReader.GetInt32NullAsZero("TeamID"));
AddAttribute(link, "RELATIONSHIP", StringUtils.EscapeAllXmlForAttribute(dataReader.GetStringNullAsEmpty("Relationship")));
switch (type)
{
case "article" :
{
AddAttribute(link, "DNAID", "A" + objectID.ToString());
break;
}
case "userpage" :
{
AddAttribute(link, "BIO", "U" + objectID.ToString());
break;
}
case "category" :
{
AddAttribute(link, "DNAID", "C" + objectID.ToString());
break;
}
case "forum" :
{
AddAttribute(link, "DNAID", "F" + objectID.ToString());
break;
}
case "thread" :
{
AddAttribute(link, "DNAID", "T" + objectID.ToString());
break;
}
case "posting" :
{
AddAttribute(link, "DNAID", "TP" + objectID.ToString());
break;
}
case "club" :
{
AddAttribute(link, "DNAID", "G" + objectID.ToString());
break;
}
default : // "external" :
{
AddAttribute(link, "URL", StringUtils.EscapeAllXmlForAttribute(dataReader.GetStringNullAsEmpty("URL")));
break;
}
}
AddAttribute(link, "PRIVATE", dataReader.GetTinyIntAsInt("Private"));
AddTextTag(link, "TITLE", dataReader.GetStringNullAsEmpty("Title"));
AddTextTag(link, "DESCRIPTION", dataReader.GetStringNullAsEmpty("LinkDescription"));
// Submitter, if we have one
if(dataReader.DoesFieldExist("SubmitterID"))
{
int submitterID = dataReader.GetInt32NullAsZero("SubmitterID");
XmlElement submitterTag = AddElementTag(link, "SUBMITTER");
AddIntElement(submitterTag, "USERID", submitterID);
//TODO Add all Submitter User fields to SP
//User submitter = new User(InputContext);
//submitter.AddPrefixedUserXMLBlock(dataReader, submitterID, "Submitter", submitterTag);
}
/*
//add information about a team which added the link:
CTeam team(m_InputContext);
if (team.GetAllTeamMembers(iTeamID))
{
CTDVString sTeam;
team.GetAsString(sTeam);
//.........这里部分代码省略.........
示例9: RatingCreateFromReader
/// <summary>
/// Creates a ratinginfo object
/// </summary>
/// <param name="reader">A reader with all information</param>
/// <returns>Rating Info object</returns>
public RatingInfo RatingCreateFromReader(IDnaDataReader reader, ISite site)
{
RatingInfo ratingInfo = new RatingInfo
{
Created = new DateTimeHelper(DateTime.Parse(reader.GetDateTime("Created").ToString())),
User = base.UserReadById(reader, site),
ID = reader.GetInt32NullAsZero("id"),
rating = reader.GetByte("rating")
};
ratingInfo.hidden = (CommentStatus.Hidden)reader.GetInt32NullAsZero("hidden");
if (reader.IsDBNull("poststyle"))
{
ratingInfo.PostStyle = PostStyle.Style.richtext;
}
else
{
ratingInfo.PostStyle = (PostStyle.Style)reader.GetTinyIntAsInt("poststyle");
}
ratingInfo.IsEditorPick = reader.GetBoolean("IsEditorPick");
ratingInfo.Index = reader.GetInt32NullAsZero("PostIndex");
//get complainant
Dictionary<string, string> replacement = new Dictionary<string, string>();
replacement.Add("sitename", site.SiteName);
replacement.Add("postid", ratingInfo.ID.ToString());
ratingInfo.ComplaintUri = UriDiscoverability.GetUriWithReplacments(BasePath, SiteList.GetSiteOptionValueString(site.SiteID, "General", "ComplaintUrl"), replacement);
replacement = new Dictionary<string, string>();
replacement.Add("RatingForumid", reader.GetString("forumuid"));
replacement.Add("sitename", site.SiteName);
ratingInfo.ForumUri = UriDiscoverability.GetUriWithReplacments(BasePath, UriDiscoverability.UriType.RatingsByRatingForumId, replacement);
replacement = new Dictionary<string, string>();
replacement.Add("parentUri", reader.GetString("parentUri"));
replacement.Add("postid", ratingInfo.ID.ToString());
ratingInfo.Uri = UriDiscoverability.GetUriWithReplacments(BasePath, UriDiscoverability.UriType.Comment, replacement);
//Get Editors Pick ( this should be expanded to include any kind of poll )
/*EditorsPick editorsPick = new EditorsPick(_dnaDiagnostics, _connection, _caching);
if (editorsPick.LoadPollResultsForItem(commentInfo.ID) && editorsPick.Id > 0)
{
commentInfo.EditorsPick = new EditorsPickInfo
{
Id = editorsPick.Id,
Response = editorsPick.Result
};
}*/
ratingInfo.text = CommentInfo.FormatComment(reader.GetString("text"), ratingInfo.PostStyle, ratingInfo.hidden, ratingInfo.User.Editor);
return ratingInfo;
}