public ActionResult GetList() { int pageindex = int.Parse(Request["PageIndex"]); int pagesize = int.Parse(Request["PageSize"]); string sqlcount = "select id from builds "; // = _baseExtensionB.GetModelsByValue(sqlstr, param); //多产品操作信息 QueryM queryM = new QueryM() { PageNum = pageindex, PageSize = pagesize, Where = "", Params = null }; List <Model.Content.Builds> builds = BD.GetListAsync(queryM); var totalCount = BD.GetModelsByValue(sqlcount, null); return(Json(new { list = builds, RowCount = totalCount.Count(), PageIndex = pageindex, PageCount = (int)Math.Ceiling(totalCount.Count() * 1.0 / 10) }, JsonRequestBehavior.DenyGet)); }
public List <T> GetListAsync(QueryM q) { try { var orderBy = q.OrderBy ?? _entityM.Identity + " DESC"; var where = string.IsNullOrEmpty(q.Where) ? "" : " " + q.Where; var str = $@"SELECT * FROM ( SELECT ROW_NUMBER() OVER(ORDER BY {orderBy}) AS rank, {string.Join(",", _entityM.Fields.Keys)} FROM {_entityM.TableFullName} {where} )a WHERE a.rank BETWEEN {(q.PageNum - 1) * q.PageSize+1} AND {q.PageSize*q.PageNum}"; return(_conn.Query <T>(str, q.Params) as List <T>); } catch (Exception) { return(null); } }
public List <T> GetListAsync(QueryM q) { return(_dao.GetListAsync(q)); }