ResultsBrowser : Batch number filter added, ver. 2.18.1110

This commit is contained in:
Milan Hanajik 2019-01-11 18:05:12 +01:00
parent e1c4da482a
commit 58f046ca34
8 changed files with 433 additions and 2 deletions

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;
using NHibernate;
using Results.Entities;
namespace ResultsBrowser.Filters
{
public class BatchNrFilter : IFilter
{
public static string GetFilterID() { return "BatchNr"; }
public static string GetFilterName() { return "Batch number"; }
///
/// Obligatory wrappers
///
public string GetThisFilterID() { return GetFilterID(); }
public void Save(StringBuilder sb) { (new XmlSerializer(this.GetType())).Serialize(new StringWriter(sb), this); }
public void Data2UI() { userIface.Data2UI(); }
public void UI2Data() { userIface.UI2Data(); }
public UserControl GetFilterUI() { return userIface as UserControl; }
///
/// Serialized filter data
///
public int BatchNr;
private BatchNrFilterUI userIface;
public BatchNrFilter()
{
userIface = new BatchNrFilterUI(this);
}
public IList<WaterMeter> ExecuteQuery(ISession[] sessions, IList<WaterMeter> waterMeters)
{
IList<WaterMeter> filteredWaterMeters = new List<WaterMeter>();
if (waterMeters == null)
{
foreach (var se in sessions)
{
IList<WaterMeter> wms = se.QueryOver<WaterMeter>().List<WaterMeter>();
foreach (var wm in wms)
{
if (wm.BatchNr() == BatchNr) filteredWaterMeters.Add(wm);
}
}
}
else
{
foreach (var wm in waterMeters)
{
if (wm.BatchNr() == BatchNr) filteredWaterMeters.Add(wm);
}
}
return filteredWaterMeters;
}
}
}

View File

@ -0,0 +1,72 @@
namespace ResultsBrowser.Filters
{
partial class BatchNrFilterUI
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.batchNrTextBox = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.batchNrTextBox);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(835, 40);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Batch number";
//
// batchNrTextBox
//
this.batchNrTextBox.Location = new System.Drawing.Point(132, 13);
this.batchNrTextBox.Name = "batchNrTextBox";
this.batchNrTextBox.Size = new System.Drawing.Size(138, 20);
this.batchNrTextBox.TabIndex = 0;
//
// BatchNrFilterUI
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1);
this.Name = "BatchNrFilterUI";
this.Size = new System.Drawing.Size(835, 40);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox batchNrTextBox;
}
}

View File

@ -0,0 +1,39 @@
using System.Windows.Forms;
namespace ResultsBrowser.Filters
{
public partial class BatchNrFilterUI : UserControl
{
BatchNrFilter data;
/// <summary> Used only by Designer </summary>
public BatchNrFilterUI()
{
InitializeComponent();
Localize();
}
/// <summary> Used to create the control aby a filter </summary>
public BatchNrFilterUI(BatchNrFilter data)
{
this.data = data;
InitializeComponent();
Localize();
}
void Localize()
{
groupBox1.Text = BatchNrFilter.GetFilterName();
}
public void Data2UI()
{
batchNrTextBox.Text = data.BatchNr.ToString();
}
public void UI2Data()
{
data.BatchNr = int.Parse(batchNrTextBox.Text);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -18,6 +18,7 @@ namespace ResultsBrowser.Filters
IDs = new string[]
{
DateFilter.GetFilterID(),
BatchNrFilter.GetFilterID(),
ProcedureFilter.GetFilterID(),
ProtocolFilter.GetFilterID(),
QnFilter.GetFilterID(),
@ -28,6 +29,7 @@ namespace ResultsBrowser.Filters
Names = new string[]
{
DateFilter.GetFilterName(),
BatchNrFilter.GetFilterName(),
ProcedureFilter.GetFilterName(),
ProtocolFilter.GetFilterName(),
QnFilter.GetFilterName(),
@ -42,6 +44,7 @@ namespace ResultsBrowser.Filters
public static IFilter GetFilter(string filterID)
{
if (filterID == DateFilter.GetFilterID()) return new DateFilter();
else if (filterID == BatchNrFilter.GetFilterID()) return new BatchNrFilter();
else if (filterID == ProcedureFilter.GetFilterID()) return new ProcedureFilter();
else if (filterID == ProtocolFilter.GetFilterID()) return new ProtocolFilter();
else if (filterID == QnFilter.GetFilterID()) return new QnFilter();
@ -57,6 +60,7 @@ namespace ResultsBrowser.Filters
{
Type type;
if (filterID == DateFilter.GetFilterID()) type = typeof(DateFilter);
else if (filterID == BatchNrFilter.GetFilterID()) type = typeof(BatchNrFilter);
else if (filterID == ProcedureFilter.GetFilterID()) type = typeof(ProcedureFilter);
else if (filterID == ProtocolFilter.GetFilterID()) type = typeof(ProtocolFilter);
else if (filterID == QnFilter.GetFilterID()) type = typeof(QnFilter);

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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1109.0")]
[assembly: AssemblyFileVersion("2.18.1109.0")]
[assembly: AssemblyVersion("2.18.1110.0")]
[assembly: AssemblyFileVersion("2.18.1110.0")]

View File

@ -70,6 +70,13 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Filters\BatchNrFilter.cs" />
<Compile Include="Filters\BatchNrFilterUI.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Filters\BatchNrFilterUI.designer.cs">
<DependentUpon>BatchNrFilterUI.cs</DependentUpon>
</Compile>
<Compile Include="Filters\DateFilterUI.cs">
<SubType>UserControl</SubType>
</Compile>
@ -168,6 +175,9 @@
<Compile Include="ResultsBrowserWnd.Designer.cs">
<DependentUpon>ResultsBrowserWnd.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Filters\BatchNrFilterUI.resx">
<DependentUpon>BatchNrFilterUI.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Filters\DateFilterUI.resx">
<DependentUpon>DateFilterUI.cs</DependentUpon>
</EmbeddedResource>