/// <summary>
        ///
        /// </summary>
        /// <param name="c1"></param>
        /// <param name="c2"></param>
        /// <param name="op"></param>
        /// <returns></returns>
        private static esComparison HandleOperator(esComparison c1, esComparison c2, esConjunction op)
        {
            List <esComparison> exp = null;

            if (c1.data.WhereExpression == null)
            {
                c1.data.WhereExpression = new List <esComparison>();
                exp = c1.data.WhereExpression;

                exp.Add(new esComparison(esParenthesis.Open));
                exp.Add(c1);
            }
            else
            {
                exp = c1.data.WhereExpression;
                exp.Insert(0, new esComparison(esParenthesis.Open));
            }

            esConjunction conj = op;

            if (c2.not)
            {
                switch (op)
                {
                case esConjunction.And:
                    conj = esConjunction.AndNot;
                    break;

                case esConjunction.Or:
                    conj = esConjunction.OrNot;
                    break;
                }
            }

            exp.Add(new esComparison(conj));

            if (c2.data.WhereExpression == null)
            {
                exp.Add(c2);
            }
            else
            {
                exp.AddRange(c2.data.WhereExpression);
            }

            exp.Add(new esComparison(esParenthesis.Close));

            return(c1);
        }
        private List <esComparison> ProcessWhereItems(esConjunction conj, params object[] theItems)
        {
            List <esComparison> items = new List <esComparison>();

            items.Add(new esComparison(esParenthesis.Open));

            bool first = true;

            esComparison whereItem;
            int          count = theItems.Length;

            for (int i = 0; i < count; i++)
            {
                object o = theItems[i];

                whereItem = o as esComparison;
                if (whereItem != null)
                {
                    if (!first)
                    {
                        items.Add(new esComparison(conj));
                    }
                    items.Add(whereItem);
                    first = false;
                }
                else
                {
                    List <esComparison> listItem = o as List <esComparison>;
                    if (listItem != null)
                    {
                        if (!first)
                        {
                            items.Add(new esComparison(conj));
                        }
                        items.AddRange(listItem);
                        first = false;
                    }
                    else
                    {
                        throw new Exception("Unsupported Type");
                    }
                }
            }

            items.Add(new esComparison(esParenthesis.Close));

            return(items);
        }
 /// <summary>
 /// The esComparison class is dynamically created by your
 /// BusinessEntity's DynamicQuery mechanism.
 /// See <see cref="esConjunction"/> Enumeration.
 /// </summary>
 /// <param name="conj">The esConjunction passed in via DynamicQuery</param>
 public esComparison(esConjunction conj)
 {
     this.data.Conjunction = conj;
 }
        private List<esComparison> ProcessWhereItems(esConjunction conj, params object[] theItems)
        {
            List<esComparison> items = new List<esComparison>();

            items.Add(new esComparison(esParenthesis.Open));

            bool first = true;

            esComparison whereItem;
            int count = theItems.Length;

            for (int i = 0; i < count; i++)
            {
                object o = theItems[i];

                whereItem = o as esComparison;
                if (whereItem != null)
                {
                    if (!first)
                    {
                        items.Add(new esComparison(conj));
                    }
                    items.Add(whereItem);
                    first = false;
                }
                else
                {
                    List<esComparison> listItem = o as List<esComparison>;
                    if (listItem != null)
                    {
                        if (!first)
                        {
                            items.Add(new esComparison(conj));
                        }
                        items.AddRange(listItem);
                        first = false;
                    }
                    else
                    {
                        throw new Exception("Unsupported Type");
                    }
                }
            }

            items.Add(new esComparison(esParenthesis.Close));

            return items;
        }
 /// <summary>
 /// The esComparison class is dynamically created by your
 /// BusinessEntity's DynamicQuery mechanism.
 /// See <see cref="esConjunction"/> Enumeration.
 /// </summary>
 /// <param name="conj">The esConjunction passed in via DynamicQuery</param>
 public esComparison(esConjunction conj)
 {
     this.data.Conjunction = conj;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="c1"></param>
        /// <param name="c2"></param>
        /// <param name="op"></param>
        /// <returns></returns>
        private static esComparison HandleOperator(esComparison c1, esComparison c2, esConjunction op)
        {
            List<esComparison> exp = null;

            if (c1.data.WhereExpression == null)
            {
                c1.data.WhereExpression = new List<esComparison>();
                exp = c1.data.WhereExpression;

                exp.Add(new esComparison(esParenthesis.Open));
                exp.Add(c1);
            }
            else
            {
                exp = c1.data.WhereExpression;
                exp.Insert(0, new esComparison(esParenthesis.Open));
            }

            esConjunction conj = op;

            if (c2.not)
            {
                switch (op)
                {
                    case esConjunction.And:
                        conj = esConjunction.AndNot;
                        break;

                    case esConjunction.Or:
                        conj = esConjunction.OrNot;
                        break;
                }
            }

            exp.Add(new esComparison(conj));

            if (c2.data.WhereExpression == null)
            {
                exp.Add(c2);
            }
            else
            {
                exp.AddRange(c2.data.WhereExpression);
            }

            exp.Add(new esComparison(esParenthesis.Close));

            return c1;
        }