diff --git a/Config/Data.cs b/Config/Data.cs index 6e26bbadf..db346ae93 100644 --- a/Config/Data.cs +++ b/Config/Data.cs @@ -15,10 +15,10 @@ namespace Config public const int HeatMetersCount = 0; public const int MaxPartNr = 1; #elif MUNICH - public const int WMsCount = 3; - public const int LineSize = 3; - public const int CompoundWMsCount = 3; - public const int HeatMetersCount = 0; + public const int WMsCount = 3; + public const int LineSize = 3; + public const int CompoundWMsCount = 3; + public const int HeatMetersCount = 0; public const int MaxPartNr = 3; #elif MALTA_WSD25 public const int WMsCount = 6; @@ -88,11 +88,6 @@ namespace Config public const int MaxPartNr = WMsCount / LineSize; #endif - /// - /// Database related: This object reference is set after a successful user login - /// - public static DatabaseSettings CurrentBench; - public static double RealDensity = 0; /// true water density [kg/m3] public static double AtTemperature = 0; /// measured at temperature [°C] public static double Buoyancy = 0; diff --git a/Config/Entities/Test.cs b/Config/Entities/Test.cs index 7112d5c7d..f678f1b34 100644 --- a/Config/Entities/Test.cs +++ b/Config/Entities/Test.cs @@ -425,29 +425,6 @@ namespace Config.Entities return false; } - /// - /// Determines whether tests part number is OK. - /// Examples of correct part number are: - /// 1, 2, 12, 21 in case of max. part nr.== 2 - /// 1, 2, 3, 4, 12, 13, 14, 23, 24, 34, 123, 124, 134, 234, 1234 in case of max. part nr.== 4 - /// - /// Tests par tnumber - /// true when Part number is OK - public static bool IsGoodPartNr(int partNr) - { - bool firstDigitIsOK = ((partNr % 10) > 0) && ((partNr % 10) <= Config.Data.MaxPartNr); - bool secondDigitIsOK = (((partNr/10) % 10) > 0) && (((partNr/10) % 10) <= Config.Data.MaxPartNr); - bool thirdDigitIsOK = (((partNr/100) % 10) > 0) && (((partNr/100) % 10) <= Config.Data.MaxPartNr); - bool fourthDigitIsOK = (((partNr/1000) % 10) > 0) && (((partNr/1000) % 10) <= Config.Data.MaxPartNr); - - if (firstDigitIsOK && (partNr / 10 == 0)) return true; - if (firstDigitIsOK && secondDigitIsOK && (partNr / 100 == 0)) return true; - if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && (partNr / 1000 == 0)) return true; - if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && fourthDigitIsOK && (partNr / 10000 == 0)) return true; - - return false; - } - public override string ToString() { string partStr = (Part > 0) ? string.Format(", part {0}", Part) : string.Empty; diff --git a/Config/FluentCommon.cs b/Config/FluentCommon.cs index 84cba50f9..54e321db1 100644 --- a/Config/FluentCommon.cs +++ b/Config/FluentCommon.cs @@ -14,40 +14,6 @@ namespace Config { public static class FluentCommon { - /// - /// Session factories for regular sessions. - /// - public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)Users.Entities.DBKind.Count]; - - /// - /// NHibernate session factory (to create the database session 'SessionFactory') - /// - /// A database session - static ISessionFactory CreateSessionFactory(Users.Entities.DBKind database) - { - Users.Entities.DBType dbType; - string connectionString; - - switch (database) - { - default: - case Users.Entities.DBKind.Config: - dbType = Data.CurrentBench.ProceduresDBSettings.DbType; - connectionString = Data.CurrentBench.ProceduresDBSettings.ConnectionString; - break; - case Users.Entities.DBKind.Results: - dbType = Data.CurrentBench.WaterMetersDBSettings.DbType; - connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString; - break; - case Users.Entities.DBKind.RemoteConfig: - dbType = Data.CurrentBench.UsersDBSettings.DbType; - connectionString = Data.CurrentBench.UsersDBSettings.ConnectionString; - break; - } - - return CreateSessionFactory(database, dbType, connectionString, false); - } - /// /// NHibernate session factory (to create the database session 'SessionFactory') /// @@ -116,17 +82,6 @@ namespace Config new SchemaExport(config).Create(true, true); } - /// Create a NHibernate session for the given database - public static ISession CreateSession(Users.Entities.DBKind database) - { - if (database < 0 || database >= Users.Entities.DBKind.Count) return null; - - int ix = (int)database; - if (SessionFactories[ix] == null) SessionFactories[ix] = CreateSessionFactory(database); - - return SessionFactories[ix].OpenSession(); - } - /// /// Create an empty users database. /// Database contains only the user 'admin' and the control board component 'CB'. diff --git a/TBF/BenchControl/DataEntry/Combined/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Combined/CycleBeginningForm.cs index ec62d4dcb..35d4a5b2f 100644 --- a/TBF/BenchControl/DataEntry/Combined/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Combined/CycleBeginningForm.cs @@ -44,9 +44,9 @@ namespace TBF.BenchControl.DataEntry.Combined /// Default constructor - Default number of compound water meters /// public CycleBeginningForm() - : this (Config.Data.CompoundWMsCount, false) + : this (TBF.Data.CompoundWMsCount, false) { - this.WaterMetersCount = Config.Data.CompoundWMsCount; + this.WaterMetersCount = TBF.Data.CompoundWMsCount; } /// diff --git a/TBF/BenchControl/DataEntry/Combined/CycleEndForm.cs b/TBF/BenchControl/DataEntry/Combined/CycleEndForm.cs index cb5495338..a08a2bb28 100644 --- a/TBF/BenchControl/DataEntry/Combined/CycleEndForm.cs +++ b/TBF/BenchControl/DataEntry/Combined/CycleEndForm.cs @@ -35,10 +35,10 @@ namespace TBF.BenchControl.DataEntry.Combined InitializeComponent(); ControlBox = false; - MainStateText = new string[Config.Data.CompoundWMsCount]; - AuxStateText = new string[Config.Data.CompoundWMsCount]; - QRise = new float[Config.Data.CompoundWMsCount]; - QFall = new float[Config.Data.CompoundWMsCount]; + MainStateText = new string[TBF.Data.CompoundWMsCount]; + AuxStateText = new string[TBF.Data.CompoundWMsCount]; + QRise = new float[TBF.Data.CompoundWMsCount]; + QFall = new float[TBF.Data.CompoundWMsCount]; completed = false; StartForceCloseHandler(); @@ -77,7 +77,7 @@ namespace TBF.BenchControl.DataEntry.Combined qRise1TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qrise, 3); qFall1TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qfall, 3); - if (Config.Data.CompoundWMsCount >= 2) + if (TBF.Data.CompoundWMsCount >= 2) { qRise2TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qrise, 3); qFall2TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qfall, 3); @@ -88,7 +88,7 @@ namespace TBF.BenchControl.DataEntry.Combined Height = 305; } - if (Config.Data.CompoundWMsCount >= 3) + if (TBF.Data.CompoundWMsCount >= 3) { qRise3TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qrise, 3); qFall3TextBox.Text = Utils.DoubleToStr(Sequences.SequenceBase.Qfall, 3); @@ -109,7 +109,7 @@ namespace TBF.BenchControl.DataEntry.Combined if (Utils.TryParseUFloat(qRise1TextBox.Text, out ftmp)) { QRise[0] = ftmp; } else { allOK = false; } if (Utils.TryParseUFloat(qFall1TextBox.Text, out ftmp)) { QFall[0] = ftmp; } else { allOK = false; } - if (Config.Data.CompoundWMsCount >= 2) + if (TBF.Data.CompoundWMsCount >= 2) { MainStateText[1] = mainState2TextBox.Text; AuxStateText[1] = auxState2TextBox.Text; @@ -117,7 +117,7 @@ namespace TBF.BenchControl.DataEntry.Combined if (Utils.TryParseUFloat(qFall2TextBox.Text, out ftmp)) { QFall[1] = ftmp; } else { allOK = false; } } - if (Config.Data.CompoundWMsCount >= 3) + if (TBF.Data.CompoundWMsCount >= 3) { MainStateText[2] = mainState3TextBox.Text; AuxStateText[2] = auxState3TextBox.Text; diff --git a/TBF/BenchControl/DataEntry/Combined/EntryForm.cs b/TBF/BenchControl/DataEntry/Combined/EntryForm.cs index 066e18305..a0ba68019 100644 --- a/TBF/BenchControl/DataEntry/Combined/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/Combined/EntryForm.cs @@ -70,11 +70,11 @@ namespace TBF.BenchControl.DataEntry.Combined public override void Initialize() { - disabled = new bool[Config.Data.CompoundWMsCount]; - wmStartState = new double[Config.Data.CompoundWMsCount * 2]; - wmStartStateStr = new string[Config.Data.CompoundWMsCount * 2]; - wmEndState = new double[Config.Data.CompoundWMsCount * 2]; - wmCycleEndState = new string[Config.Data.CompoundWMsCount * 2]; + disabled = new bool[TBF.Data.CompoundWMsCount]; + wmStartState = new double[TBF.Data.CompoundWMsCount * 2]; + wmStartStateStr = new string[TBF.Data.CompoundWMsCount * 2]; + wmEndState = new double[TBF.Data.CompoundWMsCount * 2]; + wmCycleEndState = new string[TBF.Data.CompoundWMsCount * 2]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -123,7 +123,7 @@ namespace TBF.BenchControl.DataEntry.Combined /// void OpenBeginningDlg(EntryForm myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.CompoundWMsCount, myRef.entryFormCfg.RemarkEnabled); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.CompoundWMsCount, myRef.entryFormCfg.RemarkEnabled); modelessDlg.Show(); } /// @@ -136,20 +136,20 @@ namespace TBF.BenchControl.DataEntry.Combined /// void OpenTestStartStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.CompoundWMsCount, myRef.regReaders, myRef.disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.CompoundWMsCount, myRef.regReaders, myRef.disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryForm myRef) { - string[] mainStartStateStr = new string[Config.Data.CompoundWMsCount]; - string[] auxStartStateStr = new string[Config.Data.CompoundWMsCount]; - for (int i = 0; i < Config.Data.CompoundWMsCount; i++) + string[] mainStartStateStr = new string[TBF.Data.CompoundWMsCount]; + string[] auxStartStateStr = new string[TBF.Data.CompoundWMsCount]; + for (int i = 0; i < TBF.Data.CompoundWMsCount; i++) { mainStartStateStr[i] = wmStartStateStr[2 * i]; auxStartStateStr[i] = wmStartStateStr[2 * i + 1]; } - myRef.modelessDlg = new TestStartEndForm(Config.Data.CompoundWMsCount, myRef.regReaders, mainStartStateStr, auxStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.CompoundWMsCount, myRef.regReaders, mainStartStateStr, auxStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/Combined/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/Combined/TestStartEndForm.cs index eeb5fc0e0..2971dd821 100644 --- a/TBF/BenchControl/DataEntry/Combined/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/Combined/TestStartEndForm.cs @@ -136,9 +136,9 @@ namespace TBF.BenchControl.DataEntry.Combined /// void ShuffleTextBoxes() { - if (Config.Data.CompoundWMsCount < TextBoxesCount) + if (TBF.Data.CompoundWMsCount < TextBoxesCount) { - TextBoxesCount = Config.Data.CompoundWMsCount; + TextBoxesCount = TBF.Data.CompoundWMsCount; } } diff --git a/TBF/BenchControl/DataEntry/DataStream/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/DataStream/CycleBeginningForm.cs index 26741724b..f199b5975 100644 --- a/TBF/BenchControl/DataEntry/DataStream/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/DataStream/CycleBeginningForm.cs @@ -109,7 +109,7 @@ namespace TBF.BenchControl.DataEntry.DataStream int wmsCount = Math.Min(mefImport.DataStreamIFace.GetMetersCount(), waterMeters.Count); int right, bottom; - enabledSerialNrBoxes = ShuffleTextBoxes(wmsCount, Config.Data.LineSize, out right, out bottom); + enabledSerialNrBoxes = ShuffleTextBoxes(wmsCount, TBF.Data.LineSize, out right, out bottom); Height = bottom + 60; DataStreamsCount = enabledSerialNrBoxes.Count; diff --git a/TBF/BenchControl/DataEntry/DataStream/EntryForm.cs b/TBF/BenchControl/DataEntry/DataStream/EntryForm.cs index 2f6b1d697..28af1bb50 100644 --- a/TBF/BenchControl/DataEntry/DataStream/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/DataStream/EntryForm.cs @@ -74,11 +74,11 @@ namespace TBF.BenchControl.DataEntry.DataStream public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -133,19 +133,19 @@ namespace TBF.BenchControl.DataEntry.DataStream /// void OpenEndDlg(EntryForm myRef) { - myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount, Config.Data.LineSize); + myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount, TBF.Data.LineSize); modelessDlg.Show(); } /// void OpenTestStartStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, myRef.disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/DataStream/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/DataStream/TestStartEndForm.cs index d0b13fcff..d93d8ec44 100644 --- a/TBF/BenchControl/DataEntry/DataStream/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/DataStream/TestStartEndForm.cs @@ -152,18 +152,18 @@ namespace TBF.BenchControl.DataEntry.DataStream { if (TextBoxesCount > WaterMetersCount) { - int nrLines = WaterMetersCount / Config.Data.LineSize; + int nrLines = WaterMetersCount / TBF.Data.LineSize; int gap = (TextBoxesCount - WaterMetersCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; - exclamations[dest] = exclamations[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + exclamations[dest] = exclamations[l * TBF.Data.LineSize + l * gap + i]; dest++; } } diff --git a/TBF/BenchControl/DataEntry/Fewa/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Fewa/CycleBeginningForm.cs index 55ba1c949..606e0bcbd 100644 --- a/TBF/BenchControl/DataEntry/Fewa/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Fewa/CycleBeginningForm.cs @@ -89,7 +89,7 @@ namespace TBF.BenchControl.DataEntry.Fewa suffixText = new string[WMsCount]; Disabled = new bool[WMsCount]; - ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize); //Height = 147 + WaterMetersCount * 90; } diff --git a/TBF/BenchControl/DataEntry/Fewa/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Fewa/EntryFormNoStartEnd.cs index b83f058d2..01352f1d9 100644 --- a/TBF/BenchControl/DataEntry/Fewa/EntryFormNoStartEnd.cs +++ b/TBF/BenchControl/DataEntry/Fewa/EntryFormNoStartEnd.cs @@ -70,11 +70,11 @@ namespace TBF.BenchControl.DataEntry.Fewa public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -123,25 +123,25 @@ namespace TBF.BenchControl.DataEntry.Fewa /// void OpenBeginningDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// void OpenEndDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount, Config.Data.LineSize); + myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount, TBF.Data.LineSize); modelessDlg.Show(); } /// void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, myRef.disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/Fewa/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/Fewa/TestStartEndForm.cs index f8248581f..a6eb675c9 100644 --- a/TBF/BenchControl/DataEntry/Fewa/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/Fewa/TestStartEndForm.cs @@ -152,18 +152,18 @@ namespace TBF.BenchControl.DataEntry.Fewa { if (TextBoxesCount > WMsCount) { - int nrLines = WMsCount / Config.Data.LineSize; + int nrLines = WMsCount / TBF.Data.LineSize; int gap = (TextBoxesCount - WMsCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; - exclamations[dest] = exclamations[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + exclamations[dest] = exclamations[l * TBF.Data.LineSize + l * gap + i]; dest++; } } diff --git a/TBF/BenchControl/DataEntry/HeatMeters12/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/HeatMeters12/CycleBeginningForm.cs index 5d6ef0b48..ba660abf8 100644 --- a/TBF/BenchControl/DataEntry/HeatMeters12/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/HeatMeters12/CycleBeginningForm.cs @@ -87,7 +87,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12 SNText = new string[WaterMetersCount]; Disabled = new bool[WaterMetersCount]; - ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize); foreach (var wm in waterMeters) if (wm != null) wm.Passed = wm.PassedFromTests(); diff --git a/TBF/BenchControl/DataEntry/HeatMeters12/EntryForm.cs b/TBF/BenchControl/DataEntry/HeatMeters12/EntryForm.cs index 68a521f92..d64cb3b86 100644 --- a/TBF/BenchControl/DataEntry/HeatMeters12/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/HeatMeters12/EntryForm.cs @@ -82,14 +82,14 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12 public override void Initialize() { - disabled = new bool[Config.Data.HeatMetersCount]; - wmStartState = new double[Config.Data.HeatMetersCount]; - wmStartStateStr = new string[Config.Data.HeatMetersCount]; - wmEndState = new double[Config.Data.HeatMetersCount]; - energyStartState = new double[Config.Data.HeatMetersCount]; - energyStartStateStr = new string[Config.Data.HeatMetersCount]; - energyEndState = new double[Config.Data.HeatMetersCount]; - wmCycleEndState = new string[Config.Data.HeatMetersCount]; + disabled = new bool[TBF.Data.HeatMetersCount]; + wmStartState = new double[TBF.Data.HeatMetersCount]; + wmStartStateStr = new string[TBF.Data.HeatMetersCount]; + wmEndState = new double[TBF.Data.HeatMetersCount]; + energyStartState = new double[TBF.Data.HeatMetersCount]; + energyStartStateStr = new string[TBF.Data.HeatMetersCount]; + energyEndState = new double[TBF.Data.HeatMetersCount]; + wmCycleEndState = new string[TBF.Data.HeatMetersCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -242,7 +242,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12 else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd) { CycleEndForm dlg = (modelessDlg as CycleEndForm); - int count = Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); + int count = Math.Min(waterMeters.Count, TBF.Data.HeatMetersCount); if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount; for (int i = 0; i < count; i++) @@ -260,7 +260,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12 TestStartEndForm dlg = (modelessDlg as TestStartEndForm); if (dlg != null) { - for (int i = 0; i < Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); i++) + for (int i = 0; i < Math.Min(waterMeters.Count, TBF.Data.HeatMetersCount); i++) { wmStartState[i] = dlg.WMStartState[i]; wmStartStateStr[i] = dlg.WMStartStateStr[i]; @@ -275,7 +275,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12 TestStartEndForm dlg = (modelessDlg as TestStartEndForm); if (dlg != null) { - for (int i = 0; i < Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); i++) + for (int i = 0; i < Math.Min(waterMeters.Count, TBF.Data.HeatMetersCount); i++) { wmEndState[i] = dlg.WMEndState[i]; energyEndState[i] = dlg.EnergyEndState[i]; diff --git a/TBF/BenchControl/DataEntry/HeatMeters12/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/HeatMeters12/TestStartEndForm.cs index ec2d31125..7dea59eba 100644 --- a/TBF/BenchControl/DataEntry/HeatMeters12/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/HeatMeters12/TestStartEndForm.cs @@ -177,26 +177,26 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12 /// void ShuffleTextBoxes() { - if (Config.Data.HeatMetersCount < TextBoxesCount) + if (TBF.Data.HeatMetersCount < TextBoxesCount) { - int nrLines = Math.Max(1, Config.Data.HeatMetersCount / Config.Data.LineSize); - int gap = (TextBoxesCount - Config.Data.HeatMetersCount) / nrLines; + int nrLines = Math.Max(1, TBF.Data.HeatMetersCount / TBF.Data.LineSize); + int gap = (TextBoxesCount - TBF.Data.HeatMetersCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; - energyLabels[dest] = energyLabels[l * Config.Data.LineSize + l * gap + i]; - energyStartTextBoxes[dest] = energyStartTextBoxes[l * Config.Data.LineSize + l * gap + i]; - energyEndTextBoxes[dest] = energyEndTextBoxes[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + energyLabels[dest] = energyLabels[l * TBF.Data.LineSize + l * gap + i]; + energyStartTextBoxes[dest] = energyStartTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + energyEndTextBoxes[dest] = energyEndTextBoxes[l * TBF.Data.LineSize + l * gap + i]; dest++; } } - TextBoxesCount = Config.Data.HeatMetersCount; + TextBoxesCount = TBF.Data.HeatMetersCount; } } diff --git a/TBF/BenchControl/DataEntry/HeatMeters6/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/HeatMeters6/CycleBeginningForm.cs index cac3366a3..258bbf80e 100644 --- a/TBF/BenchControl/DataEntry/HeatMeters6/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/HeatMeters6/CycleBeginningForm.cs @@ -80,7 +80,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6 SNText = new string[WaterMetersCount]; Disabled = new bool[WaterMetersCount]; - ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize); foreach (var wm in waterMeters) if (wm != null) wm.Passed = wm.PassedFromTests(); diff --git a/TBF/BenchControl/DataEntry/HeatMeters6/EntryForm.cs b/TBF/BenchControl/DataEntry/HeatMeters6/EntryForm.cs index 53216d533..3f7f845f1 100644 --- a/TBF/BenchControl/DataEntry/HeatMeters6/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/HeatMeters6/EntryForm.cs @@ -82,14 +82,14 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6 public override void Initialize() { - disabled = new bool[Config.Data.HeatMetersCount]; - wmStartState = new double[Config.Data.HeatMetersCount]; - wmStartStateStr = new string[Config.Data.HeatMetersCount]; - wmEndState = new double[Config.Data.HeatMetersCount]; - energyStartState = new double[Config.Data.HeatMetersCount]; - energyStartStateStr = new string[Config.Data.HeatMetersCount]; - energyEndState = new double[Config.Data.HeatMetersCount]; - wmCycleEndState = new string[Config.Data.HeatMetersCount]; + disabled = new bool[TBF.Data.HeatMetersCount]; + wmStartState = new double[TBF.Data.HeatMetersCount]; + wmStartStateStr = new string[TBF.Data.HeatMetersCount]; + wmEndState = new double[TBF.Data.HeatMetersCount]; + energyStartState = new double[TBF.Data.HeatMetersCount]; + energyStartStateStr = new string[TBF.Data.HeatMetersCount]; + energyEndState = new double[TBF.Data.HeatMetersCount]; + wmCycleEndState = new string[TBF.Data.HeatMetersCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -241,7 +241,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6 else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd) { CycleEndForm dlg = (modelessDlg as CycleEndForm); - int count = Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); + int count = Math.Min(waterMeters.Count, TBF.Data.HeatMetersCount); if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount; for (int i = 0; i < count; i++) @@ -259,7 +259,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6 TestStartEndForm dlg = (modelessDlg as TestStartEndForm); if (dlg != null) { - for (int i = 0; i < Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); i++) + for (int i = 0; i < Math.Min(waterMeters.Count, TBF.Data.HeatMetersCount); i++) { wmStartState[i] = dlg.WMStartState[i]; wmStartStateStr[i] = dlg.WMStartStateStr[i]; @@ -274,7 +274,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6 TestStartEndForm dlg = (modelessDlg as TestStartEndForm); if (dlg != null) { - for (int i = 0; i < Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); i++) + for (int i = 0; i < Math.Min(waterMeters.Count, TBF.Data.HeatMetersCount); i++) { wmEndState[i] = dlg.WMEndState[i]; energyEndState[i] = dlg.EnergyEndState[i]; diff --git a/TBF/BenchControl/DataEntry/HeatMeters6/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/HeatMeters6/TestStartEndForm.cs index a371e5c3b..2641c6da2 100644 --- a/TBF/BenchControl/DataEntry/HeatMeters6/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/HeatMeters6/TestStartEndForm.cs @@ -169,26 +169,26 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6 /// void ShuffleTextBoxes() { - if (Config.Data.HeatMetersCount < TextBoxesCount) + if (TBF.Data.HeatMetersCount < TextBoxesCount) { - int nrLines = Math.Max(1, Config.Data.HeatMetersCount / Config.Data.LineSize); - int gap = (TextBoxesCount - Config.Data.HeatMetersCount) / nrLines; + int nrLines = Math.Max(1, TBF.Data.HeatMetersCount / TBF.Data.LineSize); + int gap = (TextBoxesCount - TBF.Data.HeatMetersCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; - energyLabels[dest] = energyLabels[l * Config.Data.LineSize + l * gap + i]; - energyStartTextBoxes[dest] = energyStartTextBoxes[l * Config.Data.LineSize + l * gap + i]; - energyEndTextBoxes[dest] = energyEndTextBoxes[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + energyLabels[dest] = energyLabels[l * TBF.Data.LineSize + l * gap + i]; + energyStartTextBoxes[dest] = energyStartTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + energyEndTextBoxes[dest] = energyEndTextBoxes[l * TBF.Data.LineSize + l * gap + i]; dest++; } } - TextBoxesCount = Config.Data.HeatMetersCount; + TextBoxesCount = TBF.Data.HeatMetersCount; } } diff --git a/TBF/BenchControl/DataEntry/Munich/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Munich/CycleBeginningForm.cs index 1fa2dfb8d..d5b13ffbd 100644 --- a/TBF/BenchControl/DataEntry/Munich/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Munich/CycleBeginningForm.cs @@ -27,8 +27,8 @@ namespace TBF.BenchControl.DataEntry.Munich InitializeComponent(); ControlBox = false; - MainSNText = new string[Config.Data.CompoundWMsCount]; - AuxSNText = new string[Config.Data.CompoundWMsCount]; + MainSNText = new string[TBF.Data.CompoundWMsCount]; + AuxSNText = new string[TBF.Data.CompoundWMsCount]; completed = false; StartForceCloseHandler(); @@ -38,12 +38,12 @@ namespace TBF.BenchControl.DataEntry.Munich { Localize(); - if (Config.Data.CompoundWMsCount < 2) + if (TBF.Data.CompoundWMsCount < 2) { groupBox2.Visible = groupBox3.Visible = false; Height = 200; } - else if (Config.Data.CompoundWMsCount < 3) + else if (TBF.Data.CompoundWMsCount < 3) { groupBox3.Visible = false; Height = 355; @@ -73,13 +73,13 @@ namespace TBF.BenchControl.DataEntry.Munich MainSNText[0] = mainSN1TextBox.Text; AuxSNText[0] = auxSN1TextBox.Text; - if (Config.Data.CompoundWMsCount >= 2) + if (TBF.Data.CompoundWMsCount >= 2) { MainSNText[1] = mainSN2TextBox.Text; AuxSNText[1] = auxSN2TextBox.Text; } - if (Config.Data.CompoundWMsCount >= 3) + if (TBF.Data.CompoundWMsCount >= 3) { MainSNText[2] = mainSN3TextBox.Text; AuxSNText[2] = auxSN3TextBox.Text; diff --git a/TBF/BenchControl/DataEntry/Munich/CycleEndForm.cs b/TBF/BenchControl/DataEntry/Munich/CycleEndForm.cs index 63c5f7e06..f676c8f6a 100644 --- a/TBF/BenchControl/DataEntry/Munich/CycleEndForm.cs +++ b/TBF/BenchControl/DataEntry/Munich/CycleEndForm.cs @@ -37,11 +37,11 @@ namespace TBF.BenchControl.DataEntry.Munich InitializeComponent(); ControlBox = false; - MainStateText = new string[Config.Data.CompoundWMsCount]; - AuxStateText = new string[Config.Data.CompoundWMsCount]; - QRise = new float[Config.Data.CompoundWMsCount]; - QFall = new float[Config.Data.CompoundWMsCount]; - YearOfProduction = new int[Config.Data.CompoundWMsCount]; + MainStateText = new string[TBF.Data.CompoundWMsCount]; + AuxStateText = new string[TBF.Data.CompoundWMsCount]; + QRise = new float[TBF.Data.CompoundWMsCount]; + QFall = new float[TBF.Data.CompoundWMsCount]; + YearOfProduction = new int[TBF.Data.CompoundWMsCount]; completed = false; StartForceCloseHandler(); @@ -132,7 +132,7 @@ namespace TBF.BenchControl.DataEntry.Munich YearOfProduction[0] = year; } - if (Config.Data.CompoundWMsCount >= 2) + if (TBF.Data.CompoundWMsCount >= 2) { MainStateText[1] = mainState2TextBox.Text; AuxStateText[1] = auxState2TextBox.Text; @@ -144,7 +144,7 @@ namespace TBF.BenchControl.DataEntry.Munich } } - if (Config.Data.CompoundWMsCount >= 3) + if (TBF.Data.CompoundWMsCount >= 3) { MainStateText[2] = mainState3TextBox.Text; AuxStateText[2] = auxState3TextBox.Text; diff --git a/TBF/BenchControl/DataEntry/Munich/EntryForm.cs b/TBF/BenchControl/DataEntry/Munich/EntryForm.cs index 23e9dae30..032cc0a9e 100644 --- a/TBF/BenchControl/DataEntry/Munich/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/Munich/EntryForm.cs @@ -65,8 +65,8 @@ namespace TBF.BenchControl.DataEntry.Munich public override void Initialize() { - serialNr = new string[Config.Data.CompoundWMsCount]; - wmEndState = new string[Config.Data.CompoundWMsCount]; + serialNr = new string[TBF.Data.CompoundWMsCount]; + wmEndState = new string[TBF.Data.CompoundWMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -141,7 +141,7 @@ namespace TBF.BenchControl.DataEntry.Munich if (!resultSaved) /// This is to save the result only once { - int count = Math.Min(3, Math.Min(wMeters.Count, Config.Data.CompoundWMsCount)); + int count = Math.Min(3, Math.Min(wMeters.Count, TBF.Data.CompoundWMsCount)); if (modelessDlg is CycleBeginningForm) { if (count >= 1 && wMeters[0] != null) wMeters[0].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[0]; diff --git a/TBF/BenchControl/DataEntry/Munich3/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Munich3/CycleBeginningForm.cs index c48dde1c6..74f736e6f 100644 --- a/TBF/BenchControl/DataEntry/Munich3/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Munich3/CycleBeginningForm.cs @@ -41,7 +41,7 @@ namespace TBF.BenchControl.DataEntry.Munich3 /// Parameterless constructor for all watermeters public CycleBeginningForm() - : this(Config.Data.WMsCount) + : this(TBF.Data.WMsCount) { } diff --git a/TBF/BenchControl/DataEntry/Munich3/EntryForm.cs b/TBF/BenchControl/DataEntry/Munich3/EntryForm.cs index 170e37d72..225bb941e 100644 --- a/TBF/BenchControl/DataEntry/Munich3/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/Munich3/EntryForm.cs @@ -74,12 +74,12 @@ namespace TBF.BenchControl.DataEntry.Munich3 public override void Initialize() { - serialNr = new string[Config.Data.WMsCount]; - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + serialNr = new string[TBF.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -128,13 +128,13 @@ namespace TBF.BenchControl.DataEntry.Munich3 /// void OpenBeginningDlg(EntryForm myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// void OpenEndDlg(EntryForm myRef) { - CycleEndForm endForm = new CycleEndForm(Config.Data.WMsCount); + CycleEndForm endForm = new CycleEndForm(TBF.Data.WMsCount); endForm.ProtocolName1 = entryFormCfg.ProtocolTitle1; endForm.ProtocolName2 = entryFormCfg.ProtocolTitle2; endForm.ProtocolName3 = entryFormCfg.ProtocolTitle3; @@ -151,7 +151,7 @@ namespace TBF.BenchControl.DataEntry.Munich3 /// void OpenTestEndStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/S620/EntryForm.cs b/TBF/BenchControl/DataEntry/S620/EntryForm.cs index 811e5e10a..63ce4ce3a 100644 --- a/TBF/BenchControl/DataEntry/S620/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/S620/EntryForm.cs @@ -75,11 +75,11 @@ namespace TBF.BenchControl.DataEntry.S620 public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -154,13 +154,13 @@ namespace TBF.BenchControl.DataEntry.S620 /// void OpenTestStartStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/S620/FormForMechanicalMeters.cs b/TBF/BenchControl/DataEntry/S620/FormForMechanicalMeters.cs index 497e910e7..1d3fc00e7 100644 --- a/TBF/BenchControl/DataEntry/S620/FormForMechanicalMeters.cs +++ b/TBF/BenchControl/DataEntry/S620/FormForMechanicalMeters.cs @@ -180,7 +180,7 @@ namespace TBF.BenchControl.DataEntry.S620 completeSerialNr = new string[wmsCount]; disabled = new bool[wmsCount]; - ShuffleTextBoxes(wmsCount, Config.Data.LineSize); + ShuffleTextBoxes(wmsCount, TBF.Data.LineSize); } /// diff --git a/TBF/BenchControl/DataEntry/S620/FormForMechanicalMetersWithTracing.cs b/TBF/BenchControl/DataEntry/S620/FormForMechanicalMetersWithTracing.cs index 65ff9816b..fc4b47e77 100644 --- a/TBF/BenchControl/DataEntry/S620/FormForMechanicalMetersWithTracing.cs +++ b/TBF/BenchControl/DataEntry/S620/FormForMechanicalMetersWithTracing.cs @@ -3,15 +3,15 @@ /// using System; using System.Collections.Generic; +using System.Drawing; using System.Windows.Forms; using log4net; +using NHibernate; +using Oracle.DataAccess.Client; +using TracingDB; +using TracingDB.Entities; using TBF.BenchControl.Sequences; using TBF.Resources; -using Oracle.DataAccess.Client; -using TracingDB.Entities; -using NHibernate; -using TracingDB; -using System.Drawing; namespace TBF.BenchControl.DataEntry.S620 { @@ -743,7 +743,7 @@ namespace TBF.BenchControl.DataEntry.S620 refRecord.Records.Add(new Record(palety[i].Part, refRecord, palety[i].ScannedCode)); } - DB.SaveRecords(dbSession, refRecord); + TracingDB.DB.SaveRecords(dbSession, refRecord); } } diff --git a/TBF/BenchControl/DataEntry/S620/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/S620/TestStartEndForm.cs index b60ed8e9b..d03b56988 100644 --- a/TBF/BenchControl/DataEntry/S620/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/S620/TestStartEndForm.cs @@ -160,18 +160,18 @@ namespace TBF.BenchControl.DataEntry.S620 { if (TextBoxesCount > WaterMetersCount) { - int nrLines = WaterMetersCount / Config.Data.LineSize; + int nrLines = WaterMetersCount / TBF.Data.LineSize; int gap = (TextBoxesCount - WaterMetersCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; - exclamations[dest] = exclamations[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + exclamations[dest] = exclamations[l * TBF.Data.LineSize + l * gap + i]; dest++; } } diff --git a/TBF/BenchControl/DataEntry/Single/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Single/CycleBeginningForm.cs index 4cabacd30..4d28f2b21 100644 --- a/TBF/BenchControl/DataEntry/Single/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Single/CycleBeginningForm.cs @@ -77,7 +77,7 @@ namespace TBF.BenchControl.DataEntry.Single SNText = new string[WaterMetersCount]; Disabled = new bool[WaterMetersCount]; - ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize); //Height = 147 + WaterMetersCount * 90; } diff --git a/TBF/BenchControl/DataEntry/Single/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Single/EntryFormNoStartEnd.cs index 1055b7d4c..02a1d160f 100644 --- a/TBF/BenchControl/DataEntry/Single/EntryFormNoStartEnd.cs +++ b/TBF/BenchControl/DataEntry/Single/EntryFormNoStartEnd.cs @@ -70,11 +70,11 @@ namespace TBF.BenchControl.DataEntry.Single public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -123,25 +123,25 @@ namespace TBF.BenchControl.DataEntry.Single /// void OpenBeginningDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// void OpenEndDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount, Config.Data.LineSize); + myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount, TBF.Data.LineSize); modelessDlg.Show(); } /// void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, Config.Data.LineSize, myRef.regReaders, myRef.disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, TBF.Data.LineSize, myRef.regReaders, myRef.disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, Config.Data.LineSize, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, TBF.Data.LineSize, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/Standard12/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Standard12/CycleBeginningForm.cs index aaf0b97b3..152897b20 100644 --- a/TBF/BenchControl/DataEntry/Standard12/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Standard12/CycleBeginningForm.cs @@ -89,7 +89,7 @@ namespace TBF.BenchControl.DataEntry.Standard12 SNText = new string[WaterMetersCount]; Disabled = new bool[WaterMetersCount]; - ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize); foreach (var wm in waterMeters) if (wm != null) wm.Passed = wm.PassedFromTests(); diff --git a/TBF/BenchControl/DataEntry/Standard12/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Standard12/EntryFormNoStartEnd.cs index a61c06430..2cb68dff8 100644 --- a/TBF/BenchControl/DataEntry/Standard12/EntryFormNoStartEnd.cs +++ b/TBF/BenchControl/DataEntry/Standard12/EntryFormNoStartEnd.cs @@ -70,11 +70,11 @@ namespace TBF.BenchControl.DataEntry.Standard12 public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -129,19 +129,19 @@ namespace TBF.BenchControl.DataEntry.Standard12 /// void OpenEndDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount); + myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/Standard12/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/Standard12/TestStartEndForm.cs index c57dcb5d0..b7de38567 100644 --- a/TBF/BenchControl/DataEntry/Standard12/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/Standard12/TestStartEndForm.cs @@ -135,17 +135,17 @@ namespace TBF.BenchControl.DataEntry.Standard12 { if (TextBoxesCount > WaterMetersCount) { - int nrLines = WaterMetersCount / Config.Data.LineSize; + int nrLines = WaterMetersCount / TBF.Data.LineSize; int gap = (TextBoxesCount - WaterMetersCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; dest++; } } diff --git a/TBF/BenchControl/DataEntry/Standard24/AdvancedFixedStartTestForm.cs b/TBF/BenchControl/DataEntry/Standard24/AdvancedFixedStartTestForm.cs index e181d7352..1178455d7 100644 --- a/TBF/BenchControl/DataEntry/Standard24/AdvancedFixedStartTestForm.cs +++ b/TBF/BenchControl/DataEntry/Standard24/AdvancedFixedStartTestForm.cs @@ -149,25 +149,25 @@ namespace TBF.BenchControl.DataEntry.Standard24 /// void ShuffleTextBoxes() { - if (Config.Data.WMsCount < TextBoxesCount) + if (TBF.Data.WMsCount < TextBoxesCount) { - int nrLines = Config.Data.WMsCount / Config.Data.LineSize; - int gap = (TextBoxesCount - Config.Data.WMsCount) / nrLines; + int nrLines = TBF.Data.WMsCount / TBF.Data.LineSize; + int gap = (TextBoxesCount - TBF.Data.WMsCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - mid1TextBoxes[dest] = mid1TextBoxes[l * Config.Data.LineSize + l * gap + i]; - mid2TextBoxes[dest] = mid2TextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + mid1TextBoxes[dest] = mid1TextBoxes[l * TBF.Data.LineSize + l * gap + i]; + mid2TextBoxes[dest] = mid2TextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; dest++; } } - TextBoxesCount = Config.Data.WMsCount; + TextBoxesCount = TBF.Data.WMsCount; } } diff --git a/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.cs index 5bacd9fed..0c799d462 100644 --- a/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.cs @@ -77,7 +77,7 @@ namespace TBF.BenchControl.DataEntry.Standard24 SNText = new string[WaterMetersCount]; Disabled = new bool[WaterMetersCount]; - ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize); //Height = 147 + WaterMetersCount * 90; } diff --git a/TBF/BenchControl/DataEntry/Standard24/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Standard24/EntryFormNoStartEnd.cs index 5c8015517..a5c913219 100644 --- a/TBF/BenchControl/DataEntry/Standard24/EntryFormNoStartEnd.cs +++ b/TBF/BenchControl/DataEntry/Standard24/EntryFormNoStartEnd.cs @@ -70,11 +70,11 @@ namespace TBF.BenchControl.DataEntry.Standard24 public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -123,25 +123,25 @@ namespace TBF.BenchControl.DataEntry.Standard24 /// void OpenBeginningDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// void OpenEndDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount, Config.Data.LineSize); + myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount, TBF.Data.LineSize); modelessDlg.Show(); } /// void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, myRef.disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/Standard24/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/Standard24/TestStartEndForm.cs index 6bc5dd4b5..19892d0ae 100644 --- a/TBF/BenchControl/DataEntry/Standard24/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/Standard24/TestStartEndForm.cs @@ -152,18 +152,18 @@ namespace TBF.BenchControl.DataEntry.Standard24 { if (TextBoxesCount > WaterMetersCount) { - int nrLines = WaterMetersCount / Config.Data.LineSize; + int nrLines = WaterMetersCount / TBF.Data.LineSize; int gap = (TextBoxesCount - WaterMetersCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; - exclamations[dest] = exclamations[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + exclamations[dest] = exclamations[l * TBF.Data.LineSize + l * gap + i]; dest++; } } diff --git a/TBF/BenchControl/DataEntry/Standard48/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Standard48/CycleBeginningForm.cs index 6a032c014..b673d36f4 100644 --- a/TBF/BenchControl/DataEntry/Standard48/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Standard48/CycleBeginningForm.cs @@ -81,7 +81,7 @@ namespace TBF.BenchControl.DataEntry.Standard48 SNText = new string[WaterMetersCount]; Disabled = new bool[WaterMetersCount]; - ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize); //Height = 147 + WaterMetersCount * 90; } diff --git a/TBF/BenchControl/DataEntry/Standard48/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Standard48/EntryFormNoStartEnd.cs index 4accb87ce..170a49f3e 100644 --- a/TBF/BenchControl/DataEntry/Standard48/EntryFormNoStartEnd.cs +++ b/TBF/BenchControl/DataEntry/Standard48/EntryFormNoStartEnd.cs @@ -70,11 +70,11 @@ namespace TBF.BenchControl.DataEntry.Standard48 public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -123,25 +123,25 @@ namespace TBF.BenchControl.DataEntry.Standard48 /// void OpenBeginningDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// void OpenEndDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount); + myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/Standard48/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/Standard48/TestStartEndForm.cs index b8004c3d7..b5e4e2f8c 100644 --- a/TBF/BenchControl/DataEntry/Standard48/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/Standard48/TestStartEndForm.cs @@ -160,18 +160,18 @@ namespace TBF.BenchControl.DataEntry.Standard48 { if (TextBoxesCount > WaterMetersCount) { - int nrLines = WaterMetersCount / Config.Data.LineSize; + int nrLines = WaterMetersCount / TBF.Data.LineSize; int gap = (TextBoxesCount - WaterMetersCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; - exclamations[dest] = exclamations[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + exclamations[dest] = exclamations[l * TBF.Data.LineSize + l * gap + i]; dest++; } } diff --git a/TBF/BenchControl/DataEntry/Standard6/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Standard6/CycleBeginningForm.cs index c69f9ae6f..ed17c3896 100644 --- a/TBF/BenchControl/DataEntry/Standard6/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Standard6/CycleBeginningForm.cs @@ -60,7 +60,7 @@ namespace TBF.BenchControl.DataEntry.Standard6 /// Parameterless constructor for all watermeters public CycleBeginningForm() - : this(Config.Data.WMsCount, false) + : this(TBF.Data.WMsCount, false) { } diff --git a/TBF/BenchControl/DataEntry/Standard6/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Standard6/EntryFormNoStartEnd.cs index 64a13e8b5..e7f358192 100644 --- a/TBF/BenchControl/DataEntry/Standard6/EntryFormNoStartEnd.cs +++ b/TBF/BenchControl/DataEntry/Standard6/EntryFormNoStartEnd.cs @@ -67,10 +67,10 @@ namespace TBF.BenchControl.DataEntry.Standard6 public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } diff --git a/TBF/BenchControl/DataEntry/Standard6/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/Standard6/TestStartEndForm.cs index 3043856d8..5a4398589 100644 --- a/TBF/BenchControl/DataEntry/Standard6/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/Standard6/TestStartEndForm.cs @@ -87,7 +87,7 @@ namespace TBF.BenchControl.DataEntry.Standard6 /// Parameterless constructor for all watermeters public TestStartEndForm() - : this(Config.Data.WMsCount, null, null) + : this(TBF.Data.WMsCount, null, null) { } diff --git a/TBF/BenchControl/DataEntry/StandardCamera/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/StandardCamera/CycleBeginningForm.cs index beb0a00d5..6590d8681 100644 --- a/TBF/BenchControl/DataEntry/StandardCamera/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/StandardCamera/CycleBeginningForm.cs @@ -77,8 +77,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera SNText = new string[WaterMetersCount]; Disabled = new bool[WaterMetersCount]; - int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : Config.Data.LineSize; - ShuffleTextBoxes(Config.Data.WMsCount, lineSize); + int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize; + ShuffleTextBoxes(TBF.Data.WMsCount, lineSize); if (hideOrder) orderGroupBox.Visible = false; diff --git a/TBF/BenchControl/DataEntry/StandardCamera/EntryForm.cs b/TBF/BenchControl/DataEntry/StandardCamera/EntryForm.cs index 4c4a0f6f6..409facda2 100644 --- a/TBF/BenchControl/DataEntry/StandardCamera/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/StandardCamera/EntryForm.cs @@ -120,11 +120,11 @@ namespace TBF.BenchControl.DataEntry.StandardCamera public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -185,7 +185,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera /// void OpenBeginningDlg(EntryForm myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount, entryFormCfg.HideOrder); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount, entryFormCfg.HideOrder); modelessDlg.Show(); } /// @@ -196,7 +196,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera !string.IsNullOrEmpty(entryFormCfg.ProtocolTitle3) || !string.IsNullOrEmpty(entryFormCfg.ProtocolTitle4)) { - myRef.modelessDlg = new CycleEndFormMunich(Config.Data.WMsCount); + myRef.modelessDlg = new CycleEndFormMunich(TBF.Data.WMsCount); (myRef.modelessDlg as CycleEndFormMunich).ProtocolName1 = entryFormCfg.ProtocolTitle1; (myRef.modelessDlg as CycleEndFormMunich).ProtocolName2 = entryFormCfg.ProtocolTitle2; (myRef.modelessDlg as CycleEndFormMunich).ProtocolName3 = entryFormCfg.ProtocolTitle3; @@ -204,7 +204,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera } else { - myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount, Config.Data.LineSize); + myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount, TBF.Data.LineSize); } myRef.modelessDlg.Show(); @@ -212,19 +212,19 @@ namespace TBF.BenchControl.DataEntry.StandardCamera /// void OpenTestStartStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, startImages, disabled); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, startImages, disabled); modelessDlg.Show(); } /// void OpenTestEndStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, endImages, wmStartState, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, endImages, wmStartState, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } /// void OpenDeferredTestEvalDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, startImages, endImages, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, startImages, endImages, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/StandardCamera/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/StandardCamera/TestStartEndForm.cs index c7817e48c..66f0cccd5 100644 --- a/TBF/BenchControl/DataEntry/StandardCamera/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/StandardCamera/TestStartEndForm.cs @@ -154,8 +154,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera this.endImages = new string[waterMetersCount]; - /// For large benches with WaterMetersCount LE 6 is Config.Data.LineSize==1 (compound meters) - int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : Config.Data.LineSize; + /// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters) + int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize; DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys); @@ -200,8 +200,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera this.startImages = new string[waterMetersCount]; - /// For large benches with WaterMetersCount LE 6 is Config.Data.LineSize==1 (compound meters) - int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : Config.Data.LineSize; + /// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters) + int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize; DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys); @@ -232,8 +232,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera this.warningLimLo = 2 * errLimLo; this.warningLimHi = 2 * errLimHi; - /// For large benches with WaterMetersCount LE 6 is Config.Data.LineSize==1 (compound meters) - int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : Config.Data.LineSize; + /// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters) + int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize; DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys); diff --git a/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs b/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs index e1398f572..211486eb3 100644 --- a/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs @@ -72,7 +72,7 @@ namespace TBF.BenchControl.DataEntry.WMStates public override void Initialize() { - wmStartState = new double[Config.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -119,13 +119,13 @@ namespace TBF.BenchControl.DataEntry.WMStates /// void OpenWMSNsAndStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new WMSNsAndStatesForm(Config.Data.WMsCount); + myRef.modelessDlg = new WMSNsAndStatesForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// void OpenWMStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new WMStatesForm(Config.Data.WMsCount); + myRef.modelessDlg = new WMStatesForm(TBF.Data.WMsCount); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.cs b/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.cs index 6b56038f6..5c516f7c2 100644 --- a/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.cs +++ b/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.cs @@ -46,7 +46,7 @@ namespace TBF.BenchControl.DataEntry.WMStates /// Parameterless constructor for 3 watermeters public WMSNsAndStatesForm() - : this(Config.Data.WMsCount) + : this(TBF.Data.WMsCount) { } diff --git a/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.cs b/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.cs index 1ab050c75..05119b4d6 100644 --- a/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.cs +++ b/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.cs @@ -40,7 +40,7 @@ namespace TBF.BenchControl.DataEntry.WMStates /// Parameterless constructor for 3 watermeters public WMStatesForm() - : this(Config.Data.WMsCount) + : this(TBF.Data.WMsCount) { } diff --git a/TBF/BenchControl/DataEntry/iPerl/EntryForm.cs b/TBF/BenchControl/DataEntry/iPerl/EntryForm.cs index 504412a8f..7afbe3b36 100644 --- a/TBF/BenchControl/DataEntry/iPerl/EntryForm.cs +++ b/TBF/BenchControl/DataEntry/iPerl/EntryForm.cs @@ -69,11 +69,11 @@ namespace TBF.BenchControl.DataEntry.iPerl public override void Initialize() { - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); } @@ -113,7 +113,7 @@ namespace TBF.BenchControl.DataEntry.iPerl /// void OpenBeginningDlg(EntryForm myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount, myRef.entryFormCfg.ReversedDirection); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount, myRef.entryFormCfg.ReversedDirection); modelessDlg.Show(); } /// @@ -125,7 +125,7 @@ namespace TBF.BenchControl.DataEntry.iPerl /// void OpenTestEndStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); + myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TBF/BenchControl/DataEntry/iPerl/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/iPerl/TestStartEndForm.cs index 23198a450..5c3f18c73 100644 --- a/TBF/BenchControl/DataEntry/iPerl/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/iPerl/TestStartEndForm.cs @@ -140,23 +140,23 @@ namespace TBF.BenchControl.DataEntry.iPerl /// void ShuffleTextBoxes() { - if (Config.Data.WMsCount < TextBoxesCount) + if (TBF.Data.WMsCount < TextBoxesCount) { - int nrLines = Config.Data.WMsCount / Config.Data.LineSize; - int gap = (TextBoxesCount - Config.Data.WMsCount) / nrLines; + int nrLines = TBF.Data.WMsCount / TBF.Data.LineSize; + int gap = (TextBoxesCount - TBF.Data.WMsCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; dest++; } } - TextBoxesCount = Config.Data.WMsCount; + TextBoxesCount = TBF.Data.WMsCount; } } diff --git a/TBF/BenchControl/Elde/ControlComSim.cs b/TBF/BenchControl/Elde/ControlComSim.cs index fe6d26903..ab6e5c21f 100644 --- a/TBF/BenchControl/Elde/ControlComSim.cs +++ b/TBF/BenchControl/Elde/ControlComSim.cs @@ -21,7 +21,7 @@ namespace TBF.BenchControl.Elde public double ReferenceFreq { get { return referenceFreq; } } public double ReferenceFreqs(int i) { return 0; } - int[] etPulses = new int[Config.Data.WMsCount + 1]; + int[] etPulses = new int[TBF.Data.WMsCount + 1]; public int EtPulses(int wmNr1) { return etPulses[wmNr1]; @@ -31,16 +31,16 @@ namespace TBF.BenchControl.Elde public int EtPulses2 { get { return 0; } } public int EtPulses3 { get { return 0; } } - double[] errFactor = new double[Config.Data.WMsCount + 1]; /// Internal - double[] wMeterPulsesF = new double[Config.Data.WMsCount + 1]; /// Internal + double[] errFactor = new double[TBF.Data.WMsCount + 1]; /// Internal + double[] wMeterPulsesF = new double[TBF.Data.WMsCount + 1]; /// Internal - UInt16[] wMeterPulses = new UInt16[Config.Data.WMsCount + 1]; /// Rounded from wMeterPulsesF + UInt16[] wMeterPulses = new UInt16[TBF.Data.WMsCount + 1]; /// Rounded from wMeterPulsesF public UInt16 WMeterPulses(int wmNr1) { return wMeterPulses[wmNr1]; } - int[] wMeterReference = new int[Config.Data.WMsCount + 1]; + int[] wMeterReference = new int[TBF.Data.WMsCount + 1]; public int WMeterReference(int wmNr1) { return wMeterReference[wmNr1]; @@ -321,7 +321,7 @@ namespace TBF.BenchControl.Elde double pwFactor = 1.0; /// Increment reference flow meters - for (int i = 0; i <= Config.Data.WMsCount; i++) + for (int i = 0; i <= TBF.Data.WMsCount; i++) { etPulses[i] += (int)referenceFreq; if (etPulses[i] > totalRefPulses) @@ -334,7 +334,7 @@ namespace TBF.BenchControl.Elde /// Increment water meters double flowLtrPerSec = TestBenchSim.GetSimFlow() / 1800.0; - for (int i = 1; i <= Config.Data.WMsCount; i++) + for (int i = 1; i <= TBF.Data.WMsCount; i++) { float wmPulsesPerLiter = 0; if ((BenchControl.Sequences.ProcessData.RegisterReaders[i - 1] != null) && diff --git a/TBF/BenchControl/MetersPath.cs b/TBF/BenchControl/MetersPath.cs index b807918ff..0ce93759c 100644 --- a/TBF/BenchControl/MetersPath.cs +++ b/TBF/BenchControl/MetersPath.cs @@ -17,13 +17,13 @@ namespace TBF.BenchControl { ItemNr = itemNr; Name = name; - RegisterReaders = new IRegReader[Config.Data.WMsCount]; + RegisterReaders = new IRegReader[TBF.Data.WMsCount]; } public MetersPath(Config.Entities.MetersPath entity, IList components) : this(entity.Name, entity.ItemNr) { - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { RegisterReaders[i] = (IRegReader)TbfComponents.FindComponent(entity.GetSensor(i), components); } diff --git a/TBF/BenchControl/Output/DB/SaveDiverterCorrections/SaveDiverterCorr.cs b/TBF/BenchControl/Output/DB/SaveDiverterCorrections/SaveDiverterCorr.cs index f43901955..2eb122914 100644 --- a/TBF/BenchControl/Output/DB/SaveDiverterCorrections/SaveDiverterCorr.cs +++ b/TBF/BenchControl/Output/DB/SaveDiverterCorrections/SaveDiverterCorr.cs @@ -199,7 +199,7 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections ITransaction transaction = null; try { - ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); transaction = session.BeginTransaction(); for (int div = 1; div <= myCfg.DivertersCount(); div++) diff --git a/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs b/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs index 2514ad5a6..100734984 100644 --- a/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs +++ b/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs @@ -206,7 +206,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections ITransaction transaction = null; try { - ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); transaction = session.BeginTransaction(); for (int fmtr = 1; fmtr <= myCfg.FlowmetersCount(); fmtr++) diff --git a/TBF/BenchControl/RegisterReaders/DataStream/Reader/Reader.cs b/TBF/BenchControl/RegisterReaders/DataStream/Reader/Reader.cs index 33aab420c..b09b5e792 100644 --- a/TBF/BenchControl/RegisterReaders/DataStream/Reader/Reader.cs +++ b/TBF/BenchControl/RegisterReaders/DataStream/Reader/Reader.cs @@ -61,7 +61,7 @@ namespace TBF.BenchControl.RegisterReaders.DataStream.Reader if (DebugLevel == DebugMode.Normal) { - if (Position < 1 || Position > Math.Min(Config.Data.WMsCount, mefImport.DataStreamIFace.GetMetersCount())) + if (Position < 1 || Position > Math.Min(TBF.Data.WMsCount, mefImport.DataStreamIFace.GetMetersCount())) { throw new ArgumentException("Position is out of range"); } diff --git a/TBF/BenchControl/RegisterReaders/DataStream/Reader/ReaderCfg.cs b/TBF/BenchControl/RegisterReaders/DataStream/Reader/ReaderCfg.cs index 3e7f5efc5..08ec56270 100644 --- a/TBF/BenchControl/RegisterReaders/DataStream/Reader/ReaderCfg.cs +++ b/TBF/BenchControl/RegisterReaders/DataStream/Reader/ReaderCfg.cs @@ -63,7 +63,7 @@ namespace TBF.BenchControl.RegisterReaders.DataStream.Reader { case 0: IList retv = new List(); - for (int j = 1; j <= Config.Data.WMsCount; j++) retv.Add(j.ToString()); + for (int j = 1; j <= TBF.Data.WMsCount; j++) retv.Add(j.ToString()); return retv; default: return null; @@ -101,7 +101,7 @@ namespace TBF.BenchControl.RegisterReaders.DataStream.Reader switch (i) { case 0: - if (int.TryParse(strValue, out idummy) && idummy > 0 && idummy <= Config.Data.WMsCount) return true; + if (int.TryParse(strValue, out idummy) && idummy > 0 && idummy <= TBF.Data.WMsCount) return true; break; default: message = "Invalid index"; diff --git a/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/CycleBeginningForm.cs b/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/CycleBeginningForm.cs index 8e0e03330..49e07fb22 100644 --- a/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/CycleBeginningForm.cs +++ b/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/CycleBeginningForm.cs @@ -81,7 +81,7 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio SNText = new string[WaterMetersCount]; Disabled = new bool[WaterMetersCount]; - ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleTextBoxes(TBF.Data.WMsCount, TBF.Data.LineSize); //Height = 147 + WaterMetersCount * 90; } diff --git a/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/EntryForm.cs b/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/EntryForm.cs index 29203eead..798f730da 100644 --- a/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/EntryForm.cs +++ b/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/EntryForm.cs @@ -76,11 +76,11 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio if (radio == null) throw new Exception("Cannot find Radio"); radio.EntryForm = this; - disabled = new bool[Config.Data.WMsCount]; - wmStartState = new double[Config.Data.WMsCount]; - wmStartStateStr = new string[Config.Data.WMsCount]; - wmEndState = new double[Config.Data.WMsCount]; - wmCycleEndState = new string[Config.Data.WMsCount]; + disabled = new bool[TBF.Data.WMsCount]; + wmStartState = new double[TBF.Data.WMsCount]; + wmStartStateStr = new string[TBF.Data.WMsCount]; + wmEndState = new double[TBF.Data.WMsCount]; + wmCycleEndState = new string[TBF.Data.WMsCount]; currentOp = CurrentOp.None; log.FatalFormat("{0} initialized: {1}", Name, this); @@ -121,7 +121,7 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio /// void OpenBeginningDlg(EntryForm myRef) { - myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount); + myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount); modelessDlg.Show(); } /// diff --git a/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/TestStartEndForm.cs b/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/TestStartEndForm.cs index 42e0fc714..2f320be7a 100644 --- a/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/TestStartEndForm.cs +++ b/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/TestStartEndForm.cs @@ -163,18 +163,18 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio { if (TextBoxesCount > WaterMetersCount) { - int nrLines = WaterMetersCount / Config.Data.LineSize; + int nrLines = WaterMetersCount / TBF.Data.LineSize; int gap = (TextBoxesCount - WaterMetersCount) / nrLines; int dest = 0; for (int l = 0; l < nrLines; l++) { - for (int i = 0; i < Config.Data.LineSize; i++) + for (int i = 0; i < TBF.Data.LineSize; i++) { - labels[dest] = labels[l * Config.Data.LineSize + l * gap + i]; - startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i]; - endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i]; - exclamations[dest] = exclamations[l * Config.Data.LineSize + l * gap + i]; + labels[dest] = labels[l * TBF.Data.LineSize + l * gap + i]; + startTextBoxes[dest] = startTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + endTextBoxes[dest] = endTextBoxes[l * TBF.Data.LineSize + l * gap + i]; + exclamations[dest] = exclamations[l * TBF.Data.LineSize + l * gap + i]; dest++; } } diff --git a/TBF/BenchControl/Sequences/MainSeq.cs b/TBF/BenchControl/Sequences/MainSeq.cs index 5c70786c5..02b5df966 100644 --- a/TBF/BenchControl/Sequences/MainSeq.cs +++ b/TBF/BenchControl/Sequences/MainSeq.cs @@ -225,7 +225,7 @@ namespace TBF.BenchControl.Sequences try { - using (ISession localSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) + using (ISession localSession = TBF.DB.CreateSession(Users.Entities.DBKind.Config)) { StateMachine.LoadPathsAndTransitions(localSession); } @@ -238,7 +238,7 @@ namespace TBF.BenchControl.Sequences /// User has chosen to restore an interrupted session and necessary conditions are met /// TODO: Repeate twice for Users.Entities.DBKind.Config and Users.Entities.DBKind.RemoteConfig - using (ISession remoteOrLocalSession = Config.FluentCommon.CreateSession(isRemoteIntProc ? + using (ISession remoteOrLocalSession = TBF.DB.CreateSession(isRemoteIntProc ? Users.Entities.DBKind.RemoteConfig : Users.Entities.DBKind.Config)) { @@ -268,7 +268,7 @@ namespace TBF.BenchControl.Sequences } /// TODO: Repeate twice for Users.Entities.DBKind.Config and Users.Entities.DBKind.RemoteConfig - using (ISession remoteOrLocalSession = Config.FluentCommon.CreateSession(Bridge.SelectedProcedure.IsRemote ? + using (ISession remoteOrLocalSession = TBF.DB.CreateSession(Bridge.SelectedProcedure.IsRemote ? Users.Entities.DBKind.RemoteConfig : Users.Entities.DBKind.Config)) { diff --git a/TBF/BenchControl/Sequences/MainSeqUtils.cs b/TBF/BenchControl/Sequences/MainSeqUtils.cs index 590bdc7b5..e6e98bd22 100644 --- a/TBF/BenchControl/Sequences/MainSeqUtils.cs +++ b/TBF/BenchControl/Sequences/MainSeqUtils.cs @@ -560,7 +560,7 @@ namespace TBF.BenchControl.Sequences bool compound = (StateMachine.Procedure.MetersKind == MetersKind.Combined); bool heatMeters = (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter); - int waterMetersCount = Math.Min(WaterMeters.Count, heatMeters ? Config.Data.HeatMetersCount : (compound ? Config.Data.CompoundWMsCount : Config.Data.WMsCount)); + int waterMetersCount = Math.Min(WaterMeters.Count, heatMeters ? TBF.Data.HeatMetersCount : (compound ? TBF.Data.CompoundWMsCount : TBF.Data.WMsCount)); /// Results.Entities.WaterMeterData[] waterMeterData = new Results.Entities.WaterMeterData[waterMetersCount]; /// diff --git a/TBF/BenchControl/Sequences/ProcessData.cs b/TBF/BenchControl/Sequences/ProcessData.cs index 2d6e5795f..169eddcaf 100644 --- a/TBF/BenchControl/Sequences/ProcessData.cs +++ b/TBF/BenchControl/Sequences/ProcessData.cs @@ -24,10 +24,10 @@ namespace TBF.BenchControl.Sequences /// /// Safe wrappers /// - public static int WMsCount { get { return Config.Data.WMsCount; } } - public static int LinesCount { get { return Config.Data.WMsCount / Config.Data.LineSize; } } - public static int LineSize { get { return Config.Data.LineSize; } } - public static int CompoundWMsCount { get { return Config.Data.CompoundWMsCount; } } + public static int WMsCount { get { return TBF.Data.WMsCount; } } + public static int LinesCount { get { return TBF.Data.WMsCount / TBF.Data.LineSize; } } + public static int LineSize { get { return TBF.Data.LineSize; } } + public static int CompoundWMsCount { get { return TBF.Data.CompoundWMsCount; } } /// /// State variables to be saved after each completed test @@ -46,10 +46,10 @@ namespace TBF.BenchControl.Sequences static ProcessData() { /// - /// RegisterReaders should never be null, RegisterReader.Length should be Config.Data.WMsCount - /// RegisterReader[i] where i = 0..Config.Data.WMsCount-1 may be null and should always be tested + /// RegisterReaders should never be null, RegisterReader.Length should be TBF.Data.WMsCount + /// RegisterReader[i] where i = 0..TBF.Data.WMsCount-1 may be null and should always be tested /// - RegisterReaders = new IRegReader[Config.Data.WMsCount]; + RegisterReaders = new IRegReader[TBF.Data.WMsCount]; IsQ2PreCorrectionCalculated = false; CalculatedQ2PreCorrectionLR = 0; CalculatedQ2PreCorrectionRL = 0; @@ -220,7 +220,7 @@ namespace TBF.BenchControl.Sequences /// protected void ClearProcessValues() { - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { if (RegisterReaders[i] != null) RegisterReaders[i].Clear(); } diff --git a/TBF/BenchControl/StateMachine.cs b/TBF/BenchControl/StateMachine.cs index cf5d70419..efd1568d4 100644 --- a/TBF/BenchControl/StateMachine.cs +++ b/TBF/BenchControl/StateMachine.cs @@ -214,7 +214,7 @@ namespace TBF.BenchControl { /// Load the list of components (entities) from the database. /// Then create the components (derived from IComponent). - components = BenchControl.TbfComponents.LoadComponentsFromDB(Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)); + components = BenchControl.TbfComponents.LoadComponentsFromDB(TBF.DB.CreateSession(Users.Entities.DBKind.Config)); MasterValves = GenericDevices.ValveBase.MasterValves(components); CoupledValves = GenericDevices.ValveBase.CoupledValves(components); ExtendedValves = GenericDevices.ValveBase.ExtendedValves(components); @@ -430,7 +430,7 @@ namespace TBF.BenchControl try { - ISession remoteSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.RemoteConfig); + ISession remoteSession = TBF.DB.CreateSession(Users.Entities.DBKind.RemoteConfig); remoteFeedingPaths = remoteSession.QueryOver().List(); remoteBenchPaths = remoteSession.QueryOver().List(); remoteOutputPaths = remoteSession.QueryOver().List(); @@ -443,7 +443,7 @@ namespace TBF.BenchControl return false; } - ISession localSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + ISession localSession = TBF.DB.CreateSession(Users.Entities.DBKind.Config); var localFeedingPaths = localSession.QueryOver().List(); var localBenchPaths = localSession.QueryOver().List(); var localOutputPaths = localSession.QueryOver().List(); @@ -720,7 +720,7 @@ namespace TBF.BenchControl } if (pmtrs != null) { - int count = Math.Min(Config.Data.WMsCount, pmtrs.RegisterReaders.Length); + int count = Math.Min(TBF.Data.WMsCount, pmtrs.RegisterReaders.Length); for (int i = 0; i < count; i++) { if ((pmtrs.RegisterReaders[i] != null) && diff --git a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index 1edbd4b3e..3625bb784 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -26,15 +26,15 @@ namespace TBF.BenchControl.TestMethods.Adjustment { #pragma warning disable 162 /// Disables 'Unreachable code detected' warning - if (Config.Data.WMsCount > 24) + if (TBF.Data.WMsCount > 24) { myRef.modelessDlg = new WMErrorsForm48(waterMeters); } - else if (Config.Data.WMsCount > 12) + else if (TBF.Data.WMsCount > 12) { myRef.modelessDlg = new WMErrorsForm24(waterMeters); } - else if (Config.Data.WMsCount > 6) + else if (TBF.Data.WMsCount > 6) { myRef.modelessDlg = new WMErrorsForm12(waterMeters); } diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs index 913e61c93..bdb15570e 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs @@ -45,7 +45,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment public WMErrorsForm(IList waterMeters) : this() { - waterMetersCount = Math.Min(Config.Data.WMsCount, waterMeters.Count); + waterMetersCount = Math.Min(TBF.Data.WMsCount, waterMeters.Count); rects = new Rectangle[waterMetersCount]; for (int i = 0; i < waterMetersCount; i++) rects[i] = new Rectangle(385, 30 + 90 * i, 324, 57); diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs index 7594e0b52..47cb3bdb7 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs @@ -92,9 +92,9 @@ namespace TBF.BenchControl.TestMethods.Adjustment public WMErrorsForm12(IList waterMeters) : this() { - waterMetersCount = Math.Min(Config.Data.WMsCount, waterMeters.Count); + waterMetersCount = Math.Min(TBF.Data.WMsCount, waterMeters.Count); - ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + ShuffleTextBoxes(waterMetersCount, TBF.Data.LineSize); disabled = new bool[waterMetersCount]; for (int i = 0; i < waterMetersCount; i++) diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs index 8869cbe88..fe2b461a9 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs @@ -96,9 +96,9 @@ namespace TBF.BenchControl.TestMethods.Adjustment public WMErrorsForm24(IList waterMeters) : this() { - waterMetersCount = Math.Min(Config.Data.WMsCount, waterMeters.Count); + waterMetersCount = Math.Min(TBF.Data.WMsCount, waterMeters.Count); - ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + ShuffleTextBoxes(waterMetersCount, TBF.Data.LineSize); disabled = new bool[waterMetersCount]; for (int i = 0; i < waterMetersCount; i++) diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm48.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm48.cs index 991958cbb..113294c38 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm48.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm48.cs @@ -104,9 +104,9 @@ namespace TBF.BenchControl.TestMethods.Adjustment public WMErrorsForm48(IList waterMeters) : this() { - waterMetersCount = Math.Min(Config.Data.WMsCount, waterMeters.Count); + waterMetersCount = Math.Min(TBF.Data.WMsCount, waterMeters.Count); - ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + ShuffleTextBoxes(waterMetersCount, TBF.Data.LineSize); disabled = new bool[waterMetersCount]; for (int i = 0; i < waterMetersCount; i++) diff --git a/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index 47d57d481..6fd3da386 100644 --- a/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -56,9 +56,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection return new List { Event.ConfigurationError }; } - if (test.Part < 0 || test.Part > Config.Data.CompoundWMsCount) + if (test.Part < 0 || test.Part > TBF.Data.CompoundWMsCount) { - UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be '-' or 1 .. {0}", Config.Data.CompoundWMsCount)); + UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be '-' or 1 .. {0}", TBF.Data.CompoundWMsCount)); return new List { Event.ConfigurationError }; } @@ -102,7 +102,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms /// Specific for combined meters - int[] lastWMPulses = new int[2 * Config.Data.CompoundWMsCount]; + int[] lastWMPulses = new int[2 * TBF.Data.CompoundWMsCount]; //-------------------------------- State.Create(string.Format("{0}({1}) : Stop diverter gate etc", test.Method, test.Name)) @@ -317,7 +317,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection /// /// Last pulses are kept to calculate differences - for (int i = 0; i < 2 * Config.Data.CompoundWMsCount; i++) lastWMPulses[i] = RegisterReaders[i].WMPulses; + for (int i = 0; i < 2 * TBF.Data.CompoundWMsCount; i++) lastWMPulses[i] = RegisterReaders[i].WMPulses; /// Shift data in the detection buffers for (int i = DetectionBufferSize - 2; i >= 0; i--) @@ -566,7 +566,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection UpdateAllStatistics(StateMachine.Time); /// TODO: Reimplement - //for (int i = 0; i < Config.Data.CompoundWMsCount; i++) + //for (int i = 0; i < TBF.Data.CompoundWMsCount; i++) //{ // data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter // + data.TestResult.Meters[2 * i + 1].VolumeMeter; diff --git a/TBF/BenchControl/TestMethods/DiverterTest/DiverterTestSeq.cs b/TBF/BenchControl/TestMethods/DiverterTest/DiverterTestSeq.cs index 69bceeeb2..6a7a397c8 100644 --- a/TBF/BenchControl/TestMethods/DiverterTest/DiverterTestSeq.cs +++ b/TBF/BenchControl/TestMethods/DiverterTest/DiverterTestSeq.cs @@ -430,10 +430,10 @@ namespace TBF.BenchControl.TestMethods.DiverterTest /// /// Initialize cumulated reference and water metert pulses /// - int[] cumulativeEtPulses = new int[Config.Data.WMsCount + 1]; /// 0 .. Config.Data.WMsCount - int[] cumulativeWMPulses = new int[Config.Data.WMsCount + 1]; /// 1 .. Config.Data.WMsCount - double[] cumulativeTestTime = new double[Config.Data.WMsCount + 1]; /// 0 .. Config.Data.WMsCount - for (int i = 0; i <= Config.Data.WMsCount; i++) + int[] cumulativeEtPulses = new int[TBF.Data.WMsCount + 1]; /// 0 .. TBF.Data.WMsCount + int[] cumulativeWMPulses = new int[TBF.Data.WMsCount + 1]; /// 1 .. TBF.Data.WMsCount + double[] cumulativeTestTime = new double[TBF.Data.WMsCount + 1]; /// 0 .. TBF.Data.WMsCount + for (int i = 0; i <= TBF.Data.WMsCount; i++) { cumulativeEtPulses[i] = 0; if (i > 0) cumulativeWMPulses[i] = 0; @@ -547,7 +547,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest /// Accumulate partial pulses cumulativeEtPulses[0] += cBrd.EtPulses(0); cumulativeTestTime[0] += cBrd.TTime; - for (int i = 1; i <= Config.Data.WMsCount; i++) + for (int i = 1; i <= TBF.Data.WMsCount; i++) { cumulativeEtPulses[i] += cBrd.EtPulses(i); cumulativeWMPulses[i] += cBrd.WMeterPulses(i); @@ -667,7 +667,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest /// cumulativeEtPulses[0] += cBrd.EtPulses(0); cumulativeTestTime[0] += cBrd.TTime; - for (int i = 1; i <= Config.Data.WMsCount; i++) + for (int i = 1; i <= TBF.Data.WMsCount; i++) { cumulativeEtPulses[i] += cBrd.EtPulses(i); cumulativeWMPulses[i] += cBrd.WMeterPulses(i); diff --git a/TBF/BenchControl/TestMethods/Endurance/CycleDlg.cs b/TBF/BenchControl/TestMethods/Endurance/CycleDlg.cs index 9fbd9a880..38afaa46d 100644 --- a/TBF/BenchControl/TestMethods/Endurance/CycleDlg.cs +++ b/TBF/BenchControl/TestMethods/Endurance/CycleDlg.cs @@ -62,7 +62,7 @@ namespace TBF.BenchControl.TestMethods.Endurance seqStepsCtrl = new CycleStepsCtrl() as ITabWithListViewEx; /// Prepare a list of valves for the endurance test - TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)); + TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(TBF.DB.CreateSession(Users.Entities.DBKind.Config)); Valves = new List(); for (int bitNr = 0; bitNr < 8; bitNr++) { diff --git a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs index 5435e6fa8..da1ea0c15 100644 --- a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs @@ -431,7 +431,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart if (heatMetersTestParams != null) { - for (int i = 0; i < Config.Data.HeatMetersCount; i++) + for (int i = 0; i < TBF.Data.HeatMetersCount; i++) { BenchControl.Elde.FixedStartRegisterReader.RegisterReader volumeRegisterReader = sensPath.RegisterReaders[2 * i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; @@ -448,7 +448,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart } else { - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { GenericDevices.IRegReader rr = sensPath.RegisterReaders[i]; @@ -575,7 +575,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart if (compound) { /// TODO: Reimplement for combined meters - //for (int i = 0; i < Config.Data.CompoundWMsCount; i++) + //for (int i = 0; i < TBF.Data.CompoundWMsCount; i++) //{ // data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter // + data.TestResult.Meters[2 * i + 1].VolumeMeter; @@ -716,7 +716,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart if (heatMetersTestParams != null) { - for (int i = 0; i < Config.Data.HeatMetersCount; i++) + for (int i = 0; i < TBF.Data.HeatMetersCount; i++) { BenchControl.Elde.FixedStartRegisterReader.RegisterReader volumeRegisterReader = sensPath.RegisterReaders[2 * i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; @@ -733,7 +733,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart } else { - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { GenericDevices.IRegReader rr = sensPath.RegisterReaders[i]; diff --git a/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs b/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs index 1ed797e1c..5b663971e 100644 --- a/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs @@ -320,7 +320,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced } while (!e.Contains(Event.ModelessFormClosed)); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; @@ -544,7 +544,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced while (!e.Contains(Event.ModelessFormClosed)); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; diff --git a/TBF/BenchControl/TestMethods/FixedStartDeferredEval/FixedStartDeferredEvalSeq.cs b/TBF/BenchControl/TestMethods/FixedStartDeferredEval/FixedStartDeferredEvalSeq.cs index 7fdb42d81..fac154138 100644 --- a/TBF/BenchControl/TestMethods/FixedStartDeferredEval/FixedStartDeferredEvalSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartDeferredEval/FixedStartDeferredEvalSeq.cs @@ -612,7 +612,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval if (compound) { /// TODO: Reimplement for combined meters - //for (int i = 0; i < Config.Data.CompoundWMsCount; i++) + //for (int i = 0; i < TBF.Data.CompoundWMsCount; i++) //{ // data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter // + data.TestResult.Meters[2 * i + 1].VolumeMeter; @@ -904,7 +904,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval /// Update register reader star and end-volumes from data entry forms - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { GenericDevices.IRegReader r = sensPath.RegisterReaders[i]; BenchControl.Network.Camera.RoiForFixedStart.Roi rr = r as BenchControl.Network.Camera.RoiForFixedStart.Roi; diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/FixedStartMassCollDeferredEvalSeq.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/FixedStartMassCollDeferredEvalSeq.cs index 6d54ed918..b73a77232 100644 --- a/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/FixedStartMassCollDeferredEvalSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/FixedStartMassCollDeferredEvalSeq.cs @@ -716,7 +716,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval if (compound) { /// TODO: Reimplement for combined meters - //for (int i = 0; i < Config.Data.CompoundWMsCount; i++) + //for (int i = 0; i < TBF.Data.CompoundWMsCount; i++) //{ // data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter // + data.TestResult.Meters[2 * i + 1].VolumeMeter; @@ -1050,7 +1050,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval /// Update register reader star and end-volumes from data entry forms - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { GenericDevices.IRegReader r = sensPath.RegisterReaders[i]; BenchControl.Network.Camera.RoiForFixedStart.Roi rr = r as BenchControl.Network.Camera.RoiForFixedStart.Roi; diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index b3859323b..0fb32e6a1 100644 --- a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -551,7 +551,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection if (heatMetersTestParams != null) { - for (int i = 0; i < Config.Data.HeatMetersCount; i++) + for (int i = 0; i < TBF.Data.HeatMetersCount; i++) { BenchControl.Elde.FixedStartRegisterReader.RegisterReader volumeRegisterReader = sensPath.RegisterReaders[2 * i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; @@ -568,7 +568,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection } else { - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { GenericDevices.IRegReader rr = sensPath.RegisterReaders[i]; @@ -689,7 +689,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection if (compound) { /// TODO: Reimplement for combined meters - //for (int i = 0; i < Config.Data.CompoundWMsCount; i++) + //for (int i = 0; i < TBF.Data.CompoundWMsCount; i++) //{ // data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter // + data.TestResult.Meters[2 * i + 1].VolumeMeter; @@ -890,7 +890,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection if (heatMetersTestParams != null) { - for (int i = 0; i < Config.Data.HeatMetersCount; i++) + for (int i = 0; i < TBF.Data.HeatMetersCount; i++) { BenchControl.Elde.FixedStartRegisterReader.RegisterReader volumeRegisterReader = sensPath.RegisterReaders[2 * i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; @@ -907,7 +907,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection } else { - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { GenericDevices.IRegReader rr = sensPath.RegisterReaders[i]; diff --git a/TBF/BenchControl/TestMethods/FixedStartTankCollection/FixedStartTankCollectionSeq.cs b/TBF/BenchControl/TestMethods/FixedStartTankCollection/FixedStartTankCollectionSeq.cs index 9c8303a51..06b7bba34 100644 --- a/TBF/BenchControl/TestMethods/FixedStartTankCollection/FixedStartTankCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartTankCollection/FixedStartTankCollectionSeq.cs @@ -393,7 +393,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection } while (!e.Contains(Event.ModelessFormClosed)); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { GenericDevices.IRegReader rr = sensPath.RegisterReaders[i]; @@ -511,7 +511,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection if (compoundTestParams != null) { /// TODO: Reimplement for combined meters - //for (int i = 0; i < Config.Data.CompoundWMsCount; i++) + //for (int i = 0; i < TBF.Data.CompoundWMsCount; i++) //{ // data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter // + data.TestResult.Meters[2 * i + 1].VolumeMeter; @@ -653,7 +653,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection while (!e.Contains(Event.ModelessFormClosed)); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { GenericDevices.IRegReader rr = sensPath.RegisterReaders[i]; diff --git a/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs b/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs index 621ff561c..12d64b4a3 100644 --- a/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs +++ b/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs @@ -26,11 +26,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTest { #pragma warning disable 162 /// Disables 'Unreachable code detected' warning - if (Config.Data.WMsCount > 12) + if (TBF.Data.WMsCount > 12) { myRef.modelessDlg = new WMPulsesForm24(waterMeters); } - else if (Config.Data.WMsCount > 6) + else if (TBF.Data.WMsCount > 6) { myRef.modelessDlg = new WMPulsesForm12(waterMeters); } diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs index 1ddb6200b..268a53866 100644 --- a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs @@ -94,7 +94,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTest { waterMetersCount = waterMeters.Count; - ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + ShuffleTextBoxes(waterMetersCount, TBF.Data.LineSize); disabled = new bool[waterMetersCount]; for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled; diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs index 2b99c214d..66267df73 100644 --- a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs @@ -100,7 +100,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTest { waterMetersCount = waterMeters.Count; - ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + ShuffleTextBoxes(waterMetersCount, TBF.Data.LineSize); disabled = new bool[waterMetersCount]; pulsesCount = new double[waterMetersCount]; diff --git a/TBF/BenchControl/TestMethods/PulsesTestManual/ManualPulsesForm12.cs b/TBF/BenchControl/TestMethods/PulsesTestManual/ManualPulsesForm12.cs index 5cd99ea04..1f4cf1a85 100644 --- a/TBF/BenchControl/TestMethods/PulsesTestManual/ManualPulsesForm12.cs +++ b/TBF/BenchControl/TestMethods/PulsesTestManual/ManualPulsesForm12.cs @@ -79,7 +79,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual { waterMetersCount = waterMeters.Count; - ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + ShuffleTextBoxes(waterMetersCount, TBF.Data.LineSize); disabled = new bool[waterMetersCount]; passed = new bool[waterMetersCount]; diff --git a/TBF/BenchControl/TestMethods/PulsesTestManual/ManualPulsesForm24.cs b/TBF/BenchControl/TestMethods/PulsesTestManual/ManualPulsesForm24.cs index 5919714c6..326c91906 100644 --- a/TBF/BenchControl/TestMethods/PulsesTestManual/ManualPulsesForm24.cs +++ b/TBF/BenchControl/TestMethods/PulsesTestManual/ManualPulsesForm24.cs @@ -86,7 +86,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual { waterMetersCount = waterMeters.Count; - ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + ShuffleTextBoxes(waterMetersCount, TBF.Data.LineSize); disabled = new bool[waterMetersCount]; passed = new bool[waterMetersCount]; diff --git a/TBF/BenchControl/TestMethods/PulsesTestManual/PulsesTestManualSeq.cs b/TBF/BenchControl/TestMethods/PulsesTestManual/PulsesTestManualSeq.cs index 61d1c6c04..950336297 100644 --- a/TBF/BenchControl/TestMethods/PulsesTestManual/PulsesTestManualSeq.cs +++ b/TBF/BenchControl/TestMethods/PulsesTestManual/PulsesTestManualSeq.cs @@ -26,11 +26,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual { #pragma warning disable 162 /// Disables 'Unreachable code detected' warning - if (Config.Data.WMsCount > 12) + if (TBF.Data.WMsCount > 12) { myRef.modelessDlg = new ManualPulsesForm24(waterMeters); } - else if (Config.Data.WMsCount > 6) + else if (TBF.Data.WMsCount > 6) { myRef.modelessDlg = new ManualPulsesForm12(waterMeters); } diff --git a/TBF/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs b/TBF/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs index 4e7ed2f7d..df371f2e9 100644 --- a/TBF/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs +++ b/TBF/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs @@ -98,7 +98,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest /// This is to calculate increments of WM pulses - int[] lastWMPulses = new int[Config.Data.WMsCount]; + int[] lastWMPulses = new int[TBF.Data.WMsCount]; //-------------------------------- State.Create(string.Format("{0}({1}) : stopTest diverter gate etc", test.Method, test.Name)) @@ -242,11 +242,11 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest /// Allocate detection buffers double[] flowsForDetection = new double[DetectionBufferSize]; - double[,] pulseFreqsForDetection = new double[Config.Data.WMsCount, DetectionBufferSize]; + double[,] pulseFreqsForDetection = new double[TBF.Data.WMsCount, DetectionBufferSize]; /// Current values flowsForDetection[0] = RefFlow.Val; - for (int i = 0; i < Config.Data.WMsCount; i++) pulseFreqsForDetection[i, 0] = 0; + for (int i = 0; i < TBF.Data.WMsCount; i++) pulseFreqsForDetection[i, 0] = 0; int startTime = StateMachine.Time; int lastTime = StateMachine.Time; @@ -254,8 +254,8 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest float rvPulse = (testParams.TargetQ > (test.Qfrom + test.Qto) / 2.0f) ? 0.05f : -0.05f; // rise or fall? rvPulse *= (100.0f * testParams.RateOfChange); - bool[] detected = new bool[Config.Data.WMsCount]; - double[] detectedFlow = new double[Config.Data.WMsCount]; + bool[] detected = new bool[TBF.Data.WMsCount]; + double[] detectedFlow = new double[TBF.Data.WMsCount]; for (int i = 0; i < detectedFlow.Length; i++) { detected[i] = false; @@ -287,7 +287,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest { /// Last pulses are kept to calculate differences - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { if (RegisterReaders[i] != null) lastWMPulses[i] = RegisterReaders[i].WMPulses; } @@ -296,7 +296,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest for (int j = DetectionBufferSize - 2; j >= 0; j--) { flowsForDetection[j + 1] = flowsForDetection[j]; - for (int i = 0; i < Config.Data.WMsCount; i++) pulseFreqsForDetection[i, j+1] = pulseFreqsForDetection[i, j]; + for (int i = 0; i < TBF.Data.WMsCount; i++) pulseFreqsForDetection[i, j+1] = pulseFreqsForDetection[i, j]; } switch (ReadRegistersTempPressAmbient(measureOperations, false)) @@ -307,7 +307,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest /// TODO: !!! The following can only be done for compound meters flowsForDetection[0] = cBrd.ReferenceFreq * outPath.FlowMeter.NominalFlow / 2000.0f; - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { double diff = (RegisterReaders[i] != null) ? (RegisterReaders[i].WMPulses - lastWMPulses[i]) : 0; pulseFreqsForDetection[i, 0] = diff / (double)(StateMachine.Time - lastTime); @@ -348,7 +348,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest // aveFlowBefore.ToString("F2"), // aveFlowAfter.ToString("F2"))); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { if ((BatchRslts.Batch.WaterMeters[i] != null) && !BatchRslts.Batch.WaterMeters[i].Disabled && (RegisterReaders[i] != null) && !detected[i]) { @@ -399,7 +399,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest } allDetected = true; - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { if ((BatchRslts.Batch.WaterMeters[i] != null) && !BatchRslts.Batch.WaterMeters[i].Disabled && (RegisterReaders[i] != null) && !detected[i]) allDetected = false; } @@ -408,7 +408,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest } while (!allDetected && !targetReached); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { //UiBridge.Bridge.OnEvent(this, string.Format("detected flow[{0}]={1}\r\n", i+1, detectedFlow[i].ToString("F4"))); } diff --git a/TBF/BenchControl/Various/StatisticsMonitoring/ProcessStatistics.cs b/TBF/BenchControl/Various/StatisticsMonitoring/ProcessStatistics.cs index 8711f8fe9..0064c31c1 100644 --- a/TBF/BenchControl/Various/StatisticsMonitoring/ProcessStatistics.cs +++ b/TBF/BenchControl/Various/StatisticsMonitoring/ProcessStatistics.cs @@ -110,9 +110,9 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring int completeBatchesProcessed = 0; - int[] usages = new int[Config.Data.WMsCount]; - int[] failures = new int[Config.Data.WMsCount]; - for (int i = 0; i < Config.Data.WMsCount; i++) usages[i] = failures[i] = 0; + int[] usages = new int[TBF.Data.WMsCount]; + int[] failures = new int[TBF.Data.WMsCount]; + for (int i = 0; i < TBF.Data.WMsCount; i++) usages[i] = failures[i] = 0; /// /// Read results of recent batches (up to 'MaxBatches') @@ -140,7 +140,7 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring foreach (var wm in batches[0].WaterMeters) { int i = wm.WMPosition - 1; - if (0 <= i && i < Config.Data.WMsCount && usages[i] < RequiredUsages && !wm.Disabled && wm.CompletedFromTests()) + if (0 <= i && i < TBF.Data.WMsCount && usages[i] < RequiredUsages && !wm.Disabled && wm.CompletedFromTests()) { isACompleteBatch = true; usages[i]++; @@ -149,7 +149,7 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring } usagesMin = int.MaxValue; - for (int i = 0; i < Config.Data.WMsCount; i++) if (usagesMin > usages[i]) usagesMin = usages[i]; + for (int i = 0; i < TBF.Data.WMsCount; i++) if (usagesMin > usages[i]) usagesMin = usages[i]; if (isACompleteBatch) completeBatchesProcessed++; } @@ -164,7 +164,7 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring /// Find out whether at lest one event needs to be triggered /// bool doTriggerEvents = false; - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { if ((usages[i] > 0) && (iperlHeadFailureRateThreshold > 0) && (float)failures[i] / (float)usages[i] >= iperlHeadFailureRateThreshold) { @@ -183,7 +183,7 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring ISession session = Events.DB.CreateSession(); Events.DB.LoadSubscribers(session); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { if ((usages[i] > 0) && (iperlHeadFailureRateThreshold > 0) && (float)failures[i] / (float)usages[i] >= iperlHeadFailureRateThreshold) { diff --git a/TBF/DB.cs b/TBF/DB.cs new file mode 100644 index 000000000..756976ff1 --- /dev/null +++ b/TBF/DB.cs @@ -0,0 +1,66 @@ +/// +/// Copyright (c) 2021 Sensus Slovensko a.s. +/// +using System; +using NHibernate; +using Config; +using Users.Entities; + +namespace TBF +{ + public class DB + { + /// + /// Database related: This object reference is set after a successful user login + /// + public static DatabaseSettings CurrentBench; + + /// + /// Session factories for regular sessions. + /// + public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)DBKind.Count]; + + /// Create a NHibernate session for the given database + public static ISession CreateSession(DBKind database) + { + if (database < 0 || database >= DBKind.Count) return null; + + int ix = (int)database; + if (SessionFactories[ix] == null) + { + SessionFactories[ix] = CreateSessionFactory(database); + } + + return SessionFactories[ix].OpenSession(); + } + + /// + /// NHibernate session factory (to create the database session 'SessionFactory') + /// + /// A database session + static ISessionFactory CreateSessionFactory(DBKind database) + { + DBType dbType; + string connectionString; + + switch (database) + { + default: + case DBKind.Config: + dbType = CurrentBench.ProceduresDBSettings.DbType; + connectionString = CurrentBench.ProceduresDBSettings.ConnectionString; + break; + case DBKind.Results: + dbType = CurrentBench.WaterMetersDBSettings.DbType; + connectionString = CurrentBench.WaterMetersDBSettings.ConnectionString; + break; + case DBKind.RemoteConfig: + dbType = CurrentBench.UsersDBSettings.DbType; + connectionString = CurrentBench.UsersDBSettings.ConnectionString; + break; + } + + return Config.FluentCommon.CreateSessionFactory(database, dbType, connectionString, false); + } + } +} diff --git a/TBF/Data.cs b/TBF/Data.cs new file mode 100644 index 000000000..b630a47ee --- /dev/null +++ b/TBF/Data.cs @@ -0,0 +1,58 @@ +/// +/// Copyright (c) 2021 Sensus Slovensko a.s. +/// +using System; + +namespace TBF +{ + public class Data + { + public static int WMsCount; + public static int LineSize; + public static int CompoundWMsCount; + public static int HeatMetersCount; + public static int MaxPartNr; + + static Data() + { + /// Default values applied when there is no BanchInfo component + WMsCount = 20; + LineSize = 10; + CompoundWMsCount = 1; + HeatMetersCount = 0; + MaxPartNr = WMsCount / LineSize; + } + + public static void SetData() + { + WMsCount = Config.Data.WMsCount; + CompoundWMsCount = Config.Data.CompoundWMsCount; + LineSize = Config.Data.LineSize; + HeatMetersCount = Config.Data.HeatMetersCount; + MaxPartNr = Config.Data.MaxPartNr; + } + + /// + /// Determines whether tests part number is OK. + /// Examples of correct part number are: + /// 1, 2, 12, 21 in case of max. part nr.== 2 + /// 1, 2, 3, 4, 12, 13, 14, 23, 24, 34, 123, 124, 134, 234, 1234 in case of max. part nr.== 4 + /// + /// Tests par tnumber + /// true when Part number is OK + public static bool IsGoodPartNr(int partNr) + { + bool firstDigitIsOK = ((partNr % 10) > 0) && ((partNr % 10) <= MaxPartNr); + bool secondDigitIsOK = (((partNr / 10) % 10) > 0) && (((partNr / 10) % 10) <= MaxPartNr); + bool thirdDigitIsOK = (((partNr / 100) % 10) > 0) && (((partNr / 100) % 10) <= MaxPartNr); + bool fourthDigitIsOK = (((partNr / 1000) % 10) > 0) && (((partNr / 1000) % 10) <= MaxPartNr); + + if (firstDigitIsOK && (partNr / 10 == 0)) return true; + if (firstDigitIsOK && secondDigitIsOK && (partNr / 100 == 0)) return true; + if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && (partNr / 1000 == 0)) return true; + if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && fourthDigitIsOK && (partNr / 10000 == 0)) return true; + + return false; + } + } +} diff --git a/TBF/Program.cs b/TBF/Program.cs index 43bef683d..1e0331b9f 100644 --- a/TBF/Program.cs +++ b/TBF/Program.cs @@ -349,18 +349,18 @@ namespace TBF /// Copy the selected bench settings to CurrentBench. /// Clone() guarantees that current bench settings wont be modified /// when user modifies the database settings in DatabaseSettingsDlg. - Config.Data.CurrentBench = (Config.DatabaseSettings)LocalSettings.TestBenches[i].Clone(); - Results.DB.DbType = Config.Data.CurrentBench.WaterMetersDBSettings.DbType; - Results.DB.ConnectionString = Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString; + TBF.DB.CurrentBench = (Config.DatabaseSettings)LocalSettings.TestBenches[i].Clone(); + Results.DB.DbType = TBF.DB.CurrentBench.WaterMetersDBSettings.DbType; + Results.DB.ConnectionString = TBF.DB.CurrentBench.WaterMetersDBSettings.ConnectionString; /// Save the selection to local settings - LocalSettings.LastBenchName = Config.Data.CurrentBench.BenchName; + LocalSettings.LastBenchName = TBF.DB.CurrentBench.BenchName; /// /// Connect to Config database. /// This triggers an exception in case user is a power user and there is no Config database. /// - IList listOfProcedures = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config) + IList listOfProcedures = TBF.DB.CreateSession(Users.Entities.DBKind.Config) .QueryOver() .Where(x => (x.ProcedureState == ProcedureState.Active)) .And(x => (x.Name == LocalSettings.LastProcedureName)) @@ -371,7 +371,7 @@ namespace TBF /// Results.DB.LoadSharedData(); int maxBatchNr = Results.DB.GetMaxSavedBatchNr(); - if (!Config.Data.CurrentBench.IsRealBench || Program.LocalSettings.BatchNr <= maxBatchNr) + if (!TBF.DB.CurrentBench.IsRealBench || Program.LocalSettings.BatchNr <= maxBatchNr) { log.FatalFormat("Max. BatchNr in DB = {0}, LocalSettings.BatchNr = {1}", maxBatchNr, Program.LocalSettings.BatchNr); Program.LocalSettings.BatchNr = maxBatchNr + 1; @@ -382,11 +382,11 @@ namespace TBF /// /// Connect to Events database (if any) and load recent events from this test bench. /// - if (Config.Data.CurrentBench.EventsDBSettings.DbType != Users.Entities.DBType.None && - !string.IsNullOrEmpty(Config.Data.CurrentBench.EventsDBSettings.ConnectionString)) + if (TBF.DB.CurrentBench.EventsDBSettings.DbType != Users.Entities.DBType.None && + !string.IsNullOrEmpty(TBF.DB.CurrentBench.EventsDBSettings.ConnectionString)) { - Events.DB.DbType = (Events.Entities.DBType)Config.Data.CurrentBench.EventsDBSettings.DbType; - Events.DB.ConnectionString = Config.Data.CurrentBench.EventsDBSettings.ConnectionString; + Events.DB.DbType = (Events.Entities.DBType)TBF.DB.CurrentBench.EventsDBSettings.DbType; + Events.DB.ConnectionString = TBF.DB.CurrentBench.EventsDBSettings.ConnectionString; Events.DB.LoadRecentEvents(Events.DB.CreateSession(), loginDlgBench.BenchName, 7); /// Last 7 days } @@ -446,7 +446,7 @@ namespace TBF /// if (LocalSettings.LastProcedureName != null) { - IList listOfProcedures = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config) + IList listOfProcedures = TBF.DB.CreateSession(Users.Entities.DBKind.Config) .QueryOver() .Where(x => (x.ProcedureState == ProcedureState.Active)) .And(x => (x.Name == LocalSettings.LastProcedureName)) diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index 51d6ee16a..ea14bc9d3 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -2063,6 +2063,8 @@ + + True True diff --git a/TBF/UI/Bench/Components/ComponentsManagerDlg.cs b/TBF/UI/Bench/Components/ComponentsManagerDlg.cs index b87f2ff42..d5cef029c 100644 --- a/TBF/UI/Bench/Components/ComponentsManagerDlg.cs +++ b/TBF/UI/Bench/Components/ComponentsManagerDlg.cs @@ -119,7 +119,7 @@ namespace TBF.UI.Bench.Components sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit); - session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); cmpntEntities = session.QueryOver() .OrderBy(x => x.ItemNr).Asc .List(); diff --git a/TBF/UI/Bench/Metrology/MetrologyDlg.cs b/TBF/UI/Bench/Metrology/MetrologyDlg.cs index b45921aca..371f8e2fc 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlg.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlg.cs @@ -51,7 +51,7 @@ namespace TBF.UI.Bench.Metrology int platinumTempMetersCount = 0; int evaporationsCount = 0; - session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); cmpntEntities = session.QueryOver() .OrderBy(x => x. ItemNr).Asc .List(); diff --git a/TBF/UI/Bench/Paths/PathsDlg.cs b/TBF/UI/Bench/Paths/PathsDlg.cs index 294a01062..8d7ceca95 100644 --- a/TBF/UI/Bench/Paths/PathsDlg.cs +++ b/TBF/UI/Bench/Paths/PathsDlg.cs @@ -67,7 +67,7 @@ namespace TBF.UI.Bench.Paths /// Load the list of components from the database try { - TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)); + TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(TBF.DB.CreateSession(Users.Entities.DBKind.Config)); } catch { @@ -99,7 +99,7 @@ namespace TBF.UI.Bench.Paths } /// Create the database session for paths - Session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + Session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); Procedures = Session.QueryOver().List(); Tests = Session.QueryOver().List(); diff --git a/TBF/UI/Bench/Paths/PathsMetersCtrl.cs b/TBF/UI/Bench/Paths/PathsMetersCtrl.cs index b1cf2dc81..02ba4cade 100644 --- a/TBF/UI/Bench/Paths/PathsMetersCtrl.cs +++ b/TBF/UI/Bench/Paths/PathsMetersCtrl.cs @@ -64,18 +64,18 @@ namespace TBF.UI.Bench.Paths TBF.LocalSettings ls = Program.LocalSettings; Columns.Add(Strings.Name, (ls.MetersColumnCount > 0) ? ls.MetersColumnWidths[0] : 60 * parent.Dpi / Constants.Dpi100pct); int clmn = (int)Column.FixedColumnsCount; - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { Columns.Add(string.Format("{0} {1}", Strings.Sensor, i + 1), (ls.MetersColumnCount > clmn) ? ls.MetersColumnWidths[clmn] : 50 * parent.Dpi / Constants.Dpi100pct); clmn++; } /// Editors - editors = new Control[fixedColumnsCount + Config.Data.WMsCount]; + editors = new Control[fixedColumnsCount + TBF.Data.WMsCount]; /// editors[(int)Column.Name] = new TextBox(); /// Name /// Prepare valve combo-boxes (max. 64 valves) - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { ComboBox cb = new ComboBox(); foreach (var rr in readers) cb.Items.Add(rr.Cfg.Name); @@ -134,7 +134,7 @@ namespace TBF.UI.Bench.Paths ListViewItem lvi = new ListViewItem(entity.Name); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { if (path.RegisterReaders != null && path.RegisterReaders[i] != null) { @@ -157,7 +157,7 @@ namespace TBF.UI.Bench.Paths entity.Name = lvi.Text; - for (int j = 0; j < Config.Data.WMsCount; j++) + for (int j = 0; j < TBF.Data.WMsCount; j++) { entity.SetSensor(j, lvi.SubItems[fixedColumnsCount + j].Text); } diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs b/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs index bdf67b6ac..3a27359d9 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs +++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs @@ -428,7 +428,7 @@ namespace TBF.UI.Bench.TestProfiles if (e.SubItem == (int)MtrlgyClmn.Part) { if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out idummy) || !Test.IsGoodPartNr(idummy)) + if (!int.TryParse(e.DisplayText, out idummy) || !Data.IsGoodPartNr(idummy)) { e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.Cancel = true; diff --git a/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs b/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs index db96655a6..9e239cb41 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs +++ b/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs @@ -51,7 +51,7 @@ namespace TBF.UI.Bench.TestProfiles { if (Parent == null) return; - session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); this.parent = parent; this.parentControl = parentControl; diff --git a/TBF/UI/Bench/Transitions/TransitionsDlg.cs b/TBF/UI/Bench/Transitions/TransitionsDlg.cs index 2b7db12a6..1ec82081e 100644 --- a/TBF/UI/Bench/Transitions/TransitionsDlg.cs +++ b/TBF/UI/Bench/Transitions/TransitionsDlg.cs @@ -90,7 +90,7 @@ namespace TBF.UI.Bench.Transitions seqStepsCtrls = new List(); /// Open the database - Session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + Session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); /// Prepare a list of components and a list of all valves in the test bench TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Session); diff --git a/TBF/UI/Bench/Uncertainties/UncertaintiesDlg.cs b/TBF/UI/Bench/Uncertainties/UncertaintiesDlg.cs index 72125bb7d..e79a76474 100644 --- a/TBF/UI/Bench/Uncertainties/UncertaintiesDlg.cs +++ b/TBF/UI/Bench/Uncertainties/UncertaintiesDlg.cs @@ -54,7 +54,7 @@ namespace TBF.UI.Bench.Uncertainties int tempMetersCount = 0; int evaporationsCount = 0; - session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); cmpntEntities = session.QueryOver() .OrderBy(x => x. ItemNr).Asc .List(); diff --git a/TBF/UI/Calendar/CalendarTabPageCtrl.cs b/TBF/UI/Calendar/CalendarTabPageCtrl.cs index 1bb4e0d4e..dc8a3b14e 100644 --- a/TBF/UI/Calendar/CalendarTabPageCtrl.cs +++ b/TBF/UI/Calendar/CalendarTabPageCtrl.cs @@ -67,7 +67,7 @@ namespace TBF.UI.Calendar try { /// Read custom events from the database - ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); customEvents = session.QueryOver().List(); TripplicateShiftCustomEvents(customEvents); @@ -159,7 +159,7 @@ namespace TBF.UI.Calendar try { - var session = (parentSession != null) ? parentSession : Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + var session = (parentSession != null) ? parentSession : TBF.DB.CreateSession(Users.Entities.DBKind.Config); var customEvents = (customEventsFromDB != null) ? customEventsFromDB : session.QueryOver() .List(); for (int i = customEvents.Count - 1; i >= 0; i--) @@ -235,7 +235,7 @@ namespace TBF.UI.Calendar try { - ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); var customEventsFromDB = session.QueryOver().List(); for (int i = customEventsFromDB.Count - 1; i >= 0; i--) @@ -321,7 +321,7 @@ namespace TBF.UI.Calendar { try { - ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); session.SaveOrUpdate(dlg.NewEvent as CustomEvent); session.Flush(); @@ -357,7 +357,7 @@ namespace TBF.UI.Calendar try { /// Re-read selected custom event from the database - ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); var cEvents = session.QueryOver() .Where(x => (x.Id == evnt.Id)) .List(); diff --git a/TBF/UI/MainWnd.cs b/TBF/UI/MainWnd.cs index 542b7c796..9f5727b76 100644 --- a/TBF/UI/MainWnd.cs +++ b/TBF/UI/MainWnd.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2020 Sensus Slovensko a.s. +/// Copyright (c) 2013-2021 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -94,8 +94,8 @@ namespace TBF.UI Text = string.Format("Test Bench Framework ver. {0} - {1}{2}", Program.Version, - Config.Data.CurrentBench.BenchName, - Config.Data.CurrentBench.IsRealBench ? "" : Strings._offline); + TBF.DB.CurrentBench.BenchName, + TBF.DB.CurrentBench.IsRealBench ? "" : Strings._offline); /// /// Customize menu items /// @@ -124,7 +124,8 @@ namespace TBF.UI IsShutdownDisabled = true; IsShutdownPCAfterClosingTbf = false; - BenchControl.StateMachine.MachineState = Config.Data.CurrentBench.IsRealBench ? BenchControl.MachineState.StartingUp : BenchControl.MachineState.Disabled; + BenchControl.StateMachine.MachineState = TBF.DB.CurrentBench.IsRealBench ? BenchControl.MachineState.StartingUp : BenchControl.MachineState.Disabled; + TBF.Data.SetData(); /// if (BenchControl.StateMachine.MachineState == BenchControl.MachineState.StartingUp) { @@ -504,8 +505,8 @@ namespace TBF.UI private void usersTSMItem_Click(object s, EventArgs e) { - Users.DB.ConnectionString = Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString; - Users.DB.DbType = Config.Data.CurrentBench.ProceduresDBSettings.DbType; + Users.DB.ConnectionString = TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString; + Users.DB.DbType = TBF.DB.CurrentBench.ProceduresDBSettings.DbType; #if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL Users.Forms.UserManagementDlg dlg = new Users.Forms.UserManagementDlg(Users.DB.CreateSession(), true); string connStr = Users.DB.ConnectionString; @@ -592,7 +593,7 @@ namespace TBF.UI for (int i = 0; i < dBase.Length; i++) { - IList procedures = Config.FluentCommon.CreateSession(dBase[i]) + IList procedures = TBF.DB.CreateSession(dBase[i]) .QueryOver() .Where(x => (x.ProcedureState == ProcedureState.Active)) .OrderBy(x => x.ItemNr).Asc @@ -864,7 +865,7 @@ namespace TBF.UI /// void BackupConfiguration() { - string connectionString = Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString; + string connectionString = TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString; string server = Config.Utils.GetDBServer(connectionString); if ((server != "localhost") && (server != "127.0.0.1")) @@ -896,7 +897,7 @@ namespace TBF.UI /// void BackupResults() { - string connectionString = Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString; + string connectionString = TBF.DB.CurrentBench.WaterMetersDBSettings.ConnectionString; string server = Config.Utils.GetDBServer(connectionString); if ((server != "localhost") && (server != "127.0.0.1")) diff --git a/TBF/UI/Procedures/ProcedureDlg.cs b/TBF/UI/Procedures/ProcedureDlg.cs index a061ffe02..8c880f9f1 100644 --- a/TBF/UI/Procedures/ProcedureDlg.cs +++ b/TBF/UI/Procedures/ProcedureDlg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2019 Sensus Slovensko a.s. +/// Copyright (c) 2013-2021 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -85,6 +85,7 @@ namespace TBF.UI.Procedures SharedButtons.Buttons.Down | SharedButtons.Buttons.Copy; #if TURA_SPECIAL || TURA_IPERL || TURA_IPERL_NEW + /// Custom button 'Načítaj testy iPerl z Oracle' sharedButtons.OptionalButtons |= SharedButtons.Buttons.Custom1; sharedButtons.Custom1Caption = string.Format("Načítaj testy{0}iPerl z Oracle", Environment.NewLine); sharedButtons.Custom1Clicked += iPerlWizardButton_Click; @@ -136,7 +137,7 @@ namespace TBF.UI.Procedures #endif if (initialMode == Mode.PermanentlyLocked) sharedButtons.DisableUnlock(); - using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) + using (NHibernate.ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config)) { /// /// Prepare a list of components and a list of all valves in the test bench @@ -302,7 +303,7 @@ namespace TBF.UI.Procedures if (usedPath != null) { IList cmpntsInMPath = new List(); - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { IComponent sensor = TbfComponents.FirstOrDefault(x => (x.Cfg.Name.Equals(usedPath.GetSensor(i)))); cmpntsInMPath.Add(sensor); @@ -695,7 +696,7 @@ namespace TBF.UI.Procedures void RefreshHistoryTab() { - NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + NHibernate.ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); IList procedures = session .QueryOver() .Where(x => x.ProcedureState == ProcedureState.History) @@ -962,7 +963,7 @@ namespace TBF.UI.Procedures if (e.SubItem == (int)MtrlgyClmn.Part) { if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || !Test.IsGoodPartNr(dummy)) + if (!int.TryParse(e.DisplayText, out dummy) || !Data.IsGoodPartNr(dummy)) { e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.Cancel = true; @@ -1223,7 +1224,7 @@ namespace TBF.UI.Procedures if (e.SubItem == (int)Mtrlgy2Clmn.Part) { if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || !Test.IsGoodPartNr(dummy)) + if (!int.TryParse(e.DisplayText, out dummy) || !Data.IsGoodPartNr(dummy)) { e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.Cancel = true; @@ -1571,7 +1572,7 @@ namespace TBF.UI.Procedures if (e.SubItem == (int)ProcessClmn.Part) { if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || !Test.IsGoodPartNr(dummy)) + if (!int.TryParse(e.DisplayText, out dummy) || !Data.IsGoodPartNr(dummy)) { e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.Cancel = true; @@ -1827,7 +1828,7 @@ namespace TBF.UI.Procedures if (e.SubItem == (int)ParametersClmn.Part) { if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || !Test.IsGoodPartNr(dummy)) + if (!int.TryParse(e.DisplayText, out dummy) || !Data.IsGoodPartNr(dummy)) { e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.Cancel = true; @@ -2650,7 +2651,7 @@ namespace TBF.UI.Procedures MetersPath sensorsPath = metersPaths.FirstOrDefault(x => (x.Name == sensorsPathName)); if (sensorsPath != null) { - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { IComponent sensor = TbfComponents.FirstOrDefault(x => (x.Cfg.Name.Equals(sensorsPath.GetSensor(i)))); cmpntsInSensPath.Add(sensor); @@ -2717,7 +2718,7 @@ namespace TBF.UI.Procedures break; } - using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) + using (NHibernate.ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config)) { IList testsToBeUpdated = new List(); diff --git a/TBF/UI/Procedures/ProceduresCtrl.cs b/TBF/UI/Procedures/ProceduresCtrl.cs index 0b8d49cf0..e55d950ea 100644 --- a/TBF/UI/Procedures/ProceduresCtrl.cs +++ b/TBF/UI/Procedures/ProceduresCtrl.cs @@ -100,7 +100,7 @@ namespace TBF.UI.Procedures if (parent == null) return; /// Create a DB session - session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); this.parent = parent; this.parentControl = parentControl; diff --git a/TBF/UI/Process/ProcessTabPageCtrl24.cs b/TBF/UI/Process/ProcessTabPageCtrl24.cs index 90f53f7d5..5bdac7c27 100644 --- a/TBF/UI/Process/ProcessTabPageCtrl24.cs +++ b/TBF/UI/Process/ProcessTabPageCtrl24.cs @@ -94,7 +94,7 @@ namespace TBF.UI.Process cmpndError = new Label[] { error1zLabel, error2zLabel, error3zLabel }; cmpndPassed = new Label[] { passed1zLabel, passed2zLabel, passed3zLabel }; - ShuffleLabels(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleLabels(TBF.Data.WMsCount, TBF.Data.LineSize); Bridge.ProcedureSelectedHandler += delegate(object sndr, ProcedureSelectedEventArgs args) { @@ -214,7 +214,7 @@ namespace TBF.UI.Process { bool visible = (metersKind == MetersKind.Single || metersKind == MetersKind.HeatMeter); - for (int i = 2 * Config.Data.CompoundWMsCount; i < textBoxesCount; i++) + for (int i = 2 * TBF.Data.CompoundWMsCount; i < textBoxesCount; i++) { meter[i].Visible = visible; sensor[i].Visible = visible; @@ -225,9 +225,9 @@ namespace TBF.UI.Process passed[i].Visible = visible; } - groupBox1z.Visible = (metersKind == MetersKind.Combined) && (Config.Data.CompoundWMsCount >= 1); - groupBox2z.Visible = (metersKind == MetersKind.Combined) && (Config.Data.CompoundWMsCount >= 2); - groupBox3z.Visible = (metersKind == MetersKind.Combined) && (Config.Data.CompoundWMsCount >= 3); + groupBox1z.Visible = (metersKind == MetersKind.Combined) && (TBF.Data.CompoundWMsCount >= 1); + groupBox2z.Visible = (metersKind == MetersKind.Combined) && (TBF.Data.CompoundWMsCount >= 2); + groupBox3z.Visible = (metersKind == MetersKind.Combined) && (TBF.Data.CompoundWMsCount >= 3); } @@ -476,7 +476,7 @@ namespace TBF.UI.Process } else if (currentMetersKind == MetersKind.Combined) { - for (int compMtr = 0; compMtr < Config.Data.CompoundWMsCount; compMtr++) + for (int compMtr = 0; compMtr < TBF.Data.CompoundWMsCount; compMtr++) { int end = Math.Min(2 * compMtr + 2, Math.Min(textBoxesCount, ProcessData.RegisterReaders.Length)); @@ -563,12 +563,12 @@ namespace TBF.UI.Process } else { - for (int compMtr = 0; compMtr < Config.Data.CompoundWMsCount; compMtr++) + for (int compMtr = 0; compMtr < TBF.Data.CompoundWMsCount; compMtr++) { WaterMeter wm = ProcessData.BatchRslts.Batch.WaterMeters[compMtr]; if (wm == null) continue; - int end = Math.Min(textBoxesCount, Config.Data.WMsCount); + int end = Math.Min(textBoxesCount, TBF.Data.WMsCount); MeterTestRslt mtrMain = wm.GetMeterTestRslt(args.TestName, CompoundMeterId.CompoundMain); if ((mtrMain != null) && (2 * compMtr < end)) diff --git a/TBF/UI/Process/ProcessTabPageCtrl48.cs b/TBF/UI/Process/ProcessTabPageCtrl48.cs index cba5a90a8..33f964ca2 100644 --- a/TBF/UI/Process/ProcessTabPageCtrl48.cs +++ b/TBF/UI/Process/ProcessTabPageCtrl48.cs @@ -123,7 +123,7 @@ namespace TBF.UI.Process cmpndError = new Label[] { error1zLabel, error2zLabel, error3zLabel }; cmpndPassed = new Label[] { passed1zLabel, passed2zLabel, passed3zLabel }; - ShuffleLabels(Config.Data.WMsCount, Config.Data.LineSize); + ShuffleLabels(TBF.Data.WMsCount, TBF.Data.LineSize); Bridge.ProcedureSelectedHandler += delegate(object sndr, ProcedureSelectedEventArgs args) { @@ -243,7 +243,7 @@ namespace TBF.UI.Process { bool visible = (metersKind == MetersKind.Single); - for (int i = 2 * Config.Data.CompoundWMsCount; i < textBoxesCount; i++) + for (int i = 2 * TBF.Data.CompoundWMsCount; i < textBoxesCount; i++) { meter[i].Visible = visible; sensor[i].Visible = visible; @@ -254,9 +254,9 @@ namespace TBF.UI.Process passed[i].Visible = visible; } - groupBox1z.Visible = (metersKind == MetersKind.Combined) && (Config.Data.CompoundWMsCount >= 1); - groupBox2z.Visible = (metersKind == MetersKind.Combined) && (Config.Data.CompoundWMsCount >= 2); - groupBox3z.Visible = (metersKind == MetersKind.Combined) && (Config.Data.CompoundWMsCount >= 3); + groupBox1z.Visible = (metersKind == MetersKind.Combined) && (TBF.Data.CompoundWMsCount >= 1); + groupBox2z.Visible = (metersKind == MetersKind.Combined) && (TBF.Data.CompoundWMsCount >= 2); + groupBox3z.Visible = (metersKind == MetersKind.Combined) && (TBF.Data.CompoundWMsCount >= 3); } @@ -505,7 +505,7 @@ namespace TBF.UI.Process } else if (currentMetersKind == MetersKind.Combined) { - for (int compMtr = 0; compMtr < Config.Data.CompoundWMsCount; compMtr++) + for (int compMtr = 0; compMtr < TBF.Data.CompoundWMsCount; compMtr++) { int end = Math.Min(2 * compMtr+2, Math.Min(textBoxesCount, ProcessData.RegisterReaders.Length)); @@ -592,12 +592,12 @@ namespace TBF.UI.Process } else { - for (int compMtr = 0; compMtr < Config.Data.CompoundWMsCount; compMtr++) + for (int compMtr = 0; compMtr < TBF.Data.CompoundWMsCount; compMtr++) { WaterMeter wm = ProcessData.BatchRslts.Batch.WaterMeters[compMtr]; if (wm == null && !wm.Disabled) continue; - int end = Math.Min(textBoxesCount, Config.Data.WMsCount); + int end = Math.Min(textBoxesCount, TBF.Data.WMsCount); MeterTestRslt mtrMain = wm.GetMeterTestRslt(args.TestName, CompoundMeterId.CompoundMain); if ((mtrMain != null) && (2 * compMtr < end)) diff --git a/TBF/UI/Process/ProcessTabPageCtrl6.cs b/TBF/UI/Process/ProcessTabPageCtrl6.cs index 25e71a6c2..0be2a765c 100644 --- a/TBF/UI/Process/ProcessTabPageCtrl6.cs +++ b/TBF/UI/Process/ProcessTabPageCtrl6.cs @@ -214,19 +214,19 @@ namespace TBF.UI.Process sensor1Label.Text = "---"; - if (Config.Data.WMsCount >= 2) { sensor2Label.Text = "---"; } + if (TBF.Data.WMsCount >= 2) { sensor2Label.Text = "---"; } else { groupBox2.Visible = false; watermeterPictureBox2.Visible = false; } - if (Config.Data.WMsCount >= 3) { sensor3Label.Text = "---"; } + if (TBF.Data.WMsCount >= 3) { sensor3Label.Text = "---"; } else { groupBox3.Visible = false; watermeterPictureBox3.Visible = false; } - if (Config.Data.WMsCount >= 4) { sensor4Label.Text = "---"; } + if (TBF.Data.WMsCount >= 4) { sensor4Label.Text = "---"; } else { groupBox4.Visible = false; watermeterPictureBox4.Visible = false; } - if (Config.Data.WMsCount >= 5) { sensor5Label.Text = "---"; } + if (TBF.Data.WMsCount >= 5) { sensor5Label.Text = "---"; } else { groupBox5.Visible = false; watermeterPictureBox5.Visible = false; } - if (Config.Data.WMsCount >= 6) { sensor6Label.Text = "---"; } + if (TBF.Data.WMsCount >= 6) { sensor6Label.Text = "---"; } else { groupBox6.Visible = false; watermeterPictureBox6.Visible = false; } } else if (currentMetersKind == MetersKind.Combined) @@ -241,7 +241,7 @@ namespace TBF.UI.Process watermeterPictureBox1z.Visible = true; groupBox1z.Visible = true; - if (Config.Data.WMsCount >= 4) + if (TBF.Data.WMsCount >= 4) { watermeterPictureBox4.Visible = true; watermeterPictureBox2z.Visible = true; @@ -260,7 +260,7 @@ namespace TBF.UI.Process groupBox2z.Visible = false; } - if (Config.Data.WMsCount >= 6) + if (TBF.Data.WMsCount >= 6) { watermeterPictureBox6.Visible = true; watermeterPictureBox3z.Visible = true; @@ -316,7 +316,7 @@ namespace TBF.UI.Process error1Label.Text = "---"; passed1Label.Text = "---"; - if (Config.Data.WMsCount >= 2) + if (TBF.Data.WMsCount >= 2) { pulses2Label.Text = "---"; refPulses2Label.Text = "---"; @@ -325,15 +325,15 @@ namespace TBF.UI.Process passed2Label.Text = "---"; } - if (currentMetersKind == MetersKind.Combined && Config.Data.WMsCount >= 2) + if (currentMetersKind == MetersKind.Combined && TBF.Data.WMsCount >= 2) { volume1zLabel.Text = "---"; error1zLabel.Text = "---"; passed1zLabel.Text = "---"; } - if ((currentMetersKind == MetersKind.Single && Config.Data.WMsCount >= 3) || - (currentMetersKind == MetersKind.Combined && Config.Data.WMsCount >= 4)) + if ((currentMetersKind == MetersKind.Single && TBF.Data.WMsCount >= 3) || + (currentMetersKind == MetersKind.Combined && TBF.Data.WMsCount >= 4)) { pulses3Label.Text = "---"; refPulses3Label.Text = "---"; @@ -342,7 +342,7 @@ namespace TBF.UI.Process passed3Label.Text = "---"; } - if (Config.Data.WMsCount >= 4) + if (TBF.Data.WMsCount >= 4) { pulses4Label.Text = "---"; refPulses4Label.Text = "---"; @@ -351,15 +351,15 @@ namespace TBF.UI.Process passed4Label.Text = "---"; } - if (currentMetersKind == MetersKind.Combined && Config.Data.WMsCount >= 4) + if (currentMetersKind == MetersKind.Combined && TBF.Data.WMsCount >= 4) { volume2zLabel.Text = "---"; error2zLabel.Text = "---"; passed2zLabel.Text = "---"; } - if ((currentMetersKind == MetersKind.Single && Config.Data.WMsCount >= 5) || - (currentMetersKind == MetersKind.Combined && Config.Data.WMsCount >= 6)) + if ((currentMetersKind == MetersKind.Single && TBF.Data.WMsCount >= 5) || + (currentMetersKind == MetersKind.Combined && TBF.Data.WMsCount >= 6)) { pulses5Label.Text = "---"; refPulses5Label.Text = "---"; @@ -368,7 +368,7 @@ namespace TBF.UI.Process passed5Label.Text = "---"; } - if (Config.Data.WMsCount >= 6) + if (TBF.Data.WMsCount >= 6) { pulses6Label.Text = "---"; refPulses6Label.Text = "---"; @@ -377,7 +377,7 @@ namespace TBF.UI.Process passed6Label.Text = "---"; } - if (currentMetersKind == MetersKind.Combined && Config.Data.WMsCount >= 6) + if (currentMetersKind == MetersKind.Combined && TBF.Data.WMsCount >= 6) { volume3zLabel.Text = "---"; error3zLabel.Text = "---"; @@ -416,23 +416,23 @@ namespace TBF.UI.Process if (args.OutputPath.Scale != null) scaleCmpntLabel.Text = args.OutputPath.Scale.Name; sensor1Label.Text = (args.MetersPath.RegisterReaders[0] == null) ? "" : args.MetersPath.RegisterReaders[0].Cfg.Name; - if (Config.Data.WMsCount >= 2) + if (TBF.Data.WMsCount >= 2) { sensor2Label.Text = (args.MetersPath.RegisterReaders[1] == null) ? "" : args.MetersPath.RegisterReaders[1].Cfg.Name; } - if (Config.Data.WMsCount >= 3) + if (TBF.Data.WMsCount >= 3) { sensor3Label.Text = (args.MetersPath.RegisterReaders[2] == null) ? "" : args.MetersPath.RegisterReaders[2].Cfg.Name; } - if (Config.Data.WMsCount >= 4) + if (TBF.Data.WMsCount >= 4) { sensor4Label.Text = (args.MetersPath.RegisterReaders[3] == null) ? "" : args.MetersPath.RegisterReaders[3].Cfg.Name; } - if (Config.Data.WMsCount >= 5) + if (TBF.Data.WMsCount >= 5) { sensor5Label.Text = (args.MetersPath.RegisterReaders[4] == null) ? "" : args.MetersPath.RegisterReaders[4].Cfg.Name; } - if (Config.Data.WMsCount >= 6) + if (TBF.Data.WMsCount >= 6) { sensor6Label.Text = (args.MetersPath.RegisterReaders[5] == null) ? "" : args.MetersPath.RegisterReaders[5].Cfg.Name; } @@ -509,7 +509,7 @@ namespace TBF.UI.Process } else if (currentMetersKind == MetersKind.Combined) { - for (int compMtr = 0; compMtr < Config.Data.CompoundWMsCount; compMtr++) + for (int compMtr = 0; compMtr < TBF.Data.CompoundWMsCount; compMtr++) { int end = Math.Min(2 * compMtr + 2, Math.Min(textBoxesCount, ProcessData.RegisterReaders.Length)); @@ -596,12 +596,12 @@ namespace TBF.UI.Process } else { - for (int compMtr = 0; compMtr < Config.Data.CompoundWMsCount; compMtr++) + for (int compMtr = 0; compMtr < TBF.Data.CompoundWMsCount; compMtr++) { WaterMeter wm = ProcessData.BatchRslts.Batch.WaterMeters[compMtr]; if (wm == null && !wm.Disabled) continue; - int end = Math.Min(textBoxesCount, Config.Data.WMsCount); + int end = Math.Min(textBoxesCount, TBF.Data.WMsCount); MeterTestRslt mtrMain = wm.GetMeterTestRslt(args.TestName, CompoundMeterId.CompoundMain); if ((mtrMain != null) && (2 * compMtr < end)) diff --git a/TBF/UI/Process/ProcessTabPageExCtrl.cs b/TBF/UI/Process/ProcessTabPageExCtrl.cs index 9716ce18a..8a84ffe5d 100644 --- a/TBF/UI/Process/ProcessTabPageExCtrl.cs +++ b/TBF/UI/Process/ProcessTabPageExCtrl.cs @@ -157,7 +157,7 @@ namespace TBF.UI.Process if ((metersKind == MetersKind.Single) || (metersKind == MetersKind.HeatMeter)) { - for (int i = 0; i < Config.Data.WMsCount; i++) + for (int i = 0; i < TBF.Data.WMsCount; i++) { ListViewItem lvi = new ListViewItem(new string[] { (i + 1).ToString(), "---", "---", "---", "---", "---", "---" }); if (metersKind == MetersKind.HeatMeter) @@ -171,7 +171,7 @@ namespace TBF.UI.Process } else if (metersKind == MetersKind.Combined) { - for (int z = 0; z < Config.Data.CompoundWMsCount; z++) + for (int z = 0; z < TBF.Data.CompoundWMsCount; z++) { ListViewItem lvi = new ListViewItem(string.Format("{0} {1}", Strings.Compound_meter_0, z + 1)); lvi.SubItems.Add(string.Empty); /// sensor @@ -243,7 +243,7 @@ namespace TBF.UI.Process } else if (currentMetersKind == MetersKind.Combined) { - for (int z = 0; z < Math.Min(Config.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) + for (int z = 0; z < Math.Min(TBF.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) { metersListView.Items[3 * z + 1].SubItems[(int)Columns.Sensor].Text = "---"; metersListView.Items[3 * z + 2].SubItems[(int)Columns.Sensor].Text = "---"; @@ -308,7 +308,7 @@ namespace TBF.UI.Process } else if (currentMetersKind == MetersKind.Combined) { - for (int z = 0; z < Math.Min(Config.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) + for (int z = 0; z < Math.Min(TBF.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) { /// Compound metersListView.Items[3 * z].SubItems[(int)Columns.RefPulses].Text = "---"; @@ -399,7 +399,7 @@ namespace TBF.UI.Process } else if (currentMetersKind == MetersKind.Combined) { - for (int z = 0; z < Math.Min(Config.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) + for (int z = 0; z < Math.Min(TBF.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) { metersListView.Items[3 * z + 1].SubItems[(int)Columns.Sensor].Text = ((args.MetersPath.RegisterReaders != null) && (args.MetersPath.RegisterReaders.Length > 2 * z) && (args.MetersPath.RegisterReaders[2 * z] != null)) @@ -484,7 +484,7 @@ namespace TBF.UI.Process } else if (currentMetersKind == MetersKind.Combined) { - for (int z = 0; z < Math.Min(Config.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) + for (int z = 0; z < Math.Min(TBF.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) { BenchControl.GenericDevices.IRegReader rrMain = (ProcessData.RegisterReaders.Length > 2 * z) ? ProcessData.RegisterReaders[2 * z] : null; BenchControl.GenericDevices.IRegReader rrAux = (ProcessData.RegisterReaders.Length > 2 * z + 1) ? ProcessData.RegisterReaders[2 * z + 1] : null; @@ -601,7 +601,7 @@ namespace TBF.UI.Process /// /// Test results for compond meters /// - for (int z = 0; z < Math.Min(Config.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) + for (int z = 0; z < Math.Min(TBF.Data.CompoundWMsCount, metersListView.Items.Count / 3); z++) { WaterMeter wm = ProcessData.BatchRslts.Batch.WaterMeters[z]; if (wm == null && !wm.Disabled) continue; diff --git a/TBF/UI/ResultsMI/PreviousResultsDlg.cs b/TBF/UI/ResultsMI/PreviousResultsDlg.cs index 5883c050a..b0dd5a02e 100644 --- a/TBF/UI/ResultsMI/PreviousResultsDlg.cs +++ b/TBF/UI/ResultsMI/PreviousResultsDlg.cs @@ -78,7 +78,7 @@ namespace TBF.UI.ResultsMI try { - session = DB.CreateSession(); + session = Results.DB.CreateSession(); } catch (Exception exc) { @@ -209,7 +209,7 @@ namespace TBF.UI.ResultsMI //} //Database.WriteLogsToDisk(logger, b); - using (ISession configSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) + using (ISession configSession = TBF.DB.CreateSession(Users.Entities.DBKind.Config)) { IList cmpntEntities = configSession.QueryOver() .OrderBy(x => x.ItemNr).Asc diff --git a/TBF/UI/Settings/BenchesDlg.cs b/TBF/UI/Settings/BenchesDlg.cs index 3ea43423c..440737e0b 100644 --- a/TBF/UI/Settings/BenchesDlg.cs +++ b/TBF/UI/Settings/BenchesDlg.cs @@ -64,9 +64,9 @@ namespace TBF.UI.Settings private void addButton_Click(object sender, EventArgs e) { Config.DatabaseSettings bench = new Config.DatabaseSettings(); - DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench, Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString, - Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString, - Config.Data.CurrentBench.EventsDBSettings.ConnectionString); + DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench, TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString, + TBF.DB.CurrentBench.WaterMetersDBSettings.ConnectionString, + TBF.DB.CurrentBench.EventsDBSettings.ConnectionString); DialogResult dr = dlg.ShowDialog(); CurrentDBChanged |= dlg.CurrentDBChanged; if (dr == DialogResult.OK) @@ -105,9 +105,9 @@ namespace TBF.UI.Settings Config.DatabaseSettings ori = localSettings.TestBenches[testBenchesListBox.SelectedIndex]; Config.DatabaseSettings bench = (Config.DatabaseSettings)ori.Clone(); - DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench, Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString, - Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString, - Config.Data.CurrentBench.EventsDBSettings.ConnectionString); + DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench, TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString, + TBF.DB.CurrentBench.WaterMetersDBSettings.ConnectionString, + TBF.DB.CurrentBench.EventsDBSettings.ConnectionString); DialogResult dr = dlg.ShowDialog(); CurrentDBChanged |= dlg.CurrentDBChanged; if (dr == DialogResult.OK) @@ -136,9 +136,9 @@ namespace TBF.UI.Settings if (testBenchesListBox.SelectedIndex >= 0) { DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(localSettings.TestBenches[testBenchesListBox.SelectedIndex], - Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString, - Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString, - Config.Data.CurrentBench.EventsDBSettings.ConnectionString); + TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString, + TBF.DB.CurrentBench.WaterMetersDBSettings.ConnectionString, + TBF.DB.CurrentBench.EventsDBSettings.ConnectionString); DialogResult dr = dlg.ShowDialog(); CurrentDBChanged |= dlg.CurrentDBChanged; if (dr == DialogResult.OK) diff --git a/TBF/UI/Settings/UpgradeSelectionDlg.cs b/TBF/UI/Settings/UpgradeSelectionDlg.cs index fe5ef00a7..d241eb5b0 100644 --- a/TBF/UI/Settings/UpgradeSelectionDlg.cs +++ b/TBF/UI/Settings/UpgradeSelectionDlg.cs @@ -116,7 +116,7 @@ namespace TBF.UI.Settings try { - session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); var testParams = session.QueryOver() .Where(x => (x.CmpntName == errorFlagsCmpntName)) @@ -176,7 +176,7 @@ namespace TBF.UI.Settings ActivityStart(); - if (!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), commands)) + if (!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), commands)) { ActivityEnd(); MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -226,8 +226,8 @@ namespace TBF.UI.Settings ActivityStart(); - if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && - (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), resultsDbCommands))) + if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) { ActivityEnd(); MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -285,12 +285,12 @@ namespace TBF.UI.Settings ActivityStart(); - if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && - (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), resultsDbCommands))) + if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) { if (upgradeConfigDBCheckBox.Checked) { - MySqlConnection dbConn = new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString); + MySqlConnection dbConn = new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString); try { dbConn.Open(); @@ -409,12 +409,12 @@ namespace TBF.UI.Settings ActivityStart(); - if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && - (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), resultsDbCommands))) + if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) { if (upgradeConfigDBCheckBox.Checked) { - MySqlConnection dbConn = new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString); + MySqlConnection dbConn = new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString); try { dbConn.Open(); @@ -564,7 +564,7 @@ namespace TBF.UI.Settings ActivityStart(); - if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), commands)) + if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), commands)) { ActivityEnd(); MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -590,7 +590,7 @@ namespace TBF.UI.Settings ActivityStart(); - if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), commands)) + if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), commands)) { ActivityEnd(); MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -614,7 +614,7 @@ namespace TBF.UI.Settings ActivityStart(); - if (!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), commands)) + if (!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), commands)) { ActivityEnd(); MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -654,7 +654,7 @@ namespace TBF.UI.Settings ActivityStart(); - if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), resultsDbCommands)) + if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands)) { ActivityEnd(); MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -785,7 +785,7 @@ namespace TBF.UI.Settings if (upgradeConfigDBCheckBox.Checked) { - success = success && ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands); + success = success && ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands); if (!string.IsNullOrEmpty(errorFlagsComponentsTextBox.Text)) { @@ -799,7 +799,7 @@ namespace TBF.UI.Settings if (upgradeResultsDBCheckBox.Checked) { - success = success && ExecuteCommands(new MySqlConnection(DB.ConnectionString), resultsDbCommands); + success = success && ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands); } if (success) @@ -824,7 +824,7 @@ namespace TBF.UI.Settings try { - dbConn = new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString); + dbConn = new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString); dbConn.Open(); cmd = dbConn.CreateCommand(); @@ -965,8 +965,8 @@ namespace TBF.UI.Settings ActivityStart(); - if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && - (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), resultsDbCommands))) + if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) { ActivityEnd(); MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -994,7 +994,7 @@ namespace TBF.UI.Settings try { - ISession session = DB.CreateSession(); + ISession session = Results.DB.CreateSession(); IList bFrom = session.QueryOver().Where(x => (x.BatchNr == batchFrom)).List(); IList bTo = session.QueryOver().Where(x => (x.BatchNr == batchTo)).List(); @@ -1049,7 +1049,7 @@ namespace TBF.UI.Settings try { - ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); + ISession session = TBF.DB.CreateSession(Users.Entities.DBKind.Config); var proceduresToModify = session.QueryOver() .Where(x => x.CmpntName == "Sensus-Oracle-DB") diff --git a/TBF/UI/Shared/BenchControlPanel.cs b/TBF/UI/Shared/BenchControlPanel.cs index ac0cc766a..17865b312 100644 --- a/TBF/UI/Shared/BenchControlPanel.cs +++ b/TBF/UI/Shared/BenchControlPanel.cs @@ -180,7 +180,7 @@ namespace TBF.UI.Shared string oriTestName = testComboBox.Text; - IList procedures = Config.FluentCommon.CreateSession(Program.MainWnd.SelectedProcedure.IsRemote ? + IList procedures = TBF.DB.CreateSession(Program.MainWnd.SelectedProcedure.IsRemote ? Users.Entities.DBKind.RemoteConfig : Users.Entities.DBKind.Config) .QueryOver() .Where(x => (x.ProcedureState == ProcedureState.Active)) diff --git a/TBF/Utils.cs b/TBF/Utils.cs index 1d4de9cfb..1743c3156 100644 --- a/TBF/Utils.cs +++ b/TBF/Utils.cs @@ -260,7 +260,7 @@ namespace TBF if (combined) return wmNr1; - int wmPartNr = 1 + (wmNr1 - 1) / Config.Data.LineSize; + int wmPartNr = 1 + (wmNr1 - 1) / TBF.Data.LineSize; return wmPartNr; }