Exemple #1
0
 /// <summary>
 /// 获得前几行数据
 /// </summary>
 public IList <Wuyiju.Model.Article> GetList(Wuyiju.Model.Article.Query query, int?limit = null)
 {
     using (var db = new DataContext())
     {
         var _dao = this.GetDao(db);
         return(_dao.GetList(query, limit));
     }
 }
Exemple #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public IList <Wuyiju.Model.Article> GetList(Wuyiju.Model.Article.Query filter)
        {
            StringBuilder     sql   = new StringBuilder(@"select * from ec_article where 1 = 1 ");
            DynamicParameters param = new DynamicParameters();

            sql.AndEquals("cate_id").AndEquals("status").AndEquals("is_hot").AndEquals("is_best");

            if (filter != null)
            {
                param.AddDynamicParams(filter);
            }
            return(db.GetList <Wuyiju.Model.Article>(sql, param));
        }
Exemple #3
0
        public int TodayNewCount()
        {
            var today = DateTime.Now;
            var query = new Wuyiju.Model.Article.Query
            {
                StartDate = new DateTime(today.Year, today.Month, today.Day, 0, 0, 0),
                EndDate   = new DateTime(today.Year, today.Month, today.Day, 23, 59, 59)
            };

            using (var db = new DataContext())
            {
                var _dao = this.GetDao(db);
                return(_dao.GetCount(query));
            }
        }
Exemple #4
0
        public int GetCount(Wuyiju.Model.Article.Query query)
        {
            StringBuilder sql = new StringBuilder(@"select count(*) from ec_article where 1=1 ");

            sql.AndDateBetween("add_time", "startdate", "enddate");

            DynamicParameters param = new DynamicParameters();


            if (query != null)
            {
                param.AddDynamicParams(query);
            }

            return(db.ExecuteScalar <int>(sql.ToString(), param));
        }