/// <summary>
 /// The Constructor
 /// </summary>
 public esCase(esDynamicQuerySerializable query, esQueryItem queryItem)
 {
     this.data.Query = query;
     this.data.QueryItem = queryItem;
 }
 public esCase When(esQueryItem ex)
 {
     return this;
 }
        public esCase Else(esQueryItem queryItem)
        {
            esExpression expression = queryItem;
            this.data.Else = expression;

            return this;
        }
        public esCase Then(esQueryItem queryItem)
        {
            esExpression expression = queryItem;

            esSimpleCaseData.esCaseClause clause = new esSimpleCaseData.esCaseClause();
            clause.When = this.WhenItem;
            clause.Then = expression;

            if (data.Cases == null)
            {
                data.Cases = new List<esSimpleCaseData.esCaseClause>();
            }

            this.data.Cases.Add(clause);

            return this;
        }
        private static esComparison GreaterThanOrEqual(esQueryItem queryItem, object literal, esSystemType literalType, bool itemFirst)
        {
            esComparison wi = new esComparison(queryItem.query);
            wi.Operand = esComparisonOperand.GreaterThanOrEqual;

            wi.data.Column = queryItem.Column;
            wi.data.Value = literal;
            wi.data.Expression = queryItem.Expression;
            wi.data.ItemFirst = itemFirst;

            wi.SubOperators = queryItem.SubOperators;
            return wi;
        }
 private static esQueryItem ModuloOperator(esQueryItem queryItem, object literal, esSystemType literalType, bool itemFirst)
 {
     esQueryItem qi = new esQueryItem();
     qi.Expression.SelectItem1 = queryItem;
     qi.Expression.Operator = esArithmeticOperator.Modulo;
     qi.Expression.Literal = literal;
     qi.Expression.LiteralType = literalType;
     qi.Expression.ItemFirst = itemFirst;
     return qi;
 }
 public static esQueryItem operator %(esQueryItem item1, esQueryItem item2)
 {
     esQueryItem qi = new esQueryItem();
     qi.Expression.SelectItem1 = item1;
     qi.Expression.Operator = esArithmeticOperator.Modulo;
     qi.Expression.SelectItem2 = item2;
     return qi;
 }