Changeset 4390 for trunk/sources
- Timestamp:
- 09/14/10 17:24:54 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Services.OKB/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.OKB/3.3/AdminService.cs
r4388 r4390 209 209 210 210 211 public void AddAlgorithmClass(AlgorithmClass algorithmClass) { 212 using (OKBDataContext okb = new OKBDataContext()) { 213 okb.AlgorithmClasses.InsertOnSubmit(new AlgorithmClass() { Name = algorithmClass.Name, Description = algorithmClass.Description }); 214 okb.SubmitChanges(); 215 } 216 } 217 211 218 public AlgorithmClass[] GetAlgorithmClasses() { 212 219 using (OKBDataContext okb = new OKBDataContext()) { … … 217 224 public void UpdateAlgorithmClass(AlgorithmClass algorithmClass) { 218 225 using (OKBDataContext okb = new OKBDataContext()) { 219 okb.AlgorithmClasses.Attach(algorithmClass); 220 okb.SubmitChanges(); 221 } 222 } 223 224 public void UpdateAlgorithmClasses(AlgorithmClass[] algorithmClasses) { 225 using (OKBDataContext okb = new OKBDataContext()) { 226 foreach (AlgorithmClass a in algorithmClasses) { 227 AlgorithmClass original = okb.AlgorithmClasses.FirstOrDefault(x => x.Id == a.Id); 228 if (original != null) { 229 original.Name = a.Name; 230 original.Description = a.Description; 231 } else { 232 okb.AlgorithmClasses.InsertOnSubmit(a); 233 } 234 } 226 AlgorithmClass original = okb.AlgorithmClasses.First(a => a.Id == algorithmClass.Id); 227 original.Name = algorithmClass.Name; 228 original.Description = algorithmClass.Description; 229 okb.SubmitChanges(); 230 } 231 } 232 233 public void DeleteAlgorithmClass(long algorithmClassId) { 234 using (OKBDataContext okb = new OKBDataContext()) { 235 okb.AlgorithmClasses.DeleteOnSubmit(okb.AlgorithmClasses.First(a => a.Id == algorithmClassId)); 235 236 okb.SubmitChanges(); 236 237 } -
trunk/sources/HeuristicLab.Services.OKB/3.3/Interfaces/IAdminService.cs
r4388 r4390 112 112 113 113 [OperationContract] 114 void AddAlgorithmClass(AlgorithmClass algorithmClass); 115 116 [OperationContract] 114 117 AlgorithmClass[] GetAlgorithmClasses(); 115 118 … … 118 121 119 122 [OperationContract] 120 void UpdateAlgorithmClasses(AlgorithmClass[] algorithmClasses); 121 123 void DeleteAlgorithmClass(long algorithmClassId); 122 124 123 125 }
Note: See TracChangeset
for help on using the changeset viewer.