Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="c1"></param>
        /// <param name="c2"></param>
        /// <param name="op"></param>
        /// <returns></returns>
        private static tgComparison HandleOperator(tgComparison c1, tgComparison c2, tgConjunction op)
        {
            List <tgComparison> exp = null;

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

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

            tgConjunction conj = op;

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

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

            exp.Add(new tgComparison(conj));

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

            exp.Add(new tgComparison(tgParenthesis.Close));

            return(c1);
        }
Example #2
0
        private List <tgComparison> ProcessWhereItems(tgConjunction conj, params object[] theItems)
        {
            List <tgComparison> items = new List <tgComparison>();

            items.Add(new tgComparison(tgParenthesis.Open));

            bool first = true;

            tgComparison whereItem;
            int          count = theItems.Length;

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

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

            items.Add(new tgComparison(tgParenthesis.Close));

            return(items);
        }
Example #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="c1"></param>
        /// <param name="c2"></param>
        /// <param name="op"></param>
        /// <returns></returns>
        private static tgComparison HandleOperator(tgComparison c1, tgComparison c2, tgConjunction op)
        {
            List<tgComparison> exp = null;

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

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

            tgConjunction conj = op;

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

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

            exp.Add(new tgComparison(conj));

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

            exp.Add(new tgComparison(tgParenthesis.Close));

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

            items.Add(new tgComparison(tgParenthesis.Open));

            bool first = true;

            tgComparison whereItem;
            int count = theItems.Length;

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

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

            items.Add(new tgComparison(tgParenthesis.Close));

            return items;
        }