示例#1
0
 public DataTable GetData(TableFilter filter)
 {
     using (var adapter = Database.CreateAdapter(this, filter)) {
         var data = new DataTable(Name);
         adapter.Fill(data);
         return(data);
     }
 }
示例#2
0
        private TableFilter(TableFilter baseFilter)
        {
            table = baseFilter.table;

            foreach (var filter in baseFilter.filters)
            {
                filters.Add(filter.Clone());
            }
        }
示例#3
0
        private TableFilter(TableFilter baseFilter)
        {
            this.table   = baseFilter.table;
            this.filters = new List <ColumnFilter>();

            foreach (var filter in baseFilter.filters)
            {
                this.filters.Add(filter.Clone());
            }
        }
示例#4
0
        public virtual string GetBaseSelectCommandText(TableFilter filter, bool excludeWhere)
        {
            var select = new StringBuilder();

            select.Append("SELECT ");
            if (filter != null || filter.IsColumnFiltered)
            {
                filter.WriteColumnsProjection(select);
            }
            else
            {
                select.Append('*');
            }
            select.Append(" FROM ");
            select.Append(QuotedName);
            if (filter != null && filter.IsRowFiltered && !excludeWhere)
            {
                select.Append(" WHERE ");
                filter.WriteWhereStatement(select);
            }
            return(select.ToString());
        }
示例#5
0
        public virtual int GetRowCount(TableFilter filter)
        {
            var count = -1;

            using (var command = Database.CreateCommand()) {
                var sql = new StringBuilder();
                sql.Append("SELECT COUNT(*) FROM ");
                sql.Append(QuotedName);

                if (filter != null && filter.IsRowFiltered)
                {
                    sql.Append(" WHERE ");
                    filter.WriteWhereStatement(sql);
                }

                command.CommandText = sql.ToString();
                using (Database.CreateConnectionScope()) {
                    count = Convert.ToInt32(command.ExecuteScalar());
                }
            }
            return(count);
        }
示例#6
0
 public abstract DbDataAdapter CreateAdapter(Table table, TableFilter filter);
示例#7
0
 public string GetBaseSelectCommandText(TableFilter filter)
 {
     return(GetBaseSelectCommandText(filter, false));
 }
示例#8
0
 public abstract DataTable GetData(int startIndex, int count, TableFilter filter, TableSort sort);
示例#9
0
 public DataTable GetData(int startIndex, int count, TableFilter filter)
 {
     return(GetData(startIndex, count, filter, null));
 }