Пример #1
0
        /// <summary>
        /// Gets all blog comments
        /// </summary>
        /// <returns>Blog comments</returns>
        public static BlogCommentCollection GetAllBlogComments()
        {
            DBBlogCommentCollection dbCollection = DBProviderManager <DBBlogProvider> .Provider.GetAllBlogComments();

            BlogCommentCollection collection = DBMapping(dbCollection);

            return(collection);
        }
Пример #2
0
        /// <summary>
        /// Gets a collection of blog comments by blog post identifier
        /// </summary>
        /// <param name="BlogPostID">Blog post identifier</param>
        /// <returns>A collection of blog comments</returns>
        public static BlogCommentCollection GetBlogCommentsByBlogPostID(int BlogPostID)
        {
            DBBlogCommentCollection dbCollection = DBProviderManager <DBBlogProvider> .Provider.GetBlogCommentsByBlogPostID(BlogPostID);

            BlogCommentCollection collection = DBMapping(dbCollection);

            return(collection);
        }
Пример #3
0
        private static BlogCommentCollection DBMapping(DBBlogCommentCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            BlogCommentCollection collection = new BlogCommentCollection();
            foreach (DBBlogComment dbItem in dbCollection)
            {
                BlogComment item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
Пример #4
0
        /// <summary>
        /// Gets all blog comments
        /// </summary>
        /// <returns>Blog comments</returns>
        public override DBBlogCommentCollection GetAllBlogComments()
        {
            DBBlogCommentCollection blogCommentCollection = new DBBlogCommentCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogCommentLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBBlogComment blogComment = GetBlogCommentFromReader(dataReader);
                    blogCommentCollection.Add(blogComment);
                }
            }

            return(blogCommentCollection);
        }
Пример #5
0
        private static BlogCommentCollection DBMapping(DBBlogCommentCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            var collection = new BlogCommentCollection();

            foreach (var dbItem in dbCollection)
            {
                var item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
Пример #6
0
        /// <summary>
        /// Gets a collection of blog comments by blog post identifier
        /// </summary>
        /// <param name="BlogPostID">Blog post identifier</param>
        /// <returns>A collection of blog comments</returns>
        public override DBBlogCommentCollection GetBlogCommentsByBlogPostID(int BlogPostID)
        {
            DBBlogCommentCollection blogCommentCollection = new DBBlogCommentCollection();

            if (BlogPostID == 0)
            {
                return(blogCommentCollection);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogCommentLoadByBlogPostID");

            db.AddInParameter(dbCommand, "BlogPostID", DbType.Int32, BlogPostID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBBlogComment blogComment = GetBlogCommentFromReader(dataReader);
                    blogCommentCollection.Add(blogComment);
                }
            }
            return(blogCommentCollection);
        }
Пример #7
0
        /// <summary>
        /// Gets all blog comments
        /// </summary>
        /// <returns>Blog comments</returns>
        public override DBBlogCommentCollection GetAllBlogComments()
        {
            DBBlogCommentCollection blogCommentCollection = new DBBlogCommentCollection();
            Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogCommentLoadAll");
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBBlogComment blogComment = GetBlogCommentFromReader(dataReader);
                    blogCommentCollection.Add(blogComment);
                }
            }

            return blogCommentCollection;
        }
Пример #8
0
 /// <summary>
 /// Gets a collection of blog comments by blog post identifier
 /// </summary>
 /// <param name="BlogPostID">Blog post identifier</param>
 /// <returns>A collection of blog comments</returns>
 public override DBBlogCommentCollection GetBlogCommentsByBlogPostID(int BlogPostID)
 {
     DBBlogCommentCollection blogCommentCollection = new DBBlogCommentCollection();
     if (BlogPostID == 0)
         return blogCommentCollection;
     Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
     DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogCommentLoadByBlogPostID");
     db.AddInParameter(dbCommand, "BlogPostID", DbType.Int32, BlogPostID);
     using (IDataReader dataReader = db.ExecuteReader(dbCommand))
     {
         while (dataReader.Read())
         {
             DBBlogComment blogComment = GetBlogCommentFromReader(dataReader);
             blogCommentCollection.Add(blogComment);
         }
     }
     return blogCommentCollection;
 }