예제 #1
0
        public static SelectQuery OrderBy(this SelectQuery query, string tableAlias, string field, OrderDir direction = OrderDir.Asc, Aggregate aggregate = Aggregate.None)
        {
            var orderBy = new OrderByColumn(tableAlias, field, direction, aggregate);

            query.OrderByColumns.Add(orderBy);
            return(query);
        }
예제 #2
0
        private void SetQuery(SqlStringBuilder sql)
        {
            Args.ThrowIfNull(OrderByColumn, "OrderByColumn");
            IQueryFilter queryFilter = (IQueryFilter)Query.FilterDelegate.DynamicInvoke(OrderByColumn);

            sql = sql.Where(queryFilter).OrderBy(OrderByColumn.ToString(), SortOrder);
        }
예제 #3
0
 public string getOrderBy()
 {
     if (string.IsNullOrEmpty(OrderByColumn))
     {
         return("");
     }
     return(OrderByColumn.toUnderScoreCase() + " " + IsAsc);
 }
예제 #4
0
        /// <summary>
        /// Adds a field to order results by.
        /// </summary>
        public void OrderByField(string fieldId, OrderByColumnAggregate?aggregate = null, OrderByColumnOrder?order = null)
        {
            if (Raw.OrderBy == null)
            {
                Raw.OrderBy = new ObservableCollection <OrderByColumn>();
            }

            var column = new OrderByColumn
            {
                FieldId   = fieldId,
                Aggregate = aggregate,
                Order     = order
            };

            Raw.OrderBy.Add(column);
        }
예제 #5
0
 public void UpdateOrderByColumn(int index, OrderByColumn orderByColumn)
 {
     Interfaces.Events.RaiseDataChangedEvent(GetType(), (MethodInfo)MethodBase.GetCurrentMethod(), _orderByColumns[index], orderByColumn);
     _orderByColumns[index] = orderByColumn;
 }
예제 #6
0
 public void RemoveOrderByColumn(OrderByColumn orderByColumn)
 {
     Interfaces.Events.RaiseDataChangedEvent(GetType(), (MethodInfo)MethodBase.GetCurrentMethod(), null, orderByColumn);
     _orderByColumns.Remove(orderByColumn);
 }
예제 #7
0
        public bool NextPage(out IEnumerable <T> results)
        {
            LoadMeta();

            if (IdBook.PageCount >= CurrentPage + 1)
            {
                ++CurrentPage;
                List <long> ids = IdBook.PageNumber(CurrentPage);
                QuerySet    sql = Database.GetService <QuerySet>();
                sql.Top <T>(PageSize);
                QueryFilter queryFilter = (QueryFilter)Query.FilterDelegate.DynamicInvoke(OrderByColumn);
                sql.Where(queryFilter && new QueryFilter("Id").In(ids.Select(i => (object)i).ToArray())).OrderBy(OrderByColumn.ToString(), SortOrder);
                CurrentResults = new DaoCollection <C, T>(Database, sql.GetDataTable(Database));
            }
            SetLastEntry();
            results = CurrentResults;
            return(CurrentResults.Count > 0);
        }