コード例 #1
0
ファイル: ArticleDal.cs プロジェクト: joleye/1.6
 //下一篇
 public ArticleInfo getnextnews(int articleId)
 {
     ArticleInfo li = new ArticleInfo();
     return li;
 }
コード例 #2
0
ファイル: ArticleDal.cs プロジェクト: joleye/1.6
        /// <summary>
        /// 根据类型读取资讯列表
        /// </summary>
        /// <param name="classId"></param>
        /// <returns></returns>
        public List<ArticleInfo> get_list(int classId,int page,int pagesize)
        {
            DataTable dt;
            if (classId > 0)
            {
                DataSet ds = DataSetPageFind("VIEW_article","id desc", page, pagesize, "classid", classId);
                dt = ds.Tables[0];
                j_getcount = findcount("article", "classId=" + classId);
            }
            else
            {
                DataSet ds = DataSetPageFind("VIEW_article", "id desc", page, pagesize);
                dt = ds.Tables[0];
                j_getcount = findcount("article");
            }
            List<ArticleInfo> li = new List<ArticleInfo>();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ArticleInfo info = new ArticleInfo();
                    info.ArticleTitle = dr["ArticleTitle"].ToString();
                    info.content = dr["Content"].ToString();
                    info.classId = int.Parse(dr["classId"].ToString());
                    //info.DefaultImgUrl = dr["defaultImgUrl"].ToString();
                    info.id = int.Parse(dr["id"].ToString());
                    info.className = dr["className"].ToString();
                    info.createDate = cdate(dr["createDate"].ToString());
                    info.UpdateDate = cdate(dr["updateDate"].ToString());
                    li.Add(info);
                }

            }

            return li;
        }