• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDnaDataReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetCrumbtrailForItem

        /// <summary>
        /// This method creates the crumbtrail for a given item
        /// </summary>
        /// <param name="reader">The DnaDataReader that contains the crumbtrail result set.</param>
        private void GetCrumbtrailForItem(IDnaDataReader reader)
        {
            XmlNode crumbtrailsNode = AddElementTag(RootElement, "CRUMBTRAILS");
            bool startOfTrail = true;
            XmlNode crumbtrailNode = null;
            while (reader.Read())
            {
                // Check to see if we're at the top level
                int treeLevel = reader.GetInt32("TreeLevel");
                if (treeLevel == 0)
                {
                    startOfTrail = true;
                }
                
                // Check to see if we're starting a new trail
                if (startOfTrail)
                {
                    crumbtrailNode = AddElementTag(crumbtrailsNode, "CRUMBTRAIL");
                    startOfTrail = false;
                }

                XmlNode ancestorNode = AddElementTag(crumbtrailNode, "ANCESTOR");
                AddIntElement(ancestorNode, "NODEID", reader.GetInt32("NodeID"));
                AddTextElement((XmlElement)ancestorNode, "NAME", reader.GetString("DisplayName"));
                AddIntElement(ancestorNode, "TREELEVEL", treeLevel);
                AddIntElement(ancestorNode, "NODETYPE", reader.GetInt32("Type"));
                if (reader.Exists("RedirectNodeID") && !reader.IsDBNull("RedirectNodeID"))
                {
                    XmlNode redirectNode = AddTextElement((XmlElement)ancestorNode, "REDIRECTNODE", reader.GetString("RedirectNodeName"));
                    AddAttribute(redirectNode,"ID", reader.GetInt32("RedirectNodeID"));
                }
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:37,代码来源:Category.cs


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


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


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


示例5: CreateMockedDataBaseObjects

 /// <summary>
 /// Creates a mocked datareader and loads it with row data ready to replay
 /// </summary>
 /// <param name="mocks">The mock repository object that all the tests are running with</param>
 /// <param name="procedureName">The name of the procedure you want to call</param>
 /// <param name="creator">The new DataReaderCreator object</param>
 /// <param name="reader">The new DataReader object</param>
 /// <param name="testRowData">A list of test row data to load the reader with</param>
 static public void CreateMockedDataBaseObjects(MockRepository mocks, string procedureName, out IDnaDataReaderCreator creator, out IDnaDataReader reader, List<TestDatabaseRow> testRowData)
 {
     reader = CreateMockedIDnaDataReader(mocks, testRowData);
     creator = mocks.DynamicMock<IDnaDataReaderCreator>();
     creator.Stub(x => x.CreateDnaDataReader(procedureName)).Return(reader);
     mocks.ReplayAll();
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:15,代码来源:DataReaderFactory.cs


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


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


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


示例9: BuildExModerationEvents

 private IEnumerable<ExModerationEvent> BuildExModerationEvents(IDnaDataReader reader)
 {
     List<ExModerationEvent> activities = new List<ExModerationEvent>();
     while (reader.Read())
     {
         activities.Add(ExModerationEvent.CreateExModerationEvent(reader));
     }
     
     return activities;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:10,代码来源:ExModerationProcessor.cs


示例10: GetBIEvents

        private List<BIEvent> GetBIEvents(IDnaDataReader reader)
        {
            List<BIEvent> biEventList = new List<BIEvent>();
            while (reader.Read())
            {
                BIEvent be = BIEvent.CreateBiEvent(reader, this, RiskModSystem);
                biEventList.Add(be);
            }

            return biEventList;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:11,代码来源:TheGuideSystem.cs


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


示例12: BuildRecentCommentsXml

 private void BuildRecentCommentsXml(IDnaDataReader dataReader)
 {
     XmlNode recentComments = CreateElementNode("RECENTCOMMENTS");
     //ForumPost post = new ForumPost();
     if (dataReader.HasRows)
     {
         while (dataReader.Read())
         {
             ForumPost.AddPostXml(dataReader, this, recentComments, InputContext);
         };
     }
     RootElement.AppendChild(recentComments);
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:RecentCommentForumPostsBuilder.cs


示例13: SetUp

        public void SetUp()
        {
            // Create the mockery object
            _mock = new Mockery();

            // Now create a mocked DataReader. This will be returned by the mocked input context method CreateDnaDataReader
            _mockedDataReader = _mock.NewMock<IDnaDataReader>();

           

            // Ensure the Statistics object is initialised
            Statistics.ResetCounters();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:StatusComponentTest.cs


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


示例15: SetUp

        public void SetUp()
        {
            // Create the mockery object
            _mock = new Mockery();

            // Now create a mocked DataReader. This will be returned by the mocked input context method CreateDnaDataReader
            _mockedDataReader = _mock.NewMock<IDnaDataReader>();
            _mockedDiagnostics = _mock.NewMock<IDnaDiagnostics>();
            Stub.On(_mockedDiagnostics).Method("WriteWarningToLog").Will(Return.Value(null));

            // Ensure the Statistics object is initialised
            Statistics.ResetCounters();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:NewPollContentRatingTests.cs


示例16: BuildSnesEvents

 private static IEnumerable<ISnesActivity> BuildSnesEvents(IDnaDataReader reader)
 {
     var activities = new List<ISnesActivity>();
     reader.Execute();
     if (reader.HasRows)
     {
         while (reader.Read())
         {
             activities.Add(SnesActivityFactory.CreateSnesActivity(SnesActivityLogger, reader));
         }
     }
     return activities;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:SnesActivityProcessor.cs


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


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


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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDnaDataReaderCreator类代码示例发布时间:2022-05-24
下一篇:
C# IDisposable类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap