From 1eebb3b4a1d0f69aaa172e3684806f50c3af2884 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 16 Jan 2019 15:12:54 +0200 Subject: [PATCH] ResultsBrowser : Searching for a list of water meters added, ver. 2.18 1115 --- .../Filters/BatchNrFilterUI.Designer.cs | 2 +- .../Filters/ProcedureFilterUI.Designer.cs | 6 +-- ResultsBrowser/Filters/QnFilterUI.Designer.cs | 6 +-- ResultsBrowser/Filters/SerialNrFilter.cs | 40 ++++++++++++++++--- .../Filters/SerialNrFilterUI.Designer.cs | 7 ++-- ResultsBrowser/Filters/SerialNrFilterUI.cs | 9 +++++ .../Filters/WMPositionFilterUI.Designer.cs | 2 +- ResultsBrowser/Properties/AssemblyInfo.cs | 4 +- 8 files changed, 57 insertions(+), 19 deletions(-) diff --git a/ResultsBrowser/Filters/BatchNrFilterUI.Designer.cs b/ResultsBrowser/Filters/BatchNrFilterUI.Designer.cs index 0099a27d6..d1c0c245a 100644 --- a/ResultsBrowser/Filters/BatchNrFilterUI.Designer.cs +++ b/ResultsBrowser/Filters/BatchNrFilterUI.Designer.cs @@ -48,7 +48,7 @@ // this.batchNrTextBox.Location = new System.Drawing.Point(132, 13); this.batchNrTextBox.Name = "batchNrTextBox"; - this.batchNrTextBox.Size = new System.Drawing.Size(138, 20); + this.batchNrTextBox.Size = new System.Drawing.Size(80, 20); this.batchNrTextBox.TabIndex = 0; // // BatchNrFilterUI diff --git a/ResultsBrowser/Filters/ProcedureFilterUI.Designer.cs b/ResultsBrowser/Filters/ProcedureFilterUI.Designer.cs index 33811547a..77536297d 100644 --- a/ResultsBrowser/Filters/ProcedureFilterUI.Designer.cs +++ b/ResultsBrowser/Filters/ProcedureFilterUI.Designer.cs @@ -48,15 +48,15 @@ // this.procedureTextBox.Location = new System.Drawing.Point(132, 13); this.procedureTextBox.Name = "procedureTextBox"; - this.procedureTextBox.Size = new System.Drawing.Size(138, 20); + this.procedureTextBox.Size = new System.Drawing.Size(360, 20); this.procedureTextBox.TabIndex = 0; // - // ProcedureFilter + // ProcedureFilterUI // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.groupBox1); - this.Name = "ProcedureFilter"; + this.Name = "ProcedureFilterUI"; this.Size = new System.Drawing.Size(835, 40); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); diff --git a/ResultsBrowser/Filters/QnFilterUI.Designer.cs b/ResultsBrowser/Filters/QnFilterUI.Designer.cs index 2a8453fc7..b3ec19c0e 100644 --- a/ResultsBrowser/Filters/QnFilterUI.Designer.cs +++ b/ResultsBrowser/Filters/QnFilterUI.Designer.cs @@ -48,15 +48,15 @@ // this.procedureTextBox.Location = new System.Drawing.Point(132, 13); this.procedureTextBox.Name = "procedureTextBox"; - this.procedureTextBox.Size = new System.Drawing.Size(138, 20); + this.procedureTextBox.Size = new System.Drawing.Size(80, 20); this.procedureTextBox.TabIndex = 0; // - // QnFilter + // QnFilterUI // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.groupBox1); - this.Name = "QnFilter"; + this.Name = "QnFilterUI"; this.Size = new System.Drawing.Size(835, 40); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); diff --git a/ResultsBrowser/Filters/SerialNrFilter.cs b/ResultsBrowser/Filters/SerialNrFilter.cs index f48e2b20a..f85c5a928 100644 --- a/ResultsBrowser/Filters/SerialNrFilter.cs +++ b/ResultsBrowser/Filters/SerialNrFilter.cs @@ -30,7 +30,6 @@ namespace ResultsBrowser.Filters /// public string SerialNr; - private SerialNrFilterUI userIface; public SerialNrFilter() @@ -42,21 +41,50 @@ namespace ResultsBrowser.Filters { IList filteredWaterMeters = new List(); + if (string.IsNullOrEmpty(SerialNr)) return filteredWaterMeters; /// Empty s/n => Return an empty list of WM-s + + IList serialNumbers = new List(); + /// + if (SerialNr[0] == '@') + { + try + { + TextReader rdr = new StreamReader(SerialNr.Substring(1)); + string line = rdr.ReadLine(); + while (!string.IsNullOrEmpty(line)) + { + serialNumbers.Add(line); + line = rdr.ReadLine(); + } + } + catch (Exception) + { + return filteredWaterMeters; + } + } + else + { + serialNumbers.Add(SerialNr); + } + if (waterMeters == null) { foreach (var se in sessions) { - IList wms = se.QueryOver() - .Where(x => (x.SerialNr == SerialNr)) - .List(); - foreach (var wm in wms) filteredWaterMeters.Add(wm); + foreach (var oneSerialNr in serialNumbers) + { + IList wms = se.QueryOver() + .Where(x => (x.SerialNr == oneSerialNr)) + .List(); + foreach (var wm in wms) filteredWaterMeters.Add(wm); + } } } else { foreach (var wm in waterMeters) { - if (wm.SerialNr == SerialNr) filteredWaterMeters.Add(wm); + if (serialNumbers.Contains(wm.SerialNr)) filteredWaterMeters.Add(wm); } } diff --git a/ResultsBrowser/Filters/SerialNrFilterUI.Designer.cs b/ResultsBrowser/Filters/SerialNrFilterUI.Designer.cs index 06c98f1fb..d7d86c029 100644 --- a/ResultsBrowser/Filters/SerialNrFilterUI.Designer.cs +++ b/ResultsBrowser/Filters/SerialNrFilterUI.Designer.cs @@ -48,15 +48,16 @@ // this.serialNrTextBox.Location = new System.Drawing.Point(132, 13); this.serialNrTextBox.Name = "serialNrTextBox"; - this.serialNrTextBox.Size = new System.Drawing.Size(138, 20); + this.serialNrTextBox.Size = new System.Drawing.Size(360, 20); this.serialNrTextBox.TabIndex = 0; + this.serialNrTextBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.serialNrTextBox_MouseDoubleClick); // - // SerialNrFilter + // SerialNrFilterUI // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.groupBox1); - this.Name = "SerialNrFilter"; + this.Name = "SerialNrFilterUI"; this.Size = new System.Drawing.Size(835, 40); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); diff --git a/ResultsBrowser/Filters/SerialNrFilterUI.cs b/ResultsBrowser/Filters/SerialNrFilterUI.cs index 009ed7500..d14bebddd 100644 --- a/ResultsBrowser/Filters/SerialNrFilterUI.cs +++ b/ResultsBrowser/Filters/SerialNrFilterUI.cs @@ -35,5 +35,14 @@ namespace ResultsBrowser.Filters { data.SerialNr = serialNrTextBox.Text; } + + private void serialNrTextBox_MouseDoubleClick(object sender, MouseEventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + if (dlg.ShowDialog() == DialogResult.OK) + { + serialNrTextBox.Text = string.Format("@{0}", dlg.FileName); + } + } } } diff --git a/ResultsBrowser/Filters/WMPositionFilterUI.Designer.cs b/ResultsBrowser/Filters/WMPositionFilterUI.Designer.cs index abff16011..3274cb251 100644 --- a/ResultsBrowser/Filters/WMPositionFilterUI.Designer.cs +++ b/ResultsBrowser/Filters/WMPositionFilterUI.Designer.cs @@ -48,7 +48,7 @@ // this.wmPositionTextBox.Location = new System.Drawing.Point(132, 13); this.wmPositionTextBox.Name = "wmPositionTextBox"; - this.wmPositionTextBox.Size = new System.Drawing.Size(138, 20); + this.wmPositionTextBox.Size = new System.Drawing.Size(80, 20); this.wmPositionTextBox.TabIndex = 0; // // WMPositionFilterUI diff --git a/ResultsBrowser/Properties/AssemblyInfo.cs b/ResultsBrowser/Properties/AssemblyInfo.cs index 54df85ed2..1f31127f0 100644 --- a/ResultsBrowser/Properties/AssemblyInfo.cs +++ b/ResultsBrowser/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.18.1114.0")] -[assembly: AssemblyFileVersion("2.18.1114.0")] +[assembly: AssemblyVersion("2.18.1115.0")] +[assembly: AssemblyFileVersion("2.18.1115.0")]