Exemplo n.º 1
0
 public DataTable FindTable(string strSql, DbParameter[] dbParameter)
 {
     using (var dbConnection = dbcontext.Database.Connection)
     {
         var IDataReader = new DbHelper(dbConnection).ExecuteReader(CommandType.Text, strSql, dbParameter);
         return(ConvertExtension.IDataReaderToDataTable(IDataReader));
     }
 }
Exemplo n.º 2
0
 public IEnumerable <T> FindList <T>(string strSql, DbParameter[] dbParameter) where T : class
 {
     using (var dbConnection = dbcontext.Database.Connection)
     {
         var IDataReader = new DbHelper(dbConnection).ExecuteReader(CommandType.Text, strSql, dbParameter);
         return(ConvertExtension.IDataReaderToList <T>(IDataReader));
     }
 }
Exemplo n.º 3
0
 public IEnumerable <T> FindList <T>(string strSql, DbParameter[] dbParameter, string orderField, bool isAsc, int pageSize, int pageIndex, out int total) where T : class
 {
     using (var dbConnection = dbcontext.Database.Connection)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append(new DatabasePage().SqlPageSql(strSql, dbParameter, orderField, isAsc, pageSize, pageIndex));
         total = Convert.ToInt32(new DbHelper(dbConnection).ExecuteScalar(CommandType.Text, "Select Count(1) From (" + strSql + ")  t", dbParameter));
         var IDataReader = new DbHelper(dbConnection).ExecuteReader(CommandType.Text, sb.ToString(), dbParameter);
         return(ConvertExtension.IDataReaderToList <T>(IDataReader));
     }
 }