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


C# IDnaDataReaderCreator.CreateDnaDataReader方法代码示例

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


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

示例1: HasGroupAlertOnItem

        /// <summary>
        /// Checks if an item has a group alert
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="groupId"></param>
        /// <param name="userId"></param>
        /// <param name="siteId"></param>
        /// <param name="itemType"></param>
        /// <param name="itemId"></param>
        static public void HasGroupAlertOnItem(IDnaDataReaderCreator readerCreator, ref int groupId, int userId, int siteId, EventItemTypes itemType, int itemId)
        {
            groupId =0;
            IDnaDataReader reader = null;
            switch (itemType)
            {
                case EventItemTypes.IT_FORUM: reader = readerCreator.CreateDnaDataReader("getforumgroupalertid"); reader.AddParameter("itemid", itemId); break;
                case EventItemTypes.IT_H2G2: reader = readerCreator.CreateDnaDataReader("getarticlegroupalertid"); reader.AddParameter("itemid", itemId); break;
                case EventItemTypes.IT_NODE: reader = readerCreator.CreateDnaDataReader("getnodegroupalertid"); reader.AddParameter("nodeid", itemId); break;
                case EventItemTypes.IT_THREAD: reader = readerCreator.CreateDnaDataReader("getthreadgroupalertid"); reader.AddParameter("threadid", itemId); break;
                case EventItemTypes.IT_CLUB: reader = readerCreator.CreateDnaDataReader("getclubgroupalertid"); reader.AddParameter("itemid", itemId); break;
                default: throw new NotImplementedException();
            }

            using (reader)
            {
                

                reader.AddParameter("userid", userId);
                reader.AddParameter("siteid", siteId);
                reader.Execute();
                if (reader.Read())
                {
                    groupId = reader.GetInt32NullAsZero("GroupID");
                }
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:36,代码来源:EmailAlertGroup.cs

示例2: GetChildArticles

        public static List<ArticleSummary> GetChildArticles(IDnaDataReaderCreator readerCreator, int nodeID, int siteID)
        {
 
            List<ArticleSummary> childArticles = new List<ArticleSummary>();
            using (IDnaDataReader reader = readerCreator.CreateDnaDataReader("getarticlesinhierarchynode"))
            {
                reader.AddParameter("nodeID", nodeID);
                reader.AddParameter("currentsiteid", siteID);
                reader.Execute();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ArticleSummary childArticle = new ArticleSummary();
                        childArticle.H2G2ID = reader.GetInt32NullAsZero("h2g2id");
                        childArticle.Name = reader.GetStringNullAsEmpty("subject");
                        childArticle.StrippedName = StringUtils.StrippedName(reader.GetStringNullAsEmpty("subject"));
                        childArticle.Type = Article.GetArticleTypeFromInt(reader.GetInt32NullAsZero("Type"));
                        childArticle.Editor = new UserElement() { user = User.CreateUserFromReader(reader, "editor")} ;
                        childArticle.DateCreated = new DateElement(reader.GetDateTime("datecreated"));
                        childArticle.LastUpdated = new DateElement(reader.GetDateTime("lastupdated")); ;
                        //childArticle.SortOrder = null;
                        childArticle.Status = ArticleStatus.GetStatus(reader.GetInt32NullAsZero("status"));
                        childArticles.Add(childArticle);
                    }
                }
            }
            return childArticles;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:29,代码来源:ArticleSummary.cs

示例3: CreateFromDatabase

        static public ReviewForum CreateFromDatabase(IDnaDataReaderCreator readerCreator, int id, bool isReviewForumID)
        {
            ReviewForum forum = new ReviewForum()
            {
                Id = id
            };

            using (IDnaDataReader reader = readerCreator.CreateDnaDataReader("fetchreviewforumdetails"))
            {
                if (isReviewForumID)
                {
                    reader.AddParameter("reviewforumid", id);
                }
                else
                {
                    reader.AddParameter("h2g2id", id);
                }

                reader.Execute();
                // Check to see if we found anything
                if (reader.HasRows && reader.Read())
                {
                    forum.Id = reader.GetInt32NullAsZero("ReviewForumID");
                    forum.ForumName = reader.GetStringNullAsEmpty("forumname");
                    forum.UrlFriendlyName = reader.GetStringNullAsEmpty("urlfriendlyname");
                    forum.H2g2Id = reader.GetInt32NullAsZero("h2g2id");
                    forum.SiteId = reader.GetInt32NullAsZero("siteid");
                    forum.IncubateTime = reader.GetInt32NullAsZero("IncubateTime");
                    forum.Recommendable= reader.GetByteNullAsZero("recommend");
                }
            }
            return forum;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:33,代码来源:ReviewForum.cs

示例4: CreateListForArticle

        static public ArticleInfoPageAuthor CreateListForArticle(int h2g2Id, int editorId, IDnaDataReaderCreator readerCreator)
        {

            ArticleInfoPageAuthor author = new ArticleInfoPageAuthor();
            
            // Create the datareader to get the authors
            using (IDnaDataReader reader = readerCreator.CreateDnaDataReader("getauthorsfromh2g2id"))
            {
                reader.AddParameter("h2g2ID", h2g2Id);
                reader.Execute();

                // Now go through all the results in turn
                int lastUserID = 0;
                while (reader.Read())
                {
                    // Get the current researcher
                    int researcherID = reader.GetInt32("UserID");
                    if (researcherID != lastUserID)
                    {
                        // Check to see if we've just got the editors results
                        User researcher = User.CreateUserFromReader(reader);
                        author.Researchers.Add(researcher);
                        if (researcherID == editorId)
                        {
                            author.Editor = new UserElement() { user = researcher };
                        }
                        lastUserID = researcherID;
                    }
                }
            }
            return author;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:32,代码来源:ArticleInfoPageAuthor.cs

示例5: CreateSubmittable

        static public ArticleInfoSubmittable CreateSubmittable(IDnaDataReaderCreator readerCreator, int h2g2Id, bool isSubmittable)
        {
            ArticleInfoSubmittable submittable = new ArticleInfoSubmittable();
            using (IDnaDataReader reader = readerCreator.CreateDnaDataReader("fetchreviewforummemberdetails"))
            {
                reader.AddParameter("h2g2id", h2g2Id);
                reader.Execute();

                if (reader.HasRows && reader.Read())
                {
                    
                    submittable.Forum = new SubmittableForum(){Id=reader.GetInt32("ForumID")};
                    submittable.Thread = new SubmittableThread() { Id = reader.GetInt32("ThreadID") };
                    submittable.Post = new SubmittablePost() { Id = reader.GetInt32("PostID") };
                    submittable.Type = "IN";
                    submittable.ReviewForum = ReviewForum.CreateFromDatabase(readerCreator, reader.GetInt32("ReviewForumID"), true);
                }
                else if (isSubmittable)
                {
                    submittable.Type = "YES";
                }
                else
                {
                    submittable.Type = "NO";
                }
            }
            return submittable;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:28,代码来源:ArticleInfoSubmittable.cs

示例6: UpdateTermForModClassId

        /// <summary>
        /// Calls the db and updates the term and action for a given modclassid
        /// </summary>
        /// <param name="readerCreator"></param>
        /// <param name="modClassId"></param>
        /// <param name="historyId"></param>
        public bool UpdateTermForModClassId(IDnaDataReaderCreator readerCreator, int modClassId, int historyId)
        {
            if (string.IsNullOrEmpty(Value))
            {//if empty then throw exception
                throw new Exception("Term value cannot be empty.");
            }
            if (historyId == 0)
            {//if empty then throw exception
                throw new Exception("HistoryId cannot be 0.");
            }
            if (modClassId == 0)
            {//if empty then throw exception
                throw new Exception("ModClassId cannot be 0.");
            }

            bool termUpdated = true;
            using (IDnaDataReader reader = readerCreator.CreateDnaDataReader("addtermsfilterterm"))
            {
                reader.AddParameter("term", Value);
                reader.AddParameter("actionId", (byte)Action);
                reader.AddParameter("modClassId", modClassId);
                reader.AddParameter("historyId", historyId);
                reader.Execute();

                if (reader.HasRows && reader.Read())
                {
                    termUpdated = reader.GetBoolean("termupdated");
                }
            }

            return termUpdated;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:38,代码来源:Term.cs

示例7: RegisterComplaint

        /// <summary>
        /// Registers complaint against post
        /// </summary>
        /// <param name="creator"></param>
        /// <param name="userId"></param>
        /// <param name="complaintText"></param>
        /// <param name="email"></param>
        /// <param name="postId"></param>
        /// <param name="verificationUid"></param>
        /// <param name="modId"></param>
        public static void RegisterComplaint(IDnaDataReaderCreator creator, int userId, String complaintText, 
            String email, int postId, string ipAddress, Guid bbcUid, out Guid verificationUid, out int modId)
        {
            verificationUid = Guid.Empty;
            modId = 0;
            using (IDnaDataReader dataReader = creator.CreateDnaDataReader("registerpostingcomplaint"))
            {
                dataReader.AddParameter("complainantid", userId);
                dataReader.AddParameter("correspondenceemail", email);
                dataReader.AddParameter("postid", postId);
                dataReader.AddParameter("complainttext", complaintText);
                dataReader.AddParameter("ipaddress", ipAddress);
                dataReader.AddParameter("bbcuid", bbcUid);

                //HashValue
                Guid hash = DnaHasher.GenerateHash(Convert.ToString(userId) + ":" + email + ":" + Convert.ToString(postId) + ":" + complaintText);
                dataReader.AddParameter("hash", hash);
                dataReader.Execute();

                // Send Email

                if (dataReader.Read())
                {
                    if (dataReader.DoesFieldExist("modId"))
                    {
                        modId = dataReader.GetInt32NullAsZero("modId");
                    }
                    if (dataReader.DoesFieldExist("verificationUid"))
                    {
                        verificationUid = dataReader.GetGuid("verificationUid");

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

示例8: LoadSmileys

        /// <summary>
        /// Load list of smileys which need to be replaced by Smiley XML.
        /// Generate XML replacements.
        /// Generate RegEx to match smiley shortcode.
        /// </summary>
        /// <returns></returns>
        public static void LoadSmileys(IDnaDataReaderCreator  creator)
        {
            Replacements.Clear();
            TagReplacements.Clear();
            IsInitialised = false;
            String regex = String.Empty;
            using (IDnaDataReader dataReader = creator.CreateDnaDataReader("getsmileylist"))
            {
                dataReader.Execute();
                while (dataReader.Read())
                {
                    String name = dataReader.GetStringNullAsEmpty("name");
                    String shorthand = dataReader.GetStringNullAsEmpty("tag");
                    
                    String replace = "<SMILEY TYPE='***' H2G2='Smiley#***'/>";
                    shorthand = StringUtils.EscapeAllXml(shorthand);
                    if (shorthand.IndexOf("&lt;") == 0)
                    {
                        TagReplacements.Add(shorthand, replace.Replace("***", name));
                    }
                    else
                    {
                        Replacements.Add(shorthand, replace.Replace("***", name));
                    }                   
                }
            }

            IsInitialised = true;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:35,代码来源:SmileyTranslator.cs

示例9: GetDatabaseVersion

 public static string GetDatabaseVersion(IDnaDataReaderCreator readerCreator)
 {
     using (var dataReader = readerCreator.CreateDnaDataReader("dna.DatabaseVersion"))
     {
         dataReader.Execute();
         dataReader.Read();
         var databaseVersion = dataReader.GetString("DatabaseVersion");
         return databaseVersion;
     }
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:10,代码来源:DatabaseVersion.cs

示例10: ProcessUserModatedEventActivity

 static public void ProcessUserModatedEventActivity(IDnaDataReaderCreator DataReaderCreator)
 {
     using (IDnaDataReader reader = DataReaderCreator.CreateDnaDataReader("getsiteevents_usermoderation"))
     {
         reader.Execute();
         while (reader.Read())
         {
             CreateUserModatedEventActivity(reader, DataReaderCreator);
         }
     }
     
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:12,代码来源:UserModeratedEvent.cs

示例11: SaveEvent

 /// <summary>
 /// Stores the event in the db...
 /// </summary>
 /// <param name="creator"></param>
 public void SaveEvent(IDnaDataReaderCreator creator)
 {
     using (IDnaDataReader reader = creator.CreateDnaDataReader("insertsiteactivityitem"))
     {
         reader.AddParameter("type", (int)Type);
         reader.AddParameter("activitydata", ActivityData.ToString());
         reader.AddParameter("datetime", Date.DateTime);
         reader.AddParameter("siteid", SiteId);
         reader.AddParameter("userid", UserId);
         reader.Execute();
     }
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:16,代码来源:SiteEvent.cs

示例12: ProcessArticleModerationDecisionActivity

 static public void ProcessArticleModerationDecisionActivity(IDnaDataReaderCreator DataReaderCreator)
 {
 //Get Article Moderation Events
         using (IDnaDataReader reader = DataReaderCreator.CreateDnaDataReader("getsiteevents_articlemoderationdecision"))
         {
             reader.Execute();
             while (reader.Read())
             {
                 ArticleModerationDecision.CreateArticleModerationDecisionActivity(reader, DataReaderCreator);
             }
         }
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:12,代码来源:ArticleModerationDecision.cs

示例13: ProcessComplaintArticleEventActivity

 static public void ProcessComplaintArticleEventActivity(IDnaDataReaderCreator DataReaderCreator)
 {
     using (IDnaDataReader reader = DataReaderCreator.CreateDnaDataReader("getsiteevents_complaintarticle"))
     {
         reader.Execute();
         while (reader.Read())
         {
             CreateComplaintArticleEventActivity(reader, DataReaderCreator);
         }
     }
     
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:12,代码来源:ComplaintArticleEvent.cs

示例14: ProcessNewUserEventActivity

 static public void ProcessNewUserEventActivity(IDnaDataReaderCreator DataReaderCreator)
 {
     using (IDnaDataReader reader = DataReaderCreator.CreateDnaDataReader("getsiteevents_newuser"))
     {
         reader.Execute();
         while (reader.Read())
         {
             CreateNewUserEventActivity(reader, DataReaderCreator);
         }
     }
     
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:12,代码来源:NewUserEvent.cs

示例15: CreateArticleCrumbtrail

        /// <summary>
        /// This method creates the Crumbtrail xml for a given article id
        /// </summary>
        /// <param name="h2g2ID">The id of the article you want to get the crumbtrail for</param>
        static public CrumbTrails CreateArticleCrumbtrail(int h2g2ID, IDnaDataReaderCreator readerCreator)
        {
            // Create the reader to get the details
            using (IDnaDataReader reader = readerCreator.CreateDnaDataReader("getarticlecrumbtrail"))
            {
                reader.AddParameter("h2g2ID", h2g2ID);
                reader.Execute();

                // Now create the crumbtrails from the results
                return GetCrumbtrailForItem(reader);
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:16,代码来源:CrumbTrails.cs


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