本文整理汇总了C#中IDnaDataReader.Read方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.Read方法的具体用法?C# IDnaDataReader.Read怎么用?C# IDnaDataReader.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDnaDataReader
的用法示例。
在下文中一共展示了IDnaDataReader.Read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessAllowedURLListData
private void ProcessAllowedURLListData(IDnaDataReader dataReader)
{
int currentSiteID = 1;
int siteID = 1;
_allowedURLsList.Clear();
//For each row/site in the database add it's details
if (dataReader.Read())
{
siteID = dataReader.GetInt32NullAsZero("SiteID");
currentSiteID = siteID;
List<string> siteAllowedURLs = new List<string>();
string allowedURL = dataReader.GetStringNullAsEmpty("URL").ToLower();
siteAllowedURLs.Add(allowedURL);
while (dataReader.Read())
{
siteID = dataReader.GetInt32NullAsZero("SiteID");
if (siteID != currentSiteID)
{
_allowedURLsList.Add(currentSiteID, siteAllowedURLs);
siteAllowedURLs.Clear();
currentSiteID = siteID;
}
allowedURL = dataReader.GetStringNullAsEmpty("URL").ToLower();
siteAllowedURLs.Add(allowedURL);
}
_allowedURLsList.Add(currentSiteID, siteAllowedURLs);
}
}
示例2: BuildExModerationEvents
private IEnumerable<ExModerationEvent> BuildExModerationEvents(IDnaDataReader reader)
{
List<ExModerationEvent> activities = new List<ExModerationEvent>();
while (reader.Read())
{
activities.Add(ExModerationEvent.CreateExModerationEvent(reader));
}
return activities;
}
示例3: GetBIEvents
private List<BIEvent> GetBIEvents(IDnaDataReader reader)
{
List<BIEvent> biEventList = new List<BIEvent>();
while (reader.Read())
{
BIEvent be = BIEvent.CreateBiEvent(reader, this, RiskModSystem);
biEventList.Add(be);
}
return biEventList;
}
示例4: BuildRecentCommentsXml
private void BuildRecentCommentsXml(IDnaDataReader dataReader)
{
XmlNode recentComments = CreateElementNode("RECENTCOMMENTS");
//ForumPost post = new ForumPost();
if (dataReader.HasRows)
{
while (dataReader.Read())
{
ForumPost.AddPostXml(dataReader, this, recentComments, InputContext);
};
}
RootElement.AppendChild(recentComments);
}
示例5: BuildSnesEvents
private static IEnumerable<ISnesActivity> BuildSnesEvents(IDnaDataReader reader)
{
var activities = new List<ISnesActivity>();
reader.Execute();
if (reader.HasRows)
{
while (reader.Read())
{
activities.Add(SnesActivityFactory.CreateSnesActivity(SnesActivityLogger, reader));
}
}
return activities;
}
示例6: GetCrumbtrailForItem
/// <summary>
/// This method creates the crumbtrail for a given item
/// </summary>
/// <param name="reader">The DnaDataReader that contains the crumbtrail result set.</param>
static public CrumbTrails GetCrumbtrailForItem(IDnaDataReader reader)
{
CrumbTrails crumbTrialList = new CrumbTrails();
bool startOfTrail = true;
CrumbTrail crumbTrail = null;
while (reader.Read())
{
// Check to see if we're at the top level
int treeLevel = reader.GetInt32("TreeLevel");
if (treeLevel == 0)
{
startOfTrail = true;
}
// Check to see if we're starting a new trail
if (startOfTrail)
{
if (crumbTrail != null)
{//add the previous to the list
crumbTrialList.CrumbTrail.Add(crumbTrail);
}
//start new
crumbTrail = new CrumbTrail();
startOfTrail = false;
}
CrumbTrailAncestor ancestor = new CrumbTrailAncestor();
ancestor.Name = reader.GetString("DisplayName");
ancestor.NodeId = reader.GetInt32("NodeID");
ancestor.TreeLevel = treeLevel;
ancestor.NodeType = reader.GetInt32("Type");
if (reader.Exists("RedirectNodeID") && !reader.IsDBNull("RedirectNodeID"))
{
ancestor.RedirectNode = new CrumbTrialAncestorRedirect();
ancestor.RedirectNode.id = reader.GetInt32("RedirectNodeID");
ancestor.RedirectNode.value = reader.GetString("RedirectNodeName");
}
crumbTrail.Ancestor.Add(ancestor);
}
if (crumbTrail != null)
{//add the previous to the list
crumbTrialList.CrumbTrail.Add(crumbTrail);
}
return crumbTrialList;
}
示例7: GenerateCommentForumListXml
/// <summary>
/// Creates the XML fragment for the Comment CommentBoxForum List
/// </summary>
/// <param name="dataReader">The SP reader</param>
/// <param name="skip">Number of comment forums to skip</param>
/// <param name="show">Number of comment forums to show</param>
/// <param name="requestedSiteIDFilter">The requested Site Id filter if present</param>
/// <param name="requestedUrlFilter">The requested HostPageUrl filter if present</param>
public void GenerateCommentForumListXml(IDnaDataReader dataReader, int skip, int show, int requestedSiteIDFilter, string requestedUrlFilter)
{
XmlNode commentForumList = CreateElementNode("COMMENTFORUMLIST");
int commentForumListCount = 0;
if (dataReader.HasRows)
{
if (dataReader.Read())
{
commentForumListCount = dataReader.GetInt32NullAsZero("CommentForumListCount");
}
}
AddAttribute(commentForumList, "COMMENTFORUMLISTCOUNT", commentForumListCount);
AddAttribute(commentForumList, "SKIP", skip);
AddAttribute(commentForumList, "SHOW", show);
if (requestedUrlFilter == String.Empty)
{
AddAttribute(commentForumList, "REQUESTEDSITEID", requestedSiteIDFilter);
}
else
{
AddAttribute(commentForumList, "REQUESTEDURL", StringUtils.EscapeAllXmlForAttribute(requestedUrlFilter));
}
//int returnedCount = 20;
int actualForumListCount = 0;
if (commentForumListCount > 0)
{
do
{
AddCommentForumListXML(dataReader, commentForumList);
actualForumListCount++;
// returnedCount--;
} while (/*returnedCount > 0 &&*/ dataReader.Read());
}
//TODO: Move this to the right place
RootElement.AppendChild(commentForumList);
}
示例8: 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;
}
示例9: GetLatestPremodPostingsModId
int GetLatestPremodPostingsModId(IDnaDataReader reader)
{
reader.ExecuteWithinATransaction(@"SELECT top 1 * FROM PremodPostings order by modid desc");
reader.Read();
if (reader.HasRows)
return reader.GetInt32("ModId");
return -1;
}
示例10: GetLatestRiskModThreadEntryQueueId
int GetLatestRiskModThreadEntryQueueId(IDnaDataReader reader)
{
reader.ExecuteWithinATransaction(@"SELECT top 1 * FROM RiskModThreadEntryQueue order by RiskModThreadEntryQueueId desc");
reader.Read();
if (reader.HasRows)
return reader.GetInt32("RiskModThreadEntryQueueId");
return -1;
}
示例11: RiskMod_ProcessRiskAssessmentForThreadEntry
void RiskMod_ProcessRiskAssessmentForThreadEntry(IDnaDataReader reader, int riskModId, string isRisky, out int? newThreadId, out int? newThreadEntryId)
{
string sql = string.Format(@"
declare @ret int
exec @ret=riskmod_processriskassessmentforthreadentry @riskmodthreadentryqueueid={0}, @risky={1}
", riskModId, RiskyOrNotRisky(isRisky));
reader.ExecuteWithinATransaction(sql);
reader.Read();
if (reader.DoesFieldExist("ThreadId"))
{
newThreadId = reader.GetInt32("ThreadID");
newThreadEntryId = reader.GetInt32("PostID");
}
else
{
newThreadId = newThreadEntryId = null;
}
}
示例12: CreateNewSite
private static int CreateNewSite(IDnaDataReader reader, string urlname)
{
string sql = @"exec createnewsite @urlname = '"+urlname+"',"+
"@shortname = '"+urlname+"',"+
"@description = '"+urlname+"',"+
"@defaultskin = 'default',"+
"@skindescription = '',"+
"@skinset ='boards',"+
"@useframes =0,"+
"@premoderation = 0,"+
"@noautoswitch =0,"+
"@customterms = 0,"+
"@moderatorsemail = '[email protected]',"+
"@editorsemail = '[email protected]',"+
"@feedbackemail = '[email protected]',"+
"@automessageuserid = 245,"+
"@passworded = 0,"+
"@unmoderated = 0,"+
"@articleforumstyle =0,"+
"@threadorder =1,"+
"@threadedittimelimit = 0,"+
"@eventemailsubject = '',"+
"@eventalertmessageuserid = 254,"+
"@includecrumbtrail = 0,"+
"@allowpostcodesinsearch = 0,"+
"@ssoservice = null,"+
"@siteemergencyclosed = 0,"+
"@allowremovevote = 0,"+
"@queuepostings = 0,"+
"@modclassid = 1,"+
"@identitypolicy = 'http://identity/policies/dna/adult'";
reader.ExecuteDEBUGONLY(sql);
reader.Read();
int siteid = reader.GetInt32("siteid");
return siteid;
}
示例13: GenerateUsersArticleAssetsXML
private void GenerateUsersArticleAssetsXML(IDnaDataReader dataReader, MediaAssetParameters mediaAssetParams)
{
int count = 0;
int total = 0;
bool more = false;
XmlElement articleAsset = AddElementTag(_builderRoot, "ARTICLEMEDIAASSETINFO");
AddAttribute(articleAsset, "CONTENTTYPE", mediaAssetParams.ContentType);
AddAttribute(articleAsset, "SORTBY", mediaAssetParams.SortBy);
AddAttribute(articleAsset, "SKIPTO", mediaAssetParams.Skip);
AddAttribute(articleAsset, "SHOW", mediaAssetParams.Show);
AddTextElement(articleAsset, "ACTION", "showusersarticleswithassets");
if (dataReader.HasRows)
{
if (dataReader.Read())
{
User user = new User(InputContext);
user.AddUserXMLBlock(dataReader, mediaAssetParams.UserID, articleAsset);
count = dataReader.GetInt32NullAsZero("COUNT");
total = dataReader.GetInt32NullAsZero("TOTAL");
if (total > mediaAssetParams.Skip + mediaAssetParams.Show)
{
more = true;
}
do
{
XmlElement article = AddElementTag(articleAsset, "ARTICLE");
AddAttribute(article, "H2G2ID", dataReader.GetInt32NullAsZero("H2G2ID"));
AddTextElement(article, "SUBJECT", dataReader.GetStringNullAsEmpty("SUBJECT"));
XmlDocument extrainfo = new XmlDocument();
extrainfo.LoadXml(dataReader.GetStringNullAsEmpty("EXTRAINFO"));
article.AppendChild(ImportNode(extrainfo.FirstChild));
AddDateXml(dataReader, article, "DateCreated", "DATECREATED");
AddDateXml(dataReader, article, "LastUpdated", "LASTUPDATED");
MakeXml(dataReader, article);
} while (dataReader.Read());
}
}
AddAttribute(articleAsset, "COUNT", count);
AddAttribute(articleAsset, "TOTAL", total);
AddAttribute(articleAsset, "MORE", more);
}
示例14: CheckLatestThreadEntry
void CheckLatestThreadEntry(IDnaDataReader reader, int threadid, int forumid, int userid, int? nextSibling, int? parent, int? prevSibling, int? firstChild, int entryID, int? hidden, int postIndex, byte postStyle, string text)
{
reader.ExecuteWithinATransaction(@"SELECT top 1 * FROM ThreadEntries order by EntryID desc");
reader.Read();
Assert.AreEqual(threadid, reader.GetInt32("threadid"));
Assert.AreEqual(forumid, reader.GetInt32("forumid"));
Assert.AreEqual(userid, reader.GetInt32("userid"));
TestNullableIntField(reader, "nextSibling", nextSibling);
TestNullableIntField(reader, "parent", parent);
TestNullableIntField(reader, "prevSibling", prevSibling);
TestNullableIntField(reader, "firstChild", firstChild);
Assert.AreEqual(entryID, reader.GetInt32("entryID"));
TestNullableIntField(reader, "hidden", hidden);
Assert.AreEqual(postIndex, reader.GetInt32("postIndex"));
Assert.AreEqual(postStyle, reader.GetByte("postStyle"));
Assert.AreEqual(text, reader.GetString("text"));
}
示例15: CheckLatestThread
void CheckLatestThread(IDnaDataReader reader, int threadid, int forumid, byte canRead, byte canWrite, int siteid)
{
reader.ExecuteWithinATransaction(@"SELECT top 1 * FROM Threads order by ThreadID desc");
reader.Read();
Assert.AreEqual(threadid, reader.GetInt32("threadid"));
Assert.AreEqual(forumid, reader.GetInt32("forumid"));
Assert.AreEqual(canRead, reader.GetByte("canRead"));
Assert.AreEqual(canWrite, reader.GetByte("canWrite"));
Assert.AreEqual(siteid, reader.GetInt32("siteid"));
}