Ejemplo n.º 1
0
        public virtual string BuildOrderString()
        {
            if (this.orders.Count == 0)
            {
                return("");
            }
            StringBuilder builder = new StringBuilder();
            int           count   = this.orders.Count;

            for (int i = 0; i < count; i++)
            {
                if (i != 0)
                {
                    builder.Append(" , ");
                }
                else
                {
                    builder.Append(" Order By ");
                }
                QueryOrder order = (QueryOrder)this.orders[i];
                string     name  = order.Name;
                bool       sort  = order.Sort;
                builder.Append(name);
                if (sort)
                {
                    builder.Append(" ASC ");
                }
                else
                {
                    builder.Append(" DESC ");
                }
            }
            return(builder.ToString());
        }
Ejemplo n.º 2
0
        public virtual void RemoveOrder(string name)
        {
            int count = this.orders.Count;

            if (count != 0)
            {
                for (int i = count - 1; i >= 0; i--)
                {
                    QueryOrder order = (QueryOrder)this.orders[i];
                    if (order.Name == name)
                    {
                        this.orders.Remove(order);
                    }
                }
            }
        }