AJH.CMS.Core.Data.ArticleDataMapper.GetParentArticles C# (CSharp) Method

GetParentArticles() static private method

static private GetParentArticles ( int CategoryID ) : List
CategoryID int
return List
        internal static List<Article> GetParentArticles(int CategoryID)
        {
            List<Article> colArticles = null;
            Article article = null;

            using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString))
            {
                SqlCommand sqlCommand = new SqlCommand(SN_ARTICLE_GET_PARENT_BY_CATEGORY, sqlConnection);
                sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter sqlParameter = null;
                sqlParameter = new SqlParameter(PN_ARTICLE_CATEGORY_ID, System.Data.SqlDbType.Int);
                sqlParameter.Direction = System.Data.ParameterDirection.Input;
                sqlParameter.Value = CategoryID;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlParameter = new SqlParameter(PublishDataMapper.PN_PUBLISH_MODULE_ID, System.Data.SqlDbType.Int);
                sqlParameter.Direction = System.Data.ParameterDirection.Input;
                sqlParameter.Value = (int)CMSEnums.Modules.Article;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlCommand.Connection.Open();
                using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
                {
                    colArticles = new List<Article>();
                    while (sqlDataReader.Read())
                    {
                        article = GetArticle(colArticles, sqlDataReader);
                        FillFromReader(article, sqlDataReader);
                    }

                    sqlDataReader.Close();
                    sqlCommand.Connection.Close();
                }
            }
            return colArticles;
        }