コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
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()));
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
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);
        }
コード例 #6
0
 public DataTable FindTable <T>(T entity)
 {
     return(db.FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString()));
 }
コード例 #7
0
 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));
 }
コード例 #8
0
 public DataTable FindView <T>(T entity, string appendsql)
 {
     return(FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString() + appendsql));
 }
コード例 #9
0
 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));
 }
コード例 #10
0
 public DataTable FindTable <T>(T entity) where T : class, new()
 {
     return(FindTable(DatabaseCommon.QueryWhereSQL <T>(entity).ToString()));
 }