本文整理汇总了C#中IDnaDataReader.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.GetString方法的具体用法?C# IDnaDataReader.GetString怎么用?C# IDnaDataReader.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDnaDataReader
的用法示例。
在下文中一共展示了IDnaDataReader.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: SnesEventDataReaderAdapter
public SnesEventDataReaderAdapter(IDnaDataReader dataReader)
{
Rating = dataReader.IsDBNull("Rating") ? null : new RatingDataReaderAdapter(dataReader);
AppInfo = new AppInfoDataReaderAdapter(dataReader);
ActivityType = dataReader.GetInt32("ActivityType");
EventId = dataReader.GetInt32("EventId");
IdentityUserId = dataReader.GetString("IdentityUserId");
BlogUrl = dataReader.IsDBNull("BlogUrl") ? null : dataReader.GetString("BlogUrl");
UrlBuilder = new DnaUrlBuilder
{
PostId = dataReader.GetInt32("PostId"),
ForumId = dataReader.GetInt32("ForumId"),
ThreadId = dataReader.GetInt32("ThreadId"),
DnaUrl = dataReader.GetString("DnaUrl")
};
}
示例5: SetProperties
protected override void SetProperties(IDnaDataReader reader)
{
base.SetProperties(reader);
ThreadEntryId = reader.GetNullableInt32("ThreadEntryId");
ModClassId = reader.GetInt32("ModClassId");
SiteId = reader.GetInt32("SiteId");
ForumId = reader.GetInt32("ForumId");
ThreadId = reader.GetNullableInt32("ThreadId");
UserId = reader.GetInt32("UserId");
DatePosted = reader.GetDateTime("DatePosted");
Text = reader.GetString("text");
RiskModThreadEntryQueueId = reader.GetInt32("RiskModThreadEntryQueueId");
}
示例6: SetProperties
protected override void SetProperties(IDnaDataReader reader)
{
base.SetProperties(reader);
ThreadEntryId = reader.GetInt32("ThreadEntryId");
ModClassId = reader.GetInt32("ModClassId");
SiteId = reader.GetInt32("SiteId");
ForumId = reader.GetInt32("ForumId");
ThreadId = reader.GetInt32("ThreadId");
UserId = reader.GetInt32("UserId");
NextSibling = reader.GetNullableInt32("NextSibling");
Parent = reader.GetNullableInt32("Parent");
PrevSibling = reader.GetNullableInt32("PrevSibling");
FirstChild = reader.GetNullableInt32("FirstChild");
DatePosted = reader.GetDateTime("DatePosted");
Text = reader.GetString("text");
}
示例7: 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;
}
示例8: 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"));
}
示例9: CheckRiskModThreadEntryQueue
void CheckRiskModThreadEntryQueue(IDnaDataReader reader, int? ThreadEntryId, char PublishMethod, bool? IsRisky, TestDate DateAssessed, int SiteId, int ForumId, int? ThreadId, int UserId, string UserName, int? InReplyTo, string Subject, string Text, byte PostStyle, string IPAddress, string BBCUID, DateTime EventDate, byte AllowEventEntries, int NodeId, int? QueueId, int ClubId, byte IsNotable, byte IsComment, string ModNotes, byte IsThreadedComment)
{
reader.ExecuteWithinATransaction(@"SELECT rm.*
FROM RiskModThreadEntryQueue rm
WHERE RiskModThreadEntryQueueId=" + GetLatestRiskModThreadEntryQueueId(reader));
reader.Read();
// Nasty tweak. The RiskModThreadEntryQueue table always stores undefined ThreadId and ThreadEntryId values
// as NULL. We treat zero values as NULL for comparision purposes
ThreadId = NullIf(ThreadId, 0);
ThreadEntryId = NullIf(ThreadEntryId, 0);
TestNullableIntField(reader, "ThreadEntryId", ThreadEntryId);
TestPublishMethod(reader, PublishMethod);
TestNullableBoolField(reader, "IsRisky", IsRisky);
TestNullableDateField(reader, "DateAssessed", DateAssessed);
Assert.AreEqual(SiteId,reader.GetInt32("SiteId"));
Assert.AreEqual(ForumId,reader.GetInt32("ForumId"));
TestNullableIntField(reader, "ThreadId", ThreadId);
Assert.AreEqual(UserId,reader.GetInt32("UserId"));
Assert.AreEqual(UserName, reader.GetString("UserName"));
TestNullableIntField(reader, "InReplyTo", InReplyTo);
Assert.AreEqual(Subject,reader.GetString("Subject"));
Assert.AreEqual(Text,reader.GetString("Text"));
Assert.AreEqual(PostStyle, reader.GetByte("PostStyle"));
Assert.AreEqual(IPAddress,reader.GetString("IPAddress"));
Assert.AreEqual(BBCUID,reader.GetGuidAsStringOrEmpty("BBCUID"));
//Assert.AreEqual(EventDate,reader.GetInt32("EventDate"));
Assert.AreEqual(AllowEventEntries,reader.GetByte("AllowEventEntries"));
//Assert.AreEqual(NodeId,reader.GetInt32("NodeId"));
TestNullableIntField(reader, "QueueId", QueueId);
Assert.AreEqual(ClubId,reader.GetInt32("ClubId"));
Assert.AreEqual(IsNotable, reader.GetByte("IsNotable"));
Assert.AreEqual(IsComment, reader.GetByte("IsComment"));
TestNullableStringField(reader, "ModNotes", ModNotes);
Assert.AreEqual(IsThreadedComment, reader.GetByte("IsThreadedComment"));
reader.Close();
}
示例10: MockCurrentRowDataReader
private static void MockCurrentRowDataReader(IDnaDataReader reader)
{
Expect.Call(reader.Execute()).Return(reader);
Expect.Call(reader.HasRows).Return(true);
var readReturn = new Queue<bool>();
readReturn.Enqueue(true);
readReturn.Enqueue(false);
Expect.Call(reader.Read()).Return(true).WhenCalled( x => x.ReturnValue = readReturn.Dequeue());
Expect.Call(reader.Dispose);
Expect.Call(reader.GetString("AppId")).Return("iPlayer");
Expect.Call(reader.GetString("IdentityUserId")).Return("0");
//Expect.Call(reader.GetInt32NullAsZero("PostId")).Repeat.Times(2).Return(1);
//Expect.Call(reader.GetStringNullAsEmpty("DnaUrl")).Return("http://www.bbc.co.uk/dna/");
//Expect.Call(reader.GetInt32NullAsZero("ForumID")).Repeat.Any().Return(1234);
//Expect.Call(reader.GetInt32NullAsZero("ThreadId")).Repeat.Any().Return(54321);
//Expect.Call(reader.GetInt32("ActivityType")).Repeat.Times(2).Return(5);
//Expect.Call(reader.GetInt32("EventID")).Return(1234);
//string appId = Guid.NewGuid().ToString();
//Expect.Call(reader.GetStringNullAsEmpty("AppId")).Return(appId);
//Expect.Call(reader.GetStringNullAsEmpty("Body")).Return("here is some text");
//DateTime now = new DateTime(1970, 1, 1, 0, 0, 0);
//Expect.Call(reader.GetDateTime("ActivityTime")).Return(now);
//Expect.Call(reader.GetInt32("IdentityUserId")).Return(12345456);
//Expect.Call(reader.GetStringNullAsEmpty("AppName")).Return("iPlayer");
//Expect.Call(reader.GetStringNullAsEmpty("BlogUrl")).Repeat.Times(2).Return("http://www.bbc.co.uk/blogs/test");
return;
}
示例11: CreateList
//.........这里部分代码省略.........
// scout info
int scoutID = dataReader.GetInt32NullAsZero("ScoutID");
XmlElement scoutTag = AddElementTag(article, "SCOUT");
user.AddPrefixedUserXMLBlock(dataReader, scoutID, "Scout", scoutTag);
}
if (dataReader.DoesFieldExist("SubEditorID"))
{
// sub editor info
int subEditorID = dataReader.GetInt32NullAsZero("SubEditorID");
XmlElement subEditorTag = AddElementTag(article, "SUBEDITOR");
user.AddPrefixedUserXMLBlock(dataReader, subEditorID, "SubEditor", subEditorTag);
}
if (dataReader.DoesFieldExist("Status"))
{
AddIntElement(article, "STATUS", dataReader.GetInt32NullAsZero("Status"));
}
if (dataReader.DoesFieldExist("RecommendationStatus"))
{
AddIntElement(article, "RECOMMENDATION-STATUS", dataReader.GetInt32NullAsZero("RecommendationStatus"));
}
if (dataReader.DoesFieldExist("SubbingStatus"))
{
AddIntElement(article, "SUBBING-STATUS", dataReader.GetInt32NullAsZero("SubbingStatus"));
}
if (dataReader.DoesFieldExist("Style"))
{
AddIntElement(article, "STYLE", dataReader.GetInt32NullAsZero("Style"));
}
if (dataReader.DoesFieldExist("Subject"))
{
AddTextTag(article, "SUBJECT", dataReader.GetStringNullAsEmpty("Subject"));
}
if (dataReader.DoesFieldExist("DateCreated"))
{
AddDateXml(dataReader, article, "DateCreated", "DATE-CREATED");
}
if (dataReader.DoesFieldExist("LastUpdated"))
{
AddDateXml(dataReader, article, "LastUpdated", "LASTUPDATED");
}
if (dataReader.DoesFieldExist("DateRecommended"))
{
AddDateXml(dataReader, article, "DateRecommended", "DATE-RECOMMENDED");
}
if (dataReader.DoesFieldExist("DecisionDate"))
{
AddDateXml(dataReader, article, "DecisionDate", "RECOMMENDATION-DECISION-DATE");
}
if (dataReader.DoesFieldExist("DateAllocated"))
{
AddDateXml(dataReader, article, "DateAllocated", "DATE-ALLOCATED");
}
if (dataReader.DoesFieldExist("DateReturned"))
{
AddDateXml(dataReader, article, "DateReturned", "DATE-RETURNED");
}
//TODO add Extra Info correctly
if (dataReader.DoesFieldExist("ExtraInfo"))
{
//Add Extra Info XML where it exists.
string extraInfo = dataReader.GetAmpersandEscapedStringNullAsEmpty("ExtraInfo");
示例12: 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;
}
示例13: 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;
}
示例14: TestNullableStringField
void TestNullableStringField(IDnaDataReader reader, string fieldName, string expected)
{
if (reader.IsDBNull(fieldName))
Assert.IsNull(expected);
else
Assert.AreEqual(expected, reader.GetString(fieldName));
}
示例15: GenerateArticleSearchXml
/// <summary>
/// With the returned data set generate the XML for the Article Search page
/// </summary>
/// <param name="dataReader">The returned search resultset</param>
/// <param name="asp">The Article Search Params</param>
private void GenerateArticleSearchXml(IDnaDataReader dataReader, ArticleSearchParams asp)
{
RootElement.RemoveAll();
XmlNode articleSearch = AddElementTag(RootElement, "ARTICLESEARCH");
AddAttribute(articleSearch, "CONTENTTYPE", asp.ContentType);
AddAttribute(articleSearch, "SORTBY", asp.SortBy);
AddAttribute(articleSearch, "SKIPTO", asp.Skip);
AddAttribute(articleSearch, "SHOW", asp.Show);
AddAttribute(articleSearch, "DATESEARCHTYPE", asp.DateSearchType);
AddAttribute(articleSearch, "TIMEINTERVAL", asp.TimeInterval);
AddAttribute(articleSearch, "ARTICLESTATUS", asp.ArticleStatus);
AddAttribute(articleSearch, "ARTICLETYPE", asp.ArticleType);
AddAttribute(articleSearch, "LATITUDE", asp.Latitude);
AddAttribute(articleSearch, "LONGITUDE", asp.Longitude);
AddAttribute(articleSearch, "RANGE", asp.Range);
AddAttribute(articleSearch, "POSTCODE", asp.PostCode);
AddAttribute(articleSearch, "PLACENAME", asp.Placename);
AddAttribute(articleSearch, "LOCATIONSEARCHTYPE", asp.LocationSearchType);
//Add the new descending order attribute
if (asp.DescendingOrder)
{
AddAttribute(articleSearch, "DESCENDINGORDER", 1);
}
else
{
AddAttribute(articleSearch, "DESCENDINGORDER", 0);
}
//Add the requested searchphraselist
GeneratePhraseXml(asp.SearchPhraseList, (XmlElement)articleSearch);
//Add Date Search Params if we are doing a date search
if (asp.DateSearchType != 0)
{
AddDateXml(asp.StartDate, articleSearch, "DATERANGESTART");
// Take a day from the end date as used in the database for UI purposes.
// E.g. User submits a date range of 01/09/1980 to 02/09/1980. They mean for this to represent 2 days i.e. 01/09/1980 00:00 - 03/09/1980 00:00.
// This gets used in the database but for display purposes we subtract a day from the database end date to return the
// original dates submitted by the user inorder to match their expectations.
AddDateXml(asp.EndDate.AddDays(-1), articleSearch, "DATERANGEEND");
}
AddTextTag(articleSearch, "FREETEXTSEARCH", asp.FreeTextSearchCondition);
XmlNode articles = AddElementTag(articleSearch, "ARTICLES");
int total = 0;
int count = 0;
//Generate Hot-List from Search Results.
PopularPhrases popularPhrases = null;
if (InputContext.GetSiteOptionValueBool("articlesearch", "generatepopularphrases"))
{
popularPhrases = new PopularPhrases();
}
if (dataReader.HasRows)
{
// process first results set: the Article Key phrase results set
Dictionary<int, ArrayList> articleKeyPhrases = new Dictionary<int, ArrayList>();
ArrayList phraselist = new ArrayList();
int h2g2ID = 0;
if (dataReader.Read())
{
int previousH2G2ID = 0;
do
{
h2g2ID = dataReader.GetInt32NullAsZero("H2G2ID");
if (h2g2ID != previousH2G2ID)
{
//New now have a new article so clean up the last one
if (previousH2G2ID != 0)
{
articleKeyPhrases.Add(previousH2G2ID, phraselist);
phraselist = new ArrayList();
}
}
//set the previous h2g2id to this one
previousH2G2ID = h2g2ID;
//Create fill an new Phrase object
Phrase nameSpacedPhrase = new Phrase();
String nameSpace = String.Empty;
String phraseName = dataReader.GetStringNullAsEmpty("phrase");
if (phraseName != String.Empty)
{
if (dataReader.Exists("namespace"))
{
//.........这里部分代码省略.........