本文整理汇总了C#中IDnaDataReader.Exists方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.Exists方法的具体用法?C# IDnaDataReader.Exists怎么用?C# IDnaDataReader.Exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDnaDataReader
的用法示例。
在下文中一共展示了IDnaDataReader.Exists方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
if (reader.Exists("CCAddress"))
{
emailToProcess.CCAddress = reader.GetString("CCAddress");
}
return emailToProcess;
}
示例2: 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;
}
示例3: AddPrefixedUserXMLBlock
/// <summary>
/// Creates and adds the returned User Xml block to a given parent post node from the passed user parameters with a prefix
/// ie the field name of OwnerUserName, OwnerFirstNames
/// </summary>
/// <param name="dataReader">Data reader object</param>
/// <param name="userID">The users id</param>
/// <param name="prefix">The prefix of the field names for a different user in the same result set</param>
/// <param name="parent">The parent Node to add the user xml to</param>
/// <returns>XmlNode Containing user XML from the stored procedure</returns>
public void AddPrefixedUserXMLBlock(IDnaDataReader dataReader, int userID, string prefix, XmlNode parent)
{
string userName = "";
if (dataReader.Exists(prefix + "UserName"))
{
userName = dataReader.GetStringNullAsEmpty(prefix + "UserName");
}
else if (dataReader.Exists(prefix + "Name"))
{
userName = dataReader.GetStringNullAsEmpty(prefix + "Name");
}
if (userName == String.Empty)
{
userName = "Member " + userID.ToString();
}
string identityUserId = "";
if (dataReader.Exists(prefix + "identityUserId"))
{
identityUserId = dataReader.GetStringNullAsEmpty(prefix + "identityUserId");
}
string emailAddress = "";
if (dataReader.Exists(prefix + "Email"))
{
emailAddress = dataReader.GetStringNullAsEmpty(prefix + "Email");
}
double zeigeistScore = 0.0;
if (dataReader.DoesFieldExist(prefix + "ZeitgeistScore"))
{
zeigeistScore = dataReader.GetDoubleNullAsZero(prefix + "ZeitgeistScore");
}
string siteSuffix = "";
if (dataReader.Exists(prefix + "SiteSuffix"))
{
siteSuffix = dataReader.GetStringNullAsEmpty(prefix + "SiteSuffix");
}
string area = "";
if (dataReader.Exists(prefix + "Area"))
{
area = dataReader.GetStringNullAsEmpty(prefix + "Area");
}
string title = "";
if (dataReader.Exists(prefix + "Title"))
{
title = dataReader.GetStringNullAsEmpty(prefix + "Title");
}
int subQuota = 0;
if (dataReader.Exists(prefix + "SubQuota"))
{
subQuota = dataReader.GetInt32NullAsZero(prefix + "SubQuota");
}
int allocations = 0;
if (dataReader.Exists(prefix + "Allocations"))
{
allocations = dataReader.GetInt32NullAsZero(prefix + "Allocations");
}
int journal = 0;
if (dataReader.Exists(prefix + "Journal"))
{
journal = dataReader.GetInt32NullAsZero(prefix + "Journal");
}
bool isActive = false;
if (dataReader.Exists(prefix + "Active") && !dataReader.IsDBNull(prefix + "Active"))
{
isActive = dataReader.GetBoolean(prefix + "Active");
}
DateTime dateLastNotified = DateTime.MinValue;
if (dataReader.Exists(prefix + "DateLastNotified") && dataReader.GetValue(prefix + "DateLastNotified") != DBNull.Value)
{
dateLastNotified = dataReader.GetDateTime(prefix + "DateLastNotified");
}
DateTime dateJoined = DateTime.MinValue;
if (dataReader.Exists(prefix + "DateJoined") && dataReader.GetValue(prefix + "DateJoined") != DBNull.Value)
{
dateJoined = dataReader.GetDateTime(prefix + "DateJoined");
}
int forumPostedTo = -1;
if (dataReader.Exists(prefix + "ForumPostedTo"))
//.........这里部分代码省略.........
示例4: CreateUserFromReader
/// <summary>
/// Creates user object from given reader and user id
/// </summary>
/// <param name="reader"></param>
/// <param name="userID"></param>
/// <returns></returns>
static public User CreateUserFromReader(IDnaDataReader reader, string prefix)
{
//IUser user = new User(_dnaDataReaderCreator, _dnaDiagnostics, _cacheManager);
IUser user = new User();
if (reader.Exists(prefix + "userID"))
{
user.UserId = reader.GetInt32NullAsZero(prefix + "userID");
}
else if (reader.Exists(prefix + "ID"))
{
user.UserId = reader.GetInt32NullAsZero(prefix + "ID");
}
if (reader.Exists(prefix + "IdentityUserID"))
{
user.IdentityUserId = reader.GetStringNullAsEmpty(prefix + "IdentityUserId");
}
if (reader.Exists(prefix + "IdentityUserName"))
{
user.IdentityUserName = reader.GetStringNullAsEmpty(prefix + "IdentityUserName");
}
else if (reader.Exists(prefix + "LoginName"))
{
user.IdentityUserName = reader.GetStringNullAsEmpty(prefix + "LoginName");
}
/*
if (reader.Exists(prefix + "FirstNames"))
{
user.FirstNames = reader.GetStringNullAsEmpty(prefix + "FirstNames") ?? "";
}
if(reader.Exists(prefix + "LastName"))
{
user.LastName = reader.GetStringNullAsEmpty(prefix + "LastName") ?? "";
}
*/
if(reader.Exists(prefix + "Status"))
{
user.Status= reader.GetInt32NullAsZero(prefix + "Status");
}
if(reader.Exists(prefix + "TaxonomyNode"))
{
user.TaxonomyNode= reader.GetInt32NullAsZero(prefix + "TaxonomyNode");
}
if (reader.Exists(prefix + "UserName"))
{
user.UserName = reader.GetStringNullAsEmpty(prefix + "UserName") ?? "";
}
else if (reader.Exists(prefix + "Name"))
{
user.UserName = reader.GetStringNullAsEmpty(prefix + "Name") ?? "";
}
if (user.UserName == String.Empty)
{
user.UserName = "Member " + user.UserId.ToString();
}
/* NO NO not emails
* if (reader.Exists(prefix + "Email"))
{
user.Email = reader.GetStringNullAsEmpty(prefix + "Email") ?? "";
}
*/
if (reader.Exists(prefix + "SiteSuffix"))
{
user.SiteSuffix = reader.GetStringNullAsEmpty(prefix + "SiteSuffix") ?? "";
}
if (reader.Exists(prefix + "Area"))
{
user.Area = reader.GetStringNullAsEmpty(prefix + "Area") ?? "";
}
if (reader.Exists(prefix + "Title"))
{
user.Title = reader.GetStringNullAsEmpty(prefix + "Title") ?? "";
}
if (reader.Exists(prefix + "SubQuota"))
{
user.SubQuota = reader.GetInt32NullAsZero(prefix + "SubQuota");
}
if (reader.Exists(prefix + "Allocations"))
{
user.Allocations = reader.GetInt32NullAsZero(prefix + "Allocations");
}
if (reader.Exists(prefix + "Journal"))
//.........这里部分代码省略.........
示例5: 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"));
}
}
}
示例6: 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"))
{
//.........这里部分代码省略.........
示例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: ReadUserDetails
/// <summary>
/// Method for reading user data from user procedure calls
/// </summary>
/// <param name="reader">The StoredProcedure reader that contains the data</param>
private void ReadUserDetails(IDnaDataReader reader)
{
UserID = reader.GetInt32("userid");
UserName = reader.GetString("username");
IdentityUserID = reader.GetStringNullAsEmpty("IdentityUserID");
IdentityUserName = reader.GetStringNullAsEmpty("IdentityUserName");
_status = reader.GetInt32("status");
_prefStatus = reader.GetInt32("PrefStatus");
if (_status == 1)//normal global status
{
if (reader.GetInt32("PrefStatus") == 4)//banned
{
_status = 0;
}
}
//NO NO emails
Email = reader.GetString("email");
SiteSuffix = reader.GetStringNullAsEmpty("SiteSuffix");
LastSynchronisedDate = reader.GetDateTime("LastUpdatedDate");
if (reader.Exists("AcceptSubscriptions"))
{
AcceptSubscriptions = reader.GetBoolean("AcceptSubscriptions");
}
if (reader.Exists("SinBin"))
{
IsAutoSinBin = reader.GetInt32NullAsZero("SinBin");
}
//PrimarySiteId = reader.GetInt32NullAsZero("PrimarySiteId");
}