Changeset 5286 for branches/OKB/HeuristicLab.Services.OKB/3.3/Filters/ProblemDataDataTypeNameFilter.cs
- Timestamp:
- 01/12/11 04:10:13 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Services.OKB/3.3/Filters/ProblemDataDataTypeNameFilter.cs
r5269 r5286 20 20 #endregion 21 21 22 using System.Linq; 22 using System; 23 using System.Linq.Expressions; 23 24 using HeuristicLab.Services.OKB.DataAccess; 24 25 … … 27 28 public DataTransfer.SetComparison Comparison { get; set; } 28 29 public string Value { get; set; } 30 31 public Expression<Func<Run, bool>> Expression { 32 get { 33 switch (Comparison) { 34 case DataTransfer.SetComparison.Equal: 35 return x => x.Experiment.Problem.ProblemData.DataType.Name == Value; 36 case DataTransfer.SetComparison.NotEqual: 37 return x => x.Experiment.Problem.ProblemData.DataType.Name != Value; 38 case DataTransfer.SetComparison.Contains: 39 return x => x.Experiment.Problem.ProblemData.DataType.Name.Contains(Value); 40 case DataTransfer.SetComparison.NotContains: 41 return x => !x.Experiment.Problem.ProblemData.DataType.Name.Contains(Value); 42 default: 43 return x => true; 44 } 45 } 46 } 29 47 30 48 public ProblemDataDataTypeNameFilter(DataTransfer.SetComparison comparison, string value) { … … 36 54 Value = filter.Value; 37 55 } 38 39 public IQueryable<Run> Apply(IQueryable<Run> source) {40 switch (Comparison) {41 case DataTransfer.SetComparison.Equal:42 return source.Where(x => x.Experiment.Problem.ProblemData.DataType.Name == Value);43 case DataTransfer.SetComparison.NotEqual:44 return source.Where(x => x.Experiment.Problem.ProblemData.DataType.Name != Value);45 case DataTransfer.SetComparison.Contains:46 return source.Where(x => x.Experiment.Problem.ProblemData.DataType.Name.Contains(Value));47 case DataTransfer.SetComparison.NotContains:48 return source.Where(x => !x.Experiment.Problem.ProblemData.DataType.Name.Contains(Value));49 default:50 return source;51 }52 }53 56 } 54 57 }
Note: See TracChangeset
for help on using the changeset viewer.