Example #1
0
 public DataTable FindTable <T>(T entity)
 {
     if (entity == null)
     {
         return(db.FindTable(DatabaseCommon.SelectSql(EntityAttribute.GetEntityTable <T>())));
     }
     else
     {
         return(db.FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString()));
     }
 }
Example #2
0
        public DataTable FindTable <T>(T entity, Pagination pagination)
        {
            DataTable data;

            if (entity != null && pagination != null)
            {
                int total = pagination.records;
                if (pagination.sord == null)
                {
                    pagination.sord = "asc";
                }
                data = db.FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString(), pagination.sidx, pagination.sord.ToLower() == "asc" ? true : false, pagination.rows, pagination.page, out total);
                pagination.records = total;
            }
            else if (entity != null && pagination == null)
            {
                data = db.FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString());
            }
            else
            {
                data = db.FindTable(DatabaseCommon.SelectSql(EntityAttribute.GetEntityTable <T>()));
            }
            return(data);
        }