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


C# IDnaDataReader.GetInt32方法代码示例

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


在下文中一共展示了IDnaDataReader.GetInt32方法的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: SetProperties

        protected override void SetProperties(IDnaDataReader reader)
        {
            base.SetProperties(reader);

            ThreadEntryId = reader.GetNullableInt32("ThreadEntryId");
            ModClassId = reader.GetInt32("ModClassId");
            SiteId = reader.GetInt32("SiteId");
            ForumId = reader.GetInt32("ForumId");
            ThreadId = reader.GetNullableInt32("ThreadId");
            UserId = reader.GetInt32("UserId");
            DatePosted = reader.GetDateTime("DatePosted");
            Text = reader.GetString("text");
            RiskModThreadEntryQueueId = reader.GetInt32("RiskModThreadEntryQueueId");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:14,代码来源:BIPostNeedsRiskAssessmentEvent.cs

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

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

        private EmailDetailsToProcess CreateProcessorForEmail(IDnaDataReader reader)
        {
            EmailDetailsToProcess emailToProcess = new EmailDetailsToProcess();

            emailToProcess.ID = reader.GetInt32("ID");
            emailToProcess.Subject = reader.GetString("Subject");
            emailToProcess.Body = reader.GetString("Body");
            emailToProcess.FromAddress = reader.GetString("FromEmailAddress");
            emailToProcess.ToAddress = reader.GetString("ToEmailAddress");

            return emailToProcess;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:12,代码来源:DatabaseWorker.cs

示例6: CreateBiEvent

        public static BIEvent CreateBiEvent(IDnaDataReader reader, ITheGuideSystem theGuideSys, IRiskModSystem riskModSys)
        {
            EventTypes et = (EventTypes)reader.GetInt32("EventType");
            
            BIEvent be = null;

            switch (et)
            {
                case EventTypes.ET_POSTNEEDSRISKASSESSMENT: be = new BIPostNeedsRiskAssessmentEvent(theGuideSys, riskModSys); break;
                case EventTypes.ET_POSTTOFORUM:             be = new BIPostToForumEvent(riskModSys); break;
                case EventTypes.ET_MODERATIONDECISION_POST: be = new BIPostModerationDecisionEvent(riskModSys); break;

                default: throw new InvalidOperationException("Event Type " + et.ToString() + " not supported");
            }

            be.SetProperties(reader);

            return be;
        }   
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:19,代码来源:BIEvent.cs

示例7: SetProperties

        protected override void SetProperties(IDnaDataReader reader)
        {
            base.SetProperties(reader);

            ThreadEntryId = reader.GetInt32("ThreadEntryId");
            ModClassId = reader.GetInt32("ModClassId");
            SiteId = reader.GetInt32("SiteId");
            ForumId = reader.GetInt32("ForumId");
            ThreadId = reader.GetInt32("ThreadId");
            UserId = reader.GetInt32("UserId");
            NextSibling = reader.GetNullableInt32("NextSibling");
            Parent = reader.GetNullableInt32("Parent");
            PrevSibling = reader.GetNullableInt32("PrevSibling");
            FirstChild = reader.GetNullableInt32("FirstChild");
            DatePosted = reader.GetDateTime("DatePosted");
            Text = reader.GetString("text");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:17,代码来源:BIPostToForumEvent.cs

示例8: OpenSocialActivityDataReaderAdapter

        public OpenSocialActivityDataReaderAdapter(IDnaDataReader dataReader)
        {
            Body = dataReader.GetString("Body");

            PostedTime = dataReader.GetDateTime("ActivityTime").MillisecondsSinceEpoch();
            DisplayName = dataReader.GetString("displayName");
            ObjectTitle = dataReader.GetString("ObjectTitle");
            ObjectDescription =dataReader.GetString("Body");
            UserName = dataReader.GetString("Username");
            ApplicationActivityObjectId = dataReader.GetInt32("PostID");

            var appName = dataReader.GetString("DnaUrl") ?? "";

            ObjectUri = (dataReader.GetString("ObjectUriFormat") ?? "").FormatReplacementStrings(dataReader.GetInt32("ForumID"), 
                dataReader.GetInt32("ThreadID"), dataReader.GetInt32("PostID"), appName, dataReader.GetString("BlogUrl") ?? "", 
                dataReader.GetString("ObjectUri") ?? "");

            ContentPermaUrl = (dataReader.GetString("ContentPermaUrl") ?? "").FormatReplacementStrings(dataReader.GetInt32("ForumID"),
                dataReader.GetInt32("ThreadID"), dataReader.GetInt32("PostID"), appName, dataReader.GetString("BlogUrl") ?? "",
                dataReader.GetString("ObjectUri") ?? "");
                
            CustomActivityType = dataReader.GetString("CustomActivityType") ?? "";

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:24,代码来源:OpenSocialActivityDataReaderAdapter.cs

示例9: CreateContributionInternal

        private static Contribution CreateContributionInternal(IDnaDataReader reader)
        {
            Contribution contribution = new Contribution();

            // Make sure we got something back
            if (reader.HasRows && reader.Read()) 
            {
                contribution.Body = reader.GetStringNullAsEmpty("Body");
                contribution.PostIndex = reader.GetLongNullAsZero("PostIndex");
                contribution.SiteName = reader.GetStringNullAsEmpty("SiteName");
                contribution.SiteType = (SiteType)Enum.Parse(typeof(SiteType), reader.GetStringNullAsEmpty("SiteType"));
                contribution.SiteDescription = reader.GetStringNullAsEmpty("SiteDescription");
                contribution.SiteUrl = reader.GetStringNullAsEmpty("UrlName");
                contribution.FirstSubject = reader.GetStringNullAsEmpty("FirstSubject");
                contribution.Subject = reader.GetStringNullAsEmpty("Subject");
                contribution.Timestamp = new DateTimeHelper(reader.GetDateTime("TimeStamp"));
                contribution.Title = reader.GetStringNullAsEmpty("ForumTitle");
                contribution.ThreadEntryID = reader.GetInt32("ThreadEntryID");
                contribution.CommentForumUrl = reader.GetStringNullAsEmpty("CommentForumUrl");
                contribution.GuideEntrySubject = reader.GetStringNullAsEmpty("GuideEntrySubject");

                contribution.TotalPostsOnForum = reader.GetInt32NullAsZero("TotalPostsOnForum");
                contribution.AuthorUserId = reader.GetInt32NullAsZero("AuthorUserId");
                contribution.AuthorUsername = reader.GetStringNullAsEmpty("AuthorUsername");
                contribution.AuthorIdentityUsername = reader.GetStringNullAsEmpty("AuthorIdentityUsername");

                bool forumCanWrite = reader.GetByteNullAsZero("ForumCanWrite") == 1;
                bool isEmergencyClosed = reader.GetInt32NullAsZero("SiteEmergencyClosed") == 1;
                //bool isSiteScheduledClosed = reader2.GetByteNullAsZero("SiteScheduledClosed") == 1;

                DateTime closingDate = DateTime.MaxValue;
                if (reader.DoesFieldExist("forumclosedate") && !reader.IsDBNull("forumclosedate"))
                {
                    closingDate = reader.GetDateTime("forumclosedate");
                    contribution.ForumCloseDate = new DateTimeHelper(closingDate);
                }
                contribution.isClosed = (!forumCanWrite || isEmergencyClosed || (closingDate != null && DateTime.Now > closingDate));
            }
            else
            {
                throw ApiException.GetError(ErrorType.ThreadPostNotFound);
            }

            return contribution;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:45,代码来源:Contribution.cs

示例10: GetLatestRiskModThreadEntryQueueId

        int GetLatestRiskModThreadEntryQueueId(IDnaDataReader reader)
        {
            reader.ExecuteWithinATransaction(@"SELECT top 1 * FROM RiskModThreadEntryQueue order by RiskModThreadEntryQueueId desc");
            reader.Read();

            if (reader.HasRows)
                return reader.GetInt32("RiskModThreadEntryQueueId");

            return -1;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:10,代码来源:RiskModTests.cs

示例11: GetLatestPremodPostingsModId

        int GetLatestPremodPostingsModId(IDnaDataReader reader)
        {
            reader.ExecuteWithinATransaction(@"SELECT top 1 * FROM PremodPostings order by modid desc");
            reader.Read();

            if (reader.HasRows)
                return reader.GetInt32("ModId");

            return -1;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:10,代码来源:RiskModTests.cs

示例12: CheckLatestPremodPostings

        void CheckLatestPremodPostings(IDnaDataReader reader, int modId, int userid, int forumid, int? threadid, int? inReplyTo, string body, int postStyle, int siteid, byte isComment, int? riskModThreadEntryQueueId)
        {
            reader.ExecuteWithinATransaction(@"SELECT * FROM PremodPostings where ModId="+modId);
            reader.Read();

            // Nasty tweak.  With PremodPostings, when it creates a thread mod entry, it sets threadid=null and postid=0
            // posttoforuminternal returns 0 for both thread id and threadentry id, so here we're treating 0 as null
            threadid = NullIf(threadid, 0);

            Assert.AreEqual(userid, reader.GetInt32("userid"));
            Assert.AreEqual(forumid, reader.GetInt32("forumid"));
            TestNullableIntField(reader, "threadid", threadid);
            TestNullableIntField(reader, "inReplyTo", inReplyTo);
            Assert.AreEqual(body, reader.GetString("body"));
            Assert.AreEqual(postStyle, reader.GetInt32("postStyle"));
            Assert.AreEqual(siteid, reader.GetInt32("siteid"));
            Assert.AreEqual(isComment, reader.GetByte("isComment"));
            TestNullableIntField(reader, "riskModThreadEntryQueueId", riskModThreadEntryQueueId);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:19,代码来源:RiskModTests.cs

示例13: GetLatestThreadEntryId

        int GetLatestThreadEntryId(IDnaDataReader reader)
        {
            reader.ExecuteWithinATransaction(@"SELECT top 1 * FROM ThreadEntries order by EntryId desc");
            reader.Read();

            return reader.GetInt32("EntryId");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:7,代码来源:RiskModTests.cs

示例14: GetEntryFromDataBase

        /// <summary>
        /// This method reads in the entry form the database and sets up all the member fields
        /// </summary>
        /// <param name="safeToCache">A flag to state whether or not this entry is safe to cache. Usually set to false whhen an error occures.</param>
        /// <param name="failingGracefully">A flag that states whether or not this method is failing gracefully.</param>
        static public ArticleInfo GetEntryFromDataBase(int entryId, IDnaDataReader reader, IDnaDataReaderCreator readerCreator)
        {
            ArticleInfo articleInfo = null;
            // fetch all the lovely intellectual property from the database
            // Make sure we got something back
            if (reader.HasRows)
            {
                // Go though the results untill we get the main article
                do
                {
                    if (reader.GetInt32("IsMainArticle") == 1 ) 
                    {
                        articleInfo = new ArticleInfo();
                        // Now start reading in all the values for the entry
                        articleInfo.H2g2Id = reader.GetInt32("h2g2ID");
                        articleInfo.ForumId = reader.GetInt32("ForumID");
                        articleInfo.ModerationStatus = (BBC.Dna.Moderation.Utils.ModerationStatus.ArticleStatus)reader.GetInt32NullAsZero("ModerationStatus");

                        articleInfo.Status = ArticleStatus.GetStatus(reader.GetInt32("Status"));
                        articleInfo.DateCreated = new DateElement(reader.GetDateTime("DateCreated"));
                        articleInfo.LastUpdated = new DateElement(reader.GetDateTime("LastUpdated"));
                        articleInfo.PreProcessed = reader.GetInt32("PreProcessed");
                        articleInfo.SiteId = reader.GetInt32("SiteID");
                        articleInfo.Site = new ArticleInfoSite() { Id = articleInfo.SiteId };

                        //create children objects
                        articleInfo.PageAuthor = ArticleInfoPageAuthor.CreateListForArticle(articleInfo.H2g2Id, reader.GetInt32("Editor"), readerCreator);
                        articleInfo.RelatedMembers = ArticleInfoRelatedMembers.GetRelatedMembers(articleInfo.H2g2Id, readerCreator);
                        articleInfo.CrumbTrails = CrumbTrails.CreateArticleCrumbtrail(articleInfo.H2g2Id, readerCreator);
                        if (articleInfo.Status.Type == 3)
                        {//create Submittable if status = 3...
                            bool isSubmittable = (reader.GetTinyIntAsInt("Submittable")==1);
                            articleInfo.Submittable = ArticleInfoSubmittable.CreateSubmittable(readerCreator, articleInfo.H2g2Id, isSubmittable);
                        }
                        
                    }
                    if (articleInfo != null)
                    {
                        break;//got the info so run
                    }
                }
                while (reader.Read());
            }
            return articleInfo;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:50,代码来源:ArticleInfo.cs

示例15: CheckLatestThreadMod

        void CheckLatestThreadMod(IDnaDataReader reader, int forumid, int? threadid, int? postid, int? lockedby, int status, string notes, int siteid, byte isPremodPosting)
        {
            reader.ExecuteWithinATransaction(@"SELECT top 1 * FROM ThreadMod order by ModId desc");
            reader.Read();

            // Nasty tweak.  With PremodPostings, when it creates a thread mod entry, it sets threadid=null and postid=0
            // posttoforuminternal returns 0 for both thread id and threadentry id, so here we're treating 0 as null
            threadid = NullIf(threadid, 0);

            Assert.AreEqual(forumid, reader.GetInt32("forumid"));
            TestNullableIntField(reader, "threadid", threadid);
            TestNullableIntField(reader, "postid", postid);
            TestNullableIntField(reader, "lockedby", lockedby);
            Assert.AreEqual(status, reader.GetInt32("status"));
            TestNullableStringField(reader, "notes", notes);
            Assert.AreEqual(siteid, reader.GetInt32("siteid"));
            Assert.AreEqual(isPremodPosting,reader.GetByte("isPremodPosting"));
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:18,代码来源:RiskModTests.cs


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