diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs index 3dd6ecca6..dede46e70 100644 --- a/TBF/BenchControl/TbfComponents.cs +++ b/TBF/BenchControl/TbfComponents.cs @@ -56,6 +56,7 @@ namespace TBF.BenchControl Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory()); Factories.Add(new TestMethods.Counter.Factory()); Factories.Add(new TestMethods.DiverterTest.Factory()); + Factories.Add(new TestMethods.Dummy.Factory()); Factories.Add(new TestMethods.Endurance.Factory()); Factories.Add(new TestMethods.FixedStart.Single.Factory()); Factories.Add(new TestMethods.FixedStart.Compound.Factory()); diff --git a/TBF/BenchControl/TestMethods/Dummy/DummySeq.cs b/TBF/BenchControl/TestMethods/Dummy/DummySeq.cs new file mode 100644 index 000000000..3eae445c8 --- /dev/null +++ b/TBF/BenchControl/TestMethods/Dummy/DummySeq.cs @@ -0,0 +1,64 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using log4net; +using Config.Entities; +using TBF.UiBridge; + +namespace TBF.BenchControl.TestMethods.Dummy +{ + public class DummySeq : Sequences.SequenceBase + { + private static readonly ILog log = LogManager.GetLogger(typeof(DummySeq)); + + /// + /// Adjustment method sequence + /// + /// Test entity + /// + /// Event.Done . . . . . . . OK + /// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP + /// Event.OpArgumentError . Target flow is out of range + /// Event.Error . . . . . . Unspecified error + /// + public IList Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode) + { + IList e = new List(); /// Events from currently running operations + checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state + + /// Start the test, initialize test results + Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0)); + string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); + TestStartTime = DateTime.Now; + + /// + /// Show a dialog with OK button and an appropriate message + /// + Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(testName)); + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); + Bridge.OnActivity(this, test.Method); + State.Create(string.Format("{0}({1}) : Dummy", test.Method, test.Name)) + .AddOperation(checkUiOp) + .AddOperation(StateMachine.BenchWaitingOp) + .AddOperation(new Operations.MessageBoxOp(string.Format("Dummy test {0}", test.Name))) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test)); + + if (e.Contains(Event.Error)) goto stopTest; + if (TestAndLogUiCmdStop(test, e)) goto stopTest; + } + while (!e.Contains(Event.OK)); + + return new List { Event.Done }; + + stopTest: + return new List { Event.UiCmdStop }; + } + } +} diff --git a/TBF/BenchControl/TestMethods/Dummy/Factory.cs b/TBF/BenchControl/TestMethods/Dummy/Factory.cs new file mode 100644 index 000000000..8ef088ff1 --- /dev/null +++ b/TBF/BenchControl/TestMethods/Dummy/Factory.cs @@ -0,0 +1,30 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +using System.Collections.Generic; +using TBF.BenchControl.Generic; +using TBF.BenchControl.Configs.NameOnly; + +namespace TBF.BenchControl.TestMethods.Dummy +{ + public class Factory : IComponentFactory + { + public string ClassName { get { return this.GetType().Namespace.Substring(17); } } + + public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } + + public IComponent DummyComponent() { return new TestMethod(); } + + public IComponent GetComponent(IComponentCfg cfg, IList components) { return new TestMethod(cfg); } + + public IComponentCfg DefaultConfig() + { + return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); + } + + public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this); + } + } +} diff --git a/TBF/BenchControl/TestMethods/Dummy/TestMethod.cs b/TBF/BenchControl/TestMethods/Dummy/TestMethod.cs new file mode 100644 index 000000000..9a7835cd9 --- /dev/null +++ b/TBF/BenchControl/TestMethods/Dummy/TestMethod.cs @@ -0,0 +1,35 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using log4net; +using Config.Entities; +using TBF.BenchControl; + +namespace TBF.BenchControl.TestMethods.Dummy +{ + public class TestMethod : ComponentBase, GenericDevices.ITestMethod + { + private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); + public override string ToString() { return string.Format("TestMethods.ChangeFlowDirection({0})", Cfg.ToString(1)); } + + public bool CanTest(MetersKind meters) { return true; } + public bool DoTransitions() { return true; } + + public TestMethod() + { + } + + public TestMethod(Generic.IComponentCfg cfg) + : base(cfg) + { + log.Debug(this.ToString()); + } + + public IList Execute(Test test, int repetNr, bool isLastRepetition) + { + return (new DummySeq()).Execute(test, repetNr, isLastRepetition, DebugLevel); + } + } +} diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs index ae06bceea..2279d1d74 100644 --- a/TBF/Resources/Strings.Designer.cs +++ b/TBF/Resources/Strings.Designer.cs @@ -1338,6 +1338,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Do you want to update 'Use wizard' tests ?. + /// + internal static string Do_you_want_to_update_tests_QM { + get { + return ResourceManager.GetString("Do_you_want_to_update_tests_QM", resourceCulture); + } + } + /// /// Looks up a localized string similar to Down. /// @@ -5553,6 +5562,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Update. + /// + internal static string Update { + get { + return ResourceManager.GetString("Update", resourceCulture); + } + } + /// /// Looks up a localized string similar to Use {0}. /// diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx index 874fd9766..e8327e272 100644 --- a/TBF/Resources/Strings.cs.resx +++ b/TBF/Resources/Strings.cs.resx @@ -1488,4 +1488,10 @@ Program musí být uzavřen. + + Chcete modifikovat 'Use wizard' testy ? + + + Modifikovat + \ No newline at end of file diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx index 541d811bc..4333a3bba 100644 --- a/TBF/Resources/Strings.resx +++ b/TBF/Resources/Strings.resx @@ -2062,4 +2062,10 @@ No info available + + Do you want to update 'Use wizard' tests ? + + + Update + \ No newline at end of file diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index 0d50893a9..025812146 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -1120,6 +1120,9 @@ TestMethodCfgCtrl.cs + + + @@ -2164,6 +2167,12 @@ TestParamsCtrl.cs + + Form + + + ConfirmUpdatingTests.cs + Form @@ -2182,6 +2191,12 @@ MethodSelection.cs + + Form + + + OracleWZTypSelection.cs + Form @@ -3103,6 +3118,9 @@ TestParamsCtrl.cs + + ConfirmUpdatingTests.cs + FlowSelection.cs @@ -3112,6 +3130,9 @@ MethodSelection.cs + + OracleWZTypSelection.cs + PressureSelection.cs diff --git a/TBF/UI/Procedures/ProcedureDlg.cs b/TBF/UI/Procedures/ProcedureDlg.cs index ca45a810f..69b411f08 100644 --- a/TBF/UI/Procedures/ProcedureDlg.cs +++ b/TBF/UI/Procedures/ProcedureDlg.cs @@ -13,6 +13,8 @@ using TBF.BenchControl.Generic; using TBF.BenchControl.GenericDevices; using TBF.Resources; using TBF.UI.Shared; +using TBF.BenchControl.Output; +using TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead; namespace TBF.UI.Procedures { @@ -63,15 +65,23 @@ namespace TBF.UI.Procedures InitializeComponent(); - /// SharedDlgButtons configuration -#if KEMPNO_50 + /// SharedDlgButtons configuration +#if KEMPNO_50 || KRAKOW_50 sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority }; #else - sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists }; + sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists }; #endif + +#if TURA_SPECIAL || TURA_IPERL || TURA_IPERL_NEW sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove | - SharedButtons.Buttons.Up | SharedButtons.Buttons.Down; - sharedButtons.Unlocked += Unlocked; + SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |SharedButtons.Buttons.Custom1; + sharedButtons.Custom1Caption = string.Format("Načítaj testy{0}iPerl z Oracle", Environment.NewLine); + sharedButtons.Custom1Clicked += iPerlWizardButton_Click; +#else + sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove | + SharedButtons.Buttons.Up | SharedButtons.Buttons.Down; +#endif + sharedButtons.Unlocked += Unlocked; sharedButtons.OKClicked += okButton_Click; sharedButtons.CancelClicked += cancelButton_Click; sharedButtons.AddClicked += addButton_Click; @@ -108,17 +118,19 @@ namespace TBF.UI.Procedures this.usedNames = usedNames; this.openUnlocked = openUnlocked; -#if KEMPNO_50 +#if KEMPNO_50 || KRAKOW_50 sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.WaterMeterAuthority } : new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority }; #else sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists } : new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists }; #endif - /// Prepare a list of components and a list of all valves in the test bench using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) { - TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session); + /// + /// Prepare a list of components and a list of all valves in the test bench + /// + TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session); Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents); RegulValves = new List(); TestMethods = new List(); @@ -129,6 +141,7 @@ namespace TBF.UI.Procedures fileWriter2ComboBox.Items.Add("---"); fileWriter3ComboBox.Items.Add("---"); fileWriter4ComboBox.Items.Add("---"); + foreach (var cmpnt in TbfComponents) { if (cmpnt is IRegulValve) RegulValves.Add(cmpnt as IRegulValve); @@ -147,12 +160,11 @@ namespace TBF.UI.Procedures fileWriter4ComboBox.Items.Add(cmpnt.Cfg.Name); } } - } - /// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call - using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) - { - feedingPaths = session.QueryOver().List(); + /// + /// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call + /// + feedingPaths = session.QueryOver().List(); benchPaths = session.QueryOver().List(); outputPaths = session.QueryOver().List(); metersPaths = session.QueryOver().List(); @@ -316,11 +328,11 @@ namespace TBF.UI.Procedures LoadUISettings(); /// Enable/disable/show/hide controls in General tab -#if IPERL +#if KEMPNO_50 || KRAKOW_50 altProcNameLabel.Visible = true; altProcNameTextBox.Visible = true; - altProcPeriodLabel.Visible = true; - altProcPeriodTextBox.Visible = true; + //altProcPeriodLabel.Visible = true; + //altProcPeriodTextBox.Visible = true; #endif procNameTextBox.Enabled = false; descriptionTextBox.Enabled = false; @@ -404,6 +416,7 @@ namespace TBF.UI.Procedures label15.Text = Strings.Date; label18.Text = Strings.Notes; watermetersLabel.Text = Strings.Meter_types_tested; + altProcNameLabel.Text = Strings.Conditions; protectedCheckBox.Text = Strings.Protected_procedure; mustBeCompleteCheckBox.Text = Strings.All_tests_must_be_completed; manualControlDisabledCheckBox.Text = Strings.Manual_control_disabled; @@ -1951,15 +1964,13 @@ namespace TBF.UI.Procedures private void addButton_Click(object sender, EventArgs e) { ListViewEx listViewEx; - switch (selectedTab) { case ProcedureTabs.Metrology1: listViewEx = metrology1ListViewEx; break; case ProcedureTabs.Metrology2: listViewEx = metrology2ListViewEx; break; case ProcedureTabs.Process: listViewEx = processListViewEx; break; case ProcedureTabs.Parameters: listViewEx = parametersListViewEx; break; - - default: return; + default: return; } /// Find an unused test name @@ -2115,10 +2126,13 @@ namespace TBF.UI.Procedures AddToParametersTab(test); foreach (var ctrl in testParamsCtrls) ctrl.AddOne(test); - listViewEx.Focus(); - listViewEx.SelectedItems.Clear(); - listViewEx.Items[listViewEx.Items.Count - 1].Selected = true; - listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible(); + if (listViewEx != null) + { + listViewEx.Focus(); + listViewEx.SelectedItems.Clear(); + listViewEx.Items[listViewEx.Items.Count - 1].Selected = true; + listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible(); + } } private void removeButton_Click(object sender, EventArgs e) @@ -2380,5 +2394,196 @@ namespace TBF.UI.Procedures } } } + + /// + /// Queries an Oracle database and loads ... array/list + /// + private void iPerlWizardButton_Click(object sender, EventArgs e) + { + ListViewEx listViewEx = null; + switch (selectedTab) + { + case ProcedureTabs.General: + UpdateFromGeneralTab(); + break; + + case ProcedureTabs.History: + UpdateFromHistoryTab(); + break; + + case ProcedureTabs.Metrology1: + listViewEx = metrology1ListViewEx; + UpdateFromMetrology1Tab(); + break; + + case ProcedureTabs.Metrology2: + listViewEx = metrology2ListViewEx; + UpdateFromMetrology2Tab(); + break; + + case ProcedureTabs.Process: + listViewEx = processListViewEx; + UpdateFromProcessTab(); + break; + + case ProcedureTabs.Parameters: + listViewEx = parametersListViewEx; + UpdateFromParametersTab(); + break; + + default: + foreach (var ctrl in testParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name)); + foreach (var ctrl in procedureParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name)); + break; + } + + using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) + { + IList testsToBeUpdated = new List(); + + foreach (var test in LoadedProcedure.Tests) + { + foreach (var tetsMethod in TestMethods) + { + if (tetsMethod.Name == test.Method && tetsMethod.ClassName == "TestMethods.Dummy") + { + testsToBeUpdated.Add(test); + break; + } + } + } + + if (testsToBeUpdated.Count == 0) + { + MessageBox.Show("There are no tests to be updated"); + return; + } + + /// Run a wizard + TestWizard.OracleWZTypSelection oracleDlg = new TestWizard.OracleWZTypSelection(LoadedProcedure, TestMethods); + TestWizard.ConfirmUpdatingTests confirmationDlg = new TestWizard.ConfirmUpdatingTests(LoadedProcedure, TestMethods); + Form[] forms = new Form[] { oracleDlg, confirmationDlg }; + + int step = 0; /// 1st step + while ((step >= 0) && (step < forms.Length)) + { + switch (forms[step].ShowDialog()) + { + case DialogResult.OK: + /// Next + step++; + break; + + case DialogResult.Retry: + /// Back + step--; + break; + + case DialogResult.Cancel: + default: + return; + } + } + + if (step == forms.Length) + { + /// + /// Update tests + /// + foreach (var ti in oracleDlg.SelectedTestInfos) + { + foreach (var test in testsToBeUpdated) + { + if (ti.TestName == test.Name) + { + /// + /// Update this test with information obtained from Oracle + /// + double qfrom, qto; + switch (ti.Range) + { + case Range.R90_100: + qfrom = 0.9 * ti.Flow; + qto = ti.Flow; + break; + + case Range.R95_105: + qfrom = 0.95 * ti.Flow; + qto = 1.05 * ti.Flow; + break; + + case Range.R100_110: + qfrom = ti.Flow; + qto = 1.1 * ti.Flow; + break; + + default: + qfrom = qto = ti.Flow; + break; + } + + double volume = ti.TestTime * (qfrom + qto) / 7.2; + + test.Qfrom = (float)qfrom; + test.Qto = (float)qto; + test.TstTime = (float)ti.TestTime; + test.Volume = (float)volume; + test.ErrLimLo = (float)(ti.ErrLimLoFromDB - ti.Uncertainty); + test.ErrLimHi = (float)(ti.ErrLimHiFromDB + ti.Uncertainty); + test.Uncertainty = (float)ti.Uncertainty; + test.Method = ti.TestMethod; + } + } + } + + /// + /// Update iPerls and water meters + /// + foreach (var ppCtrl in procedureParamsCtrls) + { + foreach (var pp in ppCtrl.CmpntsParams) + { + var ihpp = pp as TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead.ProcParams; + if (ihpp != null) + { + ihpp.WMType_ID = oracleDlg.WMTypeId; + ihpp.MeterType = oracleDlg.MeterType; + } + + var wmpp = pp as TBF.BenchControl.WaterMeters.WaterMeter.ProcParams; + if (wmpp != null) + { + wmpp.MetrologicalClass = oracleDlg.MetrolKlasse; + wmpp.ApprovalInfo = oracleDlg.Zulasszeichen; + wmpp.Qn = (float)oracleDlg.Q3; + + switch (oracleDlg.MeterType) + { + case MeterType.DN15: wmpp.DN = 15.0F; break; + case MeterType.DN20: wmpp.DN = 20.0F; break; + case MeterType.DN25: wmpp.DN = 25.0F; break; + case MeterType.DN26: wmpp.DN = 25.0F; break; + case MeterType.DN32: wmpp.DN = 32.0F; break; + case MeterType.DN40: wmpp.DN = 40.0F; break; + default: + case MeterType.AutoDetect: wmpp.DN = 0; break; + } + } + } + } + + RefreshMetrology12AndProcessTabs(); + RefreshOtherTabs(); + + if (listViewEx != null) + { + listViewEx.Focus(); + listViewEx.SelectedItems.Clear(); + listViewEx.Items[listViewEx.Items.Count - 1].Selected = true; + listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible(); + } + } + } + } } } diff --git a/TBF/UI/Procedures/ProcedureParamsCtrl.cs b/TBF/UI/Procedures/ProcedureParamsCtrl.cs index a02cebf88..f88963b30 100644 --- a/TBF/UI/Procedures/ProcedureParamsCtrl.cs +++ b/TBF/UI/Procedures/ProcedureParamsCtrl.cs @@ -25,7 +25,8 @@ namespace TBF.UI.Procedures bool showSensorsColumn; int nrFixedColumns; IList selectedCmpnts; - IList cmpntsParams; + + public IList CmpntsParams; int paramsCount; Control[] editors; @@ -35,7 +36,7 @@ namespace TBF.UI.Procedures public ProcedureParamsCtrl() { InitializeComponent(); - cmpntsParams = new List(); + CmpntsParams = new List(); } public ProcedureParamsCtrl(ProcedureDlg parent, IList selectedCmpnts, bool showSensorsColumn) @@ -81,7 +82,7 @@ namespace TBF.UI.Procedures } } - cmpntsParams.Add(procedureParams); + CmpntsParams.Add(procedureParams); } if (sampleToCreateHeader != null) @@ -176,7 +177,7 @@ namespace TBF.UI.Procedures public void RedrawAll() { listViewEx.Items.Clear(); - foreach (var item in cmpntsParams) DrawOne(item); + foreach (var item in CmpntsParams) DrawOne(item); } void DrawOne(IParamsProvider item) diff --git a/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.Designer.cs b/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.Designer.cs new file mode 100644 index 000000000..b76c86d08 --- /dev/null +++ b/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.Designer.cs @@ -0,0 +1,103 @@ +namespace TBF.UI.Procedures.TestWizard +{ + partial class ConfirmUpdatingTests + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.cancelButton = new System.Windows.Forms.Button(); + this.nextButton = new System.Windows.Forms.Button(); + this.backButton = new System.Windows.Forms.Button(); + this.messageLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(185, 77); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 42); + this.cancelButton.TabIndex = 30; + this.cancelButton.Text = "&Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // nextButton + // + this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.nextButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.nextButton.Location = new System.Drawing.Point(104, 77); + this.nextButton.Name = "nextButton"; + this.nextButton.Size = new System.Drawing.Size(75, 42); + this.nextButton.TabIndex = 29; + this.nextButton.Text = "&Next >"; + this.nextButton.UseVisualStyleBackColor = true; + // + // backButton + // + this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry; + this.backButton.Location = new System.Drawing.Point(23, 77); + this.backButton.Name = "backButton"; + this.backButton.Size = new System.Drawing.Size(75, 42); + this.backButton.TabIndex = 28; + this.backButton.Text = "< &Back"; + this.backButton.UseVisualStyleBackColor = true; + // + // messageLabel + // + this.messageLabel.AutoSize = true; + this.messageLabel.Location = new System.Drawing.Point(20, 33); + this.messageLabel.Name = "messageLabel"; + this.messageLabel.Size = new System.Drawing.Size(208, 13); + this.messageLabel.TabIndex = 31; + this.messageLabel.Text = "Do you want to update \'Use wizard\' tests ?"; + // + // ConfirmUpdatingTests + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 136); + this.Controls.Add(this.messageLabel); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.nextButton); + this.Controls.Add(this.backButton); + this.Name = "ConfirmUpdatingTests"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Confirmation"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.Button nextButton; + private System.Windows.Forms.Button backButton; + private System.Windows.Forms.Label messageLabel; + } +} \ No newline at end of file diff --git a/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.cs b/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.cs new file mode 100644 index 000000000..a6cafc120 --- /dev/null +++ b/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using Config.Entities; +using TBF.BenchControl.GenericDevices; +using TBF.Resources; + +namespace TBF.UI.Procedures.TestWizard +{ + public partial class ConfirmUpdatingTests : Form + { + Procedure loadedProcedure; + IList testMethods; + + public ConfirmUpdatingTests(Procedure loadedProcedure, IList testMethods) + { + this.loadedProcedure = loadedProcedure; + this.testMethods = testMethods; + + InitializeComponent(); + + Text = Strings.Confirmation; + messageLabel.Text = Strings.Do_you_want_to_update_tests_QM; + backButton.Text = Strings.BackBtnText; + nextButton.Text = Strings.Update; + cancelButton.Text = Strings.CancelBtnText; + } + } +} diff --git a/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.resx b/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/UI/Procedures/TestWizard/ConfirmUpdatingTests.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.Designer.cs b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.Designer.cs new file mode 100644 index 000000000..4724cc343 --- /dev/null +++ b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.Designer.cs @@ -0,0 +1,433 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +namespace TBF.UI.Procedures.TestWizard +{ + partial class OracleWZTypSelection + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.horizSplitContainer = new System.Windows.Forms.SplitContainer(); + this.horizSplitContainer2 = new System.Windows.Forms.SplitContainer(); + this.meterTypeComboBox = new System.Windows.Forms.ComboBox(); + this.dnLabel = new System.Windows.Forms.Label(); + this.q3TextBox = new System.Windows.Forms.TextBox(); + this.q3Label = new System.Windows.Forms.Label(); + this.approvalTextBox = new System.Windows.Forms.TextBox(); + this.approvalLabel = new System.Windows.Forms.Label(); + this.metroClassTextBox = new System.Windows.Forms.TextBox(); + this.metroClassLabel = new System.Windows.Forms.Label(); + this.testInfoNameLabel = new System.Windows.Forms.Label(); + this.timeStampTextBox = new System.Windows.Forms.TextBox(); + this.timeStampLabel = new System.Windows.Forms.Label(); + this.remarkTextBox = new System.Windows.Forms.TextBox(); + this.remarkLabel = new System.Windows.Forms.Label(); + this.wzTypTextBox = new System.Windows.Forms.TextBox(); + this.wzTypLabel = new System.Windows.Forms.Label(); + this.revWZTypLabel = new System.Windows.Forms.Label(); + this.revWZTypTextBox = new System.Windows.Forms.TextBox(); + this.searchButton = new System.Windows.Forms.Button(); + this.materialCodeTextBox = new System.Windows.Forms.TextBox(); + this.idWZTypTextBox = new System.Windows.Forms.TextBox(); + this.materialCodeRadioButton = new System.Windows.Forms.RadioButton(); + this.idWZTypRadioButton = new System.Windows.Forms.RadioButton(); + this.listViewEx = new TracingDB.Forms.ListViewEx(); + this.cancelButton = new System.Windows.Forms.Button(); + this.nextButton = new System.Windows.Forms.Button(); + this.backButton = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit(); + this.horizSplitContainer.Panel1.SuspendLayout(); + this.horizSplitContainer.Panel2.SuspendLayout(); + this.horizSplitContainer.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).BeginInit(); + this.horizSplitContainer2.Panel1.SuspendLayout(); + this.horizSplitContainer2.Panel2.SuspendLayout(); + this.horizSplitContainer2.SuspendLayout(); + this.SuspendLayout(); + // + // horizSplitContainer + // + this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill; + this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.horizSplitContainer.Location = new System.Drawing.Point(0, 0); + this.horizSplitContainer.Name = "horizSplitContainer"; + this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // horizSplitContainer.Panel1 + // + this.horizSplitContainer.Panel1.Controls.Add(this.horizSplitContainer2); + // + // horizSplitContainer.Panel2 + // + this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton); + this.horizSplitContainer.Panel2.Controls.Add(this.nextButton); + this.horizSplitContainer.Panel2.Controls.Add(this.backButton); + this.horizSplitContainer.Size = new System.Drawing.Size(820, 363); + this.horizSplitContainer.SplitterDistance = 283; + this.horizSplitContainer.TabIndex = 0; + // + // horizSplitContainer2 + // + this.horizSplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.horizSplitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.horizSplitContainer2.IsSplitterFixed = true; + this.horizSplitContainer2.Location = new System.Drawing.Point(0, 0); + this.horizSplitContainer2.Name = "horizSplitContainer2"; + this.horizSplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // horizSplitContainer2.Panel1 + // + this.horizSplitContainer2.Panel1.Controls.Add(this.meterTypeComboBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.dnLabel); + this.horizSplitContainer2.Panel1.Controls.Add(this.q3TextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.q3Label); + this.horizSplitContainer2.Panel1.Controls.Add(this.approvalTextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.approvalLabel); + this.horizSplitContainer2.Panel1.Controls.Add(this.metroClassTextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.metroClassLabel); + this.horizSplitContainer2.Panel1.Controls.Add(this.testInfoNameLabel); + this.horizSplitContainer2.Panel1.Controls.Add(this.timeStampTextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.timeStampLabel); + this.horizSplitContainer2.Panel1.Controls.Add(this.remarkTextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.remarkLabel); + this.horizSplitContainer2.Panel1.Controls.Add(this.wzTypTextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.wzTypLabel); + this.horizSplitContainer2.Panel1.Controls.Add(this.revWZTypLabel); + this.horizSplitContainer2.Panel1.Controls.Add(this.revWZTypTextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.searchButton); + this.horizSplitContainer2.Panel1.Controls.Add(this.materialCodeTextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.idWZTypTextBox); + this.horizSplitContainer2.Panel1.Controls.Add(this.materialCodeRadioButton); + this.horizSplitContainer2.Panel1.Controls.Add(this.idWZTypRadioButton); + // + // horizSplitContainer2.Panel2 + // + this.horizSplitContainer2.Panel2.Controls.Add(this.listViewEx); + this.horizSplitContainer2.Size = new System.Drawing.Size(820, 283); + this.horizSplitContainer2.SplitterDistance = 115; + this.horizSplitContainer2.TabIndex = 0; + // + // meterTypeComboBox + // + this.meterTypeComboBox.FormattingEnabled = true; + this.meterTypeComboBox.Location = new System.Drawing.Point(73, 85); + this.meterTypeComboBox.Name = "meterTypeComboBox"; + this.meterTypeComboBox.Size = new System.Drawing.Size(65, 21); + this.meterTypeComboBox.TabIndex = 17; + // + // dnLabel + // + this.dnLabel.AutoSize = true; + this.dnLabel.Location = new System.Drawing.Point(31, 88); + this.dnLabel.Name = "dnLabel"; + this.dnLabel.Size = new System.Drawing.Size(23, 13); + this.dnLabel.TabIndex = 16; + this.dnLabel.Text = "DN"; + // + // q3TextBox + // + this.q3TextBox.Location = new System.Drawing.Point(103, 61); + this.q3TextBox.Name = "q3TextBox"; + this.q3TextBox.Size = new System.Drawing.Size(35, 20); + this.q3TextBox.TabIndex = 11; + this.q3TextBox.TextChanged += new System.EventHandler(this.q3TextBox_TextChanged); + // + // q3Label + // + this.q3Label.AutoSize = true; + this.q3Label.Location = new System.Drawing.Point(31, 64); + this.q3Label.Name = "q3Label"; + this.q3Label.Size = new System.Drawing.Size(46, 13); + this.q3Label.TabIndex = 10; + this.q3Label.Text = "Q3 / Qn"; + // + // approvalTextBox + // + this.approvalTextBox.Location = new System.Drawing.Point(220, 61); + this.approvalTextBox.Name = "approvalTextBox"; + this.approvalTextBox.Size = new System.Drawing.Size(275, 20); + this.approvalTextBox.TabIndex = 13; + this.approvalTextBox.TextChanged += new System.EventHandler(this.approvalTextBox_TextChanged); + // + // approvalLabel + // + this.approvalLabel.AutoSize = true; + this.approvalLabel.Location = new System.Drawing.Point(150, 64); + this.approvalLabel.Name = "approvalLabel"; + this.approvalLabel.Size = new System.Drawing.Size(49, 13); + this.approvalLabel.TabIndex = 12; + this.approvalLabel.Text = "Approval"; + // + // metroClassTextBox + // + this.metroClassTextBox.Location = new System.Drawing.Point(596, 37); + this.metroClassTextBox.Name = "metroClassTextBox"; + this.metroClassTextBox.Size = new System.Drawing.Size(104, 20); + this.metroClassTextBox.TabIndex = 9; + this.metroClassTextBox.TextChanged += new System.EventHandler(this.metroClassTextBox_TextChanged); + // + // metroClassLabel + // + this.metroClassLabel.AutoSize = true; + this.metroClassLabel.Location = new System.Drawing.Point(517, 40); + this.metroClassLabel.Name = "metroClassLabel"; + this.metroClassLabel.Size = new System.Drawing.Size(78, 13); + this.metroClassLabel.TabIndex = 8; + this.metroClassLabel.Text = "Metrolog. class"; + // + // testInfoNameLabel + // + this.testInfoNameLabel.AutoSize = true; + this.testInfoNameLabel.Location = new System.Drawing.Point(595, 88); + this.testInfoNameLabel.Name = "testInfoNameLabel"; + this.testInfoNameLabel.Size = new System.Drawing.Size(0, 13); + this.testInfoNameLabel.TabIndex = 20; + // + // timeStampTextBox + // + this.timeStampTextBox.Enabled = false; + this.timeStampTextBox.Location = new System.Drawing.Point(596, 61); + this.timeStampTextBox.Name = "timeStampTextBox"; + this.timeStampTextBox.Size = new System.Drawing.Size(104, 20); + this.timeStampTextBox.TabIndex = 15; + // + // timeStampLabel + // + this.timeStampLabel.AutoSize = true; + this.timeStampLabel.Location = new System.Drawing.Point(517, 64); + this.timeStampLabel.Name = "timeStampLabel"; + this.timeStampLabel.Size = new System.Drawing.Size(73, 13); + this.timeStampLabel.TabIndex = 14; + this.timeStampLabel.Text = "Date and time"; + // + // remarkTextBox + // + this.remarkTextBox.Enabled = false; + this.remarkTextBox.Location = new System.Drawing.Point(220, 85); + this.remarkTextBox.Name = "remarkTextBox"; + this.remarkTextBox.Size = new System.Drawing.Size(346, 20); + this.remarkTextBox.TabIndex = 19; + // + // remarkLabel + // + this.remarkLabel.AutoSize = true; + this.remarkLabel.Location = new System.Drawing.Point(150, 88); + this.remarkLabel.Name = "remarkLabel"; + this.remarkLabel.Size = new System.Drawing.Size(44, 13); + this.remarkLabel.TabIndex = 18; + this.remarkLabel.Text = "Remark"; + // + // wzTypTextBox + // + this.wzTypTextBox.Enabled = false; + this.wzTypTextBox.Location = new System.Drawing.Point(220, 37); + this.wzTypTextBox.Name = "wzTypTextBox"; + this.wzTypTextBox.Size = new System.Drawing.Size(275, 20); + this.wzTypTextBox.TabIndex = 7; + // + // wzTypLabel + // + this.wzTypLabel.AutoSize = true; + this.wzTypLabel.Location = new System.Drawing.Point(150, 40); + this.wzTypLabel.Name = "wzTypLabel"; + this.wzTypLabel.Size = new System.Drawing.Size(65, 13); + this.wzTypLabel.TabIndex = 6; + this.wzTypLabel.Text = "Water meter"; + // + // revWZTypLabel + // + this.revWZTypLabel.AutoSize = true; + this.revWZTypLabel.Location = new System.Drawing.Point(31, 40); + this.revWZTypLabel.Name = "revWZTypLabel"; + this.revWZTypLabel.Size = new System.Drawing.Size(66, 13); + this.revWZTypLabel.TabIndex = 4; + this.revWZTypLabel.Text = "Rev WZTyp"; + // + // revWZTypTextBox + // + this.revWZTypTextBox.Enabled = false; + this.revWZTypTextBox.Location = new System.Drawing.Point(103, 37); + this.revWZTypTextBox.Name = "revWZTypTextBox"; + this.revWZTypTextBox.Size = new System.Drawing.Size(35, 20); + this.revWZTypTextBox.TabIndex = 5; + // + // searchButton + // + this.searchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.searchButton.Location = new System.Drawing.Point(722, 17); + this.searchButton.Name = "searchButton"; + this.searchButton.Size = new System.Drawing.Size(75, 42); + this.searchButton.TabIndex = 21; + this.searchButton.Text = "Search"; + this.searchButton.UseVisualStyleBackColor = true; + this.searchButton.Click += new System.EventHandler(this.searchButton_Click); + // + // materialCodeTextBox + // + this.materialCodeTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.materialCodeTextBox.Location = new System.Drawing.Point(220, 13); + this.materialCodeTextBox.Name = "materialCodeTextBox"; + this.materialCodeTextBox.Size = new System.Drawing.Size(480, 20); + this.materialCodeTextBox.TabIndex = 3; + this.materialCodeTextBox.TextChanged += new System.EventHandler(this.productCodeTextBox_TextChanged); + // + // idWZTypTextBox + // + this.idWZTypTextBox.Location = new System.Drawing.Point(103, 13); + this.idWZTypTextBox.Name = "idWZTypTextBox"; + this.idWZTypTextBox.Size = new System.Drawing.Size(35, 20); + this.idWZTypTextBox.TabIndex = 1; + this.idWZTypTextBox.TextChanged += new System.EventHandler(this.wzTypTextBox_TextChanged); + // + // materialCodeRadioButton + // + this.materialCodeRadioButton.AutoSize = true; + this.materialCodeRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.materialCodeRadioButton.Location = new System.Drawing.Point(153, 14); + this.materialCodeRadioButton.Name = "materialCodeRadioButton"; + this.materialCodeRadioButton.Size = new System.Drawing.Size(62, 17); + this.materialCodeRadioButton.TabIndex = 2; + this.materialCodeRadioButton.TabStop = true; + this.materialCodeRadioButton.Text = "Material"; + this.materialCodeRadioButton.UseVisualStyleBackColor = true; + // + // idWZTypRadioButton + // + this.idWZTypRadioButton.AutoSize = true; + this.idWZTypRadioButton.Location = new System.Drawing.Point(15, 14); + this.idWZTypRadioButton.Name = "idWZTypRadioButton"; + this.idWZTypRadioButton.Size = new System.Drawing.Size(75, 17); + this.idWZTypRadioButton.TabIndex = 0; + this.idWZTypRadioButton.TabStop = true; + this.idWZTypRadioButton.Text = "ID WZTyp"; + this.idWZTypRadioButton.UseVisualStyleBackColor = true; + this.idWZTypRadioButton.CheckedChanged += new System.EventHandler(this.idWZTypRadioButton_CheckedChanged); + // + // listViewEx + // + this.listViewEx.AllowColumnReorder = true; + this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewEx.DoubleClickActivation = false; + this.listViewEx.FullRowSelect = true; + this.listViewEx.GridLines = true; + this.listViewEx.Location = new System.Drawing.Point(0, 0); + this.listViewEx.Name = "listViewEx"; + this.listViewEx.Size = new System.Drawing.Size(820, 164); + this.listViewEx.TabIndex = 0; + this.listViewEx.UseCompatibleStateImageBehavior = false; + this.listViewEx.View = System.Windows.Forms.View.Details; + this.listViewEx.SubItemClicked += new TracingDB.Forms.SubItemEventHandler(this.listViewEx_SubItemClicked); + this.listViewEx.SubItemEndEditing += new TracingDB.Forms.SubItemEndEditingEventHandler(this.listViewEx_SubItemEndEditing); + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.Location = new System.Drawing.Point(722, 17); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 42); + this.cancelButton.TabIndex = 27; + this.cancelButton.Text = "&Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); + // + // nextButton + // + this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.nextButton.Location = new System.Drawing.Point(641, 17); + this.nextButton.Name = "nextButton"; + this.nextButton.Size = new System.Drawing.Size(75, 42); + this.nextButton.TabIndex = 26; + this.nextButton.Text = "&Next >"; + this.nextButton.UseVisualStyleBackColor = true; + this.nextButton.Click += new System.EventHandler(this.nextButton_Click); + // + // backButton + // + this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.backButton.Location = new System.Drawing.Point(560, 17); + this.backButton.Name = "backButton"; + this.backButton.Size = new System.Drawing.Size(75, 42); + this.backButton.TabIndex = 25; + this.backButton.Text = "< &Back"; + this.backButton.UseVisualStyleBackColor = true; + this.backButton.Click += new System.EventHandler(this.backButton_Click); + // + // OracleWZTypSelection + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(820, 363); + this.Controls.Add(this.horizSplitContainer); + this.Name = "OracleWZTypSelection"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Výber typu vodomera (WZTyp alebo 25-miestny kód)"; + this.Load += new System.EventHandler(this.OracleWZTypSelection_Load); + this.horizSplitContainer.Panel1.ResumeLayout(false); + this.horizSplitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit(); + this.horizSplitContainer.ResumeLayout(false); + this.horizSplitContainer2.Panel1.ResumeLayout(false); + this.horizSplitContainer2.Panel1.PerformLayout(); + this.horizSplitContainer2.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).EndInit(); + this.horizSplitContainer2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer horizSplitContainer; + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.Button nextButton; + private System.Windows.Forms.Button backButton; + private System.Windows.Forms.SplitContainer horizSplitContainer2; + private System.Windows.Forms.TextBox materialCodeTextBox; + private System.Windows.Forms.TextBox idWZTypTextBox; + private System.Windows.Forms.RadioButton materialCodeRadioButton; + private System.Windows.Forms.RadioButton idWZTypRadioButton; + private System.Windows.Forms.Button searchButton; + private TracingDB.Forms.ListViewEx listViewEx; + private System.Windows.Forms.Label remarkLabel; + private System.Windows.Forms.TextBox wzTypTextBox; + private System.Windows.Forms.Label wzTypLabel; + private System.Windows.Forms.Label revWZTypLabel; + private System.Windows.Forms.TextBox revWZTypTextBox; + private System.Windows.Forms.TextBox remarkTextBox; + private System.Windows.Forms.TextBox timeStampTextBox; + private System.Windows.Forms.Label timeStampLabel; + private System.Windows.Forms.Label testInfoNameLabel; + private System.Windows.Forms.TextBox metroClassTextBox; + private System.Windows.Forms.Label metroClassLabel; + private System.Windows.Forms.TextBox q3TextBox; + private System.Windows.Forms.Label q3Label; + private System.Windows.Forms.TextBox approvalTextBox; + private System.Windows.Forms.Label approvalLabel; + private System.Windows.Forms.ComboBox meterTypeComboBox; + private System.Windows.Forms.Label dnLabel; + } +} \ No newline at end of file diff --git a/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs new file mode 100644 index 000000000..578606839 --- /dev/null +++ b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs @@ -0,0 +1,362 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; +using log4net; +using Oracle.DataAccess.Client; +using Config.Entities; +using TBF.BenchControl.GenericDevices; +using TBF.BenchControl.Output; +using TBF.BenchControl.Output.DB.SensusOracle; +using TBF.Resources; +using TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead; + +namespace TBF.UI.Procedures.TestWizard +{ + public partial class OracleWZTypSelection : Form + { + static readonly ILog log = LogManager.GetLogger(typeof(OracleWZTypSelection)); + + public IList SelectedTestInfos; + public int WMTypeId; + public string MetrolKlasse; + public string Zulasszeichen; + public double Q3; + public MeterType MeterType; + + + Procedure loadedProcedure; + IList testMethods; + + TextBox uncertaintyTB; + ComboBox testMethodCB; + + public OracleWZTypSelection(Procedure loadedProcedure, IList testMethods) + { + this.loadedProcedure = loadedProcedure; + this.testMethods = testMethods; + + InitializeComponent(); + + Text = Strings.Method_selection; + backButton.Text = Strings.BackBtnText; + nextButton.Text = Strings.NextBtnText; + cancelButton.Text = Strings.CancelBtnText; + + for (MeterType mt = 0; mt < MeterType.Count; mt++) + { + meterTypeComboBox.Items.Add(mt.ToString()); + } + meterTypeComboBox.Text = MeterType.AutoDetect.ToString(); + + listViewEx.Columns.Add("ID", 30); + listViewEx.Columns.Add("Test name", 70); + listViewEx.Columns.Add("QBezeichnung", 85); + listViewEx.Columns.Add(Strings.Q_from_m3h, 80); + listViewEx.Columns.Add(Strings.Q_to_m3h, 70); + listViewEx.Columns.Add(Strings.Test_time_s_chdr, 70); + listViewEx.Columns.Add(string.Format("{0} [l]", Strings.Volume, 60)); + listViewEx.Columns.Add(Strings.Err_limit_neg_pct_chdr, 80); + listViewEx.Columns.Add(Strings.Err_limit_pos_pct_chdr, 80); + listViewEx.Columns.Add(Strings.Uncertainty_pct_chdr, 85); + listViewEx.Columns.Add(Strings.Test_method, 200); + + uncertaintyTB = new TextBox(); + Controls.Add(uncertaintyTB); + + testMethodCB = new ComboBox(); + if (testMethods != null) + { + foreach (var tm in testMethods) testMethodCB.Items.Add(tm.Name); + } + Controls.Add(testMethodCB); + + backButton.Visible = false; + nextButton.Enabled = false; + + SelectedTestInfos = null; + } + + private void OracleWZTypSelection_Load(object sender, EventArgs e) + { + } + + bool IsFormValidForSearch() + { + if (idWZTypRadioButton.Checked) + { + int idummy; + return (int.TryParse(idWZTypTextBox.Text, out idummy) && (idummy > 0)); + } + else + { + return (materialCodeTextBox.Text.Length == 25); + } + } + + bool IsFormValid() + { + double dummy; + + return IsFormValidForSearch() && + (listViewEx.Items.Count > 0) && + Utils.TryParseUDouble(q3TextBox.Text, out dummy) && + !string.IsNullOrEmpty(metroClassTextBox.Text) && + !string.IsNullOrEmpty(approvalTextBox.Text) && + meterTypeComboBox.Items.Contains(meterTypeComboBox.Text); + } + + private void idWZTypRadioButton_CheckedChanged(object sender, EventArgs e) + { + if (idWZTypRadioButton.Checked) + { + idWZTypTextBox.Enabled = true; + materialCodeTextBox.Enabled = false; + } + else + { + idWZTypTextBox.Enabled = false; + materialCodeTextBox.Enabled = true; + } + + searchButton.Enabled = IsFormValidForSearch(); + nextButton.Enabled = false; + } + + private void wzTypTextBox_TextChanged(object sender, EventArgs e) + { + searchButton.Enabled = IsFormValidForSearch(); + nextButton.Enabled = false; + } + + private void productCodeTextBox_TextChanged(object sender, EventArgs e) + { + searchButton.Enabled = IsFormValidForSearch(); + nextButton.Enabled = false; + } + + private void backButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Retry; + Close(); + } + + private void nextButton_Click(object sender, EventArgs e) + { + MetrolKlasse = metroClassTextBox.Text; + Zulasszeichen = approvalTextBox.Text; + Q3 = Utils.ParseUDouble(q3TextBox.Text); + for (MeterType mt = 0; mt < MeterType.Count; mt++) + { + if (meterTypeComboBox.Text == mt.ToString()) + { + MeterType = mt; + break; + } + } + + DialogResult = DialogResult.OK; + Close(); + } + + private void cancelButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void searchButton_Click(object sender, EventArgs e) + { + if (!IsFormValidForSearch()) + { + MessageBox.Show("Invalid data"); + nextButton.Enabled = false; + return; + } + + bool found = ReadTestInfosFromOracle(); + if (!found) + { + MessageBox.Show("No water meter specification found in Oracle"); + } + + nextButton.Enabled = IsFormValid(); + } + + bool ReadTestInfosFromOracle() + { + IList wmTestNames = new List(); + StringBuilder procedureSignatureSB = new StringBuilder(); + + foreach (var t in loadedProcedure.Tests) + { + if (t.Publish != (byte)Config.Entities.Publish.Never) + { + wmTestNames.Add(global::Results.Utils.GetTestName(t.Name, 1, 1)); + } + } + + try + { + WMTypeId = int.Parse(idWZTypTextBox.Text); + + int wmTypeRevision; + string wzTypStr; + string materialNr; + DateTime timeStamp; + string remark; + string testInfoName; + + OracleConnection conn = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;"); + conn.Open(); + SelectedTestInfos = Database.GetOracleTestInfo(conn, WMTypeId, out wmTypeRevision, out wzTypStr, out MetrolKlasse, out Zulasszeichen, out materialNr, out Q3, out timeStamp, out remark); + conn.Close(); + + SensusTestInfo[] completeTestInfos = SensusTestInfo.GetBestMatch(SelectedTestInfos, wmTestNames, out testInfoName); + foreach (var sti in SelectedTestInfos) + { + foreach (var cti in completeTestInfos) if (cti.PruefungsNrDB == sti.PruefungsNrDB) sti.TestName = cti.TestName; + } + + materialCodeTextBox.Text = materialNr; + revWZTypTextBox.Text = wmTypeRevision.ToString(); + wzTypTextBox.Text = wzTypStr; + metroClassTextBox.Text = MetrolKlasse; + approvalTextBox.Text = Zulasszeichen; + q3TextBox.Text = Q3.ToString(); + remarkTextBox.Text = remark; + timeStampTextBox.Text = timeStamp.ToString("dd.MM.yyyy HH:mm"); + testInfoNameLabel.Text = testInfoName; + + listViewEx.Items.Clear(); + foreach (var ti in SelectedTestInfos) + { + double Qfrom, Qto; + switch (ti.Range) + { + case Range.R90_100: + Qfrom = 0.9 * ti.Flow; + Qto = ti.Flow; + break; + + case Range.R95_105: + Qfrom = 0.95 * ti.Flow; + Qto = 1.05 * ti.Flow; + break; + + case Range.R100_110: + Qfrom = ti.Flow; + Qto = 1.1 * ti.Flow; + break; + + default: + Qfrom = Qto = ti.Flow; + break; + } + + double volumeLtr = ti.TestTime * (Qfrom + Qto) / 7.2; + + ListViewItem lvi = new ListViewItem(new string[] { ti.PruefungsNrDB.ToString(), + (string.IsNullOrEmpty(ti.TestName) ? string.Empty : ti.TestName), + ti.QBezeichnungDB, + Qfrom.ToString(), + Qto.ToString(), + ti.TestTime.ToString(), + volumeLtr.ToString(Config.Utils.SignificantDigitsToFmt(volumeLtr, 4)), + (ti.ErrLimLoFromDB - ti.Uncertainty).ToString(), + (ti.ErrLimHiFromDB + ti.Uncertainty).ToString(), + ti.Uncertainty.ToString(), + ti.TestMethod, + }); + lvi.Tag = ti; + listViewEx.Items.Add(lvi); + } + + return true; + } + catch (Exception) + { + revWZTypTextBox.Text = string.Empty; + wzTypTextBox.Text = "No info found"; + metroClassTextBox.Text = string.Empty; + approvalTextBox.Text = string.Empty; + q3TextBox.Text = string.Empty; + remarkTextBox.Text = string.Empty; + timeStampTextBox.Text = string.Empty; + testInfoNameLabel.Text = string.Empty; + return false; + } + } + + private void listViewEx_SubItemClicked(object sender, TracingDB.Forms.SubItemEventArgs e) + { + if (e.SubItem == listViewEx.Columns.Count - 2) + { + /// Uncertainty column clicked (column before the last one) + listViewEx.StartEditing(uncertaintyTB, e.Item, e.SubItem); + } + else if (e.SubItem == listViewEx.Columns.Count - 1) + { + /// Test method column clicked (the last column) + listViewEx.StartEditing(testMethodCB, e.Item, e.SubItem); + } + } + + private void listViewEx_SubItemEndEditing(object sender, TracingDB.Forms.SubItemEndEditingEventArgs e) + { + if (e.SubItem == listViewEx.Columns.Count - 2) + { + double uncertainty; + if (Utils.TryParseUDouble(e.DisplayText, out uncertainty)) + { + /// Uncertainty OK + SensusTestInfo ti = e.Item.Tag as SensusTestInfo; + if (ti != null) ti.Uncertainty = uncertainty; + e.Item.SubItems[listViewEx.Columns.Count - 4].Text = (ti.ErrLimLoFromDB - ti.Uncertainty).ToString(); + e.Item.SubItems[listViewEx.Columns.Count - 3].Text = (ti.ErrLimHiFromDB + ti.Uncertainty).ToString(); + } + else + { + /// Uncertainty NOK -> revert changes + e.DisplayText = e.Item.SubItems[e.SubItem].Text; + e.Cancel = true; + return; + } + } + else if (e.SubItem == listViewEx.Columns.Count - 1) + { + if (testMethodCB.Items.Contains(e.DisplayText)) + { + /// TestMethod OK + SensusTestInfo ti = e.Item.Tag as SensusTestInfo; + if (ti != null) ti.TestMethod = e.DisplayText; + } + else + { + /// TestMethod NOK -> revert changes + e.DisplayText = e.Item.SubItems[e.SubItem].Text; + e.Cancel = true; + return; + } + } + } + + private void q3TextBox_TextChanged(object sender, EventArgs e) + { + nextButton.Enabled = IsFormValid(); + } + + private void metroClassTextBox_TextChanged(object sender, EventArgs e) + { + nextButton.Enabled = IsFormValid(); + } + + private void approvalTextBox_TextChanged(object sender, EventArgs e) + { + nextButton.Enabled = IsFormValid(); + } + } +} diff --git a/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.resx b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TBF/UI/Shared/SharedButtons.Designer.cs b/TBF/UI/Shared/SharedButtons.Designer.cs index 08e109d39..6b7fac1d7 100644 --- a/TBF/UI/Shared/SharedButtons.Designer.cs +++ b/TBF/UI/Shared/SharedButtons.Designer.cs @@ -47,6 +47,9 @@ namespace TBF.UI.Shared this.exportButton = new System.Windows.Forms.Button(); this.importButton = new System.Windows.Forms.Button(); this.compareButton = new System.Windows.Forms.Button(); + this.customButton1 = new System.Windows.Forms.Button(); + this.customButton2 = new System.Windows.Forms.Button(); + this.customButton3 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // removeButton @@ -225,10 +228,46 @@ namespace TBF.UI.Shared this.compareButton.UseVisualStyleBackColor = true; this.compareButton.Click += new System.EventHandler(this.compareButton_Click); // + // customButton1 + // + this.customButton1.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.customButton1.Location = new System.Drawing.Point(10, 755); + this.customButton1.Name = "customButton1"; + this.customButton1.Size = new System.Drawing.Size(80, 40); + this.customButton1.TabIndex = 16; + this.customButton1.Text = "Custom 1"; + this.customButton1.UseVisualStyleBackColor = true; + this.customButton1.Click += new System.EventHandler(this.customButton1_Click); + // + // customButton2 + // + this.customButton2.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.customButton2.Location = new System.Drawing.Point(10, 798); + this.customButton2.Name = "customButton2"; + this.customButton2.Size = new System.Drawing.Size(80, 40); + this.customButton2.TabIndex = 17; + this.customButton2.Text = "Custom 2"; + this.customButton2.UseVisualStyleBackColor = true; + this.customButton2.Click += new System.EventHandler(this.customButton2_Click); + // + // customButton3 + // + this.customButton3.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.customButton3.Location = new System.Drawing.Point(10, 841); + this.customButton3.Name = "customButton3"; + this.customButton3.Size = new System.Drawing.Size(80, 40); + this.customButton3.TabIndex = 18; + this.customButton3.Text = "Custom 3"; + this.customButton3.UseVisualStyleBackColor = true; + this.customButton3.Click += new System.EventHandler(this.customButton3_Click); + // // SharedButtons // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.customButton3); + this.Controls.Add(this.customButton2); + this.Controls.Add(this.customButton1); this.Controls.Add(this.compareButton); this.Controls.Add(this.importButton); this.Controls.Add(this.exportButton); @@ -246,7 +285,7 @@ namespace TBF.UI.Shared this.Controls.Add(this.cancelButton); this.Controls.Add(this.okButton); this.Name = "SharedButtons"; - this.Size = new System.Drawing.Size(100, 805); + this.Size = new System.Drawing.Size(100, 908); this.Load += new System.EventHandler(this.SharedDlgButtons_Load); this.ResumeLayout(false); @@ -270,5 +309,8 @@ namespace TBF.UI.Shared private System.Windows.Forms.Button exportButton; private System.Windows.Forms.Button importButton; private System.Windows.Forms.Button compareButton; + private System.Windows.Forms.Button customButton1; + private System.Windows.Forms.Button customButton2; + private System.Windows.Forms.Button customButton3; } } diff --git a/TBF/UI/Shared/SharedButtons.cs b/TBF/UI/Shared/SharedButtons.cs index 8d970bb36..5aebccc93 100644 --- a/TBF/UI/Shared/SharedButtons.cs +++ b/TBF/UI/Shared/SharedButtons.cs @@ -30,6 +30,9 @@ namespace TBF.UI.Shared RenameTab = (1 << 10), /// optional RemoveTab = (1 << 11), /// optional More = (1 << 12), /// optional + Custom1 = (1 << 13), /// optional + Custom2 = (1 << 14), /// optional + Custom3 = (1 << 15), /// optional } readonly System.Windows.Forms.Button[] buttonCtrls; @@ -40,6 +43,10 @@ namespace TBF.UI.Shared /// public Buttons OptionalButtons; + public string Custom1Caption { set { customButton1.Text = value; } } + public string Custom2Caption { set { customButton2.Text = value; } } + public string Custom3Caption { set { customButton3.Text = value; } } + public enum LockState { Locked, /// 'Unlock', 'Close' (=OK) are shown, all the othere are hidden @@ -84,6 +91,7 @@ namespace TBF.UI.Shared addButton, removeButton, upButton, downButton, editButton, copyButton, exportButton, importButton, compareButton, newTabButton, renameTabButton, removeTabButton, moreButton, + customButton1, customButton2, customButton3, }; OptionalButtons = Buttons.None; buttonsRepositionsed = false; @@ -208,10 +216,13 @@ namespace TBF.UI.Shared public event EventHandler NewTabClicked; public event EventHandler RenameTabClicked; public event EventHandler RemoveTabClicked; - public event EventHandler MoreClicked; public event EventHandler ExportClicked; public event EventHandler ImportClicked; public event EventHandler CompareClicked; + public event EventHandler MoreClicked; + public event EventHandler Custom1Clicked; + public event EventHandler Custom2Clicked; + public event EventHandler Custom3Clicked; /// /// 'Unlock' button handler @@ -288,5 +299,8 @@ namespace TBF.UI.Shared private void newTabButton_Click(object s, EventArgs e) { if (NewTabClicked != null) NewTabClicked(s, e); } private void renameTabButton_Click(object s, EventArgs e) { if (RenameTabClicked != null) RenameTabClicked(s, e); } private void removeTabButton_Click(object s, EventArgs e) { if (RemoveTabClicked != null) RemoveTabClicked(s, e); } + private void customButton1_Click(object s, EventArgs e) { if (Custom1Clicked != null) Custom1Clicked(s, e); } + private void customButton2_Click(object s, EventArgs e) { if (Custom2Clicked != null) Custom2Clicked(s, e); } + private void customButton3_Click(object s, EventArgs e) { if (Custom3Clicked != null) Custom3Clicked(s, e); } } }