Changeset 13501 for trunk/sources/HeuristicLab.Services.OKB/3.3/Query
- Timestamp:
- 01/12/16 16:08:38 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Services.OKB/3.3/Query
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.OKB/3.3/Query/Convert.cs
r13473 r13501 88 88 return new DT.ValueName() { Id = source.Id, Category = source.Category, Name = source.Name }; 89 89 } 90 91 public static DT.Value ToDto(DA.CharacteristicValue source) { 92 if (source == null) return null; 93 if (source.Characteristic.Type == DA.CharacteristicType.Bool) { 94 return new DT.BoolValue { Name = source.Characteristic.Name, DataType = Convert.ToDto(source.DataType), Value = source.BoolValue.GetValueOrDefault() }; 95 } else if (source.Characteristic.Type == DA.CharacteristicType.Int) { 96 return new DT.IntValue { Name = source.Characteristic.Name, DataType = Convert.ToDto(source.DataType), Value = source.IntValue.GetValueOrDefault() }; 97 } else if (source.Characteristic.Type == DA.CharacteristicType.TimeSpan) { 98 return new DT.TimeSpanValue { Name = source.Characteristic.Name, DataType = Convert.ToDto(source.DataType), Value = source.LongValue.GetValueOrDefault() }; 99 } else if (source.Characteristic.Type == DA.CharacteristicType.Long) { 100 return new DT.LongValue { Name = source.Characteristic.Name, DataType = Convert.ToDto(source.DataType), Value = source.LongValue.GetValueOrDefault() }; 101 } else if (source.Characteristic.Type == DA.CharacteristicType.Float) { 102 return new DT.FloatValue { Name = source.Characteristic.Name, DataType = Convert.ToDto(source.DataType), Value = source.FloatValue.GetValueOrDefault() }; 103 } else if (source.Characteristic.Type == DA.CharacteristicType.Double) { 104 return new DT.DoubleValue { Name = source.Characteristic.Name, DataType = Convert.ToDto(source.DataType), Value = source.DoubleValue.GetValueOrDefault() }; 105 } else if (source.Characteristic.Type == DA.CharacteristicType.Percent) { 106 return new DT.PercentValue { Name = source.Characteristic.Name, DataType = Convert.ToDto(source.DataType), Value = source.DoubleValue.GetValueOrDefault() }; 107 } else if (source.Characteristic.Type == DA.CharacteristicType.String) { 108 return new DT.StringValue { Name = source.Characteristic.Name, DataType = Convert.ToDto(source.DataType), Value = source.StringValue }; 109 } else { 110 throw new ArgumentException("Unknown characteristic type.", "source"); 111 } 112 } 90 113 } 91 114 } -
trunk/sources/HeuristicLab.Services.OKB/3.3/Query/IQueryService.cs
r12012 r13501 48 48 [OperationContract] 49 49 IEnumerable<ValueName> GetValueNames(); 50 51 [OperationContract] 52 IEnumerable<Value> GetCharacteristics(long problemId); 50 53 } 51 54 } -
trunk/sources/HeuristicLab.Services.OKB/3.3/Query/QueryService.cs
r12012 r13501 278 278 } 279 279 280 281 public IEnumerable<DataTransfer.Value> GetCharacteristics(long problemId) { 282 using (OKBDataContext okb = new OKBDataContext()) { 283 var prob = okb.Problems.SingleOrDefault(x => x.Id == problemId); 284 if (prob == null) return Enumerable.Empty<DataTransfer.Value>(); 285 return prob.CharacteristicValues.Select(Convert.ToDto).ToArray(); 286 } 287 } 288 280 289 private List<DataAccess.Run> FilterRuns(IQueryable<DataAccess.Run> runs, Filter filter, OKBDataContext okb) { 281 290 IFilter f = (IFilter)Activator.CreateInstance(Type.GetType(filter.FilterTypeName), filter);
Note: See TracChangeset
for help on using the changeset viewer.