diff --git a/Results/DB.cs b/Results/DB.cs index 88b72a71c..ecfea110c 100644 --- a/Results/DB.cs +++ b/Results/DB.cs @@ -296,13 +296,13 @@ namespace Results ISession session = DB.CreateSession(); if (session == null) return null; - TestDataList = session.QueryOver().List(); - ComponentsList = session.QueryOver().List(); - WaterMeterDataList = session.QueryOver().List(); - try { - batches = session.QueryOver() + TestDataList = session.QueryOver().List(); + ComponentsList = session.QueryOver().List(); + WaterMeterDataList = session.QueryOver().List(); + + batches = session.QueryOver() .Where(x => (x.BatchNr == batchNr)) .List(); @@ -315,14 +315,14 @@ namespace Results .Where(x => (x.Batch.Id == batch.Id)) .List(); } - } + + return (batches.Count > 0) ? batches[0] : null; + } catch (Exception exc) { log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message); return null; } - - return (batches.Count > 0) ? batches[0] : null; } } } diff --git a/TBF/BenchControl/Sequences/MainSeq.cs b/TBF/BenchControl/Sequences/MainSeq.cs index e67b4da7c..d2bdc36fe 100644 --- a/TBF/BenchControl/Sequences/MainSeq.cs +++ b/TBF/BenchControl/Sequences/MainSeq.cs @@ -1428,6 +1428,8 @@ namespace TBF.BenchControl.Sequences { Batch oriBatch = Results.DB.LoadBatch(oriBatchNr); + if (oriBatch == null) return; + batchResults.Batch.StartTime = oriBatch.StartTime; foreach (var testRslt in batchResults.Batch.TestRslts)