Beispiel #1
0
        /// <summary>
        /// 최근 아티클을 가져온다.
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public static ArticleBindModel GetRecentArticleList(int count)
        {
            SqlParameter[] param = { CreateInParam("@Count", SqlDbType.Int, 4, count) };

            SqlCommand       cmd       = GetSpCommand("UBA_GetRecentArticle", param);
            SqlDataReader    reader    = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ArticleBindModel bindModel = new ArticleBindModel();

            try
            {
                while (reader.Read())
                {
                    ArticleModel model = new ArticleModel();
                    FillArticle(reader, model);

                    bindModel.Add(model);

                    model = null;
                }
                return(bindModel);
            }
            catch (Exception ex)
            {
                throw new UmcDataException("UBA_GetRecentArticle 프로시져 호출중 에러", ex);
            }
            finally
            {
                ReleaseCommand(cmd);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 태그로 아티클을 가져온다.
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="pageCount"></param>
        /// <param name="tag"></param>
        /// <param name="publicArticle"></param>
        /// <returns></returns>
        public static ArticleBindModel GetArticleListByTag(string tag, bool publicArticle)
        {
            SqlParameter[] param =
            {
                CreateInParam("@Tag",           SqlDbType.VarChar, 50, tag),
                CreateInParam("@PublicArticle", SqlDbType.Bit,      1, publicArticle)
            };

            SqlCommand       cmd       = GetSpCommand("UBA_GetArticleListByTag", param);
            SqlDataReader    reader    = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ArticleBindModel bindModel = new ArticleBindModel();

            try
            {
                while (reader.Read())
                {
                    ArticleModel model = new ArticleModel();
                    FillArticle(reader, model);
                    bindModel.Add(model);

                    model = null;
                }

                return(bindModel);
            }
            finally
            {
                ReleaseCommand(cmd);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 검색 또는 페이지 별로 아티클을 가져온다.
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="pageCount"></param>
        /// <param name="searchMode"></param>
        /// <param name="searchKeyword"></param>
        /// <param name="publicArticle">공개포스트 true / 비공개 포스트포함 false</param>
        /// <returns></returns>
        public static ArticleBindModel GetArticleList(int currentPage, int pageCount, string searchMode, string searchKeyword, bool publicArticle)
        {
            SqlParameter[] param =
            {
                CreateInParam("@CurrentPage",   SqlDbType.Int,      4, currentPage),
                CreateInParam("@PageSize",      SqlDbType.Int,      4, pageCount),
                CreateInParam("@SearchMode",    SqlDbType.VarChar, 20, searchMode),
                CreateInParam("@SearchKeyword", SqlDbType.VarChar, 20, searchKeyword),
                CreateInParam("@PublicArticle", SqlDbType.Bit,      1, publicArticle)
            };

            SqlCommand       cmd       = GetSpCommand("UBA_GetArticleList", param);
            SqlDataReader    reader    = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ArticleBindModel bindModel = new ArticleBindModel();

            try
            {
                if (reader.Read())
                {
                    bindModel.TotalCount = (int)reader["Count"];
                }

                if (!reader.NextResult())
                {
                    return(bindModel);
                }

                while (reader.Read())
                {
                    ArticleModel model = new ArticleModel();
                    FillArticle(reader, model);

                    bindModel.Add(model);
                    model = null;
                }

                return(bindModel);
            }
            finally
            {
                ReleaseCommand(cmd);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 카테고리의 아티클 리스트를 가져온다
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static ArticleBindModel GetArticleList(CategoryNodeValue node)
        {
            SqlParameter[] param =
            {
                CreateInParam("@CategoryID",   SqlDbType.Int, 4, node.CategoryID),
                CreateInParam("@CategoryStep", SqlDbType.Int, 4, node.CategoryStep)
            };

            SqlCommand       cmd       = GetSpCommand("UBA_GetArticleListByCategoryID", param);
            SqlDataReader    reader    = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ArticleBindModel bindModel = new ArticleBindModel();

            try
            {
                while (reader.Read())
                {
                    ArticleModel model = new ArticleModel();

                    FillArticle(reader, model);

                    bindModel.Add(model);
                    model = null;
                }

                return(bindModel);
            }
            catch (Exception ex)
            {
                throw new UmcDataException("UBA_GetArticleListByCategoryID 프로시져 호출중 에러", ex);
            }
            finally
            {
                reader.Close();
                ReleaseCommand(cmd);
            }
        }