Example #1
0
        public IConstraint ApplyOperator(IConstraint cons, string db4oOperator)
        {
            try
            {
                switch (db4oOperator)
                {
                case BusinessConstants.CONDITION_STARTSWITH:
                    cons.StartsWith(false);
                    break;

                case BusinessConstants.CONDITION_ENDSWITH:
                    cons.EndsWith(false);
                    break;

                case BusinessConstants.CONDITION_EQUALS:
                    cons.Equal();
                    break;

                case BusinessConstants.CONDITION_NOTEQUALS:
                    cons.Not();
                    break;

                case BusinessConstants.CONDITION_GREATERTHAN:
                    cons.Greater();
                    break;

                case BusinessConstants.CONDITION_GREATERTHANEQUAL:
                    cons.Greater().Equal();
                    break;

                case BusinessConstants.CONDITION_LESSTHAN:
                    cons.Smaller();
                    break;

                case BusinessConstants.CONDITION_LESSTHANEQUAL:
                    cons.Smaller().Equal();
                    break;

                case BusinessConstants.CONDITION_CONTAINS:
                    cons.Like();
                    break;
                }
                return(cons);
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
                return(null);
            }
        }
Example #2
0
        public override IQLin Greater(object obj)
        {
            IConstraint constraint = _node.Constrain(obj);

            constraint.Greater();
            return(new QLinConstraint(((QLinRoot)_root), constraint));
        }
Example #3
0
            public virtual void Visit(ComparisonExpression expression)
            {
                IQuery subQuery = Descend(expression.Left());
                ComparisonQueryGeneratingVisitor visitor = new ComparisonQueryGeneratingVisitor(_predicate
                                                                                                , _classSource, _referenceResolver);

                expression.Right().Accept(visitor);
                _constraint = subQuery.Constrain(visitor.Value());
                ComparisonOperator op = expression.Op();

                if (op.Equals(ComparisonOperator.ValueEquality))
                {
                    return;
                }
                if (op.Equals(ComparisonOperator.ReferenceEquality))
                {
                    _constraint.Identity();
                    return;
                }
                if (op.Equals(ComparisonOperator.Greater))
                {
                    _constraint.Greater();
                    return;
                }
                if (op.Equals(ComparisonOperator.Smaller))
                {
                    _constraint.Smaller();
                    return;
                }
                if (op.Equals(ComparisonOperator.Contains))
                {
                    _constraint.Contains();
                    return;
                }
                if (op.Equals(ComparisonOperator.StartsWith))
                {
                    _constraint.StartsWith(true);
                    return;
                }
                if (op.Equals(ComparisonOperator.EndsWith))
                {
                    _constraint.EndsWith(true);
                    return;
                }
                throw new Exception("Can't handle constraint: " + op);
            }
Example #4
0
 public IConstraint ApplyOperator(IConstraint cons, string db4oOperator)
 {
     try
     {
         switch (db4oOperator)
         {
             case BusinessConstants.CONDITION_STARTSWITH: 
                 cons.StartsWith(false);
                 break;
             case BusinessConstants.CONDITION_ENDSWITH:
                 cons.EndsWith(false);
                 break;
             case BusinessConstants.CONDITION_EQUALS:
                 cons.Equal();
                 break;
             case BusinessConstants.CONDITION_NOTEQUALS:
                 cons.Not();
                 break;
             case BusinessConstants.CONDITION_GREATERTHAN :
                 cons.Greater();
                 break;
             case BusinessConstants.CONDITION_GREATERTHANEQUAL:
                 cons.Greater().Equal();
                 break;
             case BusinessConstants.CONDITION_LESSTHAN :
                 cons.Smaller();
                 break;
             case BusinessConstants.CONDITION_LESSTHANEQUAL:
                 cons.Smaller().Equal();
                 break;
             case BusinessConstants.CONDITION_CONTAINS:
                 cons.Like();
                 break;
         }
         return cons;
     }
     catch (Exception oEx)
     {
         LoggingHelper.HandleException(oEx);
         return null;
     }
 }
Example #5
0
			public virtual void Visit(ComparisonExpression expression)
			{
				IQuery subQuery = Descend(expression.Left());
				ComparisonQueryGeneratingVisitor visitor = new ComparisonQueryGeneratingVisitor(_predicate
					, _classSource, _referenceResolver);
				expression.Right().Accept(visitor);
				_constraint = subQuery.Constrain(visitor.Value());
				ComparisonOperator op = expression.Op();
				if (op.Equals(ComparisonOperator.ValueEquality))
				{
					return;
				}
				if (op.Equals(ComparisonOperator.ReferenceEquality))
				{
					_constraint.Identity();
					return;
				}
				if (op.Equals(ComparisonOperator.Greater))
				{
					_constraint.Greater();
					return;
				}
				if (op.Equals(ComparisonOperator.Smaller))
				{
					_constraint.Smaller();
					return;
				}
				if (op.Equals(ComparisonOperator.Contains))
				{
					_constraint.Contains();
					return;
				}
				if (op.Equals(ComparisonOperator.StartsWith))
				{
					_constraint.StartsWith(true);
					return;
				}
				if (op.Equals(ComparisonOperator.EndsWith))
				{
					_constraint.EndsWith(true);
					return;
				}
				throw new Exception("Can't handle constraint: " + op);
			}