private static CriteriaOperator ProcessSimpleNullExpression(OperandProperty property, ExpressionType expressionType) { if (expressionType == ExpressionType.Equal) return property.IsNull(); if (expressionType == ExpressionType.NotEqual) return property.IsNotNull(); throw new Exception("Cannot supply null value to operator " + expressionType); }
protected CriteriaOperator GetFilterCriterion(ComboBoxEdit pi, BaseEdit e, bool IsField, string FieldName) { if (this.IsFilterExist(pi, e)) { OperandProperty opLeft = new OperandProperty(this.column.FieldName); int num = this.OperationNumber(pi.SelectedItem); if (num < 0) { return null; } switch (((ExpressionOperators) this.operators[0, num])) { case ExpressionOperators.Equals: return (CriteriaOperator) (opLeft == this.GetRightOperand(e, IsField, FieldName)); case ExpressionOperators.NotEquals: return (CriteriaOperator) (opLeft != this.GetRightOperand(e, IsField, FieldName)); case ExpressionOperators.Greater: return (CriteriaOperator) (opLeft > this.GetRightOperand(e, IsField, FieldName)); case ExpressionOperators.GreaterOrEqual: return (CriteriaOperator) (opLeft >= this.GetRightOperand(e, IsField, FieldName)); case ExpressionOperators.Less: return (CriteriaOperator) (opLeft < this.GetRightOperand(e, IsField, FieldName)); case ExpressionOperators.LessOrEqual: return (CriteriaOperator) (opLeft <= this.GetRightOperand(e, IsField, FieldName)); case ExpressionOperators.Blanks: return opLeft.IsNull(); case ExpressionOperators.NonBlanks: return opLeft.IsNotNull(); case ExpressionOperators.Like: return new BinaryOperator(opLeft, this.PatchLikeOperand(this.GetRightOperand(e, IsField, FieldName)), BinaryOperatorType.Like); //暂时未处理 //case ExpressionOperators.NotLike: // return CriteriaOperator.op_LogicalNot(new BinaryOperator(opLeft, this.PatchLikeOperand(this.GetRightOperand(e, IsField, FieldName)), BinaryOperatorType.Like)); } } return null; }