本文整理汇总了C#中IDnaDataReader类的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader类的具体用法?C# IDnaDataReader怎么用?C# IDnaDataReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDnaDataReader类属于命名空间,在下文中一共展示了IDnaDataReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCrumbtrailForItem
/// <summary>
/// This method creates the crumbtrail for a given item
/// </summary>
/// <param name="reader">The DnaDataReader that contains the crumbtrail result set.</param>
private void GetCrumbtrailForItem(IDnaDataReader reader)
{
XmlNode crumbtrailsNode = AddElementTag(RootElement, "CRUMBTRAILS");
bool startOfTrail = true;
XmlNode crumbtrailNode = 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)
{
crumbtrailNode = AddElementTag(crumbtrailsNode, "CRUMBTRAIL");
startOfTrail = false;
}
XmlNode ancestorNode = AddElementTag(crumbtrailNode, "ANCESTOR");
AddIntElement(ancestorNode, "NODEID", reader.GetInt32("NodeID"));
AddTextElement((XmlElement)ancestorNode, "NAME", reader.GetString("DisplayName"));
AddIntElement(ancestorNode, "TREELEVEL", treeLevel);
AddIntElement(ancestorNode, "NODETYPE", reader.GetInt32("Type"));
if (reader.Exists("RedirectNodeID") && !reader.IsDBNull("RedirectNodeID"))
{
XmlNode redirectNode = AddTextElement((XmlElement)ancestorNode, "REDIRECTNODE", reader.GetString("RedirectNodeName"));
AddAttribute(redirectNode,"ID", reader.GetInt32("RedirectNodeID"));
}
}
}
示例2: CreateNewUserEventActivity
static public SiteEvent CreateNewUserEventActivity(IDnaDataReader dataReader, IDnaDataReaderCreator creator)
{
SiteEvent siteEvent = null;
try
{
siteEvent = new SiteEvent();
siteEvent.SiteId = dataReader.GetInt32NullAsZero("siteid");
siteEvent.Date = new Date(dataReader.GetDateTime("DateCreated"));
siteEvent.Type = SiteActivityType.NewUserToSite;
siteEvent.ActivityData = XElement.Parse(
string.Format(DataFormat,
dataReader.GetInt32NullAsZero("user_userid"), dataReader.GetStringNullAsEmpty("user_username"),
dataReader.GetInt32NullAsZero("siteid"))
);
siteEvent.UserId = dataReader.GetInt32NullAsZero("user_userid");
siteEvent.SaveEvent(creator);
}
catch(Exception e)
{
siteEvent = null;
SiteEventsProcessor.SiteEventLogger.LogException(e);
}
return siteEvent;
}
示例3: CreatePostFromReader
public static Post CreatePostFromReader(IDnaDataReader reader)
{
Post post = new Post();
post.YourLastPost = reader.GetInt32NullAsZero("YourLastPost");
post.YourLastPostIndex = reader.GetInt32NullAsZero("YourLastPostIndex");
post.CountPosts = reader.GetInt32NullAsZero("CountPosts");
post.Thread = PostThreadInfo.CreatePostThreadInfoFromReader(reader);
if (reader["LastReply"] != DBNull.Value)
{
post.LastReply = new DateElement(reader.GetDateTime("LastReply"));
}
if (post.YourLastPost > 0)
{
if (reader["MostRecent"] != DBNull.Value)
{
post.MostRecent = new DateElement(reader.GetDateTime("MostRecent"));
}
}
post.SiteId = reader.GetInt32NullAsZero("SiteId");
post.Private = reader.GetInt32NullAsZero("Private");
post.HasReply = reader.GetInt32NullAsZero("Replies");
post.FirstPoster = new UserElement() { user = BBC.Dna.Objects.User.CreateUserFromReader(reader, "FirstPoster") };
return post;
}
示例4: 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);
}
}
示例5: CreateMockedDataBaseObjects
/// <summary>
/// Creates a mocked datareader and loads it with row data ready to replay
/// </summary>
/// <param name="mocks">The mock repository object that all the tests are running with</param>
/// <param name="procedureName">The name of the procedure you want to call</param>
/// <param name="creator">The new DataReaderCreator object</param>
/// <param name="reader">The new DataReader object</param>
/// <param name="testRowData">A list of test row data to load the reader with</param>
static public void CreateMockedDataBaseObjects(MockRepository mocks, string procedureName, out IDnaDataReaderCreator creator, out IDnaDataReader reader, List<TestDatabaseRow> testRowData)
{
reader = CreateMockedIDnaDataReader(mocks, testRowData);
creator = mocks.DynamicMock<IDnaDataReaderCreator>();
creator.Stub(x => x.CreateDnaDataReader(procedureName)).Return(reader);
mocks.ReplayAll();
}
示例6: CreateActivity
public static ISnesActivity CreateActivity(int activityType, IDnaDataReader currentRow)
{
CommentActivity activity;
if (currentRow.IsDBNull("BlogUrl"))
{
activity = PolicyInjection.Create<MessageBoardPostActivity>();
}
else
{
activity = PolicyInjection.Create<CommentForumActivity>();
}
activity.Contents = new OpenSocialActivity();
activity.ActivityId = currentRow.GetInt32("EventID");
activity.Application = currentRow.GetString("AppId") ?? "";
activity.ActivityType = GetActivityTypeVerb(activityType);
activity.IdentityUserId = currentRow.GetInt32("IdentityUserId");
activity.SetTitle(currentRow);
activity.SetObjectTitle(currentRow);
activity.SetObjectDescription(currentRow);
activity.SetObjectUri(currentRow);
activity.Contents.Type = "comment";
activity.Contents.Body = currentRow.GetString("Body") ?? "";
activity.Contents.PostedTime = currentRow.GetDateTime("ActivityTime").MillisecondsSinceEpoch();
activity.Contents.DisplayName = currentRow.GetString("displayName") ?? "";
activity.Contents.Username = currentRow.GetString("username") ?? "";
return activity;
}
示例7: CreateComplaintArticleEventActivity
static public SiteEvent CreateComplaintArticleEventActivity(IDnaDataReader dataReader, IDnaDataReaderCreator creator)
{
SiteEvent siteEvent = null;
try
{
siteEvent = new SiteEvent();
siteEvent.SiteId = dataReader.GetInt32NullAsZero("siteid");
siteEvent.Date = new Date(dataReader.GetDateTime("DateCreated"));
siteEvent.Type = SiteActivityType.ComplaintArticle;
var complainantUserName = dataReader.GetStringNullAsEmpty("complainantUserName");
if (String.IsNullOrEmpty(complainantUserName))
{
complainantUserName = "Anonymous";
}
siteEvent.ActivityData = XElement.Parse(
string.Format(DataFormat,
dataReader.GetInt32NullAsZero("complaintantID_userid"), complainantUserName,
dataReader.GetInt32NullAsZero("h2g2id"), dataReader.GetStringNullAsEmpty("subject"),
dataReader.GetStringNullAsEmpty("complainttext"))
);
siteEvent.UserId = 0;
siteEvent.SaveEvent(creator);
}
catch(Exception e)
{
siteEvent = null;
SiteEventsProcessor.SiteEventLogger.LogException(e);
}
return siteEvent;
}
示例8: 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;
}
示例9: BuildExModerationEvents
private IEnumerable<ExModerationEvent> BuildExModerationEvents(IDnaDataReader reader)
{
List<ExModerationEvent> activities = new List<ExModerationEvent>();
while (reader.Read())
{
activities.Add(ExModerationEvent.CreateExModerationEvent(reader));
}
return activities;
}
示例10: 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;
}
示例11: CreateProcessorForEmail
private EmailDetailsToProcess CreateProcessorForEmail(IDnaDataReader reader)
{
EmailDetailsToProcess emailToProcess = new EmailDetailsToProcess();
emailToProcess.ID = reader.GetInt32("ID");
emailToProcess.Subject = reader.GetString("Subject");
emailToProcess.Body = reader.GetString("Body");
emailToProcess.FromAddress = reader.GetString("FromEmailAddress");
emailToProcess.ToAddress = reader.GetString("ToEmailAddress");
return emailToProcess;
}
示例12: 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);
}
示例13: SetUp
public void SetUp()
{
// Create the mockery object
_mock = new Mockery();
// Now create a mocked DataReader. This will be returned by the mocked input context method CreateDnaDataReader
_mockedDataReader = _mock.NewMock<IDnaDataReader>();
// Ensure the Statistics object is initialised
Statistics.ResetCounters();
}
示例14: CreateExModerationEvent
public static ExModerationEvent CreateExModerationEvent(IDnaDataReader dataReader)
{
ExModerationEvent activity = PolicyInjection.Create<ExModerationEvent>();
activity.ModId = dataReader.GetInt32NullAsZero("modid");
activity.Notes = dataReader.GetString("notes") ?? "";
activity.Uri = dataReader.GetString("uri") ?? "";
activity.DateCompleted = dataReader.GetDateTime("datecompleted");
activity.Decision = dataReader.GetInt32NullAsZero("status");
activity.CallBackUri = dataReader.GetString("callbackuri") ?? "";
return activity;
}
示例15: SetUp
public void SetUp()
{
// Create the mockery object
_mock = new Mockery();
// Now create a mocked DataReader. This will be returned by the mocked input context method CreateDnaDataReader
_mockedDataReader = _mock.NewMock<IDnaDataReader>();
_mockedDiagnostics = _mock.NewMock<IDnaDiagnostics>();
Stub.On(_mockedDiagnostics).Method("WriteWarningToLog").Will(Return.Value(null));
// Ensure the Statistics object is initialised
Statistics.ResetCounters();
}