Changeset 5071 for branches/OKB
- Timestamp:
- 12/08/10 00:47:16 (14 years ago)
- Location:
- branches/OKB
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBClient.cs
r4943 r5071 365 365 ItemCollection<Experiment> experiments = new ItemCollection<Experiment>(); 366 366 experiments.AddRange(CallAdminService<Experiment[]>(s => s.GetExperiments(algorithmId, problemId))); 367 experiments.ItemsRemoved += new CollectionItemsChangedEventHandler<Experiment>(experiments_ItemsRemoved); 367 368 return experiments; 368 369 } … … 379 380 ItemCollection<Run> runs = new ItemCollection<Run>(); 380 381 runs.AddRange(CallAdminService<Run[]>(s => s.GetRuns(experimentId)).OrderByDescending(x => x.FinishedDate)); 382 runs.ItemsRemoved += new CollectionItemsChangedEventHandler<Run>(runs_ItemsRemoved); 381 383 return runs; 382 384 } … … 659 661 } 660 662 } 663 private void experiments_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<Experiment> e) { 664 try { 665 foreach (Experiment exp in e.Items) 666 CallAdminService(s => s.DeleteExperiment(exp.Id)); 667 } 668 catch (Exception ex) { 669 ErrorHandling.ShowErrorDialog("Delete failed.", ex); 670 } 671 } 672 private void runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<Run> e) { 673 try { 674 foreach (Run r in e.Items) 675 CallAdminService(s => s.DeleteRun(r.Id)); 676 } 677 catch (Exception ex) { 678 ErrorHandling.ShowErrorDialog("Delete failed.", ex); 679 } 680 } 661 681 #endregion 662 682 -
branches/OKB/HeuristicLab.Services.OKB/3.3/OKBService.cs
r4929 r5071 476 476 } 477 477 public void DeleteExperiment(long id) { 478 using (OKBDataContext okb = new OKBDataContext()) { 478 foreach (DataTransfer.Run run in GetRuns(id)) 479 DeleteRun(run.Id); 480 481 using (OKBDataContext okb = new OKBDataContext()) { 482 IEnumerable<DataAccess.AlgorithmParameterBlobValue> algorithmParameterBlobValues = okb.AlgorithmParameterBlobValues.Where(x => x.ExperimentId == id); 483 okb.AlgorithmParameterBlobValues.DeleteAllOnSubmit(algorithmParameterBlobValues); 484 IEnumerable<DataAccess.AlgorithmParameterBoolValue> algorithmParameterBoolValues = okb.AlgorithmParameterBoolValues.Where(x => x.ExperimentId == id); 485 okb.AlgorithmParameterBoolValues.DeleteAllOnSubmit(algorithmParameterBoolValues); 486 IEnumerable<DataAccess.AlgorithmParameterFloatValue> algorithmParameterFloatValues = okb.AlgorithmParameterFloatValues.Where(x => x.ExperimentId == id); 487 okb.AlgorithmParameterFloatValues.DeleteAllOnSubmit(algorithmParameterFloatValues); 488 IEnumerable<DataAccess.AlgorithmParameterIntValue> algorithmParameterIntValues = okb.AlgorithmParameterIntValues.Where(x => x.ExperimentId == id); 489 okb.AlgorithmParameterIntValues.DeleteAllOnSubmit(algorithmParameterIntValues); 490 IEnumerable<DataAccess.AlgorithmParameterStringValue> algorithmParameterStringValues = okb.AlgorithmParameterStringValues.Where(x => x.ExperimentId == id); 491 okb.AlgorithmParameterStringValues.DeleteAllOnSubmit(algorithmParameterStringValues); 492 493 IEnumerable<DataAccess.ProblemParameterBlobValue> problemParameterBlobValues = okb.ProblemParameterBlobValues.Where(x => x.ExperimentId == id); 494 okb.ProblemParameterBlobValues.DeleteAllOnSubmit(problemParameterBlobValues); 495 IEnumerable<DataAccess.ProblemParameterBoolValue> problemParameterBoolValues = okb.ProblemParameterBoolValues.Where(x => x.ExperimentId == id); 496 okb.ProblemParameterBoolValues.DeleteAllOnSubmit(problemParameterBoolValues); 497 IEnumerable<DataAccess.ProblemParameterFloatValue> problemParameterFloatValues = okb.ProblemParameterFloatValues.Where(x => x.ExperimentId == id); 498 okb.ProblemParameterFloatValues.DeleteAllOnSubmit(problemParameterFloatValues); 499 IEnumerable<DataAccess.ProblemParameterIntValue> problemParameterIntValues = okb.ProblemParameterIntValues.Where(x => x.ExperimentId == id); 500 okb.ProblemParameterIntValues.DeleteAllOnSubmit(problemParameterIntValues); 501 IEnumerable<DataAccess.ProblemParameterStringValue> problemParameterStringValues = okb.ProblemParameterStringValues.Where(x => x.ExperimentId == id); 502 okb.ProblemParameterStringValues.DeleteAllOnSubmit(problemParameterStringValues); 503 479 504 DataAccess.Experiment entity = okb.Experiments.FirstOrDefault(x => x.Id == id); 480 505 if (entity != null) okb.Experiments.DeleteOnSubmit(entity); … … 519 544 public void DeleteRun(long id) { 520 545 using (OKBDataContext okb = new OKBDataContext()) { 546 IEnumerable<DataAccess.ResultBlobValue> resultBlobValues = okb.ResultBlobValues.Where(x => x.RunId == id); 547 okb.ResultBlobValues.DeleteAllOnSubmit(resultBlobValues); 548 IEnumerable<DataAccess.ResultBoolValue> resultBoolValues = okb.ResultBoolValues.Where(x => x.RunId == id); 549 okb.ResultBoolValues.DeleteAllOnSubmit(resultBoolValues); 550 IEnumerable<DataAccess.ResultFloatValue> resultFloatValues = okb.ResultFloatValues.Where(x => x.RunId == id); 551 okb.ResultFloatValues.DeleteAllOnSubmit(resultFloatValues); 552 IEnumerable<DataAccess.ResultIntValue> resultIntValues = okb.ResultIntValues.Where(x => x.RunId == id); 553 okb.ResultIntValues.DeleteAllOnSubmit(resultIntValues); 554 IEnumerable<DataAccess.ResultStringValue> resultStringValues = okb.ResultStringValues.Where(x => x.RunId == id); 555 okb.ResultStringValues.DeleteAllOnSubmit(resultStringValues); 556 521 557 DataAccess.Run entity = okb.Runs.FirstOrDefault(x => x.Id == id); 522 558 if (entity != null) okb.Runs.DeleteOnSubmit(entity);
Note: See TracChangeset
for help on using the changeset viewer.