- Timestamp:
- 01/12/16 16:08:38 (9 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.