public DataTable FindTable <T, FindT>(FindT FindEntity, string orderField, bool isAsc, int pageSize, int pageIndex, out int total, string appendSql = "") where FindT : class, new() { string sql = DatabaseCommon.QueryWhereSQL <FindT>(FindEntity).ToString(); Type type = FindEntity.GetType(); string viewName = ""; var viewAttribute = type.GetCustomAttributes(true).OfType <ViewAttribute>(); var descriptionAttributes = viewAttribute as ViewAttribute[] ?? viewAttribute.ToArray(); if (descriptionAttributes.Any()) { viewName = descriptionAttributes.ToList()[0].viewName; } string tableName = string.IsNullOrWhiteSpace(viewName) ? EntityAttribute.GetEntityTable <T>() : viewName; var translateInfo = DatabaseCommon.GetTranslateValue <T>(); if (translateInfo.Count(x => x.Length > 0) > 0) { sql = DatabaseCommon.PottingSql <T>(translateInfo, sql, tableName, string.IsNullOrWhiteSpace(viewName) ? false : true); } if (!string.IsNullOrEmpty(appendSql)) { sql += appendSql; } return(FindTable(sql, orderField, isAsc, pageSize, pageIndex, out total)); }
public DataTable ExecProcTable <T>(T entity, string procName, Pagination pagination, string appendSql) { int total = pagination.records; appendSql += DatabaseCommon.QueryWhereSQL <T>(entity).ToString(); var data = db.ExecProcTable(procName, pagination.sidx, pagination.sord.ToLower() == "asc" ? true : false, pagination.rows, pagination.page, out total, appendSql); pagination.records = total; return(data); }
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())); } }
public DataTable FindTable <T>(T entity, Pagination pagination) { int total = pagination.records; if (pagination.sord == null) { pagination.sord = "asc"; } var 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; return(data); }
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); }
public DataTable FindTable <T>(T entity) { return(db.FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString())); }
public DataTable FindView <T>(T entity, string appendsql, string orderField, bool isAsc, int pageSize, int pageIndex, out int total) { return(FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString() + appendsql, orderField, isAsc, pageSize, pageIndex, out total)); }
public DataTable FindView <T>(T entity, string appendsql) { return(FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString() + appendsql)); }
public DataTable FindTable <T>(T entity, string orderField, bool isAsc, int pageSize, int pageIndex, out int total) where T : class, new() { return(FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString(), orderField, isAsc, pageSize, pageIndex, out total)); }
public DataTable FindTable <T>(T entity) where T : class, new() { return(FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString())); }