当前位置: 首页>>代码示例>>C#>>正文


C# IDnaDataReader.IsDBNull方法代码示例

本文整理汇总了C#中IDnaDataReader.IsDBNull方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.IsDBNull方法的具体用法?C# IDnaDataReader.IsDBNull怎么用?C# IDnaDataReader.IsDBNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDnaDataReader的用法示例。


在下文中一共展示了IDnaDataReader.IsDBNull方法的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;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:32,代码来源:CommentActivity.cs

示例2: 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")
                             };
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:17,代码来源:SnesEventDataReaderAdapter.cs

示例3: AddCommentForumListXML

        private void AddCommentForumListXML(IDnaDataReader dataReader, XmlNode commentForumList)
        {
            // start creating the comment forum structure
            XmlNode commentForum = CreateElementNode("COMMENTFORUM");
            AddAttribute(commentForum, "UID", dataReader.GetStringNullAsEmpty("uid"));
            AddAttribute(commentForum, "FORUMID", dataReader.GetInt32NullAsZero("forumID").ToString());
            AddAttribute(commentForum, "FORUMPOSTCOUNT", dataReader.GetInt32NullAsZero("forumpostcount").ToString());
            AddAttribute(commentForum, "FORUMPOSTLIMIT", InputContext.GetSiteOptionValueInt("Forum", "PostLimit"));
            AddAttribute(commentForum, "CANWRITE", dataReader.GetByteNullAsZero("CanWrite").ToString());
            AddAttribute(commentForum, "NOTSIGNEDINUSERID", dataReader.GetInt32NullAsZero("NotSignedInUserID").ToString());

            AddTextTag(commentForum, "HOSTPAGEURL", dataReader.GetStringNullAsEmpty("url"));
            AddTextTag(commentForum, "TITLE", dataReader.GetStringNullAsEmpty("title"));
            AddTextTag(commentForum, "MODSTATUS", dataReader.GetByteNullAsZero("ModerationStatus"));
            AddTextTag(commentForum, "SITEID", dataReader.GetInt32NullAsZero("siteid"));
            AddTextTag(commentForum, "FASTMOD", dataReader.GetInt32NullAsZero("fastmod"));
            AddTextTag(commentForum, "CONTACTEMAIL", dataReader.GetStringNullAsEmpty("encryptedcontactemail"));

            if (dataReader.DoesFieldExist("DateCreated") && !dataReader.IsDBNull("DateCreated"))
            {
                DateTime dateCreated = dataReader.GetDateTime("DateCreated");
                AddElement(commentForum, "DATECREATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateCreated));
            }

            if (dataReader.DoesFieldExist("ForumCloseDate") && !dataReader.IsDBNull("ForumCloseDate"))
            {
                DateTime closeDate = dataReader.GetDateTime("ForumCloseDate");
                AddElement(commentForum, "CLOSEDATE", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, closeDate));
            }

            if (dataReader.DoesFieldExist("LastUpdated") && !dataReader.IsDBNull("LastUpdated"))
            {
                DateTime dateLastUpdated = dataReader.GetDateTime("LastUpdated");
                AddElement(commentForum, "LASTUPDATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateLastUpdated));
            }

            int forumId = dataReader.GetInt32NullAsZero("forumID");
 
            AddXmlTextTag(commentForum, "TERMS", "");

            commentForumList.AppendChild(commentForum);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:42,代码来源:ContactFormListBuilder.cs

示例4: 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;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:49,代码来源:CrumbTrails.cs

示例5: 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"))
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:User.cs

示例6: 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;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:97,代码来源:Comments.cs

示例7: CreateUserFromReader


//.........这里部分代码省略.........
                
                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"))
            {
                user.Journal = reader.GetInt32NullAsZero(prefix + "Journal");
            }
            if (reader.Exists(prefix + "Active") && !reader.IsDBNull(prefix + "Active"))
            {
                user.Active = reader.GetBoolean(prefix + "Active");
            }
            if (reader.Exists(prefix + "DateLastNotified") && reader.GetValue(prefix + "DateLastNotified") != DBNull.Value)
            {
                user.DateLastNotified = new DateElement(reader.GetDateTime(prefix + "DateLastNotified"));
            }
            if (reader.Exists(prefix + "DateJoined") && reader.GetValue(prefix + "DateJoined") != DBNull.Value)
            {
                user.DateJoined = new DateElement(reader.GetDateTime(prefix + "DateJoined"));
            }
            if (reader.Exists(prefix + "ForumPostedTo"))
            {
                user.ForumPostedTo = reader.GetInt32NullAsZero(prefix + "ForumPostedTo");
            }
            if (reader.Exists(prefix + "Masthead"))
            {
                user.MastHead = reader.GetInt32NullAsZero(prefix + "Masthead");
            }
            if (reader.Exists(prefix + "SinBin"))
            {
                user.SinBin = reader.GetInt32NullAsZero(prefix + "SinBin");
            }
            if (reader.Exists(prefix + "ForumID"))
            {
                user.ForumId = reader.GetInt32NullAsZero(prefix + "ForumID");
            }
            var siteId = 0;
            if (reader.Exists("SiteID"))
            {
                siteId = reader.GetInt32NullAsZero("SiteID");
            }
            
            
            if (siteId != 0 && user.UserId != 0)
            {
                var userGroups = (UserGroups)SignalHelper.GetObject(typeof(UserGroups));
                var groupList = userGroups.GetUsersGroupsForSite(user.UserId, siteId);
                foreach (var group in groupList)
                {
                    user.Groups.Add(new Group(){Name = group.Name.ToUpper()});
                }
            }
            else
            {

            }
             

            return (User)user;
        
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:User.cs

示例8: AddCommentForumListXML

        /// <summary>
        /// Generates the individual Comment CommentBoxForum Xml within the Comment CommentBoxForum List xml page
        /// </summary>
        /// <param name="dataReader">SP containing the comment forums</param>
        /// <param name="commentForumList">Parent node to attach to</param>
        private void AddCommentForumListXML(IDnaDataReader dataReader, XmlNode commentForumList)
        {
            // start creating the comment forum structure
            XmlNode commentForum = CreateElementNode("COMMENTFORUM");
            AddAttribute(commentForum, "UID", dataReader.GetStringNullAsEmpty("uid"));
            AddAttribute(commentForum, "FORUMID", dataReader.GetInt32NullAsZero("forumID").ToString());
            AddAttribute(commentForum, "FORUMPOSTCOUNT", dataReader.GetInt32NullAsZero("forumpostcount").ToString());
            AddAttribute(commentForum, "FORUMPOSTLIMIT", InputContext.GetSiteOptionValueInt("Forum", "PostLimit"));
            AddAttribute(commentForum, "CANWRITE", dataReader.GetByteNullAsZero("CanWrite").ToString());
            AddAttribute(commentForum, "NOTSIGNEDINUSERID", dataReader.GetInt32NullAsZero("NotSignedInUserID").ToString());

            AddTextTag(commentForum, "HOSTPAGEURL", dataReader.GetStringNullAsEmpty("url"));
            AddTextTag(commentForum, "TITLE", dataReader.GetStringNullAsEmpty("title"));
            AddTextTag(commentForum, "MODSTATUS", dataReader.GetByteNullAsZero("ModerationStatus"));
            AddTextTag(commentForum, "SITEID", dataReader.GetInt32NullAsZero("siteid"));
            AddTextTag(commentForum, "FASTMOD", dataReader.GetInt32NullAsZero("fastmod"));

            if (dataReader.DoesFieldExist("DateCreated") && !dataReader.IsDBNull("DateCreated"))
            {
                DateTime dateCreated = dataReader.GetDateTime("DateCreated");
                AddElement(commentForum, "DATECREATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateCreated));
            }

            if (dataReader.DoesFieldExist("ForumCloseDate") && !dataReader.IsDBNull("ForumCloseDate"))
            {
                DateTime closeDate = dataReader.GetDateTime("ForumCloseDate");
                AddElement(commentForum, "CLOSEDATE", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, closeDate));
            }

            if (dataReader.DoesFieldExist("LastUpdated") && !dataReader.IsDBNull("LastUpdated"))
            {
                DateTime dateLastUpdated = dataReader.GetDateTime("LastUpdated");
                AddElement(commentForum, "LASTUPDATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateLastUpdated));
            }

            int forumId = dataReader.GetInt32NullAsZero("forumID");
            //get terms admin object
            TermsFilterAdmin termsAdmin = TermsFilterAdmin.CreateForumTermAdmin(InputContext.CreateDnaDataReaderCreator(), _cache, forumId);
            XmlDocument termNodeDoc = SerialiseToXmlDoc(termsAdmin);
            string termNodeText = termNodeDoc.DocumentElement.InnerXml.ToString();
            AddXmlTextTag(commentForum, "TERMS", termNodeText);

            commentForumList.AppendChild(commentForum);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:49,代码来源:CommentForumListBuilder.cs

示例9: TestNullableStringField

 void TestNullableStringField(IDnaDataReader reader, string fieldName, string expected)
 {
     if (reader.IsDBNull(fieldName))
         Assert.IsNull(expected);
     else
         Assert.AreEqual(expected, reader.GetString(fieldName));
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:7,代码来源:RiskModTests.cs

示例10: 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);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:96,代码来源:Link.cs

示例11: GetGroupedLinks


//.........这里部分代码省略.........
	            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);
		            sXML << sTeam;
	            }
                */

	            // Add author block if we have one
                if (dataReader.DoesFieldExist("AuthorID"))
                {
                    int authorID = dataReader.GetInt32NullAsZero("AuthorID");
                    XmlElement authorTag = AddElementTag(link, "AUTHOR");
                    AddIntElement(authorTag, "USERID", authorID);
                    //TODO Add all Author User fields to SP
                    //User author = new User(InputContext);
                    //author.AddPrefixedUserXMLBlock(dataReader, authorID, "Author", authorTag);
                }

                // Add LastUpdated
                if (dataReader.DoesFieldExist("LastUpdated") && !dataReader.IsDBNull("LastUpdated"))
                {
                    AddDateXml(dataReader, link, "LastUpdated", "LASTUPDATED");
                }
                count--;

            } while (dataReader.Read() && count > 0);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:Link.cs

示例12: ReadTopDateRangeRecord

        private void ReadTopDateRangeRecord(IDnaDataReader dataReader, ref DateRangeInfo drInfo)
        {
            dataReader.ExecuteDEBUGONLY("select top 1 * from articledaterange order by entryid desc");

            if (dataReader.Read())
            {
                drInfo.entryId= dataReader.GetInt32("EntryID");
                drInfo.startDate = dataReader.GetDateTime("StartDate");
                drInfo.endDate = dataReader.GetDateTime("EndDate");
                drInfo.timeIntervalNull = dataReader.IsDBNull("TimeInterval");
                if (!drInfo.timeIntervalNull)
                {
                    drInfo.timeInterval = dataReader.GetInt32("TimeInterval");
                }
            }
            else
            {
                Assert.Fail("Unable to read the ArticleDateRange table");
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:20,代码来源:TypedArticleTests.cs

示例13: GenerateAltIdentitiesXml

        private void GenerateAltIdentitiesXml(IDnaDataReader dataReader, XmlNode parentXml)
        {
            int postPassedCount = 0;
            int postFailedCount = 0;
            int postTotalCount = 0;
            int articlePassedCount = 0;
            int articleFailedCount = 0;
            int articleTotalCount = 0;

             // Add Result Data .
            while (dataReader.Read())
            {
                XmlNode memberXml = AddElementTag(parentXml,"MEMBERDETAILS");

                //AddUser XML
                XmlNode userXml = AddElementTag(memberXml, "USER");
                AddIntElement(userXml,"USERID", dataReader.GetInt32NullAsZero("userid"));
                AddTextTag(userXml, "USERNAME", dataReader.GetStringNullAsEmpty("username"));
                AddTextTag(userXml, "LOGINNAME", dataReader.GetStringNullAsEmpty("loginname"));
                AddTextTag(userXml, "EMAIL", dataReader.GetStringNullAsEmpty("email"));
                XmlNode statusXml = AddElementTag(userXml, "STATUS");
                AddAttribute(statusXml, "STATUSID", dataReader.GetInt32NullAsZero("prefstatus"));
                AddIntElement(userXml, "ACTIVE", Convert.ToInt32(dataReader.GetBoolean("active")));

                //Add Site XML.
                int siteId = dataReader.GetInt32NullAsZero("siteid");
                ISite site = InputContext.TheSiteList.GetSite(siteId);
                SiteXmlBuilder siteXmlBuilder = new SiteXmlBuilder(InputContext);
                XmlNode siteXML = siteXmlBuilder.GenerateXml(null, site);
                siteXML = ImportNode(siteXML);
                memberXml.AppendChild(siteXML);

                if (!dataReader.IsDBNull("datejoined"))
                {
                    AddDateXml(dataReader.GetDateTime("datejoined"), memberXml, "DATEJOINED");
                }
                
                //Add Stats XML
                AddIntElement(memberXml, "POSTPASSEDCOUNT", dataReader.GetInt32NullAsZero("postpassedcount"));
                AddIntElement(memberXml, "POSTFAILEDCOUNT", dataReader.GetInt32NullAsZero("postfailedcount"));
                AddIntElement(memberXml, "POSTTOTALCOUNT", dataReader.GetInt32NullAsZero("totalpostcount"));
                AddIntElement(memberXml, "ARTICLEPASSEDCOUNT", dataReader.GetInt32NullAsZero("articlepassedcount"));
                AddIntElement(memberXml, "ARTICLEFAILEDCOUNT", dataReader.GetInt32NullAsZero("articlefailedcount"));
                AddIntElement(memberXml, "ARTICLETOTALCOUNT", dataReader.GetInt32NullAsZero("totalarticlecount"));

                postPassedCount += dataReader.GetInt32NullAsZero("postpassedcount");
                postFailedCount += dataReader.GetInt32NullAsZero("postfailedcount");
                postTotalCount += dataReader.GetInt32NullAsZero("totalpostcount");
                articlePassedCount += dataReader.GetInt32NullAsZero("articlepassedcount");
                articleFailedCount += dataReader.GetInt32NullAsZero("articlefailedcount");
                articleTotalCount += dataReader.GetInt32NullAsZero("totalarticlecount");
            }

            //Add Member Details Summary XML
            XmlNode summaryXml = AddElementTag(parentXml, "SUMMARY");
            AddIntElement(summaryXml, "POSTPASSEDCOUNT", postPassedCount);
            AddIntElement(summaryXml, "POSTFAILEDCOUNT", postFailedCount);
            AddIntElement(summaryXml, "POSTTOTALCOUNT", postTotalCount);
            AddIntElement(summaryXml, "ARTICLEPASSEDCOUNT", articlePassedCount);
            AddIntElement(summaryXml,"ARTICLEFAILEDCOUNT",articleFailedCount);
            AddIntElement(summaryXml, "ARTICLETOTALCOUNT", articleTotalCount);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:62,代码来源:ModerationMemberDetails.cs

示例14: CreateList


//.........这里部分代码省略.........
                    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");
                        if (extraInfo != string.Empty)
                        {
                            XmlDocument extraInfoXml = new XmlDocument();
                            extraInfoXml.LoadXml(extraInfo);
                            article.AppendChild(ImportNode(extraInfoXml.FirstChild));
                        }

                        //TODO Use Extra Info Class will need to change SP to get out the guide entry Type
                        //ExtraInfo extraInfo = new ExtraInfo();
                        //extraInfo.TryCreate(dataReader.GetInt32NullAsZero("Type"), dataReader.GetStringNullAsEmpty("ExtraInfo"));
                        //AddInside(article, extraInfo);
                    }

                    if (dataReader.DoesFieldExist("ForumPostCount"))
                    {
                        AddIntElement(article, "FORUMPOSTCOUNT", dataReader.GetInt32NullAsZero("ForumPostCount"));
                        AddIntElement(article, "FORUMPOSTLIMIT", InputContext.GetSiteOptionValueInt("Forum", "PostLimit"));
                    }

                    if (dataReader.DoesFieldExist("StartDate") && !dataReader.IsDBNull("StartDate"))
                    {
                        AddDateXml(dataReader, article, "StartDate", "DATERANGESTART");
                    }
                    // Take a day from the end date as stored 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 stored 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.
                    if (dataReader.DoesFieldExist("EndDate") && !dataReader.IsDBNull("EndDate"))
                    {
                        AddDateXml(dataReader.GetDateTime("EndDate").AddDays(-1), article, "DATERANGEEND");
                    }

                    if (dataReader.DoesFieldExist("TimeInterval"))
                    {
                        AddIntElement(article, "TIMEINTERVAL", dataReader.GetInt32NullAsZero("TimeInterval"));
                    }

                    if (dataReader.DoesFieldExist("LASTPOSTED"))
                    {
                        AddDateXml(dataReader, article, "LASTPOSTED", "FORUMLASTPOSTED");
                    }
                    //////////


                    if (dataReader.DoesFieldExist("BookmarkCount"))
                    {
                        AddTextTag(article, "BOOKMARKCOUNT", dataReader.GetInt32NullAsZero("BookmarkCount"));
                    }

                    if (dataReader.DoesFieldExist("ZeitgeistScore"))
                    {
                        AddElement(article, "ZEITGEIST", "<SCORE>" + dataReader.GetDoubleNullAsZero("ZeitgeistScore") + "</SCORE>");
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:67,代码来源:ArticleList.cs

示例15: 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;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:57,代码来源:Reviews.cs


注:本文中的IDnaDataReader.IsDBNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。