private static Expression GenerateExpressionQueryTree(QueryExpression queryExpression)
        {
            Expression expressionTree = null;

            if (null == queryExpression)
            {
                throw new ArgumentNullException("QueryExpression can't be null!");
            }
            else
            {
                if (null != queryExpression.LeftQueryExpression)
                {
                    LogicalCalculationQueryExpression logicalCalculationQueryExpression = (LogicalCalculationQueryExpression)queryExpression;
                    if (logicalCalculationQueryExpression.Logicalcalculation == (int)LogicalCalculationEnum.And)
                    {
                        return(Expression.And(GenerateExpressionQueryTree(queryExpression.LeftQueryExpression), GenerateExpressionQueryTree(queryExpression.RightQueryExpression)));
                    }
                    else if (logicalCalculationQueryExpression.Logicalcalculation == (int)LogicalCalculationEnum.Or)
                    {
                        return(Expression.Or(GenerateExpressionQueryTree(queryExpression.LeftQueryExpression), GenerateExpressionQueryTree(queryExpression.RightQueryExpression)));
                    }
                }
                else
                {
                    return(Expression.Constant(((FieldQueryExpression)queryExpression).Result));
                }
            }
            return(expressionTree);
        }
        private static QueryExpression LogicalCalculation(QueryExpression left, QueryExpression right, LogicalCalculationEnum logicalCalculationEnum)
        {
            QueryExpression queryExpression = null;

            if (logicalCalculationEnum == LogicalCalculationEnum.And)
            {
                queryExpression = new LogicalCalculationQueryExpression(left, right, LogicalCalculationEnum.And);
            }
            else if (logicalCalculationEnum == LogicalCalculationEnum.Or)
            {
                queryExpression = new LogicalCalculationQueryExpression(left, right, LogicalCalculationEnum.Or);
            }

            return(queryExpression);
        }
        public static LogicalCalculationQueryExpression CreateLogicalCalculationQueryExpression(QueryExpression left, QueryExpression right, LogicalCalculationEnum logicalCalculationEnum)
        {
            LogicalCalculationQueryExpression logicalCalculationQueryExpression = new LogicalCalculationQueryExpression(left, right, logicalCalculationEnum);

            return(logicalCalculationQueryExpression);
        }