- Timestamp:
- 02/22/11 03:08:43 (14 years ago)
- Location:
- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/AdministrationService.cs
r5482 r5534 134 134 public byte[] GetAlgorithmData(long algorithmId) { 135 135 using (OKBDataContext okb = new OKBDataContext()) { 136 return okb.Algorithms.Where(x => x.Id == algorithmId).Select(x => x.BinaryData.Data.ToArray()).FirstOrDefault(); 136 var data = okb.Algorithms.Where(x => x.Id == algorithmId).Select(x => x.BinaryData).FirstOrDefault(); 137 if (data != null) return data.Data.ToArray(); 138 else return null; 137 139 } 138 140 } … … 219 221 public byte[] GetProblemData(long problemId) { 220 222 using (OKBDataContext okb = new OKBDataContext()) { 221 return okb.Problems.Where(x => x.Id == problemId).Select(x => x.BinaryData.Data.ToArray()).FirstOrDefault(); 223 var data = okb.Problems.Where(x => x.Id == problemId).Select(x => x.BinaryData).FirstOrDefault(); 224 if (data != null) return data.Data.ToArray(); 225 else return null; 222 226 } 223 227 } -
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/Convert.cs
r5482 r5534 62 62 public static DT.Algorithm ToDto(DA.Algorithm source) { 63 63 if (source == null) return null; 64 return new DT.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataType = Convert.ToDto(source.DataType)};64 return new DT.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataTypeName = source.DataType.Name, DataTypeTypeName = source.DataType.TypeName }; 65 65 } 66 66 public static DA.Algorithm ToEntity(DT.Algorithm source, DA.OKBDataContext okb) { 67 67 if (source == null) return null; 68 return new DA.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataType = Convert.ToEntity(source.DataType , okb) };68 return new DA.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb) }; 69 69 } 70 70 public static void ToEntity(DT.Algorithm source, DA.Algorithm target, DA.OKBDataContext okb) { 71 71 if ((source != null) && (target != null)) { 72 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.AlgorithmClassId = source.AlgorithmClassId; target.DataType = Convert.ToEntity(source.DataType , okb);72 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.AlgorithmClassId = source.AlgorithmClassId; target.DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb); 73 73 } 74 74 } … … 94 94 public static DT.Problem ToDto(DA.Problem source) { 95 95 if (source == null) return null; 96 return new DT.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataType = Convert.ToDto(source.DataType)};96 return new DT.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataTypeName = source.DataType.Name, DataTypeTypeName = source.DataType.TypeName }; 97 97 } 98 98 public static DA.Problem ToEntity(DT.Problem source, DA.OKBDataContext okb) { 99 99 if (source == null) return null; 100 return new DA.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataType = Convert.ToEntity(source.DataType , okb) };100 return new DA.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb) }; 101 101 } 102 102 public static void ToEntity(DT.Problem source, DA.Problem target, DA.OKBDataContext okb) { 103 103 if ((source != null) && (target != null)) { 104 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.ProblemClassId = source.ProblemClassId; target.DataType = Convert.ToEntity(source.DataType , okb);104 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.ProblemClassId = source.ProblemClassId; target.DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb); 105 105 } 106 106 } … … 108 108 109 109 #region DataType 110 private static DT.DataType ToDto(DA.DataType source) { 111 if (source == null) return null; 112 return new DT.DataType { Name = source.Name, TypeName = source.TypeName }; 113 } 114 private static DA.DataType ToEntity(DT.DataType source, DA.OKBDataContext okb) { 115 if (source == null) return null; 116 var entity = okb.DataTypes.Where(x => (x.Name == source.Name) && (x.TypeName == source.TypeName)).FirstOrDefault(); 110 private static DA.DataType ToEntity(string dataTypeName, string dataTypeTypeName, DA.OKBDataContext okb) { 111 if ((dataTypeName == null) || (dataTypeTypeName == null)) return null; 112 var entity = okb.DataTypes.Where(x => (x.Name == dataTypeName) && (x.TypeName == dataTypeTypeName)).FirstOrDefault(); 117 113 if (entity == null) 118 entity = new DA.DataType() { Id = 0, Name = source.Name, TypeName = source.TypeName };114 entity = new DA.DataType() { Id = 0, Name = dataTypeName, TypeName = dataTypeTypeName }; 119 115 return entity; 120 116 } -
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/DataTransfer/Algorithm.cs
r5482 r5534 30 30 public long AlgorithmClassId { get; set; } 31 31 [DataMember] 32 public DataType DataType { get; set; } 32 public string DataTypeName { get; set; } 33 [DataMember] 34 public string DataTypeTypeName { get; set; } 33 35 } 34 36 } -
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/DataTransfer/Problem.cs
r5482 r5534 30 30 public long ProblemClassId { get; set; } 31 31 [DataMember] 32 public DataType DataType { get; set; } 32 public string DataTypeName { get; set; } 33 [DataMember] 34 public string DataTypeTypeName { get; set; } 33 35 } 34 36 }
Note: See TracChangeset
for help on using the changeset viewer.