Exemplo n.º 1
0
 /// <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);
     }
 }
Exemplo n.º 2
0
 /// <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 ");
     }
 }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        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));
            }
        }
Exemplo n.º 6
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);
			}
		}
Exemplo n.º 7
0
		/// <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 ");
			}
		}
Exemplo n.º 8
0
		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));
			}
		}
Exemplo n.º 9
0
 /// <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);
 }
Exemplo n.º 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(OrderByTermCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }