Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/15/16 12:13:51 (9 years ago)
Author:
abeham
Message:

#2560: Moved both get and set characteristic values functionality to run creation service

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

    r13501 r13511  
    8888      return new DT.ValueName() { Id = source.Id, Category = source.Category, Name = source.Name };
    8989    }
    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     }
    11390  }
    11491}
  • trunk/sources/HeuristicLab.Services.OKB/3.3/Query/IQueryService.cs

    r13501 r13511  
    4848    [OperationContract]
    4949    IEnumerable<ValueName> GetValueNames();
    50 
    51     [OperationContract]
    52     IEnumerable<Value> GetCharacteristics(long problemId);
    5350  }
    5451}
  • trunk/sources/HeuristicLab.Services.OKB/3.3/Query/QueryService.cs

    r13501 r13511  
    278278    }
    279279
    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 
    289280    private List<DataAccess.Run> FilterRuns(IQueryable<DataAccess.Run> runs, Filter filter, OKBDataContext okb) {
    290281      IFilter f = (IFilter)Activator.CreateInstance(Type.GetType(filter.FilterTypeName), filter);
Note: See TracChangeset for help on using the changeset viewer.