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


C# IDnaDataReader.GetInt32NullAsZero方法代码示例

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


在下文中一共展示了IDnaDataReader.GetInt32NullAsZero方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

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

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

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

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

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

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

示例7: CreatePostThreadInfoFromReader

        public static PostThreadInfo CreatePostThreadInfoFromReader(IDnaDataReader reader)
        {
            PostThreadInfo postThreadInfo = new PostThreadInfo();
            postThreadInfo.ForumId = reader.GetInt32NullAsZero("ForumId");
            postThreadInfo.ThreadId = reader.GetInt32NullAsZero("ThreadId");
            string type = reader.GetStringNullAsEmpty("Type");
            if (type == "")
            {
                postThreadInfo.Type = 0;
            }
            else if (type == "Notice")
            {
                postThreadInfo.Type = 1;
            }
            else if (type == "Event")
            {
                postThreadInfo.Type = 2;
            }
            else 
            {
                postThreadInfo.Type = 3;
            }

            if (reader.DoesFieldExist("FirstPostId"))
            {
                postThreadInfo.FirstPostId = reader.GetInt32NullAsZero("FirstPostId");
            }
            if (reader["DateFirstPosted"] != DBNull.Value)
            {
                postThreadInfo.DateFirstPosted = new DateElement(reader.GetDateTime("DateFirstPosted"));
            }
            if (reader["LastReply"] != DBNull.Value)
            {
                postThreadInfo.ReplyDate = new DateElement(reader.GetDateTime("LastReply"));
            }

            postThreadInfo.Subject = reader.GetStringNullAsEmpty("FirstSubject");
            postThreadInfo.ForumTitle = reader.GetStringNullAsEmpty("ForumTitle");
            if (reader.DoesFieldExist("JournalUserID"))
            {
                postThreadInfo.Journal = new UserElement() { user = BBC.Dna.Objects.User.CreateUserFromReader(reader, "Journal") };
            }
            return postThreadInfo;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:44,代码来源:PostThreadInfo.cs

示例8: CreateArticleModerationDecisionActivity

        static public SiteEvent CreateArticleModerationDecisionActivity(IDnaDataReader dataReader, IDnaDataReaderCreator creator)
        {
            SiteEvent siteEventArticleModerationDecision = null;
            try
            {
                siteEventArticleModerationDecision = new SiteEvent();
                siteEventArticleModerationDecision.SiteId = dataReader.GetInt32NullAsZero("siteid");
                siteEventArticleModerationDecision.Date = new Date(dataReader.GetDateTime("DateCreated"));
            
                var statusId = dataReader.GetInt32NullAsZero("statusid");

                
                switch ((ModerationDecisionStatus)statusId)
                {
                    case ModerationDecisionStatus.Fail:
                        siteEventArticleModerationDecision.Type = SiteActivityType.ModerateArticleFailed;
                        siteEventArticleModerationDecision.ActivityData = XElement.Parse(
                            string.Format(DataFormatFailed, dataReader.GetInt32NullAsZero("h2g2id"),
                            dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
                            dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
                            dataReader.GetStringNullAsEmpty("ModReason")
                            ));

                        break;


                    case ModerationDecisionStatus.Referred:
                        siteEventArticleModerationDecision.Type = SiteActivityType.ModerateArticleReferred;
                        siteEventArticleModerationDecision.ActivityData = XElement.Parse(
                            string.Format(DataFormatReferred, dataReader.GetInt32NullAsZero("h2g2id"),
                            dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
                            dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
                            dataReader.GetStringNullAsEmpty("Notes"))
                            );
                        break;

                    default:
                        siteEventArticleModerationDecision = null;
                        break;
                }
                siteEventArticleModerationDecision.UserId = 0;
                siteEventArticleModerationDecision.SaveEvent(creator);
            }
            catch(Exception e)
            {
                siteEventArticleModerationDecision = null;
                SiteEventsProcessor.SiteEventLogger.LogException(e);
            }

            return siteEventArticleModerationDecision;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:51,代码来源:ArticleModerationDecision.cs

示例9: CreatePostFromReader

        /// <summary>
        /// Returns filled object from reader
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="prefix"></param>
        /// <returns></returns>
        static public SearchThreadPost CreatePostFromReader(IDnaDataReader reader, int postId, string[] searchTerms)
        {

            SearchThreadPost searchPost = new SearchThreadPost() { PostId = postId };
            ThreadPost.CreateThreadPostFromReader(reader, string.Empty, postId, (SearchThreadPost)searchPost, false);
            if (reader.DoesFieldExist("rank"))
            {
                searchPost.Rank = reader.GetInt32NullAsZero("rank");
            }
            searchPost.Rank = (searchPost.Rank * 100) / 200;//normalise to out of 100

            if (reader.DoesFieldExist("forumid"))
            {
                searchPost.ForumId = reader.GetInt32NullAsZero("forumid");
            }
            searchPost.Text = HtmlUtils.RemoveAllHtmlTags(searchPost.Text);
            searchPost.Text = FormatSearchPost(searchPost.Text, searchTerms);
            
            
            return searchPost;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:27,代码来源:SearchThreadPost.cs

示例10: GetTopicFromReader

        /// <summary>
        /// Gets the topic elements from the current reader.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        static public TopicElement GetTopicFromReader(IDnaDataReader reader)
        {
            var topicEdit = new TopicElement();
            topicEdit.TopicId = reader.GetInt32NullAsZero("topicid");
            topicEdit.H2G2Id = reader.GetInt32NullAsZero("h2g2ID");
            topicEdit.SiteId = reader.GetInt32NullAsZero("SiteID");
            topicEdit.TopicStatus = (TopicStatus)reader.GetInt32NullAsZero("TopicStatus");
            topicEdit.Title = reader.GetStringNullAsEmpty("TITLE");
            topicEdit.ForumId = reader.GetInt32NullAsZero("ForumID");
            topicEdit.Description = reader.GetStringNullAsEmpty("description");
            topicEdit.Position = reader.GetInt32NullAsZero("position");
            topicEdit.TopicLinkId = reader.GetInt32NullAsZero("topiclinkid");
            topicEdit.Createdby = new TopicCreatedDate
              {
                  CreatedDate = new DateElement(reader.GetDateTime("createddate")),
                  Username = reader.GetStringNullAsEmpty("CreatedByUserName"),
                  Userid = reader.GetInt32NullAsZero("CreatedByUserID")
              };

            topicEdit.Updatedby = new TopicLastUpdated()
            {
                LastUpdated = new DateElement(reader.GetDateTime("LastUpdated")),
                Username = reader.GetStringNullAsEmpty("UpdatedByUserName"),
                Userid = reader.GetInt32NullAsZero("UpdatedByUserID")
            };
            topicEdit.Style = reader.GetInt32NullAsZero("style");
            topicEdit.ForumPostCount = reader.GetInt32NullAsZero("forumpostcount");
            topicEdit.FrontPageElement.Elementid = reader.GetInt32NullAsZero("FP_ElementID");
            topicEdit.FrontPageElement.Position = reader.GetInt32NullAsZero("FP_Position");
            topicEdit.FrontPageElement.Title = reader.GetStringNullAsEmpty("FP_Title");
            topicEdit.FrontPageElement.TemplateElement = reader.GetInt32NullAsZero("FP_Template");
            topicEdit.FrontPageElement.Text = reader.GetStringNullAsEmpty("FP_Text");
            topicEdit.FrontPageElement.ImageName = reader.GetStringNullAsEmpty("FP_ImageName");
            topicEdit.FrontPageElement.ImageAltText = reader.GetStringNullAsEmpty("FP_ImageAltText");
            topicEdit.FrontPageElement.ForumPostCount = reader.GetInt32NullAsZero("forumpostcount");
            topicEdit.FrontPageElement.TopicId = reader.GetInt32NullAsZero("topicid");
            
            topicEdit.Fastmod = reader.GetInt32NullAsZero("fastmod");
            topicEdit.Editkey = reader.GetGuid("editkey");
            topicEdit.FrontPageElement.Editkey = reader.GetGuid("FP_EditKey");

            return topicEdit;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:48,代码来源:TopicElement.cs

示例11: GenerateSoloGuideEntriesXml

        /// <summary>
        /// With the returned data set generate the XML for the Solo Guide Entries page
        /// </summary>
        /// <param name="dataReader">Data set to turn into XML</param>
        /// <param name="skip">Number of items to skip</param>
        /// <param name="show">Number of items to show</param>
        /// <param name="action">Number of items to skip</param>
        /// <param name="userID">User ID</param>
        /// <param name="oldGroupID"></param>
        /// <param name="newGroupID"></param>
        /// <param name="refreshGroups"></param>
        private void GenerateSoloGuideEntriesXml(IDnaDataReader dataReader, int skip, int show, string action, int userID, int oldGroupID, int newGroupID, int refreshGroups)
        {
            int count = 0;

            XmlElement soloGuideEntriesUserList = AddElementTag(RootElement, "SOLOGUIDEENTRIES");
            AddAttribute(soloGuideEntriesUserList, "SKIP", skip);
            AddAttribute(soloGuideEntriesUserList, "SHOW", show);
            
            XmlElement actionXml = AddElementTag(soloGuideEntriesUserList, "ACTION");
            AddTextTag(actionXml, "ACTION", action);
            AddIntElement(actionXml, "USERID", userID);
            AddIntElement(actionXml, "OLDGROUPID", oldGroupID);
            AddIntElement(actionXml, "NEWGROUPID", newGroupID);
            AddIntElement(actionXml, "REFRESHGROUPS", refreshGroups);

            if (dataReader.HasRows)
            {
                if (dataReader.Read())
                {
                    XmlElement users = AddElementTag(soloGuideEntriesUserList, "SOLOUSERS");

                    do
                    {
                        int soloUserID = dataReader.GetInt32NullAsZero("UserID");
                        XmlElement soloEditedEntryUser = AddElementTag(users, "SOLOUSER");
                        User user = new User(InputContext);
                        user.AddUserXMLBlock(dataReader, soloUserID, soloEditedEntryUser);
                        AddIntElement(soloEditedEntryUser, "ENTRY-COUNT", dataReader.GetInt32NullAsZero("Count"));

                        count++;

                    } while (count < show && dataReader.Read());
                    if (dataReader.Read())
                    {
                        AddAttribute(soloGuideEntriesUserList, "MORE", 1);
                    }
                }
            }

            AddAttribute(soloGuideEntriesUserList, "COUNT", count);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:52,代码来源:SoloGuideEntries.cs

示例12: AddPollXml

        private void AddPollXml(IDnaDataReader dataReader, XmlNode article)
        {
            //<POLL POLLID="2311" POLLTYPE="3" HIDDEN="0">
            //    <STATISTICS AVERAGERATING="0.000000" VOTECOUNT="0" /> 
            //</POLL>

            int pollID = dataReader.GetInt32NullAsZero("CRPollID");
            if (pollID != 0)
            {
                XmlNode poll = CreateElementNode("POLL");
                AddAttribute(poll, "POLLID", pollID);
                AddAttribute(poll, "POLLTYPE", 3);
                AddAttribute(poll, "HIDDEN", 0);
                XmlNode statistics = CreateElementNode("STATISTICS");
                AddAttribute(statistics, "AVERAGERATING", dataReader.GetDoubleNullAsZero("CRAverageRating").ToString());
                AddAttribute(statistics, "VOTECOUNT", dataReader.GetInt32NullAsZero("CRVoteCount").ToString());
                poll.AppendChild(statistics);
                article.AppendChild(poll);
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:20,代码来源:ArticleSubscriptionList.cs

示例13: 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

示例14: DmUserFromReader

        private User DmUserFromReader(IDnaDataReader reader, ISite site)
        {
            var user = new User
            {
                UserId = reader.GetInt32NullAsZero("DmUserID"),
                DisplayName = reader.GetStringNullAsEmpty("DmUserName"),
                Editor = (reader.GetInt32NullAsZero("DmUserIsEditor") == 1),
                Status = reader.GetInt32NullAsZero("DmStatus"),

            };
            if (reader.DoesFieldExist("DmIdentityUserId"))
            {
                user.BbcId = reader.GetStringNullAsEmpty("DmIdentityUserId");
            }
            user.SiteSpecificDisplayName = string.Empty;
            if (SiteList.GetSiteOptionValueBool(site.SiteID, "User", "UseSiteSuffix"))
            {
                if (reader.DoesFieldExist("DmSiteSpecificDisplayName"))
                {
                    user.SiteSpecificDisplayName = reader.GetStringNullAsEmpty("SiteSpecificDisplayName");
                }
            }
            return user;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:24,代码来源:Comments.cs

示例15: 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


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