Ejemplo n.º 1
0
        public IEnumerable <T> FindByCause(string orderby, string where = "", object parmeters = null)
        {
            var type        = typeof(T);
            var propMapping = type.Mapping();
            var dxQueryable = new DxQueryable <T>(propMapping);

            dxQueryable.Where(@where, parmeters);
            dxQueryable.OrderBy(orderby);
            var ds = DbHelperSql.Query(dxQueryable.ToSql, dxQueryable.DbParameters.ToArray());

            return(ds.Tables[0].Tolist <T>());
        }
Ejemplo n.º 2
0
        public virtual IPagedList <T> FindPagedList(string orderBy, string @where = "", object parameters = null, int pageIndx = 0, int pageSize = 20)
        {
            var type        = typeof(T);
            var propMapping = type.Mapping();
            var dxQueryable = new DxQueryable <T>(propMapping);

            dxQueryable.Where(@where, parameters);
            dxQueryable.OrderBy(orderBy);
            var ds         = DbHelperSql.Query(dxQueryable.ToPagingSql(pageIndx, pageSize), dxQueryable.DbParameters.ToArray());
            var list       = ds.Tables[0].Tolist <T>();
            var totalCount = ds.Tables[0].Rows != null && ds.Tables[0].Rows.Count > 0 ? ds.Tables[0].Rows[0]["RowNumTotalCount"] : 0;
            var items      = new PagedList <T>(list, pageIndx, pageSize, int.Parse(totalCount.ToString()));

            return(items);
        }