/// <summary> /// Adds the elements of another OrderByTermCollection to the end of this OrderByTermCollection. /// </summary> /// <param name="items"> /// The OrderByTermCollection whose elements are to be added to the end of this OrderByTermCollection. /// </param> public virtual void AddRange(OrderByTermCollection items) { foreach (OrderByTerm item in items) { this.List.Add(item); } }
/// <summary> /// Renders the begining of a ORDER BY statement. /// </summary> /// <param name="builder"></param> /// <param name="orderByTerms"></param> /// <remarks>If <paramref name="orderByTerms"/> has no items, nothing will be appended.</remarks> protected virtual void OrderBy(StringBuilder builder, OrderByTermCollection orderByTerms) { if (orderByTerms.Count > 0) { builder.Append(" order by "); } }
/// <summary> /// Initializes a new instance of the DBQueryBuilder class /// </summary> /// <param name="queryGroup">The query group to build the query from</param> /// <param name="maximumResults">The maximum number of results to return</param> public DBQueryBuilder(DBQueryGroup queryGroup, OrderByTermCollection orderByTerms) : this() { WhereClause whereClause = queryGroup.CreateWhereClause(this); this.OrderByTerms = orderByTerms; this.QueryString = this.BuildQuery(whereClause, 0); }
/// <summary> /// Renders ORDER BY terms /// </summary> /// <param name="builder"></param> /// <param name="orderByTerms"></param> protected virtual void OrderByTerms(StringBuilder builder, OrderByTermCollection orderByTerms) { for (int i = 0; i < orderByTerms.Count; i++) { OrderByTerm term = (OrderByTerm)orderByTerms[i]; if (i > 0) { builder.Append(", "); } OrderByTerm(builder, term); } }
private void ApplyOrderBy(OrderByTermCollection terms, SelectQuery orderQuery, bool forward, FromTerm table) { foreach (OrderByTerm expr in terms) { OrderByDirection dir = expr.Direction; //Reverse order direction if required if (!forward && dir == OrderByDirection.Ascending) { dir = OrderByDirection.Descending; } else if (!forward && dir == OrderByDirection.Descending) { dir = OrderByDirection.Ascending; } orderQuery.OrderByTerms.Add(new OrderByTerm(FormatSortFieldName(expr.Field.ToString()), table, dir)); } }
/// <summary> /// Renders ORDER BY terms /// </summary> /// <param name="builder"></param> /// <param name="orderByTerms"></param> protected virtual void OrderByTerms(StringBuilder builder, OrderByTermCollection orderByTerms) { for (int i = 0; i < orderByTerms.Count; i++) { OrderByTerm term = (OrderByTerm) orderByTerms[i]; if (i > 0) { builder.Append(", "); } OrderByTerm(builder, term); } }
/// <summary> /// Initializes a new instance of the OrderByTermCollection class, containing elements /// copied from another instance of OrderByTermCollection /// </summary> /// <param name="items"> /// The OrderByTermCollection whose elements are to be added to the new OrderByTermCollection. /// </param> public OrderByTermCollection(OrderByTermCollection items) { this.AddRange(items); }
/// <summary> /// /// </summary> /// <param name="collection"></param> public Enumerator(OrderByTermCollection collection) { this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator(); }