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); }
private void SetQuery(SqlStringBuilder sql) { Args.ThrowIfNull(OrderByColumn, "OrderByColumn"); IQueryFilter queryFilter = (IQueryFilter)Query.FilterDelegate.DynamicInvoke(OrderByColumn); sql = sql.Where(queryFilter).OrderBy(OrderByColumn.ToString(), SortOrder); }
public string getOrderBy() { if (string.IsNullOrEmpty(OrderByColumn)) { return(""); } return(OrderByColumn.toUnderScoreCase() + " " + IsAsc); }
/// <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); }
public void UpdateOrderByColumn(int index, OrderByColumn orderByColumn) { Interfaces.Events.RaiseDataChangedEvent(GetType(), (MethodInfo)MethodBase.GetCurrentMethod(), _orderByColumns[index], orderByColumn); _orderByColumns[index] = orderByColumn; }
public void RemoveOrderByColumn(OrderByColumn orderByColumn) { Interfaces.Events.RaiseDataChangedEvent(GetType(), (MethodInfo)MethodBase.GetCurrentMethod(), null, orderByColumn); _orderByColumns.Remove(orderByColumn); }
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); }