ResultsBrowser : Searching for a list of water meters added, ver. 2.18 1115

This commit is contained in:
Milan Hanajik 2019-01-16 15:12:54 +02:00
parent 550fe20094
commit 1eebb3b4a1
8 changed files with 57 additions and 19 deletions

View File

@ -48,7 +48,7 @@
// //
this.batchNrTextBox.Location = new System.Drawing.Point(132, 13); this.batchNrTextBox.Location = new System.Drawing.Point(132, 13);
this.batchNrTextBox.Name = "batchNrTextBox"; 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; this.batchNrTextBox.TabIndex = 0;
// //
// BatchNrFilterUI // BatchNrFilterUI

View File

@ -48,15 +48,15 @@
// //
this.procedureTextBox.Location = new System.Drawing.Point(132, 13); this.procedureTextBox.Location = new System.Drawing.Point(132, 13);
this.procedureTextBox.Name = "procedureTextBox"; 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; this.procedureTextBox.TabIndex = 0;
// //
// ProcedureFilter // ProcedureFilterUI
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "ProcedureFilter"; this.Name = "ProcedureFilterUI";
this.Size = new System.Drawing.Size(835, 40); this.Size = new System.Drawing.Size(835, 40);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();

View File

@ -48,15 +48,15 @@
// //
this.procedureTextBox.Location = new System.Drawing.Point(132, 13); this.procedureTextBox.Location = new System.Drawing.Point(132, 13);
this.procedureTextBox.Name = "procedureTextBox"; 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; this.procedureTextBox.TabIndex = 0;
// //
// QnFilter // QnFilterUI
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "QnFilter"; this.Name = "QnFilterUI";
this.Size = new System.Drawing.Size(835, 40); this.Size = new System.Drawing.Size(835, 40);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();

View File

@ -30,7 +30,6 @@ namespace ResultsBrowser.Filters
/// ///
public string SerialNr; public string SerialNr;
private SerialNrFilterUI userIface; private SerialNrFilterUI userIface;
public SerialNrFilter() public SerialNrFilter()
@ -42,21 +41,50 @@ namespace ResultsBrowser.Filters
{ {
IList<WaterMeter> filteredWaterMeters = new List<WaterMeter>(); IList<WaterMeter> filteredWaterMeters = new List<WaterMeter>();
if (string.IsNullOrEmpty(SerialNr)) return filteredWaterMeters; /// Empty s/n => Return an empty list of WM-s
IList<string> serialNumbers = new List<string>();
///
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) if (waterMeters == null)
{ {
foreach (var se in sessions) foreach (var se in sessions)
{ {
IList<WaterMeter> wms = se.QueryOver<WaterMeter>() foreach (var oneSerialNr in serialNumbers)
.Where(x => (x.SerialNr == SerialNr)) {
.List<WaterMeter>(); IList<WaterMeter> wms = se.QueryOver<WaterMeter>()
foreach (var wm in wms) filteredWaterMeters.Add(wm); .Where(x => (x.SerialNr == oneSerialNr))
.List<WaterMeter>();
foreach (var wm in wms) filteredWaterMeters.Add(wm);
}
} }
} }
else else
{ {
foreach (var wm in waterMeters) foreach (var wm in waterMeters)
{ {
if (wm.SerialNr == SerialNr) filteredWaterMeters.Add(wm); if (serialNumbers.Contains(wm.SerialNr)) filteredWaterMeters.Add(wm);
} }
} }

View File

@ -48,15 +48,16 @@
// //
this.serialNrTextBox.Location = new System.Drawing.Point(132, 13); this.serialNrTextBox.Location = new System.Drawing.Point(132, 13);
this.serialNrTextBox.Name = "serialNrTextBox"; 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.TabIndex = 0;
this.serialNrTextBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.serialNrTextBox_MouseDoubleClick);
// //
// SerialNrFilter // SerialNrFilterUI
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "SerialNrFilter"; this.Name = "SerialNrFilterUI";
this.Size = new System.Drawing.Size(835, 40); this.Size = new System.Drawing.Size(835, 40);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();

View File

@ -35,5 +35,14 @@ namespace ResultsBrowser.Filters
{ {
data.SerialNr = serialNrTextBox.Text; 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);
}
}
} }
} }

View File

@ -48,7 +48,7 @@
// //
this.wmPositionTextBox.Location = new System.Drawing.Point(132, 13); this.wmPositionTextBox.Location = new System.Drawing.Point(132, 13);
this.wmPositionTextBox.Name = "wmPositionTextBox"; 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; this.wmPositionTextBox.TabIndex = 0;
// //
// WMPositionFilterUI // WMPositionFilterUI

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1114.0")] [assembly: AssemblyVersion("2.18.1115.0")]
[assembly: AssemblyFileVersion("2.18.1114.0")] [assembly: AssemblyFileVersion("2.18.1115.0")]