public override Expr ToExpression() { if (this.Category == IntegerFilterCategory.NoFilter) { return(null); } else if (this.Category == IntegerFilterCategory.IsNull) { return(this.CreateIsNullExpr()); } else if (this.Category == IntegerFilterCategory.IsNotNull) { return(this.CreateIsNullExpr()); } else if (this.Category == IntegerFilterCategory.IsInRange) { var expr_and = new ExprLogicalAnd(); if (this.range.UpperBound.HasValue) { var op = ComparisonOperation.LesserThanOrEquals; var expr_compare = Expr.GetExprComparison(this.expr_field, new ExprLiteralInt(this.range.UpperBound.Value), op); expr_and.Add(expr_compare); } if (this.range.LowerBound.HasValue) { var op = ComparisonOperation.GreaterThanOrEquals; var expr_compare = Expr.GetExprComparison(this.expr_field, new ExprLiteralInt(this.range.UpperBound.Value), op); expr_and.Add(expr_compare); } return(expr_and); } else if (this.Category == IntegerFilterCategory.IsOneOf) { var expr_or = new ExprLogicalOr(); foreach (var item in this.one_of_list) { var expr2 = new ExprLiteralInt(item); var expr_compare = Expr.GetExprComparison(this.expr_field, expr2, AdlClient.OData.Models.ComparisonOperation.Equals); expr_or.Add(expr_compare); } return(expr_or); } else { string msg = string.Format("Unhandled datetime integer category: \"{0}\"", this.Category); throw new System.ArgumentException(msg); } }
public override Expr ToExpression() { if (this.Category == DateTimeFilterCategory.NoFilter) { return(null); } else if (this.Category == DateTimeFilterCategory.InRange) { // The range must have at least one bound if (!this.range.IsBounded) { return(null); } var expr_and = new ExprLogicalAnd(); if (this.range.UpperBound.HasValue) { var op = this.Inclusive ? ComparisonOperation.GreaterThanOrEquals : ComparisonOperation.LesserThan; var expr_date = new ExprLiteralDateTime(this.range.UpperBound.Value); var expr_compare = Expr.GetExprComparison(this.expr_field, expr_date, op); expr_and.Add(expr_compare); } if (this.range.LowerBound.HasValue) { var op = this.Inclusive ? ComparisonOperation.GreaterThanOrEquals : ComparisonOperation.GreaterThan; var expr_date = new ExprLiteralDateTime(this.range.LowerBound.Value); var expr_compare = Expr.GetExprComparison(this.expr_field, expr_date, op); expr_and.Add(expr_compare); } return(expr_and); } else if (this.Category == DateTimeFilterCategory.IsNull) { return(CreateIsNullExpr()); } else if (this.Category == DateTimeFilterCategory.IsNotNull) { return(CreateIsNotNullExpr()); } else { string msg = string.Format("Unhandled datetime filter category: \"{0}\"", this.Category); throw new System.ArgumentException(msg); } }
private Expr ToExpression() { var expr_and = new ExprLogicalAnd(); expr_and.Add(this.DegreeOfParallelism.ToExpression()); expr_and.Add(this.Submitter.ToExpression()); expr_and.Add(this.Priority.ToExpression()); expr_and.Add(this.Name.ToExpression()); expr_and.Add(this.SubmitTime.ToExpression()); expr_and.Add(this.StartTime.ToExpression()); expr_and.Add(this.EndTime.ToExpression()); expr_and.Add(this.State.ToExpression()); expr_and.Add(this.Result.ToExpression()); return(expr_and); }