(1) Test wizard includes 'Heat meters' step only when HEAT_METERS_SUPPORT defined, (2) type-safe queries.

This commit is contained in:
Milan Hanajik
2016-12-02 11:04:33 +01:00
parent 1f3a2af043
commit ae8ba80f67
+17 -10
View File
@@ -132,14 +132,16 @@ namespace TBF
/// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Config.Entities.DBKind.Config))
{
feedingPaths = session.CreateQuery("FROM FeedingPath").List<FeedingPath>();
benchPaths = session.CreateQuery("FROM BenchPath").List<BenchPath>();
outputPaths = session.CreateQuery("FROM OutputPath").List<OutputPath>();
metersPaths = session.CreateQuery("FROM MetersPath").List<MetersPath>();
feedingPaths = session.QueryOver<FeedingPath>().List();
benchPaths = session.QueryOver<BenchPath>().List();
outputPaths = session.QueryOver<OutputPath>().List();
metersPaths = session.QueryOver<MetersPath>().List();
#if HEAT_METERS_SUPPORT
heatMetersPaths = session.CreateQuery("FROM HeatMetersPath").List<HeatMetersPath>();
heatMetersPaths = session.QueryOver<HeatMetersPath>().List();
#else
heatMetersPaths = new List<HeatMetersPath>();
#endif
transitionSequences = session.CreateQuery("FROM TransitionSequence").List<TransitionSequence>();
transitionSequences = session.QueryOver<TransitionSequence>().List();
}
transitionStartComboBox.Items.Add("---");
@@ -513,14 +515,17 @@ namespace TBF
{
NHibernate.ISession session = Config.FluentCommon.CreateSession(Config.Entities.DBKind.Config);
IList<Procedure> procedures = session
.CreateQuery("FROM Procedure WHERE ProcedureState = 'History'")
.List<Procedure>();
.QueryOver<Procedure>()
.Where(x => x.ProcedureState == ProcedureState.History)
.List();
int predecessorId = LoadedProcedure.PredecessorId;
IList<Procedure> oneProcedure = session
.CreateQuery(string.Format("FROM Procedure WHERE ProcedureState = 'Active' AND Id = {0}", predecessorId))
.List<Procedure>();
.QueryOver<Procedure>()
.Where(x => (x.ProcedureState == ProcedureState.Active))
.And(x => (x.Id == predecessorId))
.List();
if (oneProcedure.Count == 1)
{
@@ -1661,7 +1666,9 @@ namespace TBF
if (selectedMethod is BenchControl.TestMethods.PMaxTest.TestMethod) goto pressure_label;
if (selectedMethod is BenchControl.TestMethods.LeakTest.TestMethod) goto pressure_label;
#if HEAT_METERS_SUPPORT
if (selectedMethod.CanTest(MetersKind.HeatMeter)) goto heat_meters_label;
#endif
flowLabel:
switch (flowDlg.ShowDialog())