Ejemplo n.º 1
0
        /// <summary>
        /// 获取精品文字评论
        /// </summary>
        /// <param name="articleID"></param>
        /// <returns></returns>
        public List <ArticleCommentModel> GetArticleCommentList(Guid articleID)
        {
            string strSql = string.Format("SELECT *,(SELECT CustomerName FROM dbo.Customer c WHERE c.CustomerID=a.CustomerID) as CustomerName,(SELECT Sex FROM dbo.Customer c WHERE c.CustomerID=a.CustomerID) as CustomerSex FROM dbo.ArticleComment a WHERE a.ArticleID='{0}' ORDER BY CreateDate DESC", articleID);
            List <ArticleCommentModel> list = new List <ArticleCommentModel>();

            using (SqlDataReader reader = DBHelper.GetDataReader(strSql.ToString()))
            {
                list = CommconHelper.ReaderToList <ArticleCommentModel>(reader).ToList();
                reader.Close();
            }
            return(list);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取用户自己发布的精品文字
        /// </summary>
        /// <param name="customerID"></param>
        /// <returns></returns>
        public List <ShortArticleModel> GetShortArticleByMy(Guid customerID)
        {
            string strSql = string.Format("SELECT *,(SELECT CustomerName FROM dbo.Customer c WHERE c.CustomerID=a.CustomerID) as CustomerName,(SELECT count(1) FROM [ArticleLike] l WHERE l.ArticleID=a.ArticleID) as LikeCount,(SELECT count(1) FROM [ArticleComment] c WHERE c.ArticleID=a.ArticleID) as CommentCount, (SELECT Sex FROM dbo.Customer c WHERE c.CustomerID=a.CustomerID) as CustomerSex FROM dbo.ShortArticle a WHERE a.CustomerID ='{0}' ORDER BY CreateDate DESC", customerID);
            List <ShortArticleModel> list = new List <ShortArticleModel>();

            using (SqlDataReader reader = DBHelper.GetDataReader(strSql.ToString()))
            {
                list = CommconHelper.ReaderToList <ShortArticleModel>(reader).ToList();
                reader.Close();
            }
            return(list);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取某个用户所有发布的精品文字
        /// </summary>
        /// <param name="customerID"></param>
        /// <returns></returns>
        public List <ShortArticleModel> GetShortArticleByCustomerID(Guid customerID)
        {
            string strSql = string.Format("SELECT * FROM dbo.ShortArticle WHERE CustomerID='{0}' ORDER BY CreateDate DESC", customerID);
            List <ShortArticleModel> list = new List <ShortArticleModel>();

            using (SqlDataReader reader = DBHelper.GetDataReader(strSql.ToString()))
            {
                list = CommconHelper.ReaderToList <ShortArticleModel>(reader).ToList();
                reader.Close();
            }
            return(list);
        }