Possibility to reload previous results, MainSeq modified - CreateNewBatchResults() and RestoreBatchResults(), ver. 2.12.538

This commit is contained in:
Milan Hanajik
2017-04-11 17:31:48 +02:00
parent 60f5359bd9
commit 1ccdcf9bd2
17 changed files with 512 additions and 431 deletions
+25
View File
@@ -270,5 +270,30 @@ namespace Results
return true;
}
public static Batch LoadBatch(int batchNr)
{
IList<Batch> batches;
ISession session = DB.CreateSession();
if (session == null) return null;
TestDataList = session.QueryOver<TestData>().List();
ComponentsList = session.QueryOver<Components>().List();
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
try
{
batches = session.QueryOver<Batch>()
.Where(x => (x.BatchNr == batchNr))
.List();
}
catch (Exception exc)
{
log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message);
return null;
}
return (batches.Count > 0) ? batches[0] : null;
}
}
}