private ClassSelectResult <T> ExecuteSelect <T>(ClassSelect <T> select)
        {
            if (!string.IsNullOrEmpty(this.OrderBy))
            {
                select.OrderBy(this.OrderByDirection, this.OrderBy);
            }

            select.Page(this.PageSize, this.PageOrdinal);

            ClassFilterExpression filter = null;

            foreach (BootstrapQueryHelperColumn col in this.columns)
            {
                if (!string.IsNullOrEmpty(col.Filter))
                {
                    filter = filter == null ?
                             new ClassFilterExpression(select.Aspect, col.Name, FilterComparison.Like, "%" + col.Filter.Replace(" ", "%") + "%") :
                             filter.And(col.Name, FilterComparison.Like, "%" + col.Filter.Replace(" ", "%") + "%");
                }
            }
            if (filter != null)
            {
                select.And(filter);
            }

            ClassSelectResult <T> result = select.ToResult();

            this.RecordCount = result.RecordCount;
            return(result);
        }
        public BootstrapClassSelectResult(ClassStorage <T> storage, string formName, NameValueCollection form, ClassFilter filter)
        {
            this.FormName = formName;
            PopulateDefaultParameterKeys();
            this._SearchFilter  = GetValueFromCollection <string>(form, this.DefaultParameterKeys["Filter"], null);
            this._PageOrdinal   = GetValueFromCollection <int>(form, this.DefaultParameterKeys["PageOrdinal"], 0);
            this._PageSize      = GetValueFromCollection <int>(form, this.DefaultParameterKeys["PageSize"], 20);
            this._OrderBy       = GetValueFromCollection <int>(form, this.DefaultParameterKeys["OrderBy"], -1);
            this._SortDirection = GetValueFromCollection <SortDirection>(form, this.DefaultParameterKeys["SortDirection"], EixoX.Data.SortDirection.Ascending);

            ClassSelect <T> select = null;

            if (string.IsNullOrEmpty(_SearchFilter.Value))
            {
                select = storage.Select();

                if (filter != null)
                {
                    select.Where(filter);
                }
            }
            else
            {
                select = storage.Search(_SearchFilter.Value);

                if (filter != null)
                {
                    select.And(filter);
                }
            }

            if (_OrderBy.Value >= 0)
            {
                select.OrderBy(_OrderBy.Value, _SortDirection.Value);
            }
            else
            {
                select.OrderBy(0, EixoX.Data.SortDirection.Descending);
            }

            select.Page(_PageSize.Value, _PageOrdinal.Value);

            this.Result = new ClassSelectResult <T>(select);
        }