Compare commits

..
527 changed files with 16682 additions and 39849 deletions
+3 -16
View File
@@ -1,9 +1,5 @@
Common/bin/
Common/obj/
Config/bin/
Config/obj/
DataStreamInterface/bin/
DataStreamInterface/obj/
Decrypt/bin/
Decrypt/obj/
DeviceTest/bin/
@@ -12,20 +8,12 @@ Dirichlet.Numerics/bin
Dirichlet.Numerics/obj
Encrypt/bin/
Encrypt/obj/
EventViewer/bin/
EventViewer/obj/
Events/bin/
Events/obj/
GemCard/bin
GemCard/obj
GenCode128/bin
GenCode128/obj
GraphLib/bin
GraphLib/obj
TracingDB/bin
TracingDB/obj
ResetBatchNr/bin
ResetBatchNr/obj
RestClient/bin
RestClient/obj
Results/bin/
@@ -36,14 +24,13 @@ Statistics/bin/
Statistics/obj/
TBF/bin/
TBF/obj/
ToFirstMonitor/bin/
ToFirstMonitor/obj/
ToSecondMonitor/bin/
ToSecondMonitor/obj/
TBFSetup/Debug/
TBFSetup/Release/
Users/bin/
Users/obj/
UserManagement/bin/
UserManagement/obj/
Doc/
.vs/
*.suo
*.bak
-71
View File
@@ -1,71 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C8939821-BA5C-4988-A3D0-BF53B74865C7}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Common</RootNamespace>
<AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SerializableDictionary.cs" />
<Compile Include="UIControls\CoolButtonCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UIControls\CoolButtonCtrl.Designer.cs">
<DependentUpon>CoolButtonCtrl.cs</DependentUpon>
</Compile>
<Compile Include="UIControls\LviDateTimeColumnComparer.cs" />
<Compile Include="UIControls\RoundedRectangle.cs" />
<Compile Include="Utils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UIControls\ListViewEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UIControls\ListViewExtensions.cs" />
<Compile Include="UIControls\LviIntColumnComparer.cs" />
<Compile Include="UIControls\LviTextColumnComparer.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Common")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4e3e3538-fd80-47d5-9417-2268afa590cf")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-69
View File
@@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Common
{
[XmlRoot("dictionary")]
public class SerializableDictionary<TKey, TValue>
: Dictionary<TKey, TValue>, IXmlSerializable
{
public System.Xml.Schema.XmlSchema GetSchema()
{
return null;
}
public void ReadXml(System.Xml.XmlReader reader)
{
XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));
XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));
bool wasEmpty = reader.IsEmptyElement;
reader.Read();
if (wasEmpty)
return;
while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
{
reader.ReadStartElement("item");
reader.ReadStartElement("key");
TKey key = (TKey)keySerializer.Deserialize(reader);
reader.ReadEndElement();
reader.ReadStartElement("value");
TValue value = (TValue)valueSerializer.Deserialize(reader);
reader.ReadEndElement();
this.Add(key, value);
reader.ReadEndElement();
reader.MoveToContent();
}
reader.ReadEndElement();
}
public void WriteXml(System.Xml.XmlWriter writer)
{
XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));
XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));
foreach (TKey key in this.Keys)
{
writer.WriteStartElement("item");
writer.WriteStartElement("key");
keySerializer.Serialize(writer, key);
writer.WriteEndElement();
writer.WriteStartElement("value");
TValue value = this[key];
valueSerializer.Serialize(writer, value);
writer.WriteEndElement();
writer.WriteEndElement();
}
}
}
}
-54
View File
@@ -1,54 +0,0 @@
namespace Common.UIControls
{
partial class CoolButtonCtrl
{
/// <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.SuspendLayout();
//
// CoolButton
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Transparent;
this.DoubleBuffered = true;
this.Name = "CoolButton";
this.Size = new System.Drawing.Size(72, 29);
this.Load += new System.EventHandler(this.CoolButtonLoad);
this.SizeChanged += new System.EventHandler(this.CoolButtonSizeChanged);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.CoolButtonPaint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CoolButtonMouseDown);
this.MouseEnter += new System.EventHandler(this.CoolButtonMouseEnter);
this.MouseLeave += new System.EventHandler(this.CoolButtonMouseLeave);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.CoolButtonMouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
-231
View File
@@ -1,231 +0,0 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Common.UIControls
{
public partial class CoolButtonCtrl : UserControl
{
private Color _buttonColor;
private Color _textColor;
private Color _focusColor;
private Color _borderColor;
private Color _highlightBorderColor;
private Color _highlightButtonColor;
private Font _buttonFont;
private string _buttonText;
private bool _mouseOver;
private bool _mouseDown;
public delegate void ButtonClickedArgs(object sender);
public event ButtonClickedArgs ButtonClicked;
public Color FocusColor
{
get { return _focusColor; }
set
{
_focusColor = value;
Refresh();
}
}
public Color TextColor
{
get { return _textColor; }
set
{
_textColor = value;
Refresh();
}
}
public Color HighlightBorderColor
{
get { return _highlightBorderColor; }
set
{
_highlightBorderColor = value;
Refresh();
}
}
public Color HighlightButtonColor
{
get { return _highlightButtonColor; }
set
{
_highlightButtonColor = value;
Refresh();
}
}
public string ButtonText
{
get { return _buttonText; }
set
{
_buttonText = value;
Refresh();
}
}
public Font ButtonFont
{
get { return _buttonFont; }
set
{
_buttonFont = value;
Refresh();
}
}
public Color BorderColor
{
get { return _borderColor; }
set
{
_borderColor = value;
Refresh();
}
}
public Color ButtonColor
{
get { return _buttonColor; }
set
{
_buttonColor = value;
Refresh();
}
}
public CoolButtonCtrl()
{
InitializeComponent();
_buttonColor = Color.FromArgb(243, 243, 243);
_borderColor = Color.FromArgb(220, 220, 220);
_highlightBorderColor = Color.FromArgb(198, 198, 198);
_highlightButtonColor = Color.FromArgb(246, 246, 246);
_focusColor = Color.FromArgb(77, 144, 254);
_buttonFont = new Font("Arial", 8, FontStyle.Bold);
_buttonText = "button";
_textColor = Color.Black;
_mouseOver = false;
_mouseDown = false;
LostFocus += CoolButtonFocus;
GotFocus += CoolButtonFocus;
}
void CoolButtonFocus(object sender, EventArgs e)
{
Refresh();
}
private void CoolButtonLoad(object sender, EventArgs e)
{
}
private void CoolButtonPaint(object sender, PaintEventArgs e)
{
var bmp = new Bitmap(ClientSize.Width, ClientSize.Height);
Graphics g = Graphics.FromImage(bmp);
if (!_mouseOver)
{
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
GraphicsPath path = RoundedRectangle.Create(0, 0, ClientSize.Width - 4, ClientSize.Height - 4);
SizeF fontSize = g.MeasureString(_buttonText, _buttonFont);
int horWidth = ((ClientSize.Width - 4 - (int)fontSize.Width) / 2);
int verHeight = ((ClientSize.Height - 4 - (int)fontSize.Height) / 2);
g.FillPath(new SolidBrush(_buttonColor), path);
g.DrawPath(Focused ? new Pen(_focusColor) : new Pen(_borderColor), path);
g.DrawString(_buttonText, _buttonFont, new SolidBrush(_textColor), horWidth, verHeight);
}
else
{
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
GraphicsPath path = RoundedRectangle.Create(0, 0, ClientSize.Width - 4, ClientSize.Height - 4);
SizeF fontSize = g.MeasureString(_buttonText, _buttonFont);
int horWidth = ((ClientSize.Width - 4 - (int)fontSize.Width) / 2);
int verHeight = ((ClientSize.Height - 4 - (int)fontSize.Height) / 2);
g.FillPath(new SolidBrush(_highlightButtonColor), path);
g.DrawPath(ContainsFocus ? new Pen(_focusColor) : new Pen(_borderColor), path);
g.DrawString(_buttonText, _buttonFont, new SolidBrush(_textColor), horWidth, verHeight);
Color a1 = Color.FromArgb(255, 198, 198, 198);
Color a2 = Color.FromArgb(128, 198, 198, 198);
Color a3 = Color.FromArgb(64, 198, 198, 198);
var shadowBmp = new Bitmap(1, 3);
var shadowBmp2 = new Bitmap(3, 1);
shadowBmp.SetPixel(0, 0, a1);
shadowBmp.SetPixel(0, 1, a2);
shadowBmp.SetPixel(0, 2, a3);
shadowBmp2.SetPixel(0, 0, a1);
shadowBmp2.SetPixel(1, 0, a2);
shadowBmp2.SetPixel(2, 0, a3);
for (int z = 4; z < ClientSize.Width - 4; z++)
{
g.DrawImage(shadowBmp, z, ClientSize.Height - 4, 1, 3);
}
for (int z = 4; z < ClientSize.Height - 4; z++)
{
g.DrawImage(shadowBmp2, ClientSize.Width - 4, z, 3, 1);
}
g.DrawPath(Focused ? new Pen(_focusColor) : new Pen(_borderColor), path);
}
e.Graphics.DrawImage(bmp, 0, 0, ClientSize.Width, ClientSize.Height);
//bmp.Dispose();
}
private void CoolButtonMouseEnter(object sender, EventArgs e)
{
_mouseOver = true;
Refresh();
}
private void CoolButtonMouseLeave(object sender, EventArgs e)
{
_mouseOver = false;
_mouseDown = false;
Refresh();
}
private void CoolButtonSizeChanged(object sender, EventArgs e)
{
Refresh();
}
private void CoolButtonMouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
_mouseDown = true;
}
private void CoolButtonMouseUp(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
return;
if (_mouseDown)
{
if (ButtonClicked != null)
{
ButtonClicked(this);
}
}
_mouseDown = false;
}
}
}
-120
View File
@@ -1,120 +0,0 @@
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-486
View File
@@ -1,486 +0,0 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Common.UIControls
{
/// <summary>
/// Event Handler for SubItem events
/// </summary>
public delegate void SubItemEventHandler(object sender, SubItemEventArgs e);
/// <summary>
/// Event Handler for SubItemEndEditing events
/// </summary>
public delegate void SubItemEndEditingEventHandler(object sender, SubItemEndEditingEventArgs e);
/// <summary>
/// Inherited ListView to allow in-place editing of subitems
/// </summary>
public class ListViewEx : System.Windows.Forms.ListView
{
#region Interop structs, imports and constants
/// <summary>
/// MessageHeader for WM_NOTIFY
/// </summary>
private struct NMHDR
{
#pragma warning disable
public IntPtr hwndFrom;
public Int32 idFrom;
public Int32 code;
#pragma warning restore
}
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar);
[DllImport("user32.dll", CharSet=CharSet.Ansi)]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int len, ref int [] order);
// ListView messages
private const int LVM_FIRST = 0x1000;
private const int LVM_GETCOLUMNORDERARRAY = (LVM_FIRST + 59);
// Windows Messages that will abort editing
private const int WM_HSCROLL = 0x114;
private const int WM_VSCROLL = 0x115;
private const int WM_SIZE = 0x05;
private const int WM_NOTIFY = 0x4E;
private const int HDN_FIRST = -300;
private const int HDN_BEGINDRAG = (HDN_FIRST-10);
private const int HDN_ITEMCHANGINGA = (HDN_FIRST-0);
private const int HDN_ITEMCHANGINGW = (HDN_FIRST-20);
#endregion
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public event SubItemEventHandler SubItemClicked;
public event SubItemEventHandler SubItemRightClicked;
public event SubItemEventHandler SubItemBeginEditing;
public event SubItemEndEditingEventHandler SubItemEndEditing;
public ListViewEx()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
base.FullRowSelect = true;
base.View = View.Details;
base.AllowColumnReorder = true;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( 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()
{
components = new System.ComponentModel.Container();
}
#endregion
private bool _doubleClickActivation = false;
/// <summary>
/// Is a double click required to start editing a cell?
/// </summary>
public bool DoubleClickActivation
{
get { return _doubleClickActivation; }
set { _doubleClickActivation = value; }
}
/// <summary>
/// Retrieve the order in which columns appear
/// </summary>
/// <returns>Current display order of column indices</returns>
public int[] GetColumnOrder()
{
IntPtr lPar = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * Columns.Count);
IntPtr res = SendMessage(Handle, LVM_GETCOLUMNORDERARRAY, new IntPtr(Columns.Count), lPar);
if (res.ToInt32() == 0) // Something went wrong
{
Marshal.FreeHGlobal(lPar);
return null;
}
int [] order = new int[Columns.Count];
Marshal.Copy(lPar, order, 0, Columns.Count);
Marshal.FreeHGlobal(lPar);
return order;
}
/// <summary>
/// Find ListViewItem and SubItem Index at position (x,y)
/// </summary>
/// <param name="x">relative to ListView</param>
/// <param name="y">relative to ListView</param>
/// <param name="item">Item at position (x,y)</param>
/// <returns>SubItem index</returns>
public int GetSubItemAt(int x, int y, out ListViewItem item)
{
item = this.GetItemAt(x, y);
if (item != null)
{
int[] order = GetColumnOrder();
Rectangle lviBounds;
int subItemX;
lviBounds = item.GetBounds(ItemBoundsPortion.Entire);
subItemX = lviBounds.Left;
for (int i=0; i<order.Length; i++)
{
ColumnHeader h = this.Columns[order[i]];
if (x < subItemX+h.Width)
{
return h.Index;
}
subItemX += h.Width;
}
}
return -1;
}
/// <summary>
/// Get bounds for a SubItem
/// </summary>
/// <param name="Item">Target ListViewItem</param>
/// <param name="SubItem">Target SubItem index</param>
/// <returns>Bounds of SubItem (relative to ListView)</returns>
public Rectangle GetSubItemBounds(ListViewItem Item, int SubItem)
{
int[] order = GetColumnOrder();
Rectangle subItemRect = Rectangle.Empty;
if (SubItem >= order.Length)
throw new IndexOutOfRangeException("SubItem "+SubItem+" out of range");
if (Item == null)
throw new ArgumentNullException("Item");
Rectangle lviBounds = Item.GetBounds(ItemBoundsPortion.Entire);
int subItemX = lviBounds.Left;
ColumnHeader col;
int i;
for (i=0; i<order.Length; i++)
{
col = this.Columns[order[i]];
if (col.Index == SubItem)
break;
subItemX += col.Width;
}
subItemRect = new Rectangle(subItemX, lviBounds.Top, this.Columns[order[i]].Width, lviBounds.Height);
return subItemRect;
}
protected override void WndProc(ref Message msg)
{
switch (msg.Msg)
{
// Look for WM_VSCROLL,WM_HSCROLL or WM_SIZE messages.
case WM_VSCROLL:
case WM_HSCROLL:
case WM_SIZE:
EndEditing(false);
break;
case WM_NOTIFY:
// Look for WM_NOTIFY of events that might also change the
// editor's position/size: Column reordering or resizing
NMHDR h = (NMHDR)Marshal.PtrToStructure(msg.LParam, typeof(NMHDR));
if (h.code == HDN_BEGINDRAG ||
h.code == HDN_ITEMCHANGINGA ||
h.code == HDN_ITEMCHANGINGW)
EndEditing(false);
break;
}
base.WndProc(ref msg);
}
#region Initialize editing depending of DoubleClickActivation property
protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
{
base.OnMouseUp(e);
MouseEventArgs me = (MouseEventArgs)e;
if (me.Button == MouseButtons.Right)
{
/// Right mouse button click function
RightClickFunctionSubitemAt(new Point(e.X, e.Y));
}
else
{
/// Normal function (=edit item)
if (DoubleClickActivation)
{
return;
}
EditSubitemAt(new Point(e.X, e.Y));
}
}
protected override void OnDoubleClick(EventArgs e)
{
base.OnDoubleClick (e);
if (!DoubleClickActivation)
{
return;
}
Point pt = this.PointToClient(Cursor.Position);
EditSubitemAt(pt);
}
///<summary>
/// Fire SubItemClicked
///</summary>
///<param name="p">Point of click/doubleclick</param>
private void EditSubitemAt(Point p)
{
ListViewItem item;
int idx = GetSubItemAt(p.X, p.Y, out item);
if (idx >= 0)
{
OnSubItemClicked(new SubItemEventArgs(item, idx));
}
}
///<summary>
/// Fire SubItemRightClicked
///</summary>
///<param name="p">Point of click/doubleclick</param>
private void RightClickFunctionSubitemAt(Point p)
{
ListViewItem item;
int idx = GetSubItemAt(p.X, p.Y, out item);
if (idx >= 0)
{
OnSubItemRightClicked(new SubItemEventArgs(item, idx));
}
}
#endregion
#region In-place editing functions
// The control performing the actual editing
private Control _editingControl;
// The LVI being edited
private ListViewItem _editItem;
// The SubItem being edited
private int _editSubItem;
protected void OnSubItemBeginEditing(SubItemEventArgs e)
{
if (SubItemBeginEditing != null) SubItemBeginEditing(this, e);
}
protected void OnSubItemEndEditing(SubItemEndEditingEventArgs e)
{
if (SubItemEndEditing != null) SubItemEndEditing(this, e);
}
protected void OnSubItemClicked(SubItemEventArgs e)
{
if (SubItemClicked != null) SubItemClicked(this, e);
}
protected void OnSubItemRightClicked(SubItemEventArgs e)
{
if (SubItemRightClicked != null) SubItemRightClicked(this, e);
}
/// <summary>
/// Begin in-place editing of given cell
/// </summary>
/// <param name="c">Control used as cell editor</param>
/// <param name="Item">ListViewItem to edit</param>
/// <param name="SubItem">SubItem index to edit</param>
public void StartEditing(Control c, ListViewItem Item, int SubItem)
{
OnSubItemBeginEditing(new SubItemEventArgs(Item, SubItem));
Rectangle rcSubItem = GetSubItemBounds(Item, SubItem);
if (rcSubItem.X < 0)
{
// Left edge of SubItem not visible - adjust rectangle position and width
rcSubItem.Width += rcSubItem.X;
rcSubItem.X=0;
}
if (rcSubItem.X+rcSubItem.Width > this.Width)
{
// Right edge of SubItem not visible - adjust rectangle width
rcSubItem.Width = this.Width-rcSubItem.Left;
}
// Subitem bounds are relative to the location of the ListView!
rcSubItem.Offset(Left, Top);
// In case the editing control and the listview are on different parents,
// account for different origins
Point origin = new Point(0,0);
Point lvOrigin = this.Parent.PointToScreen(origin);
Point ctlOrigin = c.Parent.PointToScreen(origin);
rcSubItem.Offset(lvOrigin.X-ctlOrigin.X, lvOrigin.Y-ctlOrigin.Y);
// Position and show editor
c.Bounds = rcSubItem;
c.Text = Item.SubItems[SubItem].Text;
c.Visible = true;
c.BringToFront();
c.Focus();
_editingControl = c;
_editingControl.Leave += new EventHandler(_editControl_Leave);
_editingControl.KeyPress += new KeyPressEventHandler(_editControl_KeyPress);
_editItem = Item;
_editSubItem = SubItem;
}
private void _editControl_Leave(object sender, EventArgs e)
{
// cell editor losing focus
EndEditing(true);
}
private void _editControl_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
switch (e.KeyChar)
{
case (char)(int)Keys.Escape:
{
EndEditing(false);
break;
}
case (char)(int)Keys.Enter:
{
EndEditing(true);
break;
}
}
}
/// <summary>
/// Accept or discard current value of cell editor control
/// </summary>
/// <param name="AcceptChanges">Use the _editingControl's Text as new SubItem text or discard changes?</param>
public void EndEditing(bool AcceptChanges)
{
if (_editingControl == null)
return;
SubItemEndEditingEventArgs e = new SubItemEndEditingEventArgs(
_editItem, // The item being edited
_editSubItem, // The subitem index being edited
AcceptChanges ?
_editingControl.Text : // Use editControl text if changes are accepted
_editItem.SubItems[_editSubItem].Text, // or the original subitem's text, if changes are discarded
!AcceptChanges // Cancel?
);
OnSubItemEndEditing(e);
_editItem.SubItems[_editSubItem].Text = e.DisplayText;
_editingControl.Leave -= new EventHandler(_editControl_Leave);
_editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);
_editingControl.Visible = false;
_editingControl = null;
_editItem = null;
_editSubItem = -1;
}
#endregion
}
/// <summary>
/// Event Args for SubItemClicked event
/// </summary>
public class SubItemEventArgs : EventArgs
{
int subItem = -1; /// Sub-item index
ListViewItem item = null;
public int SubItem { get { return subItem; } }
public ListViewItem Item { get { return item; } }
public SubItemEventArgs(ListViewItem item, int subItem)
{
this.subItem = subItem;
this.item = item;
}
}
/// <summary>
/// Event Args for SubItemEndEditingClicked event
/// </summary>
public class SubItemEndEditingEventArgs : SubItemEventArgs
{
string displayText = string.Empty;
bool cancel = true;
public SubItemEndEditingEventArgs(ListViewItem item, int subItem, string displayText, bool cancel) :
base(item, subItem)
{
this.displayText = displayText;
this.cancel = cancel;
}
public string DisplayText
{
get { return displayText; }
set { displayText = value; }
}
public bool Cancel
{
get { return cancel; }
set { cancel = value; }
}
}
}
-42
View File
@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<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" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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>1.0.0.0</value>
</resheader>
<resheader name="Reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="Writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-107
View File
@@ -1,107 +0,0 @@
///
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
///
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Common.UIControls
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ListViewExtensions
{
[StructLayout(LayoutKind.Sequential)]
public struct HDITEM
{
public Mask mask;
public int cxy;
[MarshalAs(UnmanagedType.LPTStr)]
public string pszText;
public IntPtr hbm;
public int cchTextMax;
public Format fmt;
public IntPtr lParam;
// _WIN32_IE >= 0x0300
public int iImage;
public int iOrder;
// _WIN32_IE >= 0x0500
public uint type;
public IntPtr pvFilter;
// _WIN32_WINNT >= 0x0600
public uint state;
[Flags]
public enum Mask
{
Format = 0x4, // HDI_FORMAT
};
[Flags]
public enum Format
{
SortDown = 0x200, // HDF_SORTDOWN
SortUp = 0x400, // HDF_SORTUP
};
};
public const int LVM_FIRST = 0x1000;
public const int LVM_GETHEADER = LVM_FIRST + 31;
public const int HDM_FIRST = 0x1200;
public const int HDM_GETITEM = HDM_FIRST + 11;
public const int HDM_SETITEM = HDM_FIRST + 12;
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, ref HDITEM lParam);
public static void SetSortIcon(this ListViewEx listViewControl, int columnIndex, SortOrder order)
{
IntPtr columnHeader = SendMessage(listViewControl.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);
for (int columnNumber = 0; columnNumber <= listViewControl.Columns.Count - 1; columnNumber++)
{
var columnPtr = new IntPtr(columnNumber);
var item = new HDITEM
{
mask = HDITEM.Mask.Format
};
if (SendMessage(columnHeader, HDM_GETITEM, columnPtr, ref item) == IntPtr.Zero)
{
throw new Win32Exception();
}
if (order != SortOrder.None && columnNumber == columnIndex)
{
switch (order)
{
case SortOrder.Ascending:
item.fmt &= ~HDITEM.Format.SortDown;
item.fmt |= HDITEM.Format.SortUp;
break;
case SortOrder.Descending:
item.fmt &= ~HDITEM.Format.SortUp;
item.fmt |= HDITEM.Format.SortDown;
break;
default:
break;
}
}
else
{
item.fmt &= ~HDITEM.Format.SortDown & ~HDITEM.Format.SortUp;
}
if (SendMessage(columnHeader, HDM_SETITEM, columnPtr, ref item) == IntPtr.Zero)
{
throw new Win32Exception();
}
}
}
}
}
@@ -1,46 +0,0 @@
///
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections;
using System.Windows.Forms;
namespace Common.UIControls
{
public class LviDateTimeColumnComparer : IComparer
{
int column;
SortOrder order;
public LviDateTimeColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviDateTimeColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
DateTime valX = DateTime.Parse(((ListViewItem)x).SubItems[column].Text);
DateTime valY = DateTime.Parse(((ListViewItem)y).SubItems[column].Text);
if (valX == valY)
{
return 0;
}
else if (order == SortOrder.Ascending)
{
return (valX > valY) ? 1 : -1;
}
else
{
return (valY > valX) ? 1 : -1;
}
}
}
}
-34
View File
@@ -1,34 +0,0 @@
///
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections;
using System.Windows.Forms;
namespace Common.UIControls
{
public class LviIntColumnComparer : IComparer
{
int column;
SortOrder order;
public LviIntColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviIntColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
int valX = int.Parse(((ListViewItem)x).SubItems[column].Text);
int valY = int.Parse(((ListViewItem)y).SubItems[column].Text);
return (order == SortOrder.Descending) ? (valY - valX) : (valX - valY);
}
}
}
@@ -1,34 +0,0 @@
///
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections;
using System.Windows.Forms;
namespace Common.UIControls
{
public class LviTextColumnComparer : IComparer
{
private int column;
SortOrder order;
public LviTextColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviTextColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
string txtX = ((ListViewItem)x).SubItems[column].Text;
string txtY = ((ListViewItem)y).SubItems[column].Text;
return (order == SortOrder.Descending) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY);
}
}
}
-107
View File
@@ -1,107 +0,0 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Common.UIControls
{
public abstract class RoundedRectangle
{
[Flags]
public enum RectangleCorners
{
None = 0, TopLeft = 1, TopRight = 2, BottomLeft = 4, BottomRight = 8,
All = TopLeft | TopRight | BottomLeft | BottomRight
}
public static GraphicsPath Create(int x, int y, int width, int height,
int radius, RectangleCorners corners)
{
int xw = x + width;
int yh = y + height;
int xwr = xw - radius;
int yhr = yh - radius;
int xr = x + radius;
int yr = y + radius;
int r2 = radius * 2;
int xwr2 = xw - r2;
int yhr2 = yh - r2;
var p = new GraphicsPath();
p.StartFigure();
//Top Left Corner
if ((RectangleCorners.TopLeft & corners) == RectangleCorners.TopLeft)
{
p.AddArc(x, y, r2, r2, 180, 90);
}
else
{
p.AddLine(x, yr, x, y);
p.AddLine(x, y, xr, y);
}
//Top Edge
p.AddLine(xr, y, xwr, y);
//Top Right Corner
if ((RectangleCorners.TopRight & corners) == RectangleCorners.TopRight)
{
p.AddArc(xwr2, y, r2, r2, 270, 90);
}
else
{
p.AddLine(xwr, y, xw, y);
p.AddLine(xw, y, xw, yr);
}
//Right Edge
p.AddLine(xw, yr, xw, yhr);
//Bottom Right Corner
if ((RectangleCorners.BottomRight & corners) == RectangleCorners.BottomRight)
{
p.AddArc(xwr2, yhr2, r2, r2, 0, 90);
}
else
{
p.AddLine(xw, yhr, xw, yh);
p.AddLine(xw, yh, xwr, yh);
}
//Bottom Edge
p.AddLine(xwr, yh, xr, yh);
//Bottom Left Corner
if ((RectangleCorners.BottomLeft & corners) == RectangleCorners.BottomLeft)
{
p.AddArc(x, yhr2, r2, r2, 90, 90);
}
else
{
p.AddLine(xr, yh, x, yh);
p.AddLine(x, yh, x, yhr);
}
//Left Edge
p.AddLine(x, yhr, x, yr);
p.CloseFigure();
return p;
}
public static GraphicsPath Create(Rectangle rect, int radius, RectangleCorners c)
{ return Create(rect.X, rect.Y, rect.Width, rect.Height, radius, c); }
public static GraphicsPath Create(int x, int y, int width, int height, int radius)
{ return Create(x, y, width, height, radius, RectangleCorners.All); }
public static GraphicsPath Create(Rectangle rect, int radius)
{ return Create(rect.X, rect.Y, rect.Width, rect.Height, radius); }
public static GraphicsPath Create(int x, int y, int width, int height)
{ return Create(x, y, width, height, 5); }
public static GraphicsPath Create(Rectangle rect)
{ return Create(rect.X, rect.Y, rect.Width, rect.Height); }
}
}
-12
View File
@@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Common
{
public class Utils
{
}
}
-46
View File
@@ -1,46 +0,0 @@
using System;
using System.Drawing;
namespace Config.CalendarEvent
{
/// <summary>
/// An interface for creating event types
/// </summary>
public interface ICalendarEvent
{
DateTime Date { get; set; } /// The Date that the event occurs
Frequency Frequency { get; set; } /// A value indicating how often the event occurs
bool AllDay { get; set; } /// True if the time component of DateTime value can be ignored
bool TriggerOnExactDayOnly { get; set; } /// If this is a recurring event, set this to true to make the event show up only from the day specified forward
string Source { get; set; } /// Source of this calendar event (becomes the source of the triggered event)
string Title { get; set; } /// The name of the event (becomes the text of the triggered event)
AutoAction AutoAction { get; set; } /// Automated action to be done or event to be triggered (triggered event Severity)
string Parameters { get; set; } /// Automated action parameters (e.g. name of a procedure to start)
int Rank { get; set; } /// The ranking of the event that determines the order in which it is displayed on a particular day
bool Hidden { get; set; } /// True if the event is hidden/invisible, otherwise false
bool ReadOnly { get; set; } /// True if the event details cannot be modified
int BackColor { get; set; } /// The color that the event show up in on the calendar
int TextColor { get; set; } /// The text color of the event
bool TooltipEnabled { get; set; } /// True if a tooltip should be displayed when hovering over the event
/// <summary>
/// Set this to a custom function that will automatically determine if the event should be rendered on a given day.
/// This is only executed if <see cref="Frequency"/> is set to custom.
/// </summary>
CustomRecurringFrequenciesHandler CustomRecurringFunction { get; set; }
/// <summary>
/// A function for cloning an event instance
/// </summary>
/// <returns>A cloned <see cref="ICalendarEvent"/></returns>
ICalendarEvent Clone();
}
/// <summary>
/// A delegate for creating custom recurring frequencies
/// </summary>
/// <param name="evnt">The <see cref="ICalendarEvent"/> in question</param>
/// <param name="day">The day in question</param>
/// <returns>Should return a boolean value that indicates if the event should be rendered on the day passed in</returns>
public delegate bool CustomRecurringFrequenciesHandler(ICalendarEvent evnt, DateTime day);
}
-226
View File
@@ -1,226 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using Config.Resources;
namespace Config.CalendarEvent
{
/// <summary>
/// Enumeration of calendar event actions
/// </summary>
public enum AutoAction
{
Undefined,
None, /// No action at all
Notification, /// Trigger a notification event
Warning, /// Trigger a warning event
Error, /// Trigger an error event and stop test bench function
FatalErr, /// Trigger a fatal error and stop test bench function
InvokeBeforeCycle, /// Invoke a maintenance procedure before a cycle after entering order number
InvokeInsideCycle, /// Invoke conditional tests inside a cycle (if any)
InvokeAfterCycle, /// Invoke a maintenance procedure after a cycle after saving results
BackupData,
Count,
}
/// <summary>
/// Enumeration of built-in recurring event frequencies
/// </summary>
public enum Frequency
{
Undefined,
Once, /// Indicates that the event is non recurring will occur only one time
Yearly, /// Indicates that the event will occur once a year, on the month and day specified
Monthly, /// Indicates that the event will occur every month
Weekly, /// Indicates that the event will occur every week
EveryTuTh, /// Indicates that the event will occur every Tuesday and Thursday
EveryMoWeFr, /// Indicates that the event will occur every Mon, Wed and Fri
EveryWkday, /// Indicates that the event will occur every week day (Mon - Fri)
Daily, /// Indicates that the event will occur every day
EveryShift,
Custom, /// Indicates that the recuring schedule of this event is unique
Count
}
public class Utils
{
public static string Action2String(AutoAction action)
{
return action.ToString();
}
public static AutoAction String2Action(string astr)
{
for (AutoAction a = AutoAction.None; a < AutoAction.Count; a++)
{
if (Action2String(a) == astr) return a;
}
return AutoAction.Undefined;
}
public static string Freq2String(Frequency f)
{
switch (f)
{
case Frequency.Custom: return Strings.Custom;
case Frequency.Daily: return Strings.Daily;
case Frequency.EveryMoWeFr: return Strings.Every_Mon_Wed_and_Fri;
case Frequency.EveryTuTh: return Strings.Every_Tue_and_Thu;
case Frequency.EveryWkday: return Strings.Every_Week_Day;
case Frequency.EveryShift: return Strings.Every_shift;
case Frequency.Monthly: return Strings.Every_Month;
case Frequency.Once: return Strings.Once;
case Frequency.Weekly: return Strings.Every_week;
case Frequency.Yearly: return Strings.Every_year;
default: return string.Empty;
}
}
public static Frequency String2Freq(string fstr)
{
for (Frequency f = Frequency.Once; f < Frequency.Count; f++)
{
if (Freq2String(f) == fstr) return f;
}
return Frequency.Undefined;
}
/// <summary>
/// Determine whether an event date matches given day and time (dt)
/// (whether an event needs to be rendered on a specific day).
/// </summary>
/// <param name="evnt">Calendar event</param>
/// <param name="dt">Day and time</param>
/// <returns>true = needs to be rendered</returns>
public static bool DayMatchesExactly(ICalendarEvent evnt, DateTime dt)
{
DayOfWeek dow = dt.DayOfWeek;
switch (evnt.Frequency)
{
case Frequency.EveryShift: return (dow == DayOfWeek.Sunday && evnt.Date.Hour >= 22) ||
dow == DayOfWeek.Monday ||
dow == DayOfWeek.Tuesday ||
dow == DayOfWeek.Wednesday ||
dow == DayOfWeek.Thursday ||
(dow == DayOfWeek.Friday && evnt.Date.Hour < 22);
case Frequency.Daily: return true;
case Frequency.EveryMoWeFr: return (dow == DayOfWeek.Monday) || (dow == DayOfWeek.Wednesday) || (dow == DayOfWeek.Friday);
case Frequency.EveryTuTh: return (dow == DayOfWeek.Tuesday) || (dow == DayOfWeek.Thursday);
case Frequency.EveryWkday: return (dow != DayOfWeek.Sunday) && (dow != DayOfWeek.Saturday);
case Frequency.Weekly: return evnt.Date.DayOfWeek == dow;
case Frequency.Monthly: return evnt.Date.Day == dt.Day;
case Frequency.Yearly: return evnt.Date.Month == dt.Month && evnt.Date.Day == dt.Day;
case Frequency.Once: return evnt.Date.Year == dt.Year && evnt.Date.Month == dt.Month && evnt.Date.Day == dt.Day;
case Frequency.Custom: return (evnt.CustomRecurringFunction != null) && evnt.CustomRecurringFunction(evnt, dt);
default: return false;
}
}
public static bool IsCalendarEventTrigerred(ICalendarEvent evnt, DateTime currentDate)
{
DateTime evntDT = evnt.AllDay
? new DateTime(evnt.Date.Year, evnt.Date.Month, evnt.Date.Day, 0, 0, 0)
: evnt.Date;
if (evnt.Frequency == Frequency.EveryShift)
{
DateTime dt1 = evntDT;
DateTime dt2 = evntDT + new TimeSpan(8, 0, 0);
DateTime dt3 = evntDT + new TimeSpan(16, 0, 0);
return (currentDate >= dt1) || (currentDate >= dt1) || (currentDate >= dt3);
}
else if (!evnt.TriggerOnExactDayOnly)
{
/// Trigger after event expires
return (currentDate >= evntDT);
}
else
{
/// Trigger event on exact date only
return (currentDate >= evntDT) && DayMatchesExactly(evnt, currentDate);
}
}
/// <summary>
/// Called to update event.Date after an event was trigerred and a required action was done.
/// </summary>
/// <param name="evnt">Calendar event</param>
/// <param name="currentDate">Current date and time which triggered the event</param>
/// <returns>true when event.Date was updated</returns>
public static bool UpdateRecurringDate(ICalendarEvent evnt, DateTime currentDate)
{
switch (evnt.Frequency)
{
case Frequency.Yearly:
do {
evnt.Date = evnt.Date.AddYears(1);
}
while (evnt.Date <= currentDate);
return true;
case Frequency.Monthly:
do {
evnt.Date = evnt.Date.AddMonths(1);
}
while (evnt.Date <= currentDate);
return true;
case Frequency.Weekly:
do {
evnt.Date += new TimeSpan(7, 0, 0, 0); /// add one week
}
while (evnt.Date <= currentDate);
return true;
case Frequency.EveryTuTh:
do {
evnt.Date += new TimeSpan(1, 0, 0, 0); /// add one day
}
while ((evnt.Date <= currentDate) || ((evnt.Date.DayOfWeek != DayOfWeek.Tuesday) &&
(evnt.Date.DayOfWeek != DayOfWeek.Thursday)));
return true;
case Frequency.EveryMoWeFr:
do {
evnt.Date += new TimeSpan(1, 0, 0, 0); /// add one day
}
while ((evnt.Date <= currentDate) || ((currentDate.DayOfWeek != DayOfWeek.Monday) &&
(currentDate.DayOfWeek != DayOfWeek.Wednesday) &&
(currentDate.DayOfWeek != DayOfWeek.Friday)));
return true;
case Frequency.EveryWkday:
do {
evnt.Date += new TimeSpan(1, 0, 0, 0); /// add one day
}
while ((evnt.Date <= currentDate) || (currentDate.DayOfWeek == DayOfWeek.Saturday) || (currentDate.DayOfWeek == DayOfWeek.Sunday));
return true;
case Frequency.Daily:
do {
evnt.Date += new TimeSpan(1, 0, 0, 0); /// add one day
}
while (evnt.Date <= currentDate);
return true;
case Frequency.EveryShift:
do {
evnt.Date += new TimeSpan(8, 0, 0); /// add eight hours
}
while (evnt.Date <= currentDate);
return true;
default:
/// This is not a recurring calendar event, 'Date' was not updated
return false;
}
}
}
}
+2 -6
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;SLM_150;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG;DEWA_300</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -30,7 +30,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;SLM_150;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEWA_300</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
@@ -67,11 +67,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CalendarEvent\ICalendarEvent.cs" />
<Compile Include="Data.cs" />
<Compile Include="DatabaseSettings.cs" />
<Compile Include="Entities\BenchPath.cs" />
<Compile Include="Entities\CustomEvent.cs" />
<Compile Include="Entities\Component.cs" />
<Compile Include="Entities\ComponentProcedure.cs" />
<Compile Include="Entities\ComponentTest.cs" />
@@ -97,14 +95,12 @@
<Compile Include="Entities\User.cs" />
<Compile Include="Entities\VirtualBenchSequence.cs" />
<Compile Include="Entities\VirtualBenchStep.cs" />
<Compile Include="CalendarEvent\Utils.cs" />
<Compile Include="FluentCommon.cs" />
<Compile Include="Formulas.cs" />
<Compile Include="Mappings\BenchPathMap.cs" />
<Compile Include="Mappings\ComponentMap.cs" />
<Compile Include="Mappings\ComponentProcedureMap.cs" />
<Compile Include="Mappings\ComponentTestMap.cs" />
<Compile Include="Mappings\CustomEventMap.cs" />
<Compile Include="Mappings\FeedingPathMap.cs" />
<Compile Include="Mappings\GroupMap.cs" />
<Compile Include="Mappings\HeatMetersPathMap.cs" />
+53 -35
View File
@@ -8,43 +8,31 @@ namespace Config
public const string AdminPassword = "staratura";
public const string SQLiteDbFName = "SQLite.db";
#if DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif MUNICH
#if MUNICH
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
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 0;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50 || TURA_SPECIAL
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
public const int MaxPartNr = 3;
#elif PUCHONG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif RUM_MOB
public const int WMsCount = 8;
public const int LineSize = 8;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif DEWA_300 || FUZHOU_100 || ROMA_200
#elif DEWA_300 || ROMA_200
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
@@ -56,33 +44,63 @@ namespace Config
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif SLM_END || WARSAW_END
public const int WMsCount = 10;
public const int LineSize = 5;
#elif IZRAEL_50
public const int WMsCount = 40;
public const int LineSize = 10;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_100
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 4;
#elif SLM_50
public const int WMsCount = 12;
public const int LineSize = 12;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 6;
public const int MaxPartNr = WMsCount / LineSize;
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || ALZIR_25
public const int WMsCount = 20;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif RUM_MOB
public const int WMsCount = 8;
public const int LineSize = 8;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TURA_IPERL || TURA_IPERL_NEW
public const int WMsCount = 40;
public const int LineSize = 20;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif IZRAEL_50
public const int WMsCount = 40;
public const int LineSize = 10;
#elif TURA_SPECIAL || SENTEC
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif SLM_50
public const int WMsCount = 12;
public const int LineSize = 12;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 6;
public const int MaxPartNr = WMsCount / LineSize;
#elif SLM_END || WARSAW_END
public const int WMsCount = 10;
public const int LineSize = 5;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 4;
#elif MALTA_WSD25
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
+5 -15
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Text;
@@ -10,15 +10,14 @@ namespace Config
/// <summary>
/// Test bench database settings, contains bench name and settings od several databases
/// </summary>
public class DatabaseSettings : ICloneable, IComparable
public class DatabaseSettings : ICloneable
{
// Public fields
public string BenchName;
public bool IsRealBench;
public Users.DBSettings ProceduresDBSettings; /// Configuration database settings
public Users.DBSettings ProceduresDBSettings; /// Config database settings
public Users.DBSettings WaterMetersDBSettings; /// Results database settings
public Users.DBSettings EventsDBSettings; /// Events database settings
public Users.DBSettings UsersDBSettings; /// Shared configuration database settings
public Users.DBSettings UsersDBSettings; /// Users database settings
// Constructor
public DatabaseSettings()
@@ -27,7 +26,6 @@ namespace Config
IsRealBench = false;
ProceduresDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
WaterMetersDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
EventsDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
UsersDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
}
@@ -39,25 +37,17 @@ namespace Config
result.IsRealBench = IsRealBench;
result.ProceduresDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
result.WaterMetersDBSettings = (Users.DBSettings)WaterMetersDBSettings.Clone();
result.EventsDBSettings = (Users.DBSettings)EventsDBSettings.Clone();
result.UsersDBSettings = (Users.DBSettings)UsersDBSettings.Clone();
return result;
}
public int CompareTo(object dbs2)
{
if (!(dbs2 is DatabaseSettings)) return 0;
return String.Compare(BenchName, (dbs2 as DatabaseSettings).BenchName);
}
public override string ToString()
{
return string.Format("{0} config={1} results={2} events={3} users={4}",
return string.Format("{0} config={1} results={2} users={3}",
BenchName,
ProceduresDBSettings.ConnectionString,
WaterMetersDBSettings.ConnectionString,
EventsDBSettings.ConnectionString,
UsersDBSettings.ConnectionString);
}
}
-93
View File
@@ -1,93 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using Config.CalendarEvent;
namespace Config.Entities
{
public class CustomEvent : Config.CalendarEvent.ICalendarEvent
{
public virtual int Id { get; protected set; }
public virtual DateTime Date { get; set; } /// The Date that the event occurs
public virtual Frequency Frequency { get; set; } /// A value indicating how often the event occurs
public virtual bool AllDay { get; set; } /// True if the time component of the date can be ignored
public virtual bool TriggerOnExactDayOnly { get; set; } /// If this is a recurring event, set this to true to make the event show up only from the day specified forward
public virtual string Source { get; set; } /// Source of this calendar event (becomes the source of the triggered event)
public virtual string Title { get; set; } /// The name of the event (becomes the text of the triggered event)
public virtual AutoAction AutoAction { get; set; } /// Automated action to be done or event to be triggered
public virtual string Parameters { get; set; } /// Automated action parameters (e.g. name of a procedure to start)
public virtual int Rank { get; set; } /// The ranking of the event that determines the order in which it is displayed on a particular day
public virtual bool Hidden { get; set; } /// True if the event is enabled, otherwise false
public virtual bool ReadOnly { get; set; } /// True if the event details cannot be modified
public virtual int BackColor { get; set; } /// The color that the event show up in on the calendar: (MSB)AARRGGBB(LSB)
public virtual int TextColor { get; set; } /// The text color of the event: (MSB)AARRGGBB(LSB)
public virtual bool TooltipEnabled { get; set; } /// True if a tooltip should be displayed when hovering over the event
public virtual CustomRecurringFrequenciesHandler
CustomRecurringFunction { get; set; } /// Not mapped to DB, always null
/// <summary>
/// CustomEvent Constructor
/// </summary>
public CustomEvent()
{
}
public CustomEvent(DateTime dateTime, string text)
{
Date = dateTime;
Frequency = Config.CalendarEvent.Frequency.Once;
AllDay = false;
TriggerOnExactDayOnly = false;
Source = "Calendar";
Title = text;
AutoAction = AutoAction.None;
Parameters = string.Empty;
Rank = 2;
Hidden = false;
ReadOnly = false;
BackColor = unchecked((int)0xFFFF5050);
TextColor = unchecked((int)0xFFFFFFFF);
TooltipEnabled = true;
CustomRecurringFunction = null;
}
public virtual Config.CalendarEvent.ICalendarEvent Clone()
{
return new CustomEvent
{
Date = this.Date,
Frequency = this.Frequency,
AllDay = this.AllDay,
TriggerOnExactDayOnly = this.TriggerOnExactDayOnly,
Source = this.Source,
Title = this.Title,
AutoAction = this.AutoAction,
Parameters = this.Parameters,
Rank = this.Rank,
Hidden = this.Hidden,
ReadOnly = this.ReadOnly,
BackColor = this.BackColor,
TextColor = this.TextColor,
TooltipEnabled = this.TooltipEnabled,
CustomRecurringFunction = this.CustomRecurringFunction,
};
}
/// <summary>
/// Returns true when updated
/// </summary>
/// <param name="currentDate">Current date and time</param>
/// <returns>true when the entity was updated</returns>
public virtual bool UpdateRecurringDate(DateTime currentDate)
{
return Config.CalendarEvent.Utils.UpdateRecurringDate(this, currentDate);
}
public override string ToString()
{
return Title;
}
}
}
+133 -87
View File
@@ -67,12 +67,12 @@ namespace Config.Entities
public class ProcedureInfo
{
public readonly string Name;
public readonly bool IsRemote;
public readonly Users.Entities.DBKind DBKind;
public ProcedureInfo(string name, bool isRemote)
public ProcedureInfo(string name, Users.Entities.DBKind dbKind)
{
Name = name;
IsRemote = isRemote;
DBKind = dbKind;
}
}
@@ -327,27 +327,6 @@ namespace Config.Entities
Count
}
/// <summary>
/// Three state test results and/or water meter result (Algeria PT25 requirement).
/// NearlyOK means error is within error limits not narrowed by uncertainty
/// OK: Uncertainty + ErrLimLo <= error <= ErrLimHi - Uncertainty
/// NearlyOK: not OK but stil ErrLimLo <= error <= ErrLimHi
/// Nok: otherwise
/// </summary>
public enum ThreeState
{
#if LANG_FR
[Description("NC")] Nok, /// Totally failed: not OK and not NearlyOK
[Description("2e/Ff")] NearlyOK, /// Nearly OK, not OK but not totally failed
[Description("***")] OK, /// OK
#else
[Description("NOK")] Nok, /// Totally failed: not OK and not NearlyOK
[Description("Nearly OK")] NearlyOK, /// Nearly OK, not OK but not totally failed
[Description("OK")] OK, /// OK
#endif
Count
}
public enum TestProfile
{
UserDefined,
@@ -576,70 +555,137 @@ namespace Config.Entities
}
public enum ErrorFlagShift
{
E1 = 0,
E2,
E3,
E4,
E5,
E6,
E7,
E8,
E9,
E10,
E11,
E12,
E13,
E14,
E15,
E16,
E17,
E18,
E19,
E20,
E21,
E22,
E23,
E24,
E25,
E26,
E27,
E28,
E29,
E30,
E31,
E32,
E33,
E34,
E35,
E36,
E37,
E38,
E39,
E40,
E41,
E42,
E43,
E44,
E45,
E46,
E47,
E48,
E49,
E50,
E51,
E52,
E53,
E54,
E55,
E56,
E57,
E58,
E59,
E60,
E61,
E62,
E63,
}
public enum ErrorFlagMask : long
{
E1 = (1L << 0), /// shift = 0, E1 = 1L
E2 = (1L << 1),
E3 = (1L << 2),
E4 = (1L << 3),
E5 = (1L << 4),
E6 = (1L << 5),
E7 = (1L << 6),
E8 = (1L << 7),
E9 = (1L << 8),
E10 = (1L << 9),
E11 = (1L << 10),
E12 = (1L << 11),
E13 = (1L << 12),
E14 = (1L << 13),
E15 = (1L << 14),
E16 = (1L << 15),
E17 = (1L << 16),
E18 = (1L << 17),
E19 = (1L << 18),
E20 = (1L << 19),
E21 = (1L << 20),
E22 = (1L << 21),
E23 = (1L << 22),
E24 = (1L << 23),
E25 = (1L << 24),
E26 = (1L << 25), /// iPERL: Invalid Q2 correction factors, mismatch between factors in the water meter and in DB
E27 = (1L << 26), /// iPERL: Wrong counting direction
E28 = (1L << 27), /// iPERL: Missing workflow step (assembly or test)
E29 = (1L << 28),
E30 = (1L << 29),
E31 = (1L << 30),
E32 = (1L << 31),
E33 = (1L << 32),
E34 = (1L << 33),
E35 = (1L << 34),
E36 = (1L << 35),
E37 = (1L << 36),
E38 = (1L << 37),
E39 = (1L << 38),
E40 = (1L << 39),
E41 = (1L << 40),
E42 = (1L << 41),
E43 = (1L << 42),
E44 = (1L << 43),
E45 = (1L << 44),
E46 = (1L << 45),
E47 = (1L << 46),
E48 = (1L << 47),
E49 = (1L << 48),
E50 = (1L << 49),
E51 = (1L << 50),
E52 = (1L << 51),
E53 = (1L << 52),
E54 = (1L << 53),
E55 = (1L << 54),
E56 = (1L << 55),
E57 = (1L << 56),
E58 = (1L << 57),
E59 = (1L << 58),
E60 = (1L << 59),
E61 = (1L << 60),
E62 = (1L << 61),
E63 = (1L << 62),
E1 = (1 << (int)ErrorFlagShift.E1),
E2 = (1 << (int)ErrorFlagShift.E2),
E3 = (1 << (int)ErrorFlagShift.E3),
E4 = (1 << (int)ErrorFlagShift.E4),
E5 = (1 << (int)ErrorFlagShift.E5),
E6 = (1 << (int)ErrorFlagShift.E6),
E7 = (1 << (int)ErrorFlagShift.E7),
E8 = (1 << (int)ErrorFlagShift.E8),
E9 = (1 << (int)ErrorFlagShift.E9),
E10 = (1 << (int)ErrorFlagShift.E10),
E11 = (1 << (int)ErrorFlagShift.E11),
E12 = (1 << (int)ErrorFlagShift.E12),
E13 = (1 << (int)ErrorFlagShift.E13),
E14 = (1 << (int)ErrorFlagShift.E14),
E15 = (1 << (int)ErrorFlagShift.E15),
E16 = (1 << (int)ErrorFlagShift.E16),
E17 = (1 << (int)ErrorFlagShift.E17),
E18 = (1 << (int)ErrorFlagShift.E18),
E19 = (1 << (int)ErrorFlagShift.E19),
E20 = (1 << (int)ErrorFlagShift.E20),
E21 = (1 << (int)ErrorFlagShift.E21),
E22 = (1 << (int)ErrorFlagShift.E22),
E23 = (1 << (int)ErrorFlagShift.E23),
E24 = (1 << (int)ErrorFlagShift.E24),
E25 = (1 << (int)ErrorFlagShift.E25),
E26 = (1 << (int)ErrorFlagShift.E26),
E27 = (1 << (int)ErrorFlagShift.E27),
E28 = (1 << (int)ErrorFlagShift.E28),
E29 = (1 << (int)ErrorFlagShift.E29),
E30 = (1 << (int)ErrorFlagShift.E30),
E31 = (1 << (int)ErrorFlagShift.E31),
E32 = (1 << (int)ErrorFlagShift.E32),
E33 = (1 << (int)ErrorFlagShift.E33),
E34 = (1 << (int)ErrorFlagShift.E34),
E35 = (1 << (int)ErrorFlagShift.E35),
E36 = (1 << (int)ErrorFlagShift.E36),
E37 = (1 << (int)ErrorFlagShift.E37),
E38 = (1 << (int)ErrorFlagShift.E38),
E39 = (1 << (int)ErrorFlagShift.E39),
E40 = (1 << (int)ErrorFlagShift.E40),
E41 = (1 << (int)ErrorFlagShift.E41),
E42 = (1 << (int)ErrorFlagShift.E42),
E43 = (1 << (int)ErrorFlagShift.E43),
E44 = (1 << (int)ErrorFlagShift.E44),
E45 = (1 << (int)ErrorFlagShift.E45),
E46 = (1 << (int)ErrorFlagShift.E46),
E47 = (1 << (int)ErrorFlagShift.E47),
E48 = (1 << (int)ErrorFlagShift.E48),
E49 = (1 << (int)ErrorFlagShift.E49),
E50 = (1 << (int)ErrorFlagShift.E50),
E51 = (1 << (int)ErrorFlagShift.E51),
E52 = (1 << (int)ErrorFlagShift.E52),
E53 = (1 << (int)ErrorFlagShift.E53),
E54 = (1 << (int)ErrorFlagShift.E54),
E55 = (1 << (int)ErrorFlagShift.E55),
E56 = (1 << (int)ErrorFlagShift.E56),
E57 = (1 << (int)ErrorFlagShift.E57),
E58 = (1 << (int)ErrorFlagShift.E58),
E59 = (1 << (int)ErrorFlagShift.E59),
E60 = (1 << (int)ErrorFlagShift.E60),
E61 = (1 << (int)ErrorFlagShift.E61),
E62 = (1 << (int)ErrorFlagShift.E62),
E63 = (1 << (int)ErrorFlagShift.E63),
}
}
+17 -17
View File
@@ -81,23 +81,23 @@ namespace Config.Entities
Publish = (sbyte)Config.Entities.Publish.Always;
Evaluate = true;
E1 = (sbyte)ErrorFlagsMode.On;
E2 = (sbyte)ErrorFlagsMode.On;
E3 = (sbyte)ErrorFlagsMode.On;
E4 = (sbyte)ErrorFlagsMode.On;
E5 = (sbyte)ErrorFlagsMode.On;
E6 = (sbyte)ErrorFlagsMode.On;
E7 = (sbyte)ErrorFlagsMode.On;
E8 = (sbyte)ErrorFlagsMode.On;
E9 = (sbyte)ErrorFlagsMode.On;
E10 = (sbyte)ErrorFlagsMode.On;
E11 = (sbyte)ErrorFlagsMode.On;
E12 = (sbyte)ErrorFlagsMode.On;
E13 = (sbyte)ErrorFlagsMode.On;
E14 = (sbyte)ErrorFlagsMode.On;
E15 = (sbyte)ErrorFlagsMode.On;
E16 = (sbyte)ErrorFlagsMode.Off;
E21 = (sbyte)ErrorFlagsMode.Off;
E1 = 1;
E2 = 1;
E3 = 1;
E4 = 1;
E5 = 1;
E6 = 1;
E7 = 1;
E8 = 1;
E9 = 1;
E10 = 1;
E11 = 1;
E12 = 1;
E13 = 1;
E14 = 1;
E15 = 1;
E16 = 1;
E21 = 1;
Delta_Q_pct = 5.0; /// [%]
Delta_T = 10.0; /// [°C]
+5 -21
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -36,10 +36,9 @@ namespace Config.Entities
public virtual bool ManualCtrlDisabled { get; set; } /// true = manual control of valves, etc. is disabled
public virtual string DataEntry { get; set; } /// Component to use for data entry
public virtual string ResultsPrinter { get; set; } /// Component for printing results
public virtual string ResultsWriter { get; set; } /// Component for saving results into a file
public virtual string EventTriggers { get; set; } /// Component for analysing results and triggering events
public virtual string TransitionStart { get; set; }
public virtual string ResultsPrinter { get; set; } /// Component to use for printing the results
public virtual string ResultsWriter { get; set; } /// Component to use for saving the results into the file
public virtual string TransitionStart { get; set; }
public virtual string TransitionEnd { get; set; }
public virtual string AltProcName { get; set; } /// Alternative procedure name (null or string.Empty = no alt. procedure)
@@ -53,17 +52,6 @@ namespace Config.Entities
public virtual IList<ComponentProcedure> MoreParams { get; set; }
public virtual IList<Test> Tests { get; set; }
/// Wrapper
public virtual IList<Test> RegularTests()
{
IList<Test> rslt = new List<Test>();
foreach (var t in Tests)
{
if ((t.Name.Length > 0 && t.Name[0] != '[') || !t.Name.Contains("]")) rslt.Add(t);
}
return rslt;
}
/// ------------- Additional stuff not mapped into the database -------------
public Procedure()
@@ -120,8 +108,7 @@ namespace Config.Entities
result.DataEntry = DataEntry;
result.ResultsPrinter = ResultsPrinter;
result.ResultsWriter = ResultsWriter;
result.EventTriggers = EventTriggers;
result.TransitionStart = TransitionStart;
result.TransitionStart = TransitionStart;
result.TransitionEnd = TransitionEnd;
result.AltProcName = AltProcName;
result.AltProcPeriod = AltProcPeriod;
@@ -154,7 +141,6 @@ namespace Config.Entities
output.WriteLine(DataEntry);
output.WriteLine(ResultsPrinter);
output.WriteLine(ResultsWriter);
output.WriteLine(EventTriggers);
output.WriteLine(TransitionStart);
output.WriteLine(TransitionEnd);
@@ -187,7 +173,6 @@ namespace Config.Entities
result.DataEntry = input.ReadLine();
result.ResultsPrinter = input.ReadLine();
result.ResultsWriter = input.ReadLine();
result.EventTriggers = input.ReadLine();
result.TransitionStart = input.ReadLine();
result.TransitionEnd = input.ReadLine();
@@ -234,7 +219,6 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != DataEntry) { diff.AppendFormat(fmt, "DataEntry", DataEntry, ln); };
ln = inp.ReadLine(); if (ln != ResultsPrinter) { diff.AppendFormat(fmt, "ResultsPrinter", ResultsPrinter, ln); };
ln = inp.ReadLine(); if (ln != ResultsWriter) { diff.AppendFormat(fmt, "ResultsWriter", ResultsWriter, ln); };
ln = inp.ReadLine(); if (ln != EventTriggers) { diff.AppendFormat(fmt, "EventTriggers", EventTriggers, ln); };
ln = inp.ReadLine(); if (ln != TransitionStart) { diff.AppendFormat(fmt, "TransitionStart", TransitionStart, ln); };
ln = inp.ReadLine(); if (ln != TransitionEnd) { diff.AppendFormat(fmt, "TransitionEnd", TransitionEnd, ln); };
+3 -3
View File
@@ -119,10 +119,10 @@ namespace Config
/// 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 (ix < 0 || ix >= (int)Users.Entities.DBKind.Count) return null;
int ix = (int)database;
if (SessionFactories[ix] == null) SessionFactories[ix] = CreateSessionFactory(database);
if (SessionFactories[ix] == null) SessionFactories[ix] = CreateSessionFactory(database);
return SessionFactories[ix].OpenSession();
}
-30
View File
@@ -1,30 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class CustomEventMap : ClassMap<CustomEvent>
{
public CustomEventMap()
{
Id(x => x.Id);
Map(x => x.Date);
Map(x => x.Frequency);
Map(x => x.AllDay);
Map(x => x.TriggerOnExactDayOnly);
Map(x => x.Source);
Map(x => x.Title);
Map(x => x.AutoAction);
Map(x => x.Parameters);
Map(x => x.Rank);
Map(x => x.Hidden);
Map(x => x.ReadOnly);
Map(x => x.BackColor);
Map(x => x.TextColor);
Map(x => x.TooltipEnabled);
}
}
}
+1 -2
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
@@ -35,7 +35,6 @@ namespace Config.Mappings
Map(x => x.DataEntry);
Map(x => x.ResultsPrinter);
Map(x => x.ResultsWriter);
Map(x => x.EventTriggers);
Map(x => x.TransitionStart);
Map(x => x.TransitionEnd);
+2 -2
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.26.1458.0")]
[assembly: AssemblyFileVersion("2.26.1458.0")]
[assembly: AssemblyVersion("2.25.1400.0")]
[assembly: AssemblyFileVersion("2.25.1400.0")]
+55 -101
View File
@@ -60,6 +60,24 @@ namespace Config.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Administrator.
/// </summary>
internal static string Administrator {
get {
return ResourceManager.GetString("Administrator", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Calibration Specialist.
/// </summary>
internal static string Calibration_Specialist {
get {
return ResourceManager.GetString("Calibration_Specialist", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot open DB Cause 0.
/// </summary>
@@ -74,7 +92,8 @@ namespace Config.Resources {
/// </summary>
internal static string Error
{
get {
get
{
return ResourceManager.GetString("Error", resourceCulture);
}
}
@@ -88,6 +107,33 @@ namespace Config.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Head of Lab.
/// </summary>
internal static string Head_of_Lab {
get {
return ResourceManager.GetString("Head_of_Lab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Maintenance Specialist.
/// </summary>
internal static string Maintenance_Specialist {
get {
return ResourceManager.GetString("Maintenance_Specialist", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Metrologist.
/// </summary>
internal static string Metrologist {
get {
return ResourceManager.GetString("Metrologist", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Passed.
/// </summary>
@@ -96,114 +142,22 @@ namespace Config.Resources {
return ResourceManager.GetString("Passed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Once.
/// Looks up a localized string similar to Tester.
/// </summary>
internal static string Once
{
internal static string Tester {
get {
return ResourceManager.GetString("Once", resourceCulture);
return ResourceManager.GetString("Tester", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Every year.
/// Looks up a localized string similar to Testing Specialist.
/// </summary>
internal static string Every_year
{
internal static string Testing_Specialist {
get {
return ResourceManager.GetString("Every_year", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Every Month.
/// </summary>
internal static string Every_Month
{
get {
return ResourceManager.GetString("Every_Month", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Every week.
/// </summary>
internal static string Every_week
{
get {
return ResourceManager.GetString("Every_week", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Daily.
/// </summary>
internal static string Daily
{
get {
return ResourceManager.GetString("Daily", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Every shift.
/// </summary>
internal static string Every_shift
{
get {
return ResourceManager.GetString("Every_shift", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Every Monday, Wednesday and Friday.
/// </summary>
internal static string Every_Mon_Wed_and_Fri
{
get {
return ResourceManager.GetString("Every_Mon_Wed_and_Fri", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Every Tuesday and Thursday.
/// </summary>
internal static string Every_Tue_and_Thu
{
get {
return ResourceManager.GetString("Every_Tue_and_Thu", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Every Week Day (Mon - Fri).
/// </summary>
internal static string Every_Week_Day
{
get {
return ResourceManager.GetString("Every_Week_Day", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Custom.
/// </summary>
internal static string Custom
{
get {
return ResourceManager.GetString("Custom", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Administrator.
/// </summary>
internal static string Administrator
{
get {
return ResourceManager.GetString("Administrator", resourceCulture);
return ResourceManager.GetString("Testing_Specialist", resourceCulture);
}
}
}
-33
View File
@@ -117,40 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Custom" xml:space="preserve">
<value>Volitelně</value>
</data>
<data name="Daily" xml:space="preserve">
<value>Každý den</value>
</data>
<data name="Error" xml:space="preserve">
<value>Chyba</value>
</data>
<data name="Every_Month" xml:space="preserve">
<value>Každý měsíc</value>
</data>
<data name="Every_Mon_Wed_and_Fri" xml:space="preserve">
<value>Každý pondělí, středu a pátek</value>
</data>
<data name="Every_shift" xml:space="preserve">
<value>Každou směnu</value>
</data>
<data name="Every_Tue_and_Thu" xml:space="preserve">
<value>Každý úterí a čtvrtek</value>
</data>
<data name="Every_week" xml:space="preserve">
<value>Každý týden</value>
</data>
<data name="Every_Week_Day" xml:space="preserve">
<value>Každý pracovní den (pon. - pá.)</value>
</data>
<data name="Every_year" xml:space="preserve">
<value>Každý rok</value>
</data>
<data name="Once" xml:space="preserve">
<value>Jednou</value>
</data>
<data name="Administrator" xml:space="preserve">
<value>Správce</value>
</data>
</root>
+3 -3
View File
@@ -118,15 +118,15 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Failed" xml:space="preserve">
<value>Nicht OK</value>
<value>NiO</value>
</data>
<data name="Passed" xml:space="preserve">
<value>OK</value>
<value>iO</value>
</data>
<data name="Error" xml:space="preserve">
<value>Fehler</value>
</data>
<data name="Cannot_open_DB_Cause_0" xml:space="preserve">
<value>Datenbank kann nicht geöffnet werden.\\r\\nUrsache:\\r\\n{0}</value>
<value>Datenbank kann nicht geöffnet.\\r\\nUrsache:\\r\\n{0}</value>
</data>
</root>
-33
View File
@@ -129,37 +129,4 @@
<data name="Error" xml:space="preserve">
<value>Error</value>
</data>
<data name="Custom" xml:space="preserve">
<value>Custom</value>
</data>
<data name="Daily" xml:space="preserve">
<value>Daily</value>
</data>
<data name="Every_Month" xml:space="preserve">
<value>Every Month</value>
</data>
<data name="Every_Mon_Wed_and_Fri" xml:space="preserve">
<value>Every Monday, Wednesday and Friday</value>
</data>
<data name="Every_shift" xml:space="preserve">
<value>Every shift</value>
</data>
<data name="Every_Tue_and_Thu" xml:space="preserve">
<value>Every Tuesday and Thursday</value>
</data>
<data name="Every_week" xml:space="preserve">
<value>Every week</value>
</data>
<data name="Every_Week_Day" xml:space="preserve">
<value>Every Week Day (Mon - Fri)</value>
</data>
<data name="Every_year" xml:space="preserve">
<value>Every year</value>
</data>
<data name="Once" xml:space="preserve">
<value>Once</value>
</data>
<data name="Administrator" xml:space="preserve">
<value>Administrator</value>
</data>
</root>
+12 -33
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
///
using System;
using System.Reflection;
@@ -27,14 +27,14 @@ namespace Config
[Description("m3/h")] m3ph, /// * 1 m3/h = 1000 l/h
[Description("g")] g, /// 0.001 kg
[Description("lb")] lb, /// 0.45359237 kg
[Description("kg")] kg, /// * 1 kilogram
[Description("t")] t, /// 1000 kg
[Description("lb")] lb, /// 0.45359237 kg
[Description("ms")] ms, /// 1 ms = 0.001 s
[Description("s")] s, /// * 1 second
[Description("min")] min, /// 1 min = 60 s
[Description("hr")] hour, /// 1 hour = 60 min = 3600 s
[Description("ms")] ms, /// 1 ms = 0.001 s
[Description("°C")] C, /// * degree Celsius (°C)
[Description("°F")] F, /// degree Fahrenheit
@@ -42,12 +42,11 @@ namespace Config
[Description("Pa")] Pa, /// 1 Pa = 0.01 hPa
[Description("hPa")] hPa, /// 1 hPa = 100 Pa
[Description("mbar")] mbar, /// 1 mbar = 1 hPa = 100 Pa
[Description("kPa")] kPa, /// 1 kPa = 10 hPa = 10000 Pa
[Description("inHg")] inHg, /// 1 inHg = 33.864 hPa
[Description("psi")] psi, /// 1 psi = 0.0689475729 bar
[Description("bar")] bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
[Description("kPa")] kPa, /// 1 kPa = 10 HPa
[Description("MPa")] MPa, /// 1 MPa = 10000 hPa
[Description("mbar")] mbar, /// 1 mbar = 1 hPa = 100 Pa
[Description("bar")] bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
[Description("inHg")] inHg, /// 1 inHg = 33.864 hPa
[Description("R%")] RPct, /// * 1 R%
@@ -69,8 +68,6 @@ namespace Config
[Description("kWh")] kWh, /// 1 kWh = 3600000 J
[Description("MWh")] MWh, /// 1 MWh = 3600000000 J
[Description("uS/cm")] uSpcm, /// * 1 uS/cm
#if LANG_PL
[Description("imp/l")] ppl, /// * 1 pulse/l
[Description("imp/dm3")] ppdm3, /// * 1 pulse/dm3
@@ -115,14 +112,12 @@ namespace Config
[Description("Impulse")] Pulses,
[Description("Impulse/l")] PulsePerLtr,
[Description("Impulse/kWh")] PulsePerKWh,
[Description("Leitfähigkeit")] Conductivity,
/// Quantities without units and conversions
[Description("Nummer")] Number,
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum und Uhrzeit")] DateTime,
[Description("Aufgezählt")] Enumerated,
#elif LANG_PL
[Description("Objętość")] Volume,
[Description("Przepływ")] Flow,
@@ -138,14 +133,12 @@ namespace Config
[Description("Impulsy")] Pulses,
[Description("Impulsy/litr")] PulsePerLtr,
[Description("Impulsy/kWh")] PulsePerKWh,
[Description("Przewodność")] Conductivity,
/// Quantities without units and conversions
[Description("Numer")] Number,
[Description("Tekst")] String,
[Description("Boolean")] Boolean,
[Description("Data i czas")] DateTime,
[Description("Wyliczone")] Enumerated,
#elif LANG_CS
[Description("Objem")] Volume,
[Description("Průtok")] Flow,
@@ -161,14 +154,12 @@ namespace Config
[Description("Pulzy")] Pulses,
[Description("Pulzy/litr")] PulsePerLtr,
[Description("Pulzy/kWh")] PulsePerKWh,
[Description("Vodivost")] Conductivity,
/// Quantities without units and conversions
[Description("Počet")] Number,
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum a čas")] DateTime,
[Description("Vyjmenované")] Enumerated,
#elif LANG_IT
[Description("Volume")] Volume,
[Description("Flusso")] Flow,
@@ -184,14 +175,12 @@ namespace Config
[Description("Impulso")] Pulses,
[Description("Impulso/litro")] PulsePerLtr,
[Description("Impulso/kWh")] PulsePerKWh,
[Description("Conduttività")] Conductivity,
/// Quantities without units and conversions
[Description("Numero")] Number,
[Description("Stringa")] String,
[Description("Boolean")] Boolean,
[Description("Data e ora")] DateTime,
[Description("Enumerato")] Enumerated,
#else
[Description("Volume")] Volume,
[Description("Flow")] Flow,
@@ -207,14 +196,12 @@ namespace Config
[Description("Pulses")] Pulses,
[Description("Pulses/liter")] PulsePerLtr,
[Description("Pulses/kWh")] PulsePerKWh,
[Description("Conductivity")] Conductivity,
/// Quantities without units and conversions
[Description("Number")] Number,
[Description("String")] String,
[Description("Boolean")] Boolean,
[Description("Date and time")] DateTime,
[Description("Enumerated")] Enumerated,
#endif
Count,
}
@@ -229,7 +216,7 @@ namespace Config
public static bool IsDefaultUnit(Unit unit)
{
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C || unit == Unit.bar || unit == Unit.RPct ||
unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 || unit == Unit.J || unit == Unit.ppl || unit == Unit.ppkWh || unit == Unit.uSpcm;
unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 || unit == Unit.J || unit == Unit.ppl || unit == Unit.ppkWh;
}
public static bool IsQuantity(Unit units, Quantity quantity)
@@ -277,11 +264,10 @@ namespace Config
case Unit.hPa:
case Unit.mbar:
case Unit.kPa:
case Unit.inHg:
case Unit.psi:
case Unit.bar:
case Unit.MPa:
return Config.Quantity.Pressure;
case Unit.inHg:
return Config.Quantity.Pressure;
case Unit.RPct:
return Config.Quantity.Humidity;
@@ -322,9 +308,6 @@ namespace Config
case Unit.kWhpp:
return Config.Quantity.PulsePerKWh;
case Unit.uSpcm:
return Config.Quantity.Conductivity;
default:
return Config.Quantity.Number;
}
@@ -344,8 +327,6 @@ namespace Config
public static bool IsPulses(Unit units) { return IsQuantity(units, Config.Quantity.Pulses); }
public static bool IsPulsePerLtr(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerLtr); }
public static bool IsPulsePerKWh(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerKWh); }
public static bool IsConductivity(Unit units) { return IsQuantity(units, Config.Quantity.Conductivity); }
public static double ConvertTo(Unit units, double v)
@@ -385,10 +366,9 @@ namespace Config
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 29.53 * v; /// 1 inHg =
case Unit.psi: return 14.50377378 * v; /// 1 psi =
case Unit.bar: return v; /// 1 bar = 1000 mbar = 100000 Pa
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
case Unit.inHg: return 29.53 * v; /// 1 inHg = 33.864 hPa
/// Error: internal representation in %
case Unit.Pct: return v; /// 1 %
@@ -459,10 +439,9 @@ namespace Config
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
case Unit.psi: return 0.0689475729 * v;/// 1 psi = 0.0689475729 bar
case Unit.bar: return v; /// 1 bar = 1000 mbar = 100000 Pa
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
/// Error: internal representation in %
case Unit.Pct: return v; /// 1 %
-23
View File
@@ -1,23 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
namespace DataStreamInterface
{
public class DataFrame
{
public readonly UInt64 ID; /// Frame ID
public readonly double Time; /// Time stamp in units of time
public readonly double Volume; /// Volume in units of volume
public readonly double[] Quantity; /// An array of optional quantities in their respective units
public DataFrame(UInt64 id, double time, double volume, double[] quantity)
{
ID = id;
Time = time;
Volume = volume;
Quantity = quantity;
}
}
}
@@ -1,61 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataStreamInterface</RootNamespace>
<AssemblyName>DataStreamInterface</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataFrame.cs" />
<Compile Include="Enums.cs" />
<Compile Include="IDataStreamMeter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Doc\Software interface for datastream water meters.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-95
View File
@@ -1,95 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
namespace DataStreamInterface
{
public enum Unit
{
None,
pulse,
degree,
/// Volume
ml, /// 0.001 l
l, /// * 1 liter = 1 l
dm3, /// 1 dm3 = 1 l
m3, /// 1000 l
gal_UK, /// 1 gal(UK) = 4.54609 l
gal_US, /// 1 gal(US) = 3.78541178 l
/// Flow
lph, /// 1 liter/h
m3ph, /// * 1 m3/h = 1000 l/h
/// Mass
g, /// 0.001 kg
kg, /// * 1 kilogram
t, /// 1000 kg
lb, /// 0.45359237 kg
/// Time
ms, /// 1 ms = 0.001 s
s, /// * 1 second = 1 s
min, /// 1 min = 60 s
hour, /// 1 hour = 60 min = 3600 s
/// Temperature
C, /// * degree Celsius (°C)
F, /// degree Fahrenheit
K, /// degree Kelvin
/// Pressure
Pa, /// 1 Pa = 0.01 hPa
hPa, /// 1 hPa = 100 Pa
mbar, /// 1 mbar = 1 hPa = 100 Pa
kPa, /// 1 kPa = 10 HPa
inHg, /// 1 inHg = 33.864 hPa
bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
MPa, /// 1 MPa = 10000 hPa
/// Humidity
RPct, /// * 1 R%
/// Relative error
Promile, /// 1 promile = 0.1 %
Pct, /// * 1 %
/// Length
mm, /// * 1 millimeter
cm, /// 1 cm = 10 mm
inch, /// 1 inch = 25.4 mm
foot, /// 1 foot = 304.8 mm
m, /// 1 m = 1000 mm
/// Density
kgpm3, /// * 1 kg/m3 = 0.001 kg/l
kgpl, /// 1 kg/l = 1000 kg/m3
/// Energy
J, /// * 1 Joul
kJ, /// 1 kJ = 1000 J
MJ, /// 1 MJ = 1000000 J
Wh, /// 1 Wh = 3600 J
kWh, /// 1 kWh = 3600000 J
MWh, /// 1 MWh = 3600000000 J
/// Meter coefficient - volume
ppl, /// * 1 pulse/l
ppdm3, /// * 1 pulse/dm3
degpl, /// * 1 degree/l
degpdm3, /// * 1 degree/dm3
lpp, /// * 1 l/pulse
dm3pp, /// * 1 dm3/pulse
lpdeg, /// * 1 l/degree
dm3pdeg, /// * 1 dm3/degree
/// Meter coefficient - energy
ppkWh, /// * 1 pulse/kWh
kWhpp, /// * 1 kWh/pulse
Count
}
}
-114
View File
@@ -1,114 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataStreamInterface
{
public interface IDataStreamMeter
{
/// <summary>
/// Get state of the connected data stream meter
/// </summary>
/// <param name="state">Current state of the meter</param>
/// <returns>true when successful</returns>
bool GetState(out int state, out string parameter);
/// <summary>
/// Set state of the connected data stream meter
/// </summary>
/// <param name="state">Required state of the meter</param>
/// <returns>true when successful</returns>
bool SetState(int state, string parameter);
/// <summary>
/// Establish connection with a data stream meter
/// </summary>
/// <param name="connectionParameters">Connection parameters</param>
/// <param name="meterId">Meter ID (e.g. serial number)</param>
/// <returns>true when successful</returns>
bool OpenConnection(string connectionParameters, out string meterId);
/// <summary>
/// Closes connection with the data stream meter
/// </summary>
/// <returns>true when successful</returns>
bool CloseConnection();
/// <summary>
/// Stars saving measurement results into internal data structures of the component.
/// Each data frame obtains a unique ID.
/// The very first data fraim obrains ID = 0.
/// </summary>
/// <returns>true when successful</returns>
bool StartMeasurement();
/// <summary>
/// Stops saving measurement results into internal data structures of the component.
/// Updates ID of the last date frame received from the meter.
/// </summary>
/// <param name="lastFrameID">ID of the last date frame</param>
/// <returns>true when successful</returns>
bool StopMeasurement(out UInt64 lastFrameID);
///------------------------------------------------
/// Units of time, volume and optional quantities
///------------------------------------------------
/// <summary>
/// Returns time units (s, ms, ...)
/// </summary>
Unit GetTimeUnits();
/// <summary>
/// Returns units of volume (ml, l, ...)
/// </summary>
Unit GetVolumeUnits();
///-----------------------------------------------
/// Ooptional quantities: count, units, captions
///-----------------------------------------------
/// <summary>
/// Returns count of optional quantities in each data frame
/// </summary>
/// <returns>Count of optional quantities</returns>
int GetQuantitiesCount();
/// <summary>
/// Returns units of the specified quantity
/// </summary>
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
Unit GetQuantityUnits(int quanityNr);
/// <summary>
/// Returns caption of the specified quantity
/// </summary>
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
string GetQuantityCaption(int quanityNr);
///---------------------------
/// Datastream data exchange
///---------------------------
/// <summary>
/// Retuns 'count' data frames starting with data frame with ID = 'id'
/// </summary>
/// <param name="id">First frame ID</param>
/// <param name="count">Frames count</param>
/// <returns>Selected data frames</returns>
DataFrame[] GetFrames(UInt64 id, int count);
/// <summary>
/// Returns ID of the data frame where time equals or exceeds the specified time.
/// When time of the first frame (ID=0) is larger then specified time, function returns 0.
/// </summary>
/// <param name="time">Time</param>
/// <returns>ID of the data frame at or after the pecified time</returns>
UInt64 GetID(double time);
}
}
@@ -1,38 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DataStreamInterface")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DataStreamInterface")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e44458ee-b635-4d7c-a763-20054399e817")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
+525
View File
@@ -0,0 +1,525 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="12.2">
<zoom_level>8</zoom_level>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>0</y>
<w>40</w>
<h>64</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;48;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.InitialState</type>
<coordinates>
<x>416</x>
<y>8</y>
<w>16</w>
<h>16</h>
</coordinates>
<panel_attributes>i</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>328</x>
<y>48</y>
<w>192</w>
<h>32</h>
</coordinates>
<panel_attributes>'Test Start' transition sequence</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>56</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.RegionEndState</type>
<coordinates>
<x>416</x>
<y>96</y>
<w>16</w>
<h>16</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>88</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>344</x>
<y>128</y>
<w>160</w>
<h>32</h>
</coordinates>
<panel_attributes>Initialize (single) test results</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>136</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.Decision</type>
<coordinates>
<x>408</x>
<y>176</y>
<w>32</w>
<h>32</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>184</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.Decision</type>
<coordinates>
<x>408</x>
<y>224</y>
<w>32</w>
<h>32</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.RegionEndState</type>
<coordinates>
<x>416</x>
<y>272</y>
<w>16</w>
<h>16</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>232</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>264</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>344</x>
<y>304</y>
<w>160</w>
<h>32</h>
</coordinates>
<panel_attributes>Make the water tank empty</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>312</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.RegionEndState</type>
<coordinates>
<x>416</x>
<y>352</y>
<w>16</w>
<h>16</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>344</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>272</x>
<y>168</y>
<w>160</w>
<h>128</h>
</coordinates>
<panel_attributes>lt=&lt;-
m2=[Emptying always]</panel_attributes>
<additional_attributes>144;112;24;112;24;24;136;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>408</x>
<y>216</y>
<w>176</w>
<h>160</h>
</coordinates>
<panel_attributes>lt=&lt;-
m2=[Enough room in tank]</panel_attributes>
<additional_attributes>24;144;160;144;160;24;32;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>344</x>
<y>384</y>
<w>160</w>
<h>32</h>
</coordinates>
<panel_attributes>Set the required water flow</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>392</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>328</x>
<y>432</y>
<w>192</w>
<h>32</h>
</coordinates>
<panel_attributes>Measure the 'start' mass of water</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>440</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>344</x>
<y>480</y>
<w>160</w>
<h>32</h>
</coordinates>
<panel_attributes>Start the test (diverter, etc.)</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>488</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.RegionEndState</type>
<coordinates>
<x>416</x>
<y>528</y>
<w>16</w>
<h>16</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>344</x>
<y>560</y>
<w>160</w>
<h>32</h>
</coordinates>
<panel_attributes>Read intermediate results</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>520</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>568</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.Decision</type>
<coordinates>
<x>408</x>
<y>608</y>
<w>32</w>
<h>32</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>272</x>
<y>512</y>
<w>160</w>
<h>128</h>
</coordinates>
<panel_attributes>lt=&lt;-
m2=[Test in progress]</panel_attributes>
<additional_attributes>144;24;24;24;24;112;136;112</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>616</y>
<w>40</w>
<h>64</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;48;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.Text</type>
<coordinates>
<x>424</x>
<y>640</y>
<w>104</w>
<h>24</h>
</coordinates>
<panel_attributes>[Test completed]</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>328</x>
<y>664</y>
<w>192</w>
<h>32</h>
</coordinates>
<panel_attributes>Measure the 'end' mass of water</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>328</x>
<y>712</y>
<w>192</w>
<h>32</h>
</coordinates>
<panel_attributes>Calculate and save this test results</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>672</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>720</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.Decision</type>
<coordinates>
<x>408</x>
<y>760</y>
<w>32</w>
<h>32</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>768</y>
<w>40</w>
<h>64</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;48;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>408</x>
<y>80</y>
<w>216</w>
<h>712</h>
</coordinates>
<panel_attributes>lt=&lt;-
m2=[More repetitions to be done]</panel_attributes>
<additional_attributes>24;24;200;24;200;696;32;696</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.Text</type>
<coordinates>
<x>264</x>
<y>792</y>
<w>160</w>
<h>24</h>
</coordinates>
<panel_attributes>[All test repetitions completed]</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>328</x>
<y>816</y>
<w>192</w>
<h>32</h>
</coordinates>
<panel_attributes>Stop any running tests, etc. (?)</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>328</x>
<y>864</y>
<w>192</w>
<h>32</h>
</coordinates>
<panel_attributes>'Test End' transition sequence</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>824</y>
<w>40</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;40;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>400</x>
<y>872</y>
<w>40</w>
<h>64</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>24;48;24;24</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.FinalState</type>
<coordinates>
<x>416</x>
<y>920</y>
<w>16</w>
<h>16</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
</diagram>
+261
View File
@@ -0,0 +1,261 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="12.2">
<zoom_level>10</zoom_level>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>400</x>
<y>120</y>
<w>120</w>
<h>40</h>
</coordinates>
<panel_attributes>Load the default
procedure
</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>430</x>
<y>40</y>
<w>50</w>
<h>100</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;80;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.InitialState</type>
<coordinates>
<x>450</x>
<y>60</y>
<w>20</w>
<h>20</h>
</coordinates>
<panel_attributes>i</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>400</x>
<y>190</y>
<w>120</w>
<h>40</h>
</coordinates>
<panel_attributes>Reset valves,
pumps, etc.
</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>430</x>
<y>130</y>
<w>50</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;60;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>400</x>
<y>260</y>
<w>120</w>
<h>40</h>
</coordinates>
<panel_attributes>Detect cameras</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>430</x>
<y>200</y>
<w>50</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;60;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>370</x>
<y>550</y>
<w>180</w>
<h>110</h>
</coordinates>
<panel_attributes>complex
state
--
some more...
-.</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>370</x>
<y>390</y>
<w>180</w>
<h>60</h>
</coordinates>
<panel_attributes>Display prompt, enable
'Cycle' and 'Test' buttons
and wait for a selection</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>430</x>
<y>320</y>
<w>50</w>
<h>90</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;70;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.RegionEndState</type>
<coordinates>
<x>450</x>
<y>330</y>
<w>20</w>
<h>20</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>430</x>
<y>270</y>
<w>50</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;60;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.Decision</type>
<coordinates>
<x>440</x>
<y>480</y>
<w>40</w>
<h>40</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>430</x>
<y>420</y>
<w>50</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;60;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>430</x>
<y>490</y>
<w>50</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;60;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>620</x>
<y>430</y>
<w>160</w>
<h>40</h>
</coordinates>
<panel_attributes>Disable 'Cycle'
and 'Test' buttons</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.State</type>
<coordinates>
<x>620</x>
<y>360</y>
<w>160</w>
<h>40</h>
</coordinates>
<panel_attributes>Empty the tank</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>450</x>
<y>440</y>
<w>270</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>250;30;250;60;30;60</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>670</x>
<y>370</y>
<w>50</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;30;30;60</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>440</x>
<y>310</y>
<w>280</w>
<h>70</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>30;30;260;30;260;50</additional_attributes>
</element>
<element>
<type>com.umlet.element.custom.Text</type>
<coordinates>
<x>490</x>
<y>480</y>
<w>180</w>
<h>20</h>
</coordinates>
<panel_attributes>'Empty a tank' selected
</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.custom.Text</type>
<coordinates>
<x>290</x>
<y>520</y>
<w>160</w>
<h>20</h>
</coordinates>
<panel_attributes>'Cycle' or 'Test' selected
</panel_attributes>
<additional_attributes/>
</element>
</diagram>
+73
View File
@@ -0,0 +1,73 @@
Otazky:
-------
- ako pouzit T6
- co je 'T to Open' pri RV
- na co sluzia VI2P, VI3P a VI4P
TODO:
-----
- nefunguje pumpa P3
- nahlad na cestu v procedure
- purgeStart a purgeEnd --> transitionSteps/Sequences
- horeuvedene pre RegulValve
- volba procedury nie je zablokovana pocas testov
- vsetky Target... v Process tabe
- Hmotnosti:
1 netarovat, merat okamzitu,
2 nulovacia procedura na tlacitko manualne,
3 pri starte sa spytat ci vynulovat vahy
- Preco sa nenacitaju zmeny v Test-e ???
- pouzit oneskorenie na ventily
- skontrolovat doc (freq v Hz)
Demo version:
- pouzit progress bary na vyber testu
- vycistit Measurement
- simulacia skonci pri druhom 'start_measurement'
- pri simulacii sa meni mass pri merani end-mass (klapka by mala byt vypnuta!)
- otvorit Proceduru (v dalsom okne v zamknutom stave) aj ked je okno Procedures zamknute
- pridat seriove cisla do parametrov komponentov
- zapamatavat si sirky stlpcov v PathsDlg, ... (aj inde)
- skontroluj vsetky ListViewEx-y + skorsie spracovanie vysledkov (dolezite aj pre spravnu tvorbu noveho mena)
- preco posledne okno skace
- chyba spracovanie procedure / metrology2 Tol.Abzug, Fehl.Korr -+
- vsetky mena stlpcov a tabov do Strings.xxx
Testovanie na stanici:
- pouzivat skutocne 'rvalves'
- ked vyberiem priamo Q1, Q2, Q3 (poskonceni predchadzajuceho testu), neprepise sa obsah combo boxu
- prislusne EtPulses by mali ist cez RegisterReader komponent + common RegisterReader pre Master
- ako je to s WM0 ...
- na zaciatku zmerat vahu a dovolit vypustit tanky
- updatovat vahu - obrazok = je nespravna kapacita vahy
- spracovanie vysledkov podla excelu: corr. na hustotu vzduchu (zavazie), corr. na hustotu vody v zav. od teploty
- podpora pre zbieranie vysledkov
- logovanie vysledkov do excelu
- zastavit vodu na konci skusky
- Pri nastavovani prietoku nie je nic vidno
- pouzivat skutocne 'rvalves'
- pri vytvarani testov vyberat cesty podla prietoku
- ked sa zada cesta napisanim mena = skontrolovat
- zapamatat si stav ventilu pri prietoku
- nulovanie = nulovanie vahy
- zmenit text: tarovanie -> vypustanie
- pripravit IDC100: !ReadRegisterOp, Idc100.GetValue-SetValue (na konci), GetState a ukoncenie operacie
- sub-sekvencie pre Q-set a metody
- zobrazit typizovanu schemu
Neskor:
- nevidno ci su neulozene zmeny
- upozornenie pri cancel ak su neulozene zmeny
- spravne updatovat tlacitka ked su FixedItems (FixedRows)
- ked odomknem Komponenty tak sa zrusi vyber
- vaha ToString - prve zobrazit capacity
- moznost menenia poradia aj v components
- rozdelit ventily podla ciest?
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

+91
View File
@@ -0,0 +1,91 @@
Assumption
----------
The installation consists of one or more similar test benches. Each test bench is controlled by one PC-based computer. In addition, one or more PC-s can run the same application and manipulated data shared by the test benches (e.g. PC located in offices). All PC-s run the same version of software (this is a must now - Munich - in the future we can try to deal with backward/forward compatibility issues).
Development environment
-----------------------
- Visual Studio 2012 Professional
- Database: MySQL (???)
User iterface
-------------
- WindowsFormsApplication
- Main part of the window occupies a tab control with hidden tabs
(see http://weblogs.asp.net/kdente/archive/2005/11/14/430591.aspx)
Tabs swithing is done programatically
Tabs:
Procedure
- Procedure Info (summary, header)
- Procedure History (changes)
- Procedure Metrology
- Procedure Technical
- Procedure Purge
- Procedure End
- Procedure Adjustment
- Procedure View
- Procedure Inputs
Home
Insert
Results
- Results
- Results D
- Meters Ch
- Temp Ch
- Pressure
Bench parameters
- Technical
- Balance
- Temperature
- Pressure
- Flowmeter
- Density
Logs
Sensus Testbench Framework application settings consist of
----------------------------------------------------------
S1. Local settings stored on each PC
S1.1 language settings, appearance, etc. (no other impact on the system function)
S1.2 specification of databases used to store other settings (see 2.)
There might be several sets of DB settings (1.2) when one should be able to access more test benches. When starting the system, this is indicated on the login screen as 'Test bench'/'Pruefstation'.
S2. Settings stored in databases:
S2.1 'users' (typically shared between all benches - centralized access control)
S2.2 'watermeter_types' info (typically shared between more benches)
S2.3 'test_procedures' (typically shared between more identical benches)
S2.4 'metrological_parameters' of the system (always unique for each system, not shared)
S2.5 'watermeters' info (typically centralized / shared)
S2.6 'test_results' (typically centralized / shared)
etc.
The databases might be running either on the local PC or remote,
each database might be used by a single bench, or shared by more test benches. This configured in 1.2.
Application can be used to:
---------------------------
A1. Change local settings (S1.1, S1.2)
A2. Change settings stored in the databases
A3. Control system and run test procedures - this is only possible on PC-s controlling the benches. When procedure is started, local copy of necessary information from the DB-s is made to avoid problems.
User access control:
--------------------
U1. Access to
U1.1 information read
U1.2 information write/modify
U1.3 action start
is controlled by an access control mechanism.
U2. Users
U3. Groups
Each user is a member of one or more groups. In case needed, a group with a single user is created. Access to information/actions is granted to groups.
Muenich: Grooups are 'Tester',
'Testing specialist',
'Head of lab'
'Maintenance specialist'
'Metrologist'
'Calibration specialist'
U4. When necessary, system prompts user to authenticate himself/herself (login dialog). Authentication is invalidated as follows (optional):
U4.1 When user closes the dialog, which was protected.
U4.2 After certain time period
U4.3 Never
+25
View File
@@ -0,0 +1,25 @@
<log4net>
<!-- A1 is set to be a ConsoleAppender -->
<appender name="A1" type="log4net.Appender.ConsoleAppender">
<!-- A1 uses PatternLayout -->
<layout type="log4net.Layout.PatternLayout">
<!-- Print the date in ISO 8601 format -->
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
</layout>
</appender>
<!-- Set root logger level to DEBUG and its only appender to A1 -->
<root>
<level value="DEBUG" />
<appender-ref ref="A1" />
</root>
<!-- Print only messages of level WARN or above in the package NHibernate -->
<logger name="NHibernate">
<level value="WARN" />
</logger>
<logger name="TestBenchFramework.BenchControl.StateMachine">
<level value="WARN" />
</logger>
</log4net>
+27
View File
@@ -0,0 +1,27 @@
foreach (var device in devices) device.RunDeviceBefore(); . . . . . . in StateMachine.Worker()
State.Create(...).AddOperation(...).AddOperation(...).EnterState() . . in the sequence in Execute(...)
foreach (var device in devices) device.RunDeviceAfter(); . . . . . . . in WaitRunDevsRunOps()
WaitNextTick() (may throw QuitStateMachineException) . . . . . . . . in WaitRunDevsRunOps()
foreach (var device in devices) device.RunDeviceBefore(); . . . . . . in WaitRunDevsRunOps()
IList<Event> events = State.RunOperations(); . . . . . . . . . . . . . in WaitRunDevsRunOps()
foreach (var device in devices) device.RunDeviceAfter(); . . . . . . . in WaitRunDevsRunOps()
WaitNextTick() (may throw QuitStateMachineException) . . . . . . . . in WaitRunDevsRunOps()
foreach (var device in devices) device.RunDeviceBefore(); . . . . . . in WaitRunDevsRunOps()
IList<Event> events = State.RunOperations(); . . . . . . . . . . . . . in WaitRunDevsRunOps()
State.Create(...).AddOperation(...).AddOperation(...).EnterState() . . in the sequence in Execute(...)
foreach (var device in devices) device.RunDeviceAfter(); . . . . . . . in WaitRunDevsRunOps()
WaitNextTick() (may throw QuitStateMachineException) . . . . . . . . in WaitRunDevsRunOps()
foreach (var device in devices) device.RunDeviceBefore(); . . . . . . in WaitRunDevsRunOps()
IList<Event> events = State.RunOperations(); . . . . . . . . . . . . . in WaitRunDevsRunOps()
foreach (var device in devices) device.RunDeviceAfter(); . . . . . . . in WaitRunDevsRunOps()
WaitNextTick() (assume QuitStateMachineException thrown) . . . . . . in WaitRunDevsRunOps()
foreach (var device in devices) device.RunDeviceBefore(); . . . . . . in StateMachine.Worker() catch()
State.RunOperations(); . . . . . . . . . . . . . . . . . . . . . . . . in StateMachine.Worker() catch()
State.Empty.EnterState(); . . . . . . . . . . . . . . . . . . . . . . in StateMachine.Worker() catch()
foreach (var device in devices) device.RunDeviceAfter(); . . . . . . . in StateMachine.Worker() catch()
foreach (var device in devices) device.StopDevice(); . . . . . . . . . in StateMachine.Worker() catch()
+11
View File
@@ -0,0 +1,11 @@
Showing tabs in the designer:
- select mainTabControl
- in Properies change SizeMode to normal
- in Properies change ItemSize to 0; 20
Hiding tabs in the designer:
- select mainTabControl
- in Properies change SizeMode to Fixed
- in Poperties change ItemSize to 0; 1
+4
View File
@@ -0,0 +1,4 @@
af242843887f3bdcc52e485483356eaccd37ba67a35941530bd195a8310fc7d5aca8560576dfb62ad5a4bd2df789a5e8be068e62e7c976d6eeed8d63abbd9909
= staratura
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
-148
View File
@@ -1,148 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CF5BE6CD-A224-4B58-950D-14040E7A3C6A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EventViewer</RootNamespace>
<AssemblyName>EventViewer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentNHibernate, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Security" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EventViewerWnd.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="EventViewerWnd.Designer.cs">
<DependentUpon>EventViewerWnd.cs</DependentUpon>
</Compile>
<Compile Include="Forms\EventDetailsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\EventDetailsDlg.Designer.cs">
<DependentUpon>EventDetailsDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\SettingsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\SettingsDlg.designer.cs">
<DependentUpon>SettingsDlg.cs</DependentUpon>
</Compile>
<Compile Include="LocalSettings.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="EventViewerWnd.resx">
<DependentUpon>EventViewerWnd.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\EventDetailsDlg.resx">
<DependentUpon>EventDetailsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SettingsDlg.resx">
<DependentUpon>SettingsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Resources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.sk.resx" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Events\Events.csproj">
<Project>{5d9b49e3-cdf9-4a27-80b4-58141d0eb0e0}</Project>
<Name>Events</Name>
</ProjectReference>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6e5cb0e9-e1b6-4e5d-ac6e-b1049e180f2b}</Project>
<Name>Users</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-186
View File
@@ -1,186 +0,0 @@
namespace EventViewer
{
partial class EventViewerWnd
{
/// <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 Windows Form 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.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.userLoginButton = new System.Windows.Forms.Button();
this.eventsSelectionGroupBox = new System.Windows.Forms.GroupBox();
this.recentEventsRadioButton = new System.Windows.Forms.RadioButton();
this.unreadEventsRadioButton = new System.Windows.Forms.RadioButton();
this.allEventsRadioButton = new System.Windows.Forms.RadioButton();
this.settingsButton = new System.Windows.Forms.Button();
this.eventsListView = new Common.UIControls.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.eventsSelectionGroupBox.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.userLoginButton);
this.splitContainer1.Panel1.Controls.Add(this.eventsSelectionGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.settingsButton);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.eventsListView);
this.splitContainer1.Size = new System.Drawing.Size(863, 592);
this.splitContainer1.SplitterDistance = 100;
this.splitContainer1.TabIndex = 0;
//
// userLoginButton
//
this.userLoginButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.userLoginButton.Location = new System.Drawing.Point(636, 17);
this.userLoginButton.Name = "userLoginButton";
this.userLoginButton.Size = new System.Drawing.Size(100, 37);
this.userLoginButton.TabIndex = 4;
this.userLoginButton.Text = "User login";
this.userLoginButton.UseVisualStyleBackColor = true;
this.userLoginButton.Click += new System.EventHandler(this.userLoginButton_Click);
//
// eventsSelectionGroupBox
//
this.eventsSelectionGroupBox.Controls.Add(this.recentEventsRadioButton);
this.eventsSelectionGroupBox.Controls.Add(this.unreadEventsRadioButton);
this.eventsSelectionGroupBox.Controls.Add(this.allEventsRadioButton);
this.eventsSelectionGroupBox.Location = new System.Drawing.Point(22, 5);
this.eventsSelectionGroupBox.Name = "eventsSelectionGroupBox";
this.eventsSelectionGroupBox.Size = new System.Drawing.Size(269, 92);
this.eventsSelectionGroupBox.TabIndex = 3;
this.eventsSelectionGroupBox.TabStop = false;
this.eventsSelectionGroupBox.Text = "Select events";
//
// recentEventsRadioButton
//
this.recentEventsRadioButton.AutoSize = true;
this.recentEventsRadioButton.Location = new System.Drawing.Point(24, 42);
this.recentEventsRadioButton.Name = "recentEventsRadioButton";
this.recentEventsRadioButton.Size = new System.Drawing.Size(95, 17);
this.recentEventsRadioButton.TabIndex = 1;
this.recentEventsRadioButton.TabStop = true;
this.recentEventsRadioButton.Text = "Recent events";
this.recentEventsRadioButton.UseVisualStyleBackColor = true;
this.recentEventsRadioButton.CheckedChanged += new System.EventHandler(this.recentEventsRadioButton_CheckedChanged);
//
// unreadEventsRadioButton
//
this.unreadEventsRadioButton.AutoSize = true;
this.unreadEventsRadioButton.Location = new System.Drawing.Point(24, 20);
this.unreadEventsRadioButton.Name = "unreadEventsRadioButton";
this.unreadEventsRadioButton.Size = new System.Drawing.Size(120, 17);
this.unreadEventsRadioButton.TabIndex = 0;
this.unreadEventsRadioButton.TabStop = true;
this.unreadEventsRadioButton.Text = "Unconfirmed events";
this.unreadEventsRadioButton.UseVisualStyleBackColor = true;
this.unreadEventsRadioButton.CheckedChanged += new System.EventHandler(this.unreadEventsRadioButton_CheckedChanged);
//
// allEventsRadioButton
//
this.allEventsRadioButton.AutoSize = true;
this.allEventsRadioButton.Location = new System.Drawing.Point(24, 64);
this.allEventsRadioButton.Name = "allEventsRadioButton";
this.allEventsRadioButton.Size = new System.Drawing.Size(71, 17);
this.allEventsRadioButton.TabIndex = 2;
this.allEventsRadioButton.TabStop = true;
this.allEventsRadioButton.Text = "All events";
this.allEventsRadioButton.UseVisualStyleBackColor = true;
this.allEventsRadioButton.CheckedChanged += new System.EventHandler(this.allEventsRadioButton_CheckedChanged);
//
// settingsButton
//
this.settingsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.settingsButton.Location = new System.Drawing.Point(748, 17);
this.settingsButton.Name = "settingsButton";
this.settingsButton.Size = new System.Drawing.Size(100, 37);
this.settingsButton.TabIndex = 0;
this.settingsButton.Text = "Settings";
this.settingsButton.UseVisualStyleBackColor = true;
this.settingsButton.Click += new System.EventHandler(this.settingsButton_Click);
//
// eventsListView
//
this.eventsListView.AllowColumnReorder = true;
this.eventsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.eventsListView.DoubleClickActivation = false;
this.eventsListView.FullRowSelect = true;
this.eventsListView.GridLines = true;
this.eventsListView.Location = new System.Drawing.Point(0, 0);
this.eventsListView.Name = "eventsListView";
this.eventsListView.Size = new System.Drawing.Size(863, 488);
this.eventsListView.TabIndex = 0;
this.eventsListView.UseCompatibleStateImageBehavior = false;
this.eventsListView.View = System.Windows.Forms.View.Details;
this.eventsListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.eventsListView_ColumnClick);
this.eventsListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.eventsListView_MouseDoubleClick);
//
// EventViewerWnd
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(863, 592);
this.Controls.Add(this.splitContainer1);
this.Name = "EventViewerWnd";
this.Text = "Event viewer";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EventViewerWnd_FormClosing);
this.Load += new System.EventHandler(this.EventViewerWnd_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.eventsSelectionGroupBox.ResumeLayout(false);
this.eventsSelectionGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button settingsButton;
private Common.UIControls.ListViewEx eventsListView;
private System.Windows.Forms.GroupBox eventsSelectionGroupBox;
private System.Windows.Forms.RadioButton unreadEventsRadioButton;
private System.Windows.Forms.RadioButton allEventsRadioButton;
private System.Windows.Forms.Button userLoginButton;
private System.Windows.Forms.RadioButton recentEventsRadioButton;
}
}
-364
View File
@@ -1,364 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using NHibernate;
using Common.UIControls;
using Events;
using Events.Entities;
using EventViewer.Resources;
using System.Drawing;
namespace EventViewer
{
public partial class EventViewerWnd : Form
{
public const int Dpi100pct = 96;
int currentDpi;
enum Column
{
DateTime,
Bench,
Source,
Class,
Severity,
Message,
Count
}
ISession session;
IList<Subscriber> subscribers;
IList<Event> events;
SortOrder sortOrder = SortOrder.Ascending;
int sortColumn = -1; /// 0-based index of column to be used for sorting
EViewerOption eViewerOption;
string loginUserName;
string currentUser
{
get
{
if (!string.IsNullOrEmpty(loginUserName))
{
return loginUserName;
}
else if (Program.LocalSettings != null && Program.LocalSettings.NonAnonymousAccess && !string.IsNullOrEmpty(Program.LocalSettings.UserName))
{
return Program.LocalSettings.UserName;
}
else
{
return null;
}
}
}
/// The following 3 private variables determine whether list of events is redrawn
EViewerOption lastEViewerOption;
string lastUser;
int lastRecentTimePeriodInDays;
public EventViewerWnd()
{
InitializeComponent();
loginUserName = null;
eViewerOption = string.IsNullOrEmpty(currentUser) ? EViewerOption.RecentEvents : EViewerOption.UnreadEvents;
lastEViewerOption = EViewerOption.Undefined;
lastRecentTimePeriodInDays = 0;
Localize();
currentDpi = (int)this.CreateGraphics().DpiX;
LocalSettings ls = Program.LocalSettings;
eventsListView.Columns.Add(Strings.Date_time, (ls.ColWid1 > 0) ? ls.ColWid1 : 80 * currentDpi / Dpi100pct);
eventsListView.Columns.Add(Strings.Bench, (ls.ColWid2 > 0) ? ls.ColWid2 : 50 * currentDpi / Dpi100pct);
eventsListView.Columns.Add(Strings.Source, (ls.ColWid3 > 0) ? ls.ColWid3 : 100 * currentDpi / Dpi100pct);
eventsListView.Columns.Add(Strings.Class, (ls.ColWid4 > 0) ? ls.ColWid4 : 60 * currentDpi / Dpi100pct);
eventsListView.Columns.Add(Strings.Severity, (ls.ColWid5 > 0) ? ls.ColWid5 : 70 * currentDpi / Dpi100pct);
eventsListView.Columns.Add(Strings.Message, (ls.ColWid6 > 0) ? ls.ColWid6 : 500 * currentDpi / Dpi100pct);
LoadUISettings();
}
void Localize()
{
RedrawTitle();
eventsSelectionGroupBox.Text = Strings.Event_selection;
unreadEventsRadioButton.Text = Strings.Unread_events;
recentEventsRadioButton.Text = Strings.Recent_events;
allEventsRadioButton.Text = Strings.All_events;
settingsButton.Text = Strings.Settings;
userLoginButton.Text = Strings.User_login;
}
void RedrawTitle()
{
Text = string.Format("{0} {1} {2}", Strings.Event_viewer, Program.Version, !string.IsNullOrEmpty(currentUser) ? string.Format("({0})", currentUser) : string.Empty);
}
private void EventViewerWnd_Load(object sender, EventArgs e)
{
try
{
DB.DbType = DBType.MySql;
DB.ConnectionString = Program.LocalSettings.ConnectionString;
session = DB.CreateSession();
subscribers = session.QueryOver<Subscriber>().List();
unreadEventsRadioButton.Checked = true;
}
catch (Exception exc)
{
MessageBox.Show(string.Format("{0}{1}{2}", Strings.Cannot_connect_to_the_database, Environment.NewLine, exc.Message),
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private void unreadEventsRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (unreadEventsRadioButton.Checked) eViewerOption = EViewerOption.UnreadEvents;
Redraw();
}
private void recentEventsRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (recentEventsRadioButton.Checked) eViewerOption = EViewerOption.RecentEvents;
Redraw();
}
private void allEventsRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (allEventsRadioButton.Checked) eViewerOption = EViewerOption.AllEvents;
Redraw();
}
/// <summary>
/// Redraw events
/// </summary>
/// <param name="allEvents">true = Display all events (also confirmed read)</param>
void Redraw(bool redrawAlways = false)
{
int days = Program.LocalSettings.RecentTimeDays;
if (!redrawAlways &&
lastEViewerOption == eViewerOption &&
lastUser == currentUser &&
lastRecentTimePeriodInDays == days)
{
return; /// Do not redraw the list of events
}
try
{
if (eViewerOption == EViewerOption.AllEvents)
{
/// Read all events
events = session.QueryOver<Event>().List();
}
else if (eViewerOption == EViewerOption.RecentEvents)
{
/// Read events from tha last 'recentTimePeriodInDays' days
events = session.QueryOver<Event>()
.Where(e => (e.TimeStamp >= DateTime.Now - new TimeSpan(days, 0, 0, 0)))
.List();
}
else if (!string.IsNullOrEmpty(loginUserName))
{
/// Read unread events of the specified user
events = session.QueryOver<Event>()
.JoinQueryOver<Subscriber>(e => e.Subscribers)
.Where(s => (s.Name == string.Format("User_{0}", loginUserName)))
.List<Event>();
}
else
{
/// Read unread events of all users
events = session.QueryOver<Event>()
.JoinQueryOver<Subscriber>(e => e.Subscribers)
.List<Event>();
for (int i = 0; i < events.Count; i++)
{
for (int j = events.Count - 1; j > i; j--)
{
if (events[i].Id == events[j].Id) events.RemoveAt(j);
}
}
}
eventsListView.Items.Clear();
foreach (var e in events) AddOne(e);
lastEViewerOption = eViewerOption;
lastUser = currentUser;
lastRecentTimePeriodInDays = days;
}
catch (Exception exc)
{
MessageBox.Show(string.Format("{0}{1}{2}", Strings.Cannot_connect_to_the_database, Environment.NewLine, exc.Message),
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
void AddOne(Event evnt)
{
ListViewItem lvi = new ListViewItem(evnt.TimeStamp.ToString("dd.MM.yyyy HH:mm"));
lvi.Tag = evnt;
lvi.SubItems.Add(evnt.Bench);
lvi.SubItems.Add(evnt.Source);
lvi.SubItems.Add(evnt.EventClass.ToString());
{
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(evnt.Severity.ToString());
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = Utils.GetSeverityColor(evnt.Severity);
lvi.SubItems[lvi.SubItems.Count - 1].ForeColor = Utils.GetSeverityColor(evnt.Severity, true);
}
lvi.SubItems.Add(evnt.Message);
eventsListView.Items.Add(lvi);
}
private void eventsListView_ColumnClick(object sender, ColumnClickEventArgs e)
{
if (e.Column == sortColumn)
{
sortOrder = (sortOrder == SortOrder.Ascending) ? SortOrder.Descending : SortOrder.Ascending;
}
else
{
/// Clicked on another column header => set sortOrder to SortOrder.Ascending
sortColumn = e.Column;
sortOrder = SortOrder.Ascending;
}
switch ((Column)sortColumn)
{
default:
case Column.DateTime:
eventsListView.ListViewItemSorter = new LviDateTimeColumnComparer(sortColumn, sortOrder);
break;
case Column.Bench:
case Column.Source:
case Column.Class:
case Column.Severity:
case Column.Message:
eventsListView.ListViewItemSorter = new LviTextColumnComparer(sortColumn, sortOrder);
break;
}
eventsListView.SetSortIcon(sortColumn, sortOrder);
eventsListView.Sort();
}
private void eventsListView_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (eventsListView.SelectedIndices.Count != 1) return;
Event evnt = eventsListView.SelectedItems[0].Tag as Events.Entities.Event;
if (evnt == null) return;
bool enableConfirmReadButton = (session != null) && (eViewerOption == EViewerOption.UnreadEvents) && !string.IsNullOrEmpty(currentUser);
if ((new Forms.EventDetailsDlg(evnt, enableConfirmReadButton)).ShowDialog() == DialogResult.OK)
{
/// Reading selected event was confirmed => delete subscriber from this event.Subscribers
foreach (var s in subscribers)
{
if (s.Name == string.Format("User_{0}", currentUser))
{
session.CreateSQLQuery(string.Format("DELETE FROM `eventsubscriber` WHERE Event_id = {0} AND Subscriber_id = {1};", evnt.Id, s.Id))
.ExecuteUpdate();
session.Flush();
Redraw(true);
break;
}
}
}
}
private void settingsButton_Click(object sender, EventArgs e)
{
//Users.Entities.GID[] groupsWithAccess = new Users.Entities.GID[] { Users.Entities.GID.Administrators };
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg(true);
if (dlg.ShowDialog() == DialogResult.OK)
{
if ((new Forms.SettingsDlg()).ShowDialog() == DialogResult.OK)
{
Close();
}
}
}
private void userLoginButton_Click(object sender, EventArgs e)
{
try
{
Users.GlobalData.RemoteUsersDB = new Users.DBSettings(Users.Entities.DBType.MySql, Program.LocalSettings.UsersDBConnString);
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg();
if (dlg.ShowDialog() == DialogResult.OK)
{
loginUserName = dlg.UserName;
RedrawTitle();
Redraw();
}
}
catch (Exception)
{
}
}
private void EventViewerWnd_FormClosing(object sender, FormClosingEventArgs e)
{
SaveUISettings();
}
private void LoadUISettings()
{
LocalSettings ls = Program.LocalSettings;
if (ls != null)
{
WindowState = (ls.WndMaximized ? FormWindowState.Maximized : FormWindowState.Normal);
Width = (ls.WndWidth > 0) ? ls.WndWidth : 800;
Height = (ls.WndHeight > 0) ? ls.WndHeight : 420;
Left = (ls.WndLeft != 0) ? ls.WndLeft : 150;
Top = (ls.WndTop != 0) ? ls.WndTop : 150;
}
}
private void SaveUISettings()
{
/// Obtain ProcedureDlg dimensions, etc.
bool isMaximized = (WindowState == FormWindowState.Maximized);
int left = (WindowState == FormWindowState.Normal) ? Location.X : RestoreBounds.Left;
int top = (WindowState == FormWindowState.Normal) ? Location.Y : RestoreBounds.Top;
int width = (WindowState == FormWindowState.Normal) ? Size.Width : RestoreBounds.Width;
int height = (WindowState == FormWindowState.Normal) ? Size.Height : RestoreBounds.Height;
LocalSettings ls = Program.LocalSettings;
if (ls != null && (ls.WndMaximized != isMaximized ||
ls.WndLeft != left ||
ls.WndTop != top ||
ls.WndWidth != width ||
ls.WndHeight != height ||
ls.ColWid1 != eventsListView.Columns[0].Width ||
ls.ColWid2 != eventsListView.Columns[1].Width ||
ls.ColWid3 != eventsListView.Columns[2].Width ||
ls.ColWid4 != eventsListView.Columns[3].Width ||
ls.ColWid5 != eventsListView.Columns[4].Width ||
ls.ColWid6 != eventsListView.Columns[5].Width))
{
/// At least one ProcedureDlg dimension differs => Update local settings and save them
ls.WndMaximized = isMaximized;
ls.WndLeft = left;
ls.WndTop = top;
ls.WndWidth = width;
ls.WndHeight = height;
ls.ColWid1 = eventsListView.Columns[0].Width;
ls.ColWid2 = eventsListView.Columns[1].Width;
ls.ColWid3 = eventsListView.Columns[2].Width;
ls.ColWid4 = eventsListView.Columns[3].Width;
ls.ColWid5 = eventsListView.Columns[4].Width;
ls.ColWid6 = eventsListView.Columns[5].Width;
ls.Save();
}
}
}
}
-232
View File
@@ -1,232 +0,0 @@
namespace EventViewer.Forms
{
partial class EventDetailsDlg
{
/// <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 Windows Form 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.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.closeButton = new System.Windows.Forms.Button();
this.confirmReadButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 44);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 1;
this.label2.Text = "label2";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(13, 71);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 2;
this.label3.Text = "label3";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(13, 98);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(35, 13);
this.label4.TabIndex = 3;
this.label4.Text = "label4";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(13, 125);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 4;
this.label5.Text = "label5";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(13, 152);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(35, 13);
this.label6.TabIndex = 5;
this.label6.Text = "label6";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(13, 199);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(35, 13);
this.label7.TabIndex = 6;
this.label7.Text = "label7";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(96, 14);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(138, 20);
this.textBox1.TabIndex = 7;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(96, 41);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(138, 20);
this.textBox2.TabIndex = 8;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(96, 68);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(138, 20);
this.textBox3.TabIndex = 9;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(96, 95);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(138, 20);
this.textBox4.TabIndex = 10;
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(96, 122);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(138, 20);
this.textBox5.TabIndex = 11;
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(96, 149);
this.textBox6.Multiline = true;
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(538, 40);
this.textBox6.TabIndex = 12;
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(96, 196);
this.textBox7.Multiline = true;
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(538, 60);
this.textBox7.TabIndex = 13;
//
// closeButton
//
this.closeButton.Location = new System.Drawing.Point(531, 14);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(103, 35);
this.closeButton.TabIndex = 14;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
//
// confirmReadButton
//
this.confirmReadButton.Location = new System.Drawing.Point(531, 55);
this.confirmReadButton.Name = "confirmReadButton";
this.confirmReadButton.Size = new System.Drawing.Size(103, 35);
this.confirmReadButton.TabIndex = 15;
this.confirmReadButton.Text = "Confirm read";
this.confirmReadButton.UseVisualStyleBackColor = true;
this.confirmReadButton.Click += new System.EventHandler(this.confirmReadButton_Click);
//
// EventDetailsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(651, 267);
this.Controls.Add(this.confirmReadButton);
this.Controls.Add(this.closeButton);
this.Controls.Add(this.textBox7);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "EventDetailsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Event details";
this.Load += new System.EventHandler(this.EventDetailsDlg_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.Button closeButton;
private System.Windows.Forms.Button confirmReadButton;
}
}
-67
View File
@@ -1,67 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using EventViewer.Resources;
namespace EventViewer.Forms
{
public partial class EventDetailsDlg : Form
{
Events.Entities.Event evnt;
public EventDetailsDlg()
{
InitializeComponent();
Localize();
}
public EventDetailsDlg(Events.Entities.Event evnt, bool enableConfirmReadButton)
: this()
{
this.evnt = evnt;
confirmReadButton.Visible = confirmReadButton.Enabled = enableConfirmReadButton;
}
void Localize()
{
Text = Strings.Event_details;
label1.Text = Strings.Date_time;
label2.Text = Strings.Bench;
label3.Text = Strings.Source;
label4.Text = Strings.Class;
label5.Text = Strings.Severity;
label6.Text = Strings.Message;
label7.Text = Strings.More_information;
closeButton.Text = Strings.Close;
confirmReadButton.Text = Strings.Confirm_read;
}
private void EventDetailsDlg_Load(object sender, EventArgs e)
{
if (evnt != null)
{
textBox1.Text = evnt.TimeStamp.ToString();
textBox2.Text = evnt.Bench;
textBox3.Text = evnt.Source;
textBox4.Text = evnt.EventClass.ToString();
textBox5.Text = evnt.Severity.ToString();
textBox6.Text = evnt.Message;
textBox7.Text = evnt.MoreInfo;
}
}
private void closeButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void confirmReadButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
}
}
-223
View File
@@ -1,223 +0,0 @@
namespace EventViewer.Forms
{
partial class SettingsDlg
{
/// <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 Windows Form 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.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.eventsDBConnStringTextBox = new System.Windows.Forms.TextBox();
this.eventsDBConnStringLabel = new System.Windows.Forms.Label();
this.userNameLabel = new System.Windows.Forms.Label();
this.userGroupBox = new System.Windows.Forms.GroupBox();
this.userNameTextBox = new System.Windows.Forms.TextBox();
this.nonAnonymousAccessCheckBox = new System.Windows.Forms.CheckBox();
this.usersDBConnStringLabel = new System.Windows.Forms.Label();
this.usersDBConnStringTextBox = new System.Windows.Forms.TextBox();
this.languageTextBox = new System.Windows.Forms.TextBox();
this.languageLabel = new System.Windows.Forms.Label();
this.recentTimeDaysTextBox = new System.Windows.Forms.TextBox();
this.recentTimeDaysLabel = new System.Windows.Forms.Label();
this.userGroupBox.SuspendLayout();
this.SuspendLayout();
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(686, 172);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(85, 38);
this.okButton.TabIndex = 0;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// 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(781, 172);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(85, 38);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// eventsDBConnStringTextBox
//
this.eventsDBConnStringTextBox.Location = new System.Drawing.Point(164, 21);
this.eventsDBConnStringTextBox.Name = "eventsDBConnStringTextBox";
this.eventsDBConnStringTextBox.Size = new System.Drawing.Size(708, 20);
this.eventsDBConnStringTextBox.TabIndex = 5;
//
// eventsDBConnStringLabel
//
this.eventsDBConnStringLabel.AutoSize = true;
this.eventsDBConnStringLabel.Location = new System.Drawing.Point(26, 24);
this.eventsDBConnStringLabel.Name = "eventsDBConnStringLabel";
this.eventsDBConnStringLabel.Size = new System.Drawing.Size(87, 13);
this.eventsDBConnStringLabel.TabIndex = 4;
this.eventsDBConnStringLabel.Text = "Events database";
//
// userNameLabel
//
this.userNameLabel.AutoSize = true;
this.userNameLabel.Location = new System.Drawing.Point(14, 29);
this.userNameLabel.Name = "userNameLabel";
this.userNameLabel.Size = new System.Drawing.Size(58, 13);
this.userNameLabel.TabIndex = 0;
this.userNameLabel.Text = "User name";
//
// userGroupBox
//
this.userGroupBox.Controls.Add(this.userNameTextBox);
this.userGroupBox.Controls.Add(this.nonAnonymousAccessCheckBox);
this.userGroupBox.Controls.Add(this.userNameLabel);
this.userGroupBox.Location = new System.Drawing.Point(12, 86);
this.userGroupBox.Name = "userGroupBox";
this.userGroupBox.Size = new System.Drawing.Size(871, 63);
this.userGroupBox.TabIndex = 18;
this.userGroupBox.TabStop = false;
//
// userNameTextBox
//
this.userNameTextBox.Location = new System.Drawing.Point(152, 26);
this.userNameTextBox.Name = "userNameTextBox";
this.userNameTextBox.Size = new System.Drawing.Size(197, 20);
this.userNameTextBox.TabIndex = 8;
//
// nonAnonymousAccessCheckBox
//
this.nonAnonymousAccessCheckBox.AutoSize = true;
this.nonAnonymousAccessCheckBox.Location = new System.Drawing.Point(17, 0);
this.nonAnonymousAccessCheckBox.Name = "nonAnonymousAccessCheckBox";
this.nonAnonymousAccessCheckBox.Size = new System.Drawing.Size(140, 17);
this.nonAnonymousAccessCheckBox.TabIndex = 2;
this.nonAnonymousAccessCheckBox.Text = "Non anonymous access";
this.nonAnonymousAccessCheckBox.UseVisualStyleBackColor = true;
this.nonAnonymousAccessCheckBox.CheckedChanged += new System.EventHandler(this.nonAnonymousAccessCheckBox_CheckedChanged);
//
// usersDBConnStringLabel
//
this.usersDBConnStringLabel.AutoSize = true;
this.usersDBConnStringLabel.Location = new System.Drawing.Point(26, 54);
this.usersDBConnStringLabel.Name = "usersDBConnStringLabel";
this.usersDBConnStringLabel.Size = new System.Drawing.Size(81, 13);
this.usersDBConnStringLabel.TabIndex = 6;
this.usersDBConnStringLabel.Text = "Users database";
//
// usersDBConnStringTextBox
//
this.usersDBConnStringTextBox.Location = new System.Drawing.Point(164, 51);
this.usersDBConnStringTextBox.Name = "usersDBConnStringTextBox";
this.usersDBConnStringTextBox.Size = new System.Drawing.Size(708, 20);
this.usersDBConnStringTextBox.TabIndex = 7;
//
// languageTextBox
//
this.languageTextBox.Location = new System.Drawing.Point(164, 190);
this.languageTextBox.Name = "languageTextBox";
this.languageTextBox.Size = new System.Drawing.Size(53, 20);
this.languageTextBox.TabIndex = 20;
//
// languageLabel
//
this.languageLabel.AutoSize = true;
this.languageLabel.Location = new System.Drawing.Point(26, 193);
this.languageLabel.Name = "languageLabel";
this.languageLabel.Size = new System.Drawing.Size(55, 13);
this.languageLabel.TabIndex = 19;
this.languageLabel.Text = "Language";
//
// recentTimeDaysTextBox
//
this.recentTimeDaysTextBox.Location = new System.Drawing.Point(164, 160);
this.recentTimeDaysTextBox.Name = "recentTimeDaysTextBox";
this.recentTimeDaysTextBox.Size = new System.Drawing.Size(53, 20);
this.recentTimeDaysTextBox.TabIndex = 22;
//
// recentTimeDaysLabel
//
this.recentTimeDaysLabel.AutoSize = true;
this.recentTimeDaysLabel.Location = new System.Drawing.Point(26, 163);
this.recentTimeDaysLabel.Name = "recentTimeDaysLabel";
this.recentTimeDaysLabel.Size = new System.Drawing.Size(132, 13);
this.recentTimeDaysLabel.TabIndex = 21;
this.recentTimeDaysLabel.Text = "Recent time period in days";
//
// SettingsDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(895, 228);
this.Controls.Add(this.recentTimeDaysTextBox);
this.Controls.Add(this.recentTimeDaysLabel);
this.Controls.Add(this.languageTextBox);
this.Controls.Add(this.usersDBConnStringLabel);
this.Controls.Add(this.languageLabel);
this.Controls.Add(this.userGroupBox);
this.Controls.Add(this.usersDBConnStringTextBox);
this.Controls.Add(this.eventsDBConnStringLabel);
this.Controls.Add(this.eventsDBConnStringTextBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SettingsDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Settings";
this.Load += new System.EventHandler(this.SettingsDlg_Load);
this.userGroupBox.ResumeLayout(false);
this.userGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.TextBox eventsDBConnStringTextBox;
private System.Windows.Forms.Label eventsDBConnStringLabel;
private System.Windows.Forms.Label userNameLabel;
private System.Windows.Forms.GroupBox userGroupBox;
private System.Windows.Forms.CheckBox nonAnonymousAccessCheckBox;
private System.Windows.Forms.Label usersDBConnStringLabel;
private System.Windows.Forms.TextBox usersDBConnStringTextBox;
private System.Windows.Forms.TextBox userNameTextBox;
private System.Windows.Forms.TextBox languageTextBox;
private System.Windows.Forms.Label languageLabel;
private System.Windows.Forms.TextBox recentTimeDaysTextBox;
private System.Windows.Forms.Label recentTimeDaysLabel;
}
}
-85
View File
@@ -1,85 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using EventViewer.Resources;
namespace EventViewer.Forms
{
public partial class SettingsDlg : Form
{
public SettingsDlg()
{
InitializeComponent();
Localize();
ManageCheckGroupBox(nonAnonymousAccessCheckBox, userGroupBox);
}
void Localize()
{
Text = Strings.Settings;
eventsDBConnStringLabel.Text = Strings.Events_database;
usersDBConnStringLabel.Text = Strings.Users_database;
nonAnonymousAccessCheckBox.Text = Strings.Non_anonymous_access;
userNameLabel.Text = Strings.User_name;
recentTimeDaysLabel.Text = Strings.Recent_time_period_in_days;
languageLabel.Text = Strings.Language;
okButton.Text = Strings.OK;
cancelButton.Text = Strings.Cancel;
}
private void SettingsDlg_Load(object sender, EventArgs e)
{
LocalSettings ls = Program.LocalSettings;
eventsDBConnStringTextBox.Text = ls.ConnectionString;
usersDBConnStringTextBox.Text = ls.UsersDBConnString;
nonAnonymousAccessCheckBox.Checked = ls.NonAnonymousAccess;
userNameTextBox.Text = ls.UserName;
recentTimeDaysTextBox.Text = ls.RecentTimeDays.ToString();
languageTextBox.Text = ls.Language;
}
private void okButton_Click(object sender, EventArgs e)
{
int days;
LocalSettings ls = Program.LocalSettings;
ls.ConnectionString = eventsDBConnStringTextBox.Text;
ls.UsersDBConnString = usersDBConnStringTextBox.Text;
ls.NonAnonymousAccess = nonAnonymousAccessCheckBox.Checked;
ls.UserName = userNameTextBox.Text;
if (int.TryParse(recentTimeDaysTextBox.Text, out days) && days > 0) ls.RecentTimeDays = days;
ls.Language = languageTextBox.Text;
ls.Save();
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void nonAnonymousAccessCheckBox_CheckedChanged(object sender, EventArgs e)
{
ManageCheckGroupBox(nonAnonymousAccessCheckBox, userGroupBox);
}
private void ManageCheckGroupBox(CheckBox chk, GroupBox grp)
{
/// Make sure the CheckBox isn't in the GroupBox. This will only happen the first time.
if (chk.Parent == grp)
{
grp.Parent.Controls.Add(chk); /// Reparent the CheckBox so it's not in the GroupBox.
chk.Location = new Point(chk.Left + grp.Left, chk.Top + grp.Top); /// Adjust the CheckBox's location.
chk.BringToFront(); /// Move the CheckBox to the top of the stacking order.
}
/// Enable or disable the GroupBox.
grp.Enabled = chk.Checked;
}
}
}
-212
View File
@@ -1,212 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Xml.Serialization;
namespace EventViewer
{
/// <summary>
/// Class to be serialized to an XML file...
/// </summary>
[XmlRootAttribute("EventViewer")]
public class LocalSettings
{
static XmlSerializer serializer = XmlSerializer.FromTypes(new[] { typeof(LocalSettings) })[0];
///
/// Configuration file ecryption/decryption key and initialization vector
///
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
/// Common
public string ConnectionString;
public bool NonAnonymousAccess;
public string UserName;
public string UsersDBConnString;
public int RecentTimeDays;
public string Language;
/// MainWnd
public int WndLeft;
public int WndTop;
public int WndWidth;
public int WndHeight;
public bool WndMaximized;
public int ColWid1;
public int ColWid2;
public int ColWid3;
public int ColWid4;
public int ColWid5;
public int ColWid6;
public LocalSettings()
{
}
public LocalSettings(bool createNew)
: this()
{
/// Default settings
/// Common
#if DEBUG
ConnectionString = "SERVER=localhost; DATABASE=test-e; UID=root; PASSWORD=kraken; CHARSET=utf8";
UsersDBConnString = "SERVER=localhost; DATABASE=test; UID=root; PASSWORD=kraken; CHARSET=utf8;";
#else
ConnectionString = "SERVER=10.42.128.16; DATABASE=st_wr_shared_events; UID=v9305784; PASSWORD=p89344390; CHARSET=utf8";
UsersDBConnString = "SERVER=10.42.128.16; DATABASE=st_wr_shared_config; UID=u9305784; PASSWORD=p89344390; CHARSET=utf8;";
#endif
RecentTimeDays = 7;
Language = "sk";
/// MainWnd
WndLeft = 20;
WndTop = 20;
WndWidth = 1250;
WndHeight = 750;
WndMaximized = false;
ColWid1 = 80;
ColWid2 = 50;
ColWid3 = 100;
ColWid4 = 60;
ColWid5 = 70;
ColWid6 = 500;
}
/// <summary>
/// Load public fields of this class from the XML file.
/// </summary>
/// <param name="fileName">Name of the file.</param>
/// <returns>
/// LocalSettings object or null when Load() fails
/// </returns>
public static LocalSettings Load(string fileName)
{
try
{
bool isEncrypted = true;
using (StreamReader reader = new StreamReader(fileName))
{
isEncrypted = !reader.ReadLine().StartsWith("<?xml version=");
reader.Close();
}
if (isEncrypted)
{
/// Write settings to a string
StringBuilder plain = new StringBuilder();
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(fileName, FileMode.Open))
{
using (ICryptoTransform decryptor = aes.CreateDecryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, decryptor, CryptoStreamMode.Read))
{
using (MemoryStream mStream = new MemoryStream())
{
using (var writer = new BinaryWriter(mStream))
{
int data;
while ((data = cs.ReadByte()) != -1)
{
if (data != 0) writer.Write((byte)data);
}
writer.Flush();
mStream.Position = 0;
using (var reader = new StreamReader(mStream))
{
LocalSettings ls = serializer.Deserialize(reader) as LocalSettings;
//log.WarnFormat("Succesfully loaded and decrypted from '{0}'", fileName);
return ls;
}
}
}
}
}
}
}
}
else
{
using (StreamReader reader = new StreamReader(fileName))
{
LocalSettings ls = serializer.Deserialize(reader) as LocalSettings;
//log.WarnFormat("Succesfully loaded from '{0}'", fileName);
return ls;
}
}
}
catch (Exception e)
{
//log.ErrorFormat("Failed to load from '{0}': {1}", fileName, e.Message);
return null;
}
}
/// <summary>
/// Save public fields of this class to the XML file.
/// </summary>
public void Save()
{
try
{
#if false
/// Write settings to an unencrypted file
using (TextWriter writer = new StreamWriter(Program.LocalSettingsFileName))
{
serializer.Serialize(writer, this);
log.Warn("LocalSettings succesfully saved");
}
#else
/// Encrypt and write to file 'Program.LocalSettingsFileName'
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(Program.LocalSettingsFileName, FileMode.Create))
{
using (ICryptoTransform encryptor = aes.CreateEncryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, encryptor, CryptoStreamMode.Write))
{
using (MemoryStream mStream = new MemoryStream())
{
using (var writer = new StreamWriter(mStream))
{
/// Serialize and write settings to a memory stream
serializer.Serialize(writer, this);
writer.Flush();
mStream.Position = 0;
using (var reader = new StreamReader(mStream))
{
/// Encrypt and write to file 'Program.LocalSettingsFileName'
int data;
while ((data = mStream.ReadByte()) != -1) cs.WriteByte((byte)data);
//log.WarnFormat("Succesfully encrypted and saved to '{0}'", Program.LocalSettingsFileName);
}
}
}
}
}
}
}
#endif
}
catch (Exception e)
{
//log.ErrorFormat("Failed to save to '{0}': {1}", Program.LocalSettingsFileName, e.Message);
}
}
}
}
-156
View File
@@ -1,156 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Windows.Forms;
using EventViewer.Resources;
namespace EventViewer
{
static class Program
{
/// Program information
public static string Version; /// version string
public static DateTime BuildDateTime; /// date and time of program build
/// Local settings
public static string ExecutableDirectory;
public static string ConfigDirectory;
public static string LocalSettingsFileName;
public static string LocalSettingsBackupName;
public static LocalSettings LocalSettings;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
/// Program version string
System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
Version ver = thisAssembly.GetName().Version;
Version = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
BuildDateTime = new System.IO.FileInfo(thisAssembly.Location).LastWriteTime;
/// Local program configuration directory including the trailing backslash
ExecutableDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
/// Config directory is a sibling directory of the executable directory
ConfigDirectory = Path.Combine(ExecutableDirectory, "..", string.Format("Cfg{0}", (args.Length >= 1) ? args[0] : string.Empty));
LocalSettingsFileName = Path.Combine(ConfigDirectory, "config.xml");
LocalSettingsBackupName = Path.Combine(ConfigDirectory, "config.backup.xml");
///// Configue and start logging
//log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(ConfigDirectory + "log4netConfig.xml"));
//log = LogManager.GetLogger(typeof(Program));
//log.Fatal("------------------------------------------------------------------------------------------------");
//log.Fatal("started");
///
/// Load the local settings
///
bool isConfigReadOnly = false;
LocalSettings = LocalSettings.Load(Program.LocalSettingsFileName);
if (LocalSettings == null)
{
/// Loading local seetings from regular config file failed. Use the backup
LocalSettings = LocalSettings.Load(Program.LocalSettingsBackupName);
if (LocalSettings == null)
{
MessageBox.Show(Strings.No_program_settings_found + Strings.Using_default_settings,
string.Empty,
MessageBoxButtons.OK,
MessageBoxIcon.Information);
/// Create new default settings
LocalSettings = new LocalSettings(true);
}
try
{
/// Create config directory if it is missing
if (!Directory.Exists(ConfigDirectory)) Directory.CreateDirectory(ConfigDirectory);
/// Save settings (overwrite a wrong file in case loading settings failed
LocalSettings.Save();
}
catch (Exception)
{
isConfigReadOnly = true;
}
}
else
{
try
{
/// Loading local seetings from the regular config file was successful. Update the backup
File.Copy(Program.LocalSettingsFileName, Program.LocalSettingsBackupName, true);
}
catch (Exception)
{
isConfigReadOnly = true;
}
}
try
{
string culture = (LocalSettings.Language != null) ? LocalSettings.Language.Replace('_', '-') : "EN";
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(culture);
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture);
}
catch (Exception e)
{
string msg = e.Message;
MessageBox.Show(Strings.Selected_language_is_not_supported + Environment.NewLine + Strings.Using_English,
Strings.Warning,
MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en");
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
}
/// This belongs to Application.Run(new MainWnd()) ...
/// and should be executed before opening 'loginDlg'
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
{
/// Open the main application window
Application.Run(new EventViewerWnd());
}
catch (Exception e)
{
//LogException(log, "Exception in Application.Run(new ResultsBrowserWnd(args))", e);
}
finally
{
/// Save local settings
LocalSettings.Save();
}
/// Close Fluent NHibernate
/// Todo
}
static void MyHandler(object sender, UnhandledExceptionEventArgs args)
{
//LogException(log, "Unhandled exception", (Exception)args.ExceptionObject);
}
//static void LogException(ILog log, string description, Exception e)
//{
// log.FatalFormat("---------------( {0} )---------------", description);
// log.FatalFormat("Message : {0}", e.Message);
// if (e.InnerException != null)
// {
// log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
// }
// log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
// log.Fatal("--------------------------------------");
//}
}
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EventViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EventViewer")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b031f658-ee6d-452d-8bc8-fa833c30c359")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-71
View File
@@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace EventViewer.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EventViewer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
-117
View File
@@ -1,117 +0,0 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-30
View File
@@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace EventViewer.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
-7
View File
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
-351
View File
@@ -1,351 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace EventViewer.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Strings() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EventViewer.Resources.Strings", typeof(Strings).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to All events.
/// </summary>
internal static string All_events {
get {
return ResourceManager.GetString("All_events", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Bench.
/// </summary>
internal static string Bench {
get {
return ResourceManager.GetString("Bench", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
internal static string Cancel {
get {
return ResourceManager.GetString("Cancel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot connect to the database.
/// </summary>
internal static string Cannot_connect_to_the_database {
get {
return ResourceManager.GetString("Cannot_connect_to_the_database", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Class.
/// </summary>
internal static string Class {
get {
return ResourceManager.GetString("Class", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Close.
/// </summary>
internal static string Close {
get {
return ResourceManager.GetString("Close", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Confirm read.
/// </summary>
internal static string Confirm_read {
get {
return ResourceManager.GetString("Confirm_read", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Date/time.
/// </summary>
internal static string Date_time {
get {
return ResourceManager.GetString("Date_time", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error.
/// </summary>
internal static string Error {
get {
return ResourceManager.GetString("Error", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Event details.
/// </summary>
internal static string Event_details {
get {
return ResourceManager.GetString("Event_details", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Event selection.
/// </summary>
internal static string Event_selection {
get {
return ResourceManager.GetString("Event_selection", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Event viewer.
/// </summary>
internal static string Event_viewer {
get {
return ResourceManager.GetString("Event_viewer", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Events database.
/// </summary>
internal static string Events_database {
get {
return ResourceManager.GetString("Events_database", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Language.
/// </summary>
internal static string Language {
get {
return ResourceManager.GetString("Language", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Message.
/// </summary>
internal static string Message {
get {
return ResourceManager.GetString("Message", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to More information.
/// </summary>
internal static string More_information {
get {
return ResourceManager.GetString("More_information", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No program settings found..
/// </summary>
internal static string No_program_settings_found {
get {
return ResourceManager.GetString("No_program_settings_found", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Non anonymous access (required for confirmation of events).
/// </summary>
internal static string Non_anonymous_access {
get {
return ResourceManager.GetString("Non_anonymous_access", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>
internal static string OK {
get {
return ResourceManager.GetString("OK", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Recent events.
/// </summary>
internal static string Recent_events {
get {
return ResourceManager.GetString("Recent_events", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Recent time period in days.
/// </summary>
internal static string Recent_time_period_in_days {
get {
return ResourceManager.GetString("Recent_time_period_in_days", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Selected language is not supported..
/// </summary>
internal static string Selected_language_is_not_supported {
get {
return ResourceManager.GetString("Selected_language_is_not_supported", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Settings.
/// </summary>
internal static string Settings {
get {
return ResourceManager.GetString("Settings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Severity.
/// </summary>
internal static string Severity {
get {
return ResourceManager.GetString("Severity", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Source.
/// </summary>
internal static string Source {
get {
return ResourceManager.GetString("Source", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unconfirmed events.
/// </summary>
internal static string Unread_events {
get {
return ResourceManager.GetString("Unread_events", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to User login.
/// </summary>
internal static string User_login {
get {
return ResourceManager.GetString("User_login", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to User name.
/// </summary>
internal static string User_name {
get {
return ResourceManager.GetString("User_name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Users database.
/// </summary>
internal static string Users_database {
get {
return ResourceManager.GetString("Users_database", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Using default settings..
/// </summary>
internal static string Using_default_settings {
get {
return ResourceManager.GetString("Using_default_settings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Using English..
/// </summary>
internal static string Using_English {
get {
return ResourceManager.GetString("Using_English", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning.
/// </summary>
internal static string Warning {
get {
return ResourceManager.GetString("Warning", resourceCulture);
}
}
}
}
-216
View File
@@ -1,216 +0,0 @@
<?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>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Error" xml:space="preserve">
<value>Error</value>
</data>
<data name="Event_viewer" xml:space="preserve">
<value>Event viewer</value>
</data>
<data name="No_program_settings_found" xml:space="preserve">
<value>No program settings found.</value>
</data>
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="Selected_language_is_not_supported" xml:space="preserve">
<value>Selected language is not supported.</value>
</data>
<data name="Using_default_settings" xml:space="preserve">
<value>Using default settings.</value>
</data>
<data name="Using_English" xml:space="preserve">
<value>Using English.</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="Bench" xml:space="preserve">
<value>Bench</value>
</data>
<data name="Class" xml:space="preserve">
<value>Class</value>
</data>
<data name="Date_time" xml:space="preserve">
<value>Date/time</value>
</data>
<data name="Message" xml:space="preserve">
<value>Message</value>
</data>
<data name="Severity" xml:space="preserve">
<value>Severity</value>
</data>
<data name="Source" xml:space="preserve">
<value>Source</value>
</data>
<data name="Cannot_connect_to_the_database" xml:space="preserve">
<value>Cannot connect to the database</value>
</data>
<data name="Events_database" xml:space="preserve">
<value>Events database</value>
</data>
<data name="Language" xml:space="preserve">
<value>Language</value>
</data>
<data name="Non_anonymous_access" xml:space="preserve">
<value>Non anonymous access (required for confirmation of events)</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Settings</value>
</data>
<data name="Users_database" xml:space="preserve">
<value>Users database</value>
</data>
<data name="User_name" xml:space="preserve">
<value>User name</value>
</data>
<data name="More_information" xml:space="preserve">
<value>More information</value>
</data>
<data name="Event_details" xml:space="preserve">
<value>Event details</value>
</data>
<data name="Close" xml:space="preserve">
<value>Close</value>
</data>
<data name="Confirm_read" xml:space="preserve">
<value>Confirm read</value>
</data>
<data name="All_events" xml:space="preserve">
<value>All events</value>
</data>
<data name="Event_selection" xml:space="preserve">
<value>Event selection</value>
</data>
<data name="Unread_events" xml:space="preserve">
<value>Unconfirmed events</value>
</data>
<data name="User_login" xml:space="preserve">
<value>User login</value>
</data>
<data name="Recent_events" xml:space="preserve">
<value>Recent events</value>
</data>
<data name="Recent_time_period_in_days" xml:space="preserve">
<value>Recent time period in days</value>
</data>
</root>
-216
View File
@@ -1,216 +0,0 @@
<?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>
<data name="Cancel" xml:space="preserve">
<value>Zrušiť</value>
</data>
<data name="Error" xml:space="preserve">
<value>Chyba</value>
</data>
<data name="Event_viewer" xml:space="preserve">
<value>Prehliadač udalostí</value>
</data>
<data name="No_program_settings_found" xml:space="preserve">
<value>Chýbajú nastavenia programu.</value>
</data>
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="Selected_language_is_not_supported" xml:space="preserve">
<value>Vybraný jazyk nie je podporovaný.</value>
</data>
<data name="Using_default_settings" xml:space="preserve">
<value>Použijú sa štandardné nastavenia.</value>
</data>
<data name="Using_English" xml:space="preserve">
<value>Bude sa používať angličtina.</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Upozornenie</value>
</data>
<data name="Cannot_connect_to_the_database" xml:space="preserve">
<value>Nepodarilo sa pripojiť k databáze</value>
</data>
<data name="Events_database" xml:space="preserve">
<value>Databáza udalostí</value>
</data>
<data name="Language" xml:space="preserve">
<value>Jazyk (language)</value>
</data>
<data name="Non_anonymous_access" xml:space="preserve">
<value>Ne-anonymný prístup (potrebný pre potvrdzovanie udalostí)</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Nastavenia</value>
</data>
<data name="Users_database" xml:space="preserve">
<value>Daatabáza používateľov</value>
</data>
<data name="User_name" xml:space="preserve">
<value>Meno používateľa</value>
</data>
<data name="Class" xml:space="preserve">
<value>Trieda</value>
</data>
<data name="Date_time" xml:space="preserve">
<value>Dátum a čas</value>
</data>
<data name="Message" xml:space="preserve">
<value>Správa</value>
</data>
<data name="More_information" xml:space="preserve">
<value>Viac informácií</value>
</data>
<data name="Severity" xml:space="preserve">
<value>Závažnosť</value>
</data>
<data name="Source" xml:space="preserve">
<value>Pôvod</value>
</data>
<data name="Bench" xml:space="preserve">
<value>Stanica</value>
</data>
<data name="Event_details" xml:space="preserve">
<value>Detaily udalosti</value>
</data>
<data name="Close" xml:space="preserve">
<value>Zavrieť</value>
</data>
<data name="Confirm_read" xml:space="preserve">
<value>Potvrdiť prečítanie</value>
</data>
<data name="All_events" xml:space="preserve">
<value>Všetky udalosti</value>
</data>
<data name="Event_selection" xml:space="preserve">
<value>Výber udalostí</value>
</data>
<data name="Unread_events" xml:space="preserve">
<value>Neprečítané udalosti</value>
</data>
<data name="User_login" xml:space="preserve">
<value>Prihlásenie</value>
</data>
<data name="Recent_events" xml:space="preserve">
<value>Nedávne udalosti</value>
</data>
<data name="Recent_time_period_in_days" xml:space="preserve">
<value>Nedávne obdobie v dňoch</value>
</data>
</root>
-219
View File
@@ -1,219 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using Events.Entities;
namespace Events
{
public static class DB
{
/// <summary> Session factory for all regular sessions, not for CreateEmptyResultsDB(). </summary>
public static ISessionFactory SessionFactory;
/// <summary> Connection string for all sessions </summary>
static string connectionString;
///
public static string ConnectionString
{
get { return connectionString; }
set
{
if (value != connectionString)
{
connectionString = value;
SessionFactory = null; /// Clear SessionFactory on connection string change
}
}
}
/// <summary> Database type (MySQL or SQLite) for all sessions </summary>
private static Entities.DBType dbType;
///
public static Entities.DBType DbType
{
get { return dbType; }
set { dbType = value; SessionFactory = null; }
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
static ISessionFactory CreateSessionFactory()
{
return CreateSessionFactory(false);
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <param name="createDB">true = Create a new DB, false = Regular DB</param>
/// <returns>A database session</returns>
public static ISessionFactory CreateSessionFactory(bool createDB)
{
FluentConfiguration cfg = Fluently.Configure();
switch (dbType)
{
default:
case Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Entities.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.Event>());
if (createDB)
{
return cfg.ExposeConfiguration(BuildSchemaCreate).BuildSessionFactory();
}
else
{
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
}
}
static void BuildSchema(Configuration config)
{
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
new SchemaExport(config).SetOutputFile("db_schema");
}
static void BuildSchemaCreate(Configuration config)
{
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
new SchemaExport(config).Create(true, true);
}
/// Create a NHibernate session for the given database
public static ISession CreateSession()
{
if (string.IsNullOrEmpty(connectionString))
{
throw new Exception("Connection string was not specified");
}
if (SessionFactory == null) SessionFactory = CreateSessionFactory();
return SessionFactory.OpenSession();
}
public static void SaveObject(object obj)
{
SaveObject(CreateSession(), obj);
}
///
public static void SaveObject(ISession session, object obj)
{
using (var transaction = session.BeginTransaction())
{
session.SaveOrUpdate(obj);
try { transaction.Commit(); }
catch { }
}
}
public static void DeleteObject(object obj)
{
DeleteObject(CreateSession(), obj);
}
///
public static void DeleteObject(ISession session, object obj)
{
using (var transaction = session.BeginTransaction())
{
session.Delete(obj);
transaction.Commit();
}
}
/// <summary>
/// Create an empty users database.
/// Database contains only the user 'admin' and the control board component 'CB'.
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyDB()
{
ISessionFactory sessionFactory = CreateSessionFactory(true);
if (sessionFactory == null) return false;
/// Populate the database
using (var session = sessionFactory.OpenSession())
{
using (var transaction = session.BeginTransaction())
{
transaction.Commit();
}
}
return true;
}
/// <summary>
/// Shared data (initially empty)
/// </summary>
public static string BenchName = "undefined";
public static IList<Entities.Event> RecentEvents = null;
static IList<Entities.Subscriber> allSubscribers = null;
/// <summary>
/// Set test bench name used in Events.Entities.Event constructors
/// </summary>
public static void SetBenchName(string benchName)
{
DB.BenchName = benchName;
}
/// <summary>
/// Loads shared data from the database
/// </summary>
public static void LoadSubscribers(ISession session)
{
allSubscribers = session.QueryOver<Subscriber>().List();
}
/// <summary>
/// Loads shared data from the database
/// </summary>
public static void LoadRecentEvents(ISession session, string benchName, int days)
{
RecentEvents = session.QueryOver<Event>()
.Where(e => (e.Bench == benchName))
.And(e => (e.TimeStamp >= DateTime.Now - new TimeSpan(days, 0, 0, 0)))
.List();
}
public static void SaveEvent(ISession session, Event evnt, SubscriberGroup groups)
{
if (allSubscribers == null) return;
IList<Subscriber> thisEventSubscribers = new List<Subscriber>();
foreach (var s in allSubscribers)
{
if ((s.Groups & (long)groups) != 0)
{
/// Subscriber 's' belongs to at least one of SubscriberGroup(s) in 'groups' bit field
thisEventSubscribers.Add(s);
}
}
evnt.Bench = BenchName;
evnt.Subscribers = thisEventSubscribers;
session.SaveOrUpdate(evnt);
session.Flush();
}
}
}
-58
View File
@@ -1,58 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace Events.Entities
{
/// <summary>
/// Identifies the type of a database
/// </summary>
public enum DBType
{
None, /// Database disabled
MySql, /// MySQL database
SQLite, /// SQLite
Count
}
public enum Severity
{
Undefined,
Notification,
Warning,
Error,
FatalError,
Count
}
public enum EventClass
{
Undefined,
EquipmentHW,
Metrology,
TestingProcess,
BadResults,
ComputerResources,
Network,
Other,
Count
}
public enum SubscriberGroup : long
{
None = 0,
Metrology = 1,
Maintenance = 2,
Production = 4,
Management = 8,
Finish = 16,
}
public enum EViewerOption
{
Undefined,
AllEvents,
RecentEvents,
UnreadEvents,
}
}
-51
View File
@@ -1,51 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
namespace Events.Entities
{
public class Event
{
public virtual int Id { get; protected set; }
public virtual DateTime TimeStamp { get; set; }
public virtual string Bench { get; set; }
public virtual string Source { get; set; }
public virtual EventClass EventClass { get; set; }
public virtual Severity Severity { get; set; }
public virtual string Message { get; set; }
public virtual string MoreInfo { get; set; }
public virtual IList<Subscriber> Subscribers { get; set; }
public virtual SubscriberGroup SubscriberGroups { get; set; } /// Not mapped to DB, intermediate inforamtion
public Event()
{
Subscribers = new List<Subscriber>();
}
public Event(string bench, string source, EventClass eventClass, Severity severity, string message, string moreInfo, IList<Subscriber> subscribers, SubscriberGroup subscriberGroups = 0)
: this()
{
TimeStamp = DateTime.Now;
Bench = bench;
Source = source;
EventClass = eventClass;
Severity = severity;
Message = message;
MoreInfo = moreInfo;
if (subscribers != null)
{
foreach (var s in subscribers) Subscribers.Add(s);
}
SubscriberGroups = subscriberGroups;
}
public override string ToString()
{
return string.Format("{0:yyMMdd}_{0:HHmm} {1} {2} {3} {4} {5}", TimeStamp, Bench, Source, EventClass, Severity, Message);
}
}
}
-37
View File
@@ -1,37 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
namespace Events.Entities
{
public class Subscriber
{
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual long Groups { get; set; }
public virtual string DeliveryService { get; set; } /// Aka component class
public virtual string Parameters { get; set; } /// Aka component parameters
public virtual IList<Event> Events { get; set; } /// Group can be a member of a list of users
public Subscriber()
{
Events = new List<Event>();
}
public Subscriber(string name, long groups, string deliveryService, string parameters)
: this()
{
Name = name;
Groups = groups;
DeliveryService = deliveryService;
Parameters = parameters;
}
public override string ToString()
{
return string.Format("{0} {1:X2} {2} {3}", Name, Groups, DeliveryService, Parameters);
}
}
}
-78
View File
@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5D9B49E3-CDF9-4A27-80B4-58141D0EB0E0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Events</RootNamespace>
<AssemblyName>Events</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections">
<HintPath>..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="NHibernate">
<HintPath>..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DB.cs" />
<Compile Include="Entities\Enums.cs" />
<Compile Include="Entities\Event.cs" />
<Compile Include="Entities\Subscriber.cs" />
<Compile Include="Utils.cs" />
<Compile Include="Mappings\EventMap.cs" />
<Compile Include="Mappings\SubscriberMap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="DeliveryServices\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-26
View File
@@ -1,26 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Events.Entities;
namespace Events.Mappings
{
class EventMap : ClassMap<Event>
{
public EventMap()
{
Id(x => x.Id);
Map(x => x.TimeStamp);
Map(x => x.Bench);
Map(x => x.Source);
Map(x => x.EventClass);
Map(x => x.Severity);
Map(x => x.Message);
Map(x => x.MoreInfo);
HasManyToMany(x => x.Subscribers)
.Cascade.SaveUpdate()
.Table("EventSubscriber");
}
}
}
-24
View File
@@ -1,24 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Events.Entities;
namespace Events.Mappings
{
class SubscriberMap : ClassMap<Subscriber>
{
public SubscriberMap()
{
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.Groups);
Map(x => x.DeliveryService);
Map(x => x.Parameters);
HasManyToMany(x => x.Events)
.Cascade.SaveUpdate()
.Inverse()
.Table("EventSubscriber");
}
}
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Events")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Events")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3a68150f-6cfc-4f15-a813-cef63bc8bb47")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-24
View File
@@ -1,24 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using Events.Entities;
namespace Events
{
public class Utils
{
public static Color GetSeverityColor(Severity severity, bool foreColor = false)
{
switch (severity)
{
case Severity.Notification: return foreColor ? Color.White : Color.SteelBlue;
case Severity.Warning: return foreColor ? Color.Black : Color.Orange;
case Severity.Error: return foreColor ? Color.White : Color.Red;
case Severity.FatalError: return foreColor ? Color.White : Color.Purple;
default: return foreColor ? Color.Black : Color.White;
}
}
}
}
-51
View File
@@ -1,51 +0,0 @@
using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GenCode128")]
[assembly: AssemblyDescription("GenCode128")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Chris Wuestefeld")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("2006 Chris Wuestefeld")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
-139
View File
@@ -1,139 +0,0 @@
namespace GenCode128
{
/// <summary>
/// Static tools for determining codes for individual characters in the content
/// </summary>
public static class Code128Code
{
private const int CShift = 98;
private const int CCodeA = 101;
private const int CCodeB = 100;
private const int CStartA = 103;
private const int CStartB = 104;
private const int CStop = 106;
/// <summary>
/// Indicates which code sets can represent a character -- CodeA, CodeB, or either
/// </summary>
public enum CodeSetAllowed
{
CodeA,
CodeB,
CodeAorB
}
/// <summary>
/// Get the Code128 code value(s) to represent an ASCII character, with
/// optional look-ahead for length optimization
/// </summary>
/// <param name="charAscii">The ASCII value of the character to translate</param>
/// <param name="lookAheadAscii">The next character in sequence (or -1 if none)</param>
/// <param name="currentCodeSet">The current codeset, that the returned codes need to follow;
/// if the returned codes change that, then this value will be changed to reflect it</param>
/// <returns>An array of integers representing the codes that need to be output to produce the
/// given character</returns>
public static int[] CodesForChar(int charAscii, int lookAheadAscii, ref CodeSet currentCodeSet)
{
int[] result;
var shifter = -1;
if (!CharCompatibleWithCodeset(charAscii, currentCodeSet))
{
// if we have a lookahead character AND if the next character is ALSO not compatible
if ((lookAheadAscii != -1) && !CharCompatibleWithCodeset(lookAheadAscii, currentCodeSet))
{
// we need to switch code sets
switch (currentCodeSet)
{
case CodeSet.CodeA:
shifter = CCodeB;
currentCodeSet = CodeSet.CodeB;
break;
case CodeSet.CodeB:
shifter = CCodeA;
currentCodeSet = CodeSet.CodeA;
break;
}
}
else
{
// no need to switch code sets, a temporary SHIFT will suffice
shifter = CShift;
}
}
if (shifter != -1)
{
result = new int[2];
result[0] = shifter;
result[1] = CodeValueForChar(charAscii);
}
else
{
result = new int[1];
result[0] = CodeValueForChar(charAscii);
}
return result;
}
/// <summary>
/// Tells us which codesets a given character value is allowed in
/// </summary>
/// <param name="charAscii">ASCII value of character to look at</param>
/// <returns>Which codeset(s) can be used to represent this character</returns>
public static CodeSetAllowed CodesetAllowedForChar(int charAscii)
{
if (charAscii >= 32 && charAscii <= 95)
{
return CodeSetAllowed.CodeAorB;
}
else
{
return charAscii < 32 ? CodeSetAllowed.CodeA : CodeSetAllowed.CodeB;
}
}
/// <summary>
/// Determine if a character can be represented in a given codeset
/// </summary>
/// <param name="charAscii">character to check for</param>
/// <param name="currentCodeSet">codeset context to test</param>
/// <returns>true if the codeset contains a representation for the ASCII character</returns>
public static bool CharCompatibleWithCodeset(int charAscii, CodeSet currentCodeSet)
{
var csa = CodesetAllowedForChar(charAscii);
return csa == CodeSetAllowed.CodeAorB || (csa == CodeSetAllowed.CodeA && currentCodeSet == CodeSet.CodeA)
|| (csa == CodeSetAllowed.CodeB && currentCodeSet == CodeSet.CodeB);
}
/// <summary>
/// Gets the integer code128 code value for a character (assuming the appropriate code set)
/// </summary>
/// <param name="charAscii">character to convert</param>
/// <returns>code128 symbol value for the character</returns>
public static int CodeValueForChar(int charAscii)
{
return charAscii >= 32 ? charAscii - 32 : charAscii + 64;
}
/// <summary>
/// Return the appropriate START code depending on the codeset we want to be in
/// </summary>
/// <param name="cs">The codeset you want to start in</param>
/// <returns>The code128 code to start a barcode in that codeset</returns>
public static int StartCodeForCodeSet(CodeSet cs)
{
return cs == CodeSet.CodeA ? CStartA : CStartB;
}
/// <summary>
/// Return the Code128 stop code
/// </summary>
/// <returns>the stop code</returns>
public static int StopCode()
{
return CStop;
}
}
}
-97
View File
@@ -1,97 +0,0 @@
namespace GenCode128
{
using System.Collections;
using System.Text;
/// <summary>
/// Represent the set of code values to be output into barcode form
/// </summary>
public class Code128Content
{
/// <summary>
/// Create content based on a string of ASCII data
/// </summary>
/// <param name="asciiData">the string that should be represented</param>
public Code128Content(string asciiData)
{
this.Codes = this.StringToCode128(asciiData);
}
/// <summary>
/// Provides the Code128 code values representing the object's string
/// </summary>
public int[] Codes
{
get { return codes; }
set { codes = value; }
}
int[] codes;
/// <summary>
/// Transform the string into integers representing the Code128 codes
/// necessary to represent it
/// </summary>
/// <param name="asciiData">String to be encoded</param>
/// <returns>Code128 representation</returns>
private int[] StringToCode128(string asciiData)
{
// turn the string into ascii byte data
var asciiBytes = Encoding.ASCII.GetBytes(asciiData);
// decide which codeset to start with
var csa1 = asciiBytes.Length > 0
? Code128Code.CodesetAllowedForChar(asciiBytes[0])
: Code128Code.CodeSetAllowed.CodeAorB;
var csa2 = asciiBytes.Length > 1
? Code128Code.CodesetAllowedForChar(asciiBytes[1])
: Code128Code.CodeSetAllowed.CodeAorB;
var currentCodeSet = this.GetBestStartSet(csa1, csa2);
// set up the beginning of the barcode
// assume no codeset changes, account for start, checksum, and stop
var codes = new ArrayList(asciiBytes.Length + 3) { Code128Code.StartCodeForCodeSet(currentCodeSet) };
// add the codes for each character in the string
for (var i = 0; i < asciiBytes.Length; i++)
{
int thischar = asciiBytes[i];
var nextchar = asciiBytes.Length > i + 1 ? asciiBytes[i + 1] : -1;
codes.AddRange(Code128Code.CodesForChar(thischar, nextchar, ref currentCodeSet));
}
// calculate the check digit
var checksum = (int)codes[0];
for (var i = 1; i < codes.Count; i++)
{
checksum += i * (int)codes[i];
}
codes.Add(checksum % 103);
codes.Add(Code128Code.StopCode());
var result = codes.ToArray(typeof(int)) as int[];
return result;
}
/// <summary>
/// Determines the best starting code set based on the the first two
/// characters of the string to be encoded
/// </summary>
/// <param name="csa1">First character of input string</param>
/// <param name="csa2">Second character of input string</param>
/// <returns>The codeset determined to be best to start with</returns>
private CodeSet GetBestStartSet(Code128Code.CodeSetAllowed csa1, Code128Code.CodeSetAllowed csa2)
{
var vote = 0;
vote += csa1 == Code128Code.CodeSetAllowed.CodeA ? 1 : 0;
vote += csa1 == Code128Code.CodeSetAllowed.CodeB ? -1 : 0;
vote += csa2 == Code128Code.CodeSetAllowed.CodeA ? 1 : 0;
vote += csa2 == Code128Code.CodeSetAllowed.CodeB ? -1 : 0;
return vote > 0 ? CodeSet.CodeA : CodeSet.CodeB; // ties go to codeB due to my own prejudices
}
}
}
-188
View File
@@ -1,188 +0,0 @@
namespace GenCode128
{
using System;
using System.Drawing;
/// <summary>
/// Summary description for Code128Rendering.
/// </summary>
public static class Code128Rendering
{
private const int CQuietWidth = 10;
// Code patterns:
// in principle these rows should each have 6 elements
// however, the last one -- STOP -- has 7. The cost of the
// extra integers is trivial, and this lets the code flow
// much more elegantly
private static readonly int[,] CPatterns =
{
{ 2, 1, 2, 2, 2, 2, 0, 0 }, // 0
{ 2, 2, 2, 1, 2, 2, 0, 0 }, // 1
{ 2, 2, 2, 2, 2, 1, 0, 0 }, // 2
{ 1, 2, 1, 2, 2, 3, 0, 0 }, // 3
{ 1, 2, 1, 3, 2, 2, 0, 0 }, // 4
{ 1, 3, 1, 2, 2, 2, 0, 0 }, // 5
{ 1, 2, 2, 2, 1, 3, 0, 0 }, // 6
{ 1, 2, 2, 3, 1, 2, 0, 0 }, // 7
{ 1, 3, 2, 2, 1, 2, 0, 0 }, // 8
{ 2, 2, 1, 2, 1, 3, 0, 0 }, // 9
{ 2, 2, 1, 3, 1, 2, 0, 0 }, // 10
{ 2, 3, 1, 2, 1, 2, 0, 0 }, // 11
{ 1, 1, 2, 2, 3, 2, 0, 0 }, // 12
{ 1, 2, 2, 1, 3, 2, 0, 0 }, // 13
{ 1, 2, 2, 2, 3, 1, 0, 0 }, // 14
{ 1, 1, 3, 2, 2, 2, 0, 0 }, // 15
{ 1, 2, 3, 1, 2, 2, 0, 0 }, // 16
{ 1, 2, 3, 2, 2, 1, 0, 0 }, // 17
{ 2, 2, 3, 2, 1, 1, 0, 0 }, // 18
{ 2, 2, 1, 1, 3, 2, 0, 0 }, // 19
{ 2, 2, 1, 2, 3, 1, 0, 0 }, // 20
{ 2, 1, 3, 2, 1, 2, 0, 0 }, // 21
{ 2, 2, 3, 1, 1, 2, 0, 0 }, // 22
{ 3, 1, 2, 1, 3, 1, 0, 0 }, // 23
{ 3, 1, 1, 2, 2, 2, 0, 0 }, // 24
{ 3, 2, 1, 1, 2, 2, 0, 0 }, // 25
{ 3, 2, 1, 2, 2, 1, 0, 0 }, // 26
{ 3, 1, 2, 2, 1, 2, 0, 0 }, // 27
{ 3, 2, 2, 1, 1, 2, 0, 0 }, // 28
{ 3, 2, 2, 2, 1, 1, 0, 0 }, // 29
{ 2, 1, 2, 1, 2, 3, 0, 0 }, // 30
{ 2, 1, 2, 3, 2, 1, 0, 0 }, // 31
{ 2, 3, 2, 1, 2, 1, 0, 0 }, // 32
{ 1, 1, 1, 3, 2, 3, 0, 0 }, // 33
{ 1, 3, 1, 1, 2, 3, 0, 0 }, // 34
{ 1, 3, 1, 3, 2, 1, 0, 0 }, // 35
{ 1, 1, 2, 3, 1, 3, 0, 0 }, // 36
{ 1, 3, 2, 1, 1, 3, 0, 0 }, // 37
{ 1, 3, 2, 3, 1, 1, 0, 0 }, // 38
{ 2, 1, 1, 3, 1, 3, 0, 0 }, // 39
{ 2, 3, 1, 1, 1, 3, 0, 0 }, // 40
{ 2, 3, 1, 3, 1, 1, 0, 0 }, // 41
{ 1, 1, 2, 1, 3, 3, 0, 0 }, // 42
{ 1, 1, 2, 3, 3, 1, 0, 0 }, // 43
{ 1, 3, 2, 1, 3, 1, 0, 0 }, // 44
{ 1, 1, 3, 1, 2, 3, 0, 0 }, // 45
{ 1, 1, 3, 3, 2, 1, 0, 0 }, // 46
{ 1, 3, 3, 1, 2, 1, 0, 0 }, // 47
{ 3, 1, 3, 1, 2, 1, 0, 0 }, // 48
{ 2, 1, 1, 3, 3, 1, 0, 0 }, // 49
{ 2, 3, 1, 1, 3, 1, 0, 0 }, // 50
{ 2, 1, 3, 1, 1, 3, 0, 0 }, // 51
{ 2, 1, 3, 3, 1, 1, 0, 0 }, // 52
{ 2, 1, 3, 1, 3, 1, 0, 0 }, // 53
{ 3, 1, 1, 1, 2, 3, 0, 0 }, // 54
{ 3, 1, 1, 3, 2, 1, 0, 0 }, // 55
{ 3, 3, 1, 1, 2, 1, 0, 0 }, // 56
{ 3, 1, 2, 1, 1, 3, 0, 0 }, // 57
{ 3, 1, 2, 3, 1, 1, 0, 0 }, // 58
{ 3, 3, 2, 1, 1, 1, 0, 0 }, // 59
{ 3, 1, 4, 1, 1, 1, 0, 0 }, // 60
{ 2, 2, 1, 4, 1, 1, 0, 0 }, // 61
{ 4, 3, 1, 1, 1, 1, 0, 0 }, // 62
{ 1, 1, 1, 2, 2, 4, 0, 0 }, // 63
{ 1, 1, 1, 4, 2, 2, 0, 0 }, // 64
{ 1, 2, 1, 1, 2, 4, 0, 0 }, // 65
{ 1, 2, 1, 4, 2, 1, 0, 0 }, // 66
{ 1, 4, 1, 1, 2, 2, 0, 0 }, // 67
{ 1, 4, 1, 2, 2, 1, 0, 0 }, // 68
{ 1, 1, 2, 2, 1, 4, 0, 0 }, // 69
{ 1, 1, 2, 4, 1, 2, 0, 0 }, // 70
{ 1, 2, 2, 1, 1, 4, 0, 0 }, // 71
{ 1, 2, 2, 4, 1, 1, 0, 0 }, // 72
{ 1, 4, 2, 1, 1, 2, 0, 0 }, // 73
{ 1, 4, 2, 2, 1, 1, 0, 0 }, // 74
{ 2, 4, 1, 2, 1, 1, 0, 0 }, // 75
{ 2, 2, 1, 1, 1, 4, 0, 0 }, // 76
{ 4, 1, 3, 1, 1, 1, 0, 0 }, // 77
{ 2, 4, 1, 1, 1, 2, 0, 0 }, // 78
{ 1, 3, 4, 1, 1, 1, 0, 0 }, // 79
{ 1, 1, 1, 2, 4, 2, 0, 0 }, // 80
{ 1, 2, 1, 1, 4, 2, 0, 0 }, // 81
{ 1, 2, 1, 2, 4, 1, 0, 0 }, // 82
{ 1, 1, 4, 2, 1, 2, 0, 0 }, // 83
{ 1, 2, 4, 1, 1, 2, 0, 0 }, // 84
{ 1, 2, 4, 2, 1, 1, 0, 0 }, // 85
{ 4, 1, 1, 2, 1, 2, 0, 0 }, // 86
{ 4, 2, 1, 1, 1, 2, 0, 0 }, // 87
{ 4, 2, 1, 2, 1, 1, 0, 0 }, // 88
{ 2, 1, 2, 1, 4, 1, 0, 0 }, // 89
{ 2, 1, 4, 1, 2, 1, 0, 0 }, // 90
{ 4, 1, 2, 1, 2, 1, 0, 0 }, // 91
{ 1, 1, 1, 1, 4, 3, 0, 0 }, // 92
{ 1, 1, 1, 3, 4, 1, 0, 0 }, // 93
{ 1, 3, 1, 1, 4, 1, 0, 0 }, // 94
{ 1, 1, 4, 1, 1, 3, 0, 0 }, // 95
{ 1, 1, 4, 3, 1, 1, 0, 0 }, // 96
{ 4, 1, 1, 1, 1, 3, 0, 0 }, // 97
{ 4, 1, 1, 3, 1, 1, 0, 0 }, // 98
{ 1, 1, 3, 1, 4, 1, 0, 0 }, // 99
{ 1, 1, 4, 1, 3, 1, 0, 0 }, // 100
{ 3, 1, 1, 1, 4, 1, 0, 0 }, // 101
{ 4, 1, 1, 1, 3, 1, 0, 0 }, // 102
{ 2, 1, 1, 4, 1, 2, 0, 0 }, // 103
{ 2, 1, 1, 2, 1, 4, 0, 0 }, // 104
{ 2, 1, 1, 2, 3, 2, 0, 0 }, // 105
{ 2, 3, 3, 1, 1, 1, 2, 0 } // 106
};
/// <summary>
/// Make an image of a Code128 barcode for a given string
/// </summary>
/// <param name="inputData">Message to be encoded</param>
/// <param name="barWeight">Base thickness for bar width (1 or 2 works well)</param>
/// <param name="addQuietZone">Add required horizontal margins (use if output is tight)</param>
/// <returns>An Image of the Code128 barcode representing the message</returns>
public static Image MakeBarcodeImage(string inputData, int barWeight, bool addQuietZone)
{
// get the Code128 codes to represent the message
var content = new Code128Content(inputData);
var codes = content.Codes;
var width = (((codes.Length - 3) * 11) + 35) * barWeight;
var height = Convert.ToInt32(Math.Ceiling(Convert.ToSingle(width) * .15F));
if (addQuietZone)
{
width += 2 * CQuietWidth * barWeight; // on both sides
}
// get surface to draw on
Image myImage = new Bitmap(width, height);
using (var gr = Graphics.FromImage(myImage))
{
// set to white so we don't have to fill the spaces with white
gr.FillRectangle(Brushes.White, 0, 0, width, height);
// skip quiet zone
var cursor = addQuietZone ? CQuietWidth * barWeight : 0;
for (var codeIdx = 0; codeIdx < codes.Length; codeIdx++)
{
var code = codes[codeIdx];
// take the bars two at a time: a black and a white
for (var bar = 0; bar < 8; bar += 2)
{
var barWidth = CPatterns[code, bar] * barWeight;
var spcWidth = CPatterns[code, bar + 1] * barWeight;
// if width is zero, don't try to draw it
if (barWidth > 0)
{
gr.FillRectangle(Brushes.Black, cursor, 0, barWidth, height);
}
// note that we never need to draw the space, since we
// initialized the graphics to all white
// advance cursor beyond this pair
cursor += barWidth + spcWidth;
}
}
}
return myImage;
}
}
}
-9
View File
@@ -1,9 +0,0 @@
namespace GenCode128
{
public enum CodeSet
{
CodeA,
CodeB
//// CodeC // not supported
}
}
-147
View File
@@ -1,147 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{32817BF9-E380-4467-9C7F-936F4B122BC7}</ProjectGuid>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>GenCode128</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>GenCode128</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OldToolsVersion>2.0</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Code128Code.cs" />
<Compile Include="CodeSet.cs" />
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Code128Content.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Code128Rendering.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
-46
View File
@@ -1,46 +0,0 @@
using System;
using System.IO;
using TBF;
namespace ResetBatchNr
{
class Program
{
static LocalSettings ls;
static void Main(string[] args)
{
if (!Directory.Exists(TBF.Program.ConfigDir)) return;
Environment.CurrentDirectory = TBF.Program.ConfigDir;
ls = LocalSettings.Load(TBF.Program.LocalSettingsFileName);
if (ls == null || ls.TestBenches == null)
{
/// Loading local seetings from regular config file failed. Use the backup
ls = LocalSettings.Load(TBF.Program.LocalSettingsBackupName);
if (ls == null || ls.TestBenches == null)
{
/// Neither config.xml, nor config.backup.xml could be loaded
Console.WriteLine(string.Format("Could not load file {0}, nor {1}.", TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName));
Console.ReadLine();
return;
}
}
else
{
/// Loading local seetings from the regular config file was successful. Update the backup
File.Copy(TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName, true);
}
///
/// Process local settings so that windows are shifted to the 1st monitor
///
ls.BatchNr = 1;
ls.Save();
Console.WriteLine("BatchNr was reset to 1");
Console.ReadLine();
return;
}
}
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ResetBatchNr")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ResetBatchNr")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("de8130eb-2f43-46a6-9f5b-bf96432a0c7c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-72
View File
@@ -1,72 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D7F5A111-B2DF-4761-9574-AB730DF573A6}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ResetBatchNr</RootNamespace>
<AssemblyName>ResetBatchNr</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Config\Config.csproj">
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\TBF\TBF.csproj">
<Project>{8648fd92-cda1-4c3a-b5f9-fe547ce1fa48}</Project>
<Name>TBF</Name>
</ProjectReference>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6e5cb0e9-e1b6-4e5d-ac6e-b1049e180f2b}</Project>
<Name>Users</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+107 -100
View File
@@ -1,43 +1,32 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Results.Entities;
namespace Results
{
public class BatchResults
public class BatchResults
{
public Batch Batch;
public int WMPositionsCount;
public readonly int WMPositionsCount;
public IList<Entities.TestData> TestDataList;
public IList<Entities.Components> ComponentsList;
public IList<Entities.WaterMeterData> WaterMeterDataList;
public IList<Entities.TestData> TestDataList;
public IList<Entities.Components> ComponentsList;
public IList<Entities.WaterMeterData> WaterMeterDataList;
/// <summary>
/// Parameterless constructor required for serialization
/// </summary>
public BatchResults()
{
TestDataList = new List<Entities.TestData>();
ComponentsList = new List<Entities.Components>();
WaterMeterDataList = new List<Entities.WaterMeterData>();
}
/// <summary>
/// Constructor invoked by static BatchResults NewFromProcedure(...)
/// </summary>
/// <param name="wmPositionsCount">Watermeters count</param>
private BatchResults(int wmPositionsCount)
: this()
{
WMPositionsCount = wmPositionsCount;
TestDataList = new List<Entities.TestData>();
ComponentsList = new List<Entities.Components>();
WaterMeterDataList = new List<Entities.WaterMeterData>();
}
public Batch Batch;
public WaterMeter[] WaterMeters;
public static BatchResults NewFromProcedure(int batchNr, int benchId, string benchName, string a1, string a2, string a3, string a4, string a5,
string user, int userNr, string programVer, Config.Entities.Procedure procedure,
WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double densityCorr)
@@ -49,7 +38,6 @@ namespace Results
d.Batch = new Batch()
{
BatchNr = batchNr,
ProgramVersion = programVer,
TestBenchId = benchId,
TestBenchName = benchName,
Address1 = a1,
@@ -57,6 +45,7 @@ namespace Results
Address3 = a3,
Address4 = a4,
Address5 = a5,
ProgramVersion = programVer,
UserName = user,
UserNumber = userNr,
ProcedureName = procedure.Name,
@@ -76,64 +65,62 @@ namespace Results
/// Add watermeter to an array, array index is WM position.
/// AddWaterMetersToBatch() has to be used before saving results.
///
for (int wmPos0 = 0; wmPos0 < d.WMPositionsCount; wmPos0++)
d.WaterMeters = new WaterMeter[d.WMPositionsCount];
for (int i = 0; i < d.WMPositionsCount; i++)
{
if (waterMeterDatas[wmPos0] == null)
{
d.Batch.WaterMeters.Add(new WaterMeter() { Batch = d.Batch,
WaterMeterData = null,
WMPosition = wmPos0 + 1,
YearOfProduction = year,
Disabled = true, });
}
else
{
WaterMeterData wmd = WaterMeterData.UpdateList(d.WaterMeterDataList, waterMeterDatas[wmPos0]);
d.Batch.WaterMeters.Add(new WaterMeter() { Batch = d.Batch,
WaterMeterData = wmd,
WMPosition = wmPos0 + 1,
YearOfProduction = year, });
}
if (waterMeterDatas[i] == null) continue;
WaterMeterData wmd = WaterMeterData.UpdateList(d.WaterMeterDataList, waterMeterDatas[i]);
d.WaterMeters[i] = new WaterMeter()
{
Batch = d.Batch,
WaterMeterData = wmd,
WMPosition = i + 1,
YearOfProduction = year,
};
}
foreach (var t in procedure.Tests)
{
TestData td = TestData.UpdateList(d.TestDataList, new TestData(t));
for (int rnr = 1; rnr <= t.Repeats; rnr++)
if (t.Publish != (byte)Config.Entities.Publish.Never)
{
/// Create an empty test result and add it to the list
TestRslt tr = new TestRslt(d.Batch, td, t.Part, rnr);
d.Batch.TestRslts.Add(tr);
TestData td = TestData.UpdateList(d.TestDataList, new TestData(t));
for (int i = 0; i < d.WMPositionsCount; i++)
for (int rnr = 1; rnr <= t.Repeats; rnr++)
{
if (!d.Batch.WaterMeters[i].Disabled && t.IsPartCompatible(waterMeterParts[i]))
{
///
/// Create empty watermeter test results and add them to the list and to dictionaries
///
IList<MeterTestRslt> wmtrs = d.Batch.WaterMeters[i].MeterTestRslts;
if (d.Batch.Compound)
{
/// Compound water meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundMain));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundAux));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Compound));
}
else if (d.Batch.HeatMeter)
{
/// Heat meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterVolume));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterEnergy));
}
else
{
/// Water meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Single));
}
}
/// Create an empty test result and add it to the list
TestRslt tr = new TestRslt(d.Batch, td, t.Part, rnr);
d.Batch.TestRslts.Add(tr);
for (int i = 0; i < d.WMPositionsCount; i++)
{
if (d.WaterMeters[i] == null) continue;
if (!t.IsPartCompatible(waterMeterParts[i])) continue;
///
/// Create empty watermeter test results and add them to the list and to dictionaries
///
IList<MeterTestRslt> wmtrs = d.WaterMeters[i].MeterTestRslts;
if (d.Batch.Compound)
{
/// Compound water meter
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundMain));
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundAux));
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Compound));
}
else if (d.Batch.HeatMeter)
{
/// Heat meter
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterVolume));
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterEnergy));
}
else
{
/// Water meter
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Single));
}
}
}
}
}
@@ -150,17 +137,11 @@ namespace Results
BatchResults batchResults = new BatchResults(wmPosMax);
batchResults.Batch = batch;
/// Insert missing disabled water meters
for (int wmNr0 = 0; wmNr0 < wmPosMax; wmNr0++)
batchResults.WaterMeters = new WaterMeter[wmPosMax];
for (int i = 0; i < batch.WaterMeters.Count; i++)
{
if (batch.WaterMeters[wmNr0].WMPosition > wmNr0 + 1)
{
batch.WaterMeters.Insert(wmNr0, new WaterMeter() { Batch = batch,
WaterMeterData = null,
WMPosition = wmNr0 + 1,
YearOfProduction = 0,
Disabled = true, });
}
WaterMeter wm = batch.WaterMeters[i];
batchResults.WaterMeters[wm.WMPosition - 1] = wm;
}
return batchResults;
@@ -171,11 +152,11 @@ namespace Results
return Batch.GetTestRslt(name, part);
}
public MeterTestRslt GetMeterTestRslt(string name, int wmNr0, Config.Entities.CompoundMeterId meterId)
public MeterTestRslt GetMeterTestRslt(string name, int wmnr0, Config.Entities.CompoundMeterId meterId)
{
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0 && !Batch.WaterMeters[wmNr0].Disabled)
if (WaterMeters[wmnr0] != null)
{
return Batch.WaterMeters[wmNr0].GetMeterTestRslt(name, meterId);
return WaterMeters[wmnr0].GetMeterTestRslt(name, meterId);
}
return null;
}
@@ -187,13 +168,13 @@ namespace Results
/// <returns>true = all tests done</returns>
public bool AllTestsDone()
{
for (int wmNr0 = 0; wmNr0 < WMPositionsCount; wmNr0++)
for (int i = 0; i < WMPositionsCount; i++)
{
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0 && !Batch.WaterMeters[wmNr0].Disabled)
if ((WaterMeters[i] != null) && !WaterMeters[i].Disabled)
{
foreach (var mtr in Batch.WaterMeters[wmNr0].MeterTestRslts)
foreach (var mtr in WaterMeters[i].MeterTestRslts)
{
if (mtr.Evaluate() && !mtr.TestDone) return false;
if (!mtr.TestDone) return false;
}
}
}
@@ -201,17 +182,43 @@ namespace Results
}
public virtual void WriteBinary(BinaryWriter writer)
{
Batch.WriteBinary(writer);
writer.Write(WMPositionsCount);
}
/// <summary>
/// Adds non-null water meters from an array to a Batch water meters list.
/// This method should be used when results are prepared and
/// all disabled water meters are deleted.
/// </summary>
public void AddWaterMetersToBatch()
{
for (int i = 0; i < WMPositionsCount; i++)
{
if (WaterMeters[i] != null)
{
WaterMeters[i].Passed = WaterMeters[i].PassedFromTests();
if (!WaterMeters[i].Disabled)
{
Batch.WaterMeters.Add(WaterMeters[i]);
}
}
}
}
public virtual void ReadBinary(BinaryReader reader)
public bool IsProduction()
{
Batch = new Batch();
Batch.ReadBinary(reader);
WMPositionsCount = reader.ReadInt32();
for (int i = 0; i < WMPositionsCount; i++)
{
if (WaterMeters[i] != null)
{
foreach (var mtr in WaterMeters[i].MeterTestRslts)
{
if (mtr.TestData().Name.ToLower().Contains("adj") || mtr.TestData().Name.ToLower().Contains("just"))
{
return true;
}
}
}
}
return false;
}
}
}
}
+4 -5
View File
@@ -66,13 +66,13 @@ namespace Results
switch (dbType)
{
default:
case Users.Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Users.Entities.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
case Users.Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
}
}
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.WaterMeterData>());
@@ -311,7 +311,6 @@ namespace Results
batch.TestRslts = session.QueryOver<TestRslt>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
batch.WaterMeters = session.QueryOver<WaterMeter>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
Binary file not shown.
Binary file not shown.
+11 -227
View File
@@ -1,28 +1,26 @@
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
/// Copyright (c) 2015-2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
namespace Results.Entities
{
public class Batch
{
public virtual int Id { get; protected set; }
public virtual int Id { get; protected set; }
public virtual int BatchNr { get; set; }
public virtual string ProgramVersion { get; set; }
public virtual int TestBenchId { get; set; }
public virtual int TestBenchId { get; set; }
public virtual string TestBenchName { get; set; } /// CEVAK, not mapped to DB
public virtual string Address1 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address2 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address3 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address4 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address5 { get; set; } /// CEVAK, not mapped to DB
public virtual string ProgramVersion { get; set; }
public virtual string UserName { get; set; }
public virtual int UserNumber { get; set; }
public virtual string ProcedureName { get; set; }
public virtual bool IsRemoteProcedure { get; set; } /// Stara Tura, not mapped to DB
public virtual string ProcedureDescription { get; set; } /// CEVAK, not mapped to DB
public virtual int ProcedureRevision { get; set; }
public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB
@@ -45,78 +43,13 @@ namespace Results.Entities
public virtual IList<WaterMeter> WaterMeters { get; set; }
public virtual IList<TestRslt> TestRslts { get; set; }
public virtual bool Compound { get; set; } /// Not mapped to DB now
public virtual bool HeatMeter { get; set; } /// Not mapped to DB now
public virtual IList<TestData> RegularTests()
{
IList<TestData> rslt = new List<TestData>();
foreach (var td in Tests)
{
if ((td.Name.Length > 0 && td.Name[0] != '[') || !td.Name.Contains("]")) rslt.Add(td);
}
return rslt;
}
public virtual IList<TestRslt> RegularTestRslts()
{
IList<TestRslt> rslt = new List<TestRslt>();
foreach (var tr in TestRslts)
{
if ((tr.Name().Length > 0 && tr.Name()[0] != '[') || !tr.Name().Contains("]")) rslt.Add(tr);
}
return rslt;
}
public virtual IList<TestData> AutoTests(string param)
{
int len = param.Length;
IList<TestData> rslt = new List<TestData>();
foreach (var td in Tests)
{
if (td.Name.Length > len + 1 && td.Name[0] == '[' && td.Name.IndexOf(param) == 1 && td.Name[len + 1] == ']')
{
rslt.Add(td);
}
}
return rslt;
}
public virtual IList<TestRslt> AutoTestRslts(string param)
{
int len = param.Length;
IList<TestRslt> rslt = new List<TestRslt>();
foreach (var tr in TestRslts)
{
if (tr.Name().Length > len + 1 && tr.Name()[0] == '[' && tr.Name().IndexOf(param) == 1 && tr.Name()[len + 1] == ']')
{
rslt.Add(tr);
}
}
return rslt;
}
public virtual bool HeatMeter { get; set; } /// Not mapped to DB now ///
public Batch()
{
Tests = new List<TestData>();
WaterMeters = new List<WaterMeter>();
TestRslts = new List<TestRslt>();
ProgramVersion = string.Empty;
TestBenchName = string.Empty;
Address1 = string.Empty;
Address2 = string.Empty;
Address3 = string.Empty;
Address4 = string.Empty;
Address5 = string.Empty;
UserName = string.Empty;
ProcedureName = string.Empty;
IsRemoteProcedure = false;
ProcedureDescription = string.Empty;
WatermetersStr = string.Empty;
ProtocolTitle = string.Empty;
ProtocolTitle = string.Empty;
Remark = string.Empty;
}
public virtual int PassedMetersCount()
@@ -131,28 +64,6 @@ namespace Results.Entities
return WaterMeters.Count - PassedMetersCount();
}
public virtual long ErrorFlags()
{
long result = 0;
foreach (var tr in TestRslts) { result |= tr.ErrorFlags; }
foreach (var wm in WaterMeters)
{
if (!wm.Disabled) { result |= wm.ErrorFlags; }
}
return result;
}
public virtual long InfoFlags()
{
long result = 0;
foreach (var tr in TestRslts) { result |= tr.InfoFlags; }
foreach (var wm in WaterMeters)
{
if (!wm.Disabled) { result |= wm.InfoFlags; }
}
return result;
}
public virtual double AmbTempMean()
{
double timeSum = 0;
@@ -297,138 +208,11 @@ namespace Results.Entities
public virtual string ToString(int i)
{
return string.Format("Batch: BatchNr={0} ProgramVersion={1} TestBenchId={2} UserName={3} UserNumber={4} ProcedureName={5}{6} ProcRev={7} ProtocolTitle={8} Remark={9} DensityCorr={10} Custom2={11} Custom3={12} StartTime={13} EndTime={14} Dirty={15} RsltsSent={16} RsltsPrinted={17}",
BatchNr, ProgramVersion, TestBenchId, UserName, UserNumber,
ProcedureName, (IsRemoteProcedure ? "(R)" : ""), ProcedureRevision,
ProtocolTitle, Remark, DensityCorr, Custom2, Custom3,
StartTime, EndTime, Dirty, RsltsSent, RsltsPrinted);
return string.Format("Batch: BatchNr={0} TestBenchId={1} ProgramVersion={2} UserName={3} UserNumber={4} ProcedureName={5} ProcedureRevision={6} ProtocolTitle={7} Remark={8} DensityCorr={9} Custom2={10} Custom3={11} StartTime={12} EndTime={13} Dirty={14} RsltsSent={15} RsltsPrinted={16}",
BatchNr, TestBenchId, ProgramVersion, UserName, UserNumber,
ProcedureName, ProcedureRevision, ProtocolTitle, Remark, DensityCorr,
Custom2, Custom3, StartTime, EndTime, Dirty,
RsltsSent, RsltsPrinted);
}
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(BatchNr);
writer.Write((ProgramVersion != null) ? ProgramVersion : string.Empty);
writer.Write((ProcedureName != null) ? ProcedureName : string.Empty);
writer.Write(IsRemoteProcedure);
writer.Write(Id);
writer.Write(TestBenchId);
writer.Write((TestBenchName != null) ? TestBenchName : string.Empty);
writer.Write((Address1 != null) ? Address1 : string.Empty);
writer.Write((Address2 != null) ? Address2 : string.Empty);
writer.Write((Address3 != null) ? Address3 : string.Empty);
writer.Write((Address4 != null) ? Address4 : string.Empty);
writer.Write((Address5 != null) ? Address5 : string.Empty);
writer.Write((UserName != null) ? UserName : string.Empty);
writer.Write(UserNumber);
writer.Write((ProcedureDescription != null) ? ProcedureDescription : string.Empty);
writer.Write(ProcedureRevision);
writer.Write((WatermetersStr != null) ? WatermetersStr : string.Empty);
writer.Write((ProtocolTitle != null) ? ProtocolTitle : string.Empty);
writer.Write((Remark != null) ? Remark : string.Empty);
writer.Write(DensityCorr);
writer.Write(Custom2);
writer.Write(Custom3);
writer.Write(Counter6);
writer.Write(Counter7);
writer.Write(Counter8);
writer.Write(Counter9);
writer.Write(Counter10);
writer.Write(StartTime.ToString());
writer.Write(EndTime.ToString());
writer.Write(Dirty);
writer.Write(RsltsSent);
writer.Write(RsltsPrinted);
writer.Write(Compound);
writer.Write(HeatMeter);
IList<TestData> savedTestDatas = new List<TestData>(); /// Initially empty
writer.Write(TestRslts.Count);
for (int i = 0; i < TestRslts.Count; i++)
{
TestRslts[i].WriteBinary(writer, savedTestDatas);
}
IList<WaterMeterData> savedWMDatas = new List<WaterMeterData>(); /// Initially empty
writer.Write(WaterMeters.Count);
for (int i = 0; i < WaterMeters.Count; i++)
{
WaterMeters[i].WriteBinary(writer, savedWMDatas);
}
}
public static void ReadStart(BinaryReader reader, out int batchNr, out string programVersion, out string procedureName, out bool isRemoteProcedure)
{
batchNr = reader.ReadInt32();
programVersion = reader.ReadString();
procedureName = reader.ReadString();
isRemoteProcedure = reader.ReadBoolean();
}
public virtual void ReadBinary(BinaryReader reader)
{
/// ReadStart() is used to avoid code repetition
int batchNr;
string programVersion;
string procedureName;
bool isRemoteProcedure;
ReadStart(reader, out batchNr, out programVersion, out procedureName, out isRemoteProcedure);
BatchNr = batchNr;
ProgramVersion = programVersion;
ProcedureName = procedureName;
IsRemoteProcedure = isRemoteProcedure;
Id = reader.ReadInt32();
TestBenchId = reader.ReadInt32();
TestBenchName = reader.ReadString();
Address1 = reader.ReadString();
Address2 = reader.ReadString();
Address3 = reader.ReadString();
Address4 = reader.ReadString();
Address5 = reader.ReadString();
UserName = reader.ReadString();
UserNumber = reader.ReadInt32();
ProcedureDescription = reader.ReadString();
ProcedureRevision = reader.ReadInt32();
WatermetersStr = reader.ReadString();
ProtocolTitle = reader.ReadString();
Remark = reader.ReadString();
DensityCorr = reader.ReadInt32();
Custom2 = reader.ReadInt32();
Custom3 = reader.ReadInt32();
Counter6 = reader.ReadInt32();
Counter7 = reader.ReadInt32();
Counter8 = reader.ReadInt32();
Counter9 = reader.ReadInt32();
Counter10 = reader.ReadInt32();
StartTime = DateTime.Parse(reader.ReadString());
EndTime = DateTime.Parse(reader.ReadString());
Dirty = reader.ReadBoolean();
RsltsSent = reader.ReadBoolean();
RsltsPrinted = reader.ReadBoolean();
Compound = reader.ReadBoolean();
HeatMeter = reader.ReadBoolean();
Tests = new List<TestData>(); /// Initially empty
int testRsltsCount = reader.ReadInt32();
TestRslts = new List<TestRslt>();
for (int i = 0; i < testRsltsCount; i++)
{
TestRslts.Add(new TestRslt());
TestRslts[i].ReadBinary(reader, Tests);
TestRslts[i].Batch = this;
}
IList<WaterMeterData> wmDatasRetirevedSoFar = new List<WaterMeterData>(); /// Initially empty
int waterMetersCount = reader.ReadInt32();
WaterMeters = new List<WaterMeter>();
for (int i = 0; i < waterMetersCount; i++)
{
WaterMeters.Add(new WaterMeter());
WaterMeters[i].ReadBinary(reader, wmDatasRetirevedSoFar, TestRslts);
WaterMeters[i].Batch = this;
}
}
}
}
}
+15 -46
View File
@@ -1,17 +1,16 @@
///
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
/// Copyright (c) 2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace Results.Entities
{
public class Components
public class Components
{
public virtual int Id { get; protected set; }
public virtual int TestBenchId { get; set; }
public virtual int Id { get; protected set; }
public virtual int TestBenchId { get; set; }
public virtual string TestBenchName { get; set; }
public virtual string Pump { get; set; }
public virtual string RegValve { get; set; }
@@ -22,7 +21,7 @@ namespace Results.Entities
public virtual string Custom2 { get; set; }
public virtual string Custom3 { get; set; }
public Components()
protected Components()
{
TestBenchId = 0;
TestBenchName = string.Empty;
@@ -60,15 +59,15 @@ namespace Results.Entities
public virtual bool Equals(Components bc)
{
if (TestBenchId != bc.TestBenchId) return false;
if (TestBenchName != bc.TestBenchName) return false;
if (Pump != bc.Pump) return false;
if (RegValve != bc.RegValve) return false;
if (Flowmeter != bc.Flowmeter) return false;
if (Diverter != bc.Diverter) return false;
if (Scale != bc.Scale) return false;
if (Custom1 != bc.Custom1) return false;
if (Custom2 != bc.Custom2) return false;
if (Custom3 != bc.Custom3) return false;
if (!TestBenchName.Equals(bc.TestBenchName)) return false;
if (!Pump.Equals(bc.Pump)) return false;
if (!RegValve.Equals(bc.RegValve)) return false;
if (!Flowmeter.Equals(bc.Flowmeter)) return false;
if (!Diverter.Equals(bc.Diverter)) return false;
if (!Scale.Equals(bc.Scale)) return false;
if (!Custom1.Equals(bc.Custom1)) return false;
if (!Custom2.Equals(bc.Custom2)) return false;
if (!Custom3.Equals(bc.Custom3)) return false;
return true;
}
@@ -91,35 +90,5 @@ namespace Results.Entities
list.Add(item); /// Item not fund in the list, it is added to the list
return item;
}
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(Id);
writer.Write(TestBenchId);
writer.Write((TestBenchName != null) ? TestBenchName : string.Empty);
writer.Write((Pump != null) ? Pump : string.Empty);
writer.Write((RegValve != null) ? RegValve : string.Empty);
writer.Write((Flowmeter != null) ? Flowmeter : string.Empty);
writer.Write((Diverter != null) ? Diverter : string.Empty);
writer.Write((Scale != null) ? Scale : string.Empty);
writer.Write((Custom1 != null) ? Custom1 : string.Empty);
writer.Write((Custom2 != null) ? Custom2 : string.Empty);
writer.Write((Custom3 != null) ? Custom3 : string.Empty);
}
public virtual void ReadBinary(BinaryReader reader)
{
Id = reader.ReadInt32();
TestBenchId = reader.ReadInt32();
TestBenchName = reader.ReadString();
Pump = reader.ReadString();
RegValve = reader.ReadString();
Flowmeter = reader.ReadString();
Diverter = reader.ReadString();
Scale = reader.ReadString();
Custom1 = reader.ReadString();
Custom2 = reader.ReadString();
Custom3 = reader.ReadString();
}
}
}
}
+3 -72
View File
@@ -1,15 +1,14 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
namespace Results.Entities
{
public class MeterTestRslt
{
public virtual int Id { get; protected set; }
public virtual int Id { get; protected set; }
public virtual byte CompoundMeterId { get; set; } /// 0=single, 1=compound/main, 2=compound/aux., 3=compound/overal, 4=heat meter volume, 5=heat meter energy
public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depend on localization and customer
@@ -144,73 +143,5 @@ namespace Results.Entities
{
return (TestRslt != null) ? Name() : base.ToString();
}
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(Id);
writer.Write(CompoundMeterId);
writer.Write(RegReaderType);
writer.Write(PulsesMeter);
writer.Write(PulsesMaster);
writer.Write(PulsesPerLiter);
writer.Write(VolumeStart);
writer.Write(VolumeEnd);
writer.Write(VolumeMeter);
writer.Write(VolumeRef);
writer.Write(TimestampStart);
writer.Write(TimestampEnd);
writer.Write(TestTime);
writer.Write(Error);
writer.Write(ErrorIndicators);
writer.Write(InfoIndicators);
writer.Write(KorrErrQ);
writer.Write(TestDone);
writer.Write(Passed);
#if ORACLE_DB
writer.Write(LastError);
#endif
writer.Write((TestRslt != null && TestRslt.Name() != null) ? TestRslt.Name() : string.Empty);
writer.Write(TestRslt.Part);
}
public virtual void ReadBinary(BinaryReader reader, IList<TestRslt> testResults)
{
Id = reader.ReadInt32();
CompoundMeterId = reader.ReadByte();
RegReaderType = reader.ReadInt32();
PulsesMeter = reader.ReadDouble();
PulsesMaster = reader.ReadDouble();
PulsesPerLiter = reader.ReadDouble();
VolumeStart = reader.ReadDouble();
VolumeEnd = reader.ReadDouble();
VolumeMeter = reader.ReadDouble();
VolumeRef = reader.ReadDouble();
TimestampStart = reader.ReadDouble();
TimestampEnd = reader.ReadDouble();
TestTime = reader.ReadDouble();
Error = reader.ReadDouble();
ErrorIndicators = reader.ReadInt64();
InfoIndicators = reader.ReadInt64();
KorrErrQ = reader.ReadDouble();
TestDone = reader.ReadBoolean();
Passed = reader.ReadBoolean();
#if ORACLE_DB
LastError = reader.ReadDouble();
#endif
TestRslt = null;
string trName = reader.ReadString();
int trPart = reader.ReadInt32();
if (testResults != null && !string.IsNullOrEmpty(trName))
{
foreach (var tr in testResults)
{
if ((tr.Name() == trName) && (tr.Part == trPart))
{
TestRslt = tr;
break;
}
}
}
}
}
}
+6 -49
View File
@@ -1,19 +1,18 @@
///
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
/// Copyright (c) 2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace Results.Entities
{
/// <summary>
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
/// </summary>
public class TestData
public class TestData
{
public virtual int Id { get; protected set; }
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual int Repeats { get; set; }
public virtual double Qtg { get; set; } /// [m3/h] flow range low limit
@@ -32,7 +31,7 @@ namespace Results.Entities
public virtual bool Evaluate { get; set; }
public TestData()
protected TestData()
{
Name = string.Empty;
Method = string.Empty;
@@ -67,14 +66,14 @@ namespace Results.Entities
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(TestData td)
{
if (Name != td.Name) return false;
if (!Name.Equals(td.Name)) return false;
if (Repeats != td.Repeats) return false;
if (Qtg != td.Qtg) return false;
if (Qfrom != td.Qfrom) return false;
if (Qto != td.Qto) return false;
if (TargetVolume != td.TargetVolume) return false;
if (TargetTime != td.TargetTime) return false;
if (Method != td.Method) return false;
if (!Method.Equals(td.Method)) return false;
if (ErrLimLo != td.ErrLimLo) return false;
if (ErrLimHi != td.ErrLimHi) return false;
if (ErrLimMargin != td.ErrLimMargin) return false;
@@ -108,47 +107,5 @@ namespace Results.Entities
list.Add(item); /// Item not fund in the list, it is added to the list
return item;
}
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(Id);
writer.Write((Name != null) ? Name : string.Empty);
writer.Write(Repeats);
writer.Write(Qtg);
writer.Write(Qfrom);
writer.Write(Qto);
writer.Write(TargetVolume);
writer.Write(TargetTime);
writer.Write((Method != null) ? Method : string.Empty);
writer.Write(ErrLimLo);
writer.Write(ErrLimHi);
writer.Write(ErrLimMargin);
writer.Write(DoControlWaterTemp);
writer.Write(TempLimLo);
writer.Write(TempLimHi);
writer.Write(Publish);
writer.Write(Evaluate);
}
public virtual void ReadBinary(BinaryReader reader)
{
Id = reader.ReadInt32();
Name = reader.ReadString();
Repeats = reader.ReadInt32();
Qtg = reader.ReadDouble();
Qfrom = reader.ReadDouble();
Qto = reader.ReadDouble();
TargetVolume = reader.ReadDouble();
TargetTime = reader.ReadDouble();
Method = reader.ReadString();
ErrLimLo = reader.ReadDouble();
ErrLimHi = reader.ReadDouble();
ErrLimMargin = reader.ReadDouble();
DoControlWaterTemp = reader.ReadBoolean();
TempLimLo = reader.ReadSingle();
TempLimHi = reader.ReadSingle();
Publish = reader.ReadSByte();
Evaluate = reader.ReadBoolean();
}
}
}
+5 -300
View File
@@ -1,16 +1,15 @@
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace Results.Entities
{
public class TestRslt
{
/// Identity
/// Identity
public virtual int Id { get; protected set; }
public virtual Batch Batch { get; set; }
public virtual TestData TestData { get; set; }
@@ -115,11 +114,6 @@ namespace Results.Entities
public virtual float FlowEnd { get; set; } /// [m3/h] flow at the end of test from the reference flowmeter
public virtual float FlowMin { get; set; } /// [m3/h]
public virtual float FlowMax { get; set; } /// [m3/h]
public virtual float ConductMean { get; set; } /// [uS/cm]
public virtual float ConductStart { get; set; } /// [uS/cm]
public virtual float ConductEnd { get; set; } /// [uS/cm]
public virtual float ConductMin { get; set; } /// [uS/cm]
public virtual float ConductMax { get; set; } /// [uS/cm]
public virtual float Uncertnt { get; set; } /// [%] Relative error uncertainty
public virtual float UncertntScale { get; set; } /// [%] Contribution to uncertainty from scale
@@ -227,10 +221,8 @@ namespace Results.Entities
public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData.Publish; }
public TestRslt()
protected TestRslt()
{
MethodClass = string.Empty;
Remark = string.Empty;
}
public TestRslt(Batch batch, TestData testData, int part, int repetitionNr)
@@ -336,11 +328,6 @@ namespace Results.Entities
FlowEnd = src.FlowEnd;
FlowMin = src.FlowMin;
FlowMax = src.FlowMax;
ConductMean = src.ConductMean;
ConductStart = src.ConductStart;
ConductEnd = src.ConductEnd;
ConductMin = src.ConductMin;
ConductMax = src.ConductMax;
Custom1 = src.Custom1;
Custom2 = src.Custom2;
@@ -385,7 +372,7 @@ namespace Results.Entities
public override string ToString()
{
return string.Format("batch={0}, procedure={1}, test={2}, part={3} start={4} {5}", Batch.BatchNr, Batch.ProcedureName, Name(), Part, StartTime.ToShortDateString(), StartTime.ToShortTimeString());
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", Batch.BatchNr, Batch.ProcedureName, Name(), StartTime.ToShortDateString(), StartTime.ToShortTimeString());
}
public virtual string ToString(int i)
@@ -408,287 +395,5 @@ namespace Results.Entities
Custom1, Custom2, Custom3, Custom4, Custom5, Custom6, Custom7, Custom8, Custom9, Custom10,
DiverterStart, DiverterEnd);
}
public virtual void WriteBinary(BinaryWriter writer, IList<TestData> savedTestDatas)
{
writer.Write(Id);
/// Save TestData or TestData.Name
if (savedTestDatas != null && !savedTestDatas.Contains(TestData))
{
writer.Write(true);
TestData.WriteBinary(writer);
savedTestDatas.Add(TestData);
}
else
{
writer.Write(false);
writer.Write(TestData.Name);
}
/// Save Components if not null
if (Components != null)
{
writer.Write(true);
Components.WriteBinary(writer); /// Write Components
}
else
{
writer.Write(false);
}
writer.Write(Part);
writer.Write(RepetitionNr);
writer.Write((MethodClass != null) ? MethodClass : string.Empty);
writer.Write(TestDone);
writer.Write((Remark != null) ? Remark : string.Empty);
writer.Write(StartTime.ToString());
writer.Write(EndTime.ToString());
writer.Write(FlowSetTime);
writer.Write(TimeBtwnMassMsrmnts);
writer.Write(TestTime);
writer.Write(TestTimeCorrection);
writer.Write(PulsesMaster);
writer.Write(TotalPulsesMstr);
writer.Write(ConstMasterRaw);
writer.Write(ConstMasterCorr);
writer.Write(ConstMaster);
writer.Write(MassStartRaw);
writer.Write(MassStart);
writer.Write(MassEndRaw);
writer.Write(MassEnd);
writer.Write(DensityIn);
writer.Write(DensityLine);
writer.Write(DensityDiv);
writer.Write(Buoyancy);
writer.Write(FlowMass);
writer.Write(FlowVolume);
writer.Write(VolumeCTV);
writer.Write(VolumeMaster);
writer.Write(ErrorMaster);
writer.Write(DiverterStart);
writer.Write(DivStart10);
writer.Write(DivStart50);
writer.Write(DivStart90);
writer.Write(DiverterEnd);
writer.Write(DivEnd90);
writer.Write(DivEnd50);
writer.Write(DivEnd10);
writer.Write(ErrorFlags);
writer.Write(InfoFlags);
writer.Write(RefEnergy);
writer.Write(AmbTempMean);
writer.Write(AmbTempStart);
writer.Write(AmbTempEnd);
writer.Write(AmbTempMin);
writer.Write(AmbTempMax);
writer.Write(AmbPressMean);
writer.Write(AmbPressStart);
writer.Write(AmbPressEnd);
writer.Write(AmbPressMin);
writer.Write(AmbPressMax);
writer.Write(AmbHumiMean);
writer.Write(AmbHumiStart);
writer.Write(AmbHumiEnd);
writer.Write(AmbHumiMin);
writer.Write(AmbHumiMax);
writer.Write(PressUpMean);
writer.Write(PressUpStart);
writer.Write(PressUpEnd);
writer.Write(PressUpMin);
writer.Write(PressUpMax);
writer.Write(PressDownMean);
writer.Write(PressDownStart);
writer.Write(PressDownEnd);
writer.Write(PressDownMin);
writer.Write(PressDownMax);
writer.Write(PressDeltaMean);
writer.Write(PressDeltaStart);
writer.Write(PressDeltaEnd);
writer.Write(PressDeltaMin);
writer.Write(PressDeltaMax);
writer.Write(TempUpMean);
writer.Write(TempUpStart);
writer.Write(TempUpEnd);
writer.Write(TempUpMin);
writer.Write(TempUpMax);
writer.Write(TempDownMean);
writer.Write(TempDownStart);
writer.Write(TempDownEnd);
writer.Write(TempDownMin);
writer.Write(TempDownMax);
writer.Write(TempDivMean);
writer.Write(TempDivStart);
writer.Write(TempDivEnd);
writer.Write(TempDivMin);
writer.Write(TempDivMax);
writer.Write(FlowMean);
writer.Write(FlowStart);
writer.Write(FlowEnd);
writer.Write(FlowMin);
writer.Write(FlowMax);
writer.Write(Uncertnt);
writer.Write(UncertntScale);
writer.Write(UncertntDensity);
writer.Write(UncertntTemp);
writer.Write(UncertntPressure);
writer.Write(Custom1);
writer.Write(Custom2);
writer.Write(Custom3);
writer.Write(Custom4);
writer.Write(Custom5);
writer.Write(Custom6);
writer.Write(Custom7);
writer.Write(Custom8);
writer.Write(Custom9);
writer.Write(Custom10);
writer.Write(Counter1);
writer.Write(Counter2);
writer.Write(Counter3);
writer.Write(Counter4);
writer.Write(Counter5);
}
public virtual void ReadBinary(BinaryReader reader, IList<TestData> testDatas)
{
Id = reader.ReadInt32();
/// Retrieve TestData
if (reader.ReadBoolean())
{
(TestData = new TestData()).ReadBinary(reader);
if (testDatas != null) testDatas.Add(TestData);
}
else
{
TestData = null;
string testDataName = reader.ReadString();
foreach (var td in testDatas)
{
if (td.Name == testDataName)
{
TestData = td;
break;
}
}
}
if (reader.ReadBoolean())
{
(Components = new Components()).ReadBinary(reader); /// Read Components
}
Part = reader.ReadInt32();
RepetitionNr = reader.ReadInt32();
MethodClass = reader.ReadString();
TestDone = reader.ReadBoolean();
Remark = reader.ReadString();
StartTime = DateTime.Parse(reader.ReadString());
EndTime = DateTime.Parse(reader.ReadString());
FlowSetTime = reader.ReadInt32();
TimeBtwnMassMsrmnts = reader.ReadInt32();
TestTime = reader.ReadDouble();
TestTimeCorrection = reader.ReadDouble();
PulsesMaster = reader.ReadDouble();
TotalPulsesMstr = reader.ReadDouble();
ConstMasterRaw = reader.ReadDouble();
ConstMasterCorr = reader.ReadDouble();
ConstMaster = reader.ReadDouble();
MassStartRaw = reader.ReadDouble();
MassStart = reader.ReadDouble();
MassEndRaw = reader.ReadDouble();
MassEnd = reader.ReadDouble();
DensityIn = reader.ReadDouble();
DensityLine = reader.ReadDouble();
DensityDiv = reader.ReadDouble();
Buoyancy = reader.ReadDouble();
FlowMass = reader.ReadDouble();
FlowVolume = reader.ReadDouble();
VolumeCTV = reader.ReadDouble();
VolumeMaster = reader.ReadDouble();
ErrorMaster = reader.ReadDouble();
DiverterStart = reader.ReadSingle();
DivStart10 = reader.ReadSingle();
DivStart50 = reader.ReadSingle();
DivStart90 = reader.ReadSingle();
DiverterEnd = reader.ReadSingle();
DivEnd90 = reader.ReadSingle();
DivEnd50 = reader.ReadSingle();
DivEnd10 = reader.ReadSingle();
ErrorFlags = reader.ReadInt64();
InfoFlags = reader.ReadInt64();
RefEnergy = reader.ReadDouble();
AmbTempMean = reader.ReadSingle();
AmbTempStart = reader.ReadSingle();
AmbTempEnd = reader.ReadSingle();
AmbTempMin = reader.ReadSingle();
AmbTempMax = reader.ReadSingle();
AmbPressMean = reader.ReadSingle();
AmbPressStart = reader.ReadSingle();
AmbPressEnd = reader.ReadSingle();
AmbPressMin = reader.ReadSingle();
AmbPressMax = reader.ReadSingle();
AmbHumiMean = reader.ReadSingle();
AmbHumiStart = reader.ReadSingle();
AmbHumiEnd = reader.ReadSingle();
AmbHumiMin = reader.ReadSingle();
AmbHumiMax = reader.ReadSingle();
PressUpMean = reader.ReadSingle();
PressUpStart = reader.ReadSingle();
PressUpEnd = reader.ReadSingle();
PressUpMin = reader.ReadSingle();
PressUpMax = reader.ReadSingle();
PressDownMean = reader.ReadSingle();
PressDownStart = reader.ReadSingle();
PressDownEnd = reader.ReadSingle();
PressDownMin = reader.ReadSingle();
PressDownMax = reader.ReadSingle();
PressDeltaMean = reader.ReadSingle();
PressDeltaStart = reader.ReadSingle();
PressDeltaEnd = reader.ReadSingle();
PressDeltaMin = reader.ReadSingle();
PressDeltaMax = reader.ReadSingle();
TempUpMean = reader.ReadSingle();
TempUpStart = reader.ReadSingle();
TempUpEnd = reader.ReadSingle();
TempUpMin = reader.ReadSingle();
TempUpMax = reader.ReadSingle();
TempDownMean = reader.ReadSingle();
TempDownStart = reader.ReadSingle();
TempDownEnd = reader.ReadSingle();
TempDownMin = reader.ReadSingle();
TempDownMax = reader.ReadSingle();
TempDivMean = reader.ReadSingle();
TempDivStart = reader.ReadSingle();
TempDivEnd = reader.ReadSingle();
TempDivMin = reader.ReadSingle();
TempDivMax = reader.ReadSingle();
FlowMean = reader.ReadSingle();
FlowStart = reader.ReadSingle();
FlowEnd = reader.ReadSingle();
FlowMin = reader.ReadSingle();
FlowMax = reader.ReadSingle();
Uncertnt = reader.ReadSingle();
UncertntScale = reader.ReadSingle();
UncertntDensity = reader.ReadSingle();
UncertntTemp = reader.ReadSingle();
UncertntPressure = reader.ReadSingle();
Custom1 = reader.ReadSingle();
Custom2 = reader.ReadSingle();
Custom3 = reader.ReadSingle();
Custom4 = reader.ReadSingle();
Custom5 = reader.ReadSingle();
Custom6 = reader.ReadSingle();
Custom7 = reader.ReadSingle();
Custom8 = reader.ReadSingle();
Custom9 = reader.ReadSingle();
Custom10 = reader.ReadSingle();
Counter1 = reader.ReadInt32();
Counter2 = reader.ReadInt32();
Counter3 = reader.ReadInt32();
Counter4 = reader.ReadInt32();
Counter5 = reader.ReadInt32();
}
}
}
}
+7 -276
View File
@@ -1,15 +1,15 @@
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Config.Entities;
using Results.Resources;
namespace Results.Entities
{
public enum ResultCode
{
None = 0,
@@ -41,12 +41,12 @@ namespace Results.Entities
public class WaterMeter
{
public virtual int Id { get; protected set; }
public virtual int Id { get; protected set; }
public virtual string SerialNr { get; set; } /// S/N _or_ S/N of the main meter of a compound meter _or_ PCB Number of an iPerl water meter
public virtual string SerialNrAux { get; set; } /// S/N of the aux. meter of a compound meter _or_ a complete assigned S/N of an iPerl water meter
public virtual string PurchaseOrder { get; set; }
public virtual int YearOfProduction { get; set; }
public virtual int WMPosition { get; set; } /// 1-based water meter position
public virtual int WMPosition { get; set; }
public virtual string EndState { get; set; } /// End state (of the main water meter)
public virtual string EndStateAux { get; set; } /// End state of the auxiliary water meter
public virtual double QRise { get; set; } /// [m3/h] detected Q_rise of a composed meter or 'sensitivity' of a single meter
@@ -133,29 +133,9 @@ namespace Results.Entities
public virtual DateTime StartTime() { return Batch.StartTime; }
public virtual DateTime EndTime() { return Batch.EndTime; }
public virtual IList<MeterTestRslt> RegularMeterTestRslts()
{
IList<MeterTestRslt> rslt = new List<MeterTestRslt>();
foreach (var mtr in MeterTestRslts)
{
if ((mtr.Name().Length > 0 && mtr.Name()[0] != '[') || !mtr.Name().Contains("]")) rslt.Add(mtr);
}
return rslt;
}
protected MeterTestRslt lastMeterTestRslts;
public virtual MeterTestRslt LastMeterTestRslts() { return lastMeterTestRslts; }
public virtual IList<MeterTestRslt> AutoMeterTestRslts(string param)
{
int len = param.Length;
IList<MeterTestRslt> rslt = new List<MeterTestRslt>();
foreach (var mtr in MeterTestRslts)
{
if (mtr.Name().Length > len + 1 && mtr.Name()[0] == '[' && mtr.Name().IndexOf(param) == 1 && mtr.Name()[len + 1] == ']')
{
rslt.Add(mtr);
}
}
return rslt;
}
public virtual long ErrorFlagsFromTests()
{
@@ -229,38 +209,6 @@ namespace Results.Entities
return passed;
}
/// <summary>
/// Three state test results and/or water meter result (Algeria PT25 requirement).
/// NearlyOK means error is within error limits not narrowed by uncertainty
/// OK: Uncertainty + ErrLimLo <= error <= ErrLimHi - Uncertainty
/// NearlyOK: not OK but stil ErrLimLo <= error <= ErrLimHi
/// Nok: otherwise
/// </summary>
public virtual ThreeState ThreeStateFromTests()
{
ThreeState result = ThreeState.OK;
if (ErrorFlagsFromTestsAndWM() != 0) result = ThreeState.Nok;
foreach (var mtr in MeterTestRslts)
{
if (mtr.Evaluate())
{
if(!mtr.TestDone || mtr.Error < mtr.ErrLimLo() || mtr.Error > mtr.ErrLimHi())
{
/// Test was not done or completely failed (was outside broader error limits)
result = ThreeState.Nok;
}
else if (result == ThreeState.OK && (mtr.Error < mtr.ErrLimLo() + mtr.Uncertainty() || mtr.Error > mtr.ErrLimHi() - mtr.Uncertainty()))
{
/// So far the water meter was OK, but this test was outside narrow error limits (= limits shrinked by Uncertainty)
result = ThreeState.NearlyOK;
}
}
}
return result;
}
public virtual bool CompletedFromTests()
{
bool completed = true;
@@ -405,25 +353,7 @@ namespace Results.Entities
SessionId = 0;
ErrorFlags = 0;
LastRecordIsNok = false;
/// Initialize strings
SerialNr = string.Empty;
SerialNrAux = string.Empty;
PurchaseOrder = string.Empty;
EndState = string.Empty;
EndStateAux = string.Empty;
ArchivePath = string.Empty;
Remark = string.Empty;
#if TURA_SPECIAL
CompleteSerialNr = string.Empty;
RadioAddress = string.Empty;
ProdUserName = string.Empty;
ProdPurchaseOrder = string.Empty;
#endif
#if IPERL
FWVersion = string.Empty;
#endif
}
}
public virtual void CopyContentFrom(WaterMeter src)
@@ -604,204 +534,5 @@ namespace Results.Entities
return NotCompletedColor;
}
}
public virtual void WriteBinary(BinaryWriter writer, IList<WaterMeterData> savedWMDatas)
{
writer.Write(Id);
writer.Write((SerialNr != null) ? SerialNr : string.Empty);
writer.Write((SerialNrAux != null) ? SerialNrAux : string.Empty);
writer.Write((PurchaseOrder != null) ? PurchaseOrder : string.Empty);
writer.Write(YearOfProduction);
writer.Write(WMPosition);
writer.Write((EndState != null) ? EndState : string.Empty);
writer.Write((EndStateAux != null) ? EndStateAux : string.Empty);
writer.Write(QRise);
writer.Write(QFall);
writer.Write(ErrorFlags);
writer.Write(InfoFlags);
writer.Write(Passed);
writer.Write(ResultCode);
writer.Write((ArchivePath != null) ? ArchivePath : string.Empty);
writer.Write((Remark != null) ? Remark : string.Empty);
#if IPERL
writer.Write(OrigCalibFactor);
writer.Write(CalibFactor);
writer.Write(OrigCalibFactorLNA);
writer.Write(CalibFactorLNA);
writer.Write(Q2ErrWOCorrection);
writer.Write(Q2CorrRL);
writer.Write(Q2CorrLR);
writer.Write(Q2CorrFlowRight);
writer.Write(Diff2Hz8Hz);
writer.Write(Hz2CorrectionDone);
writer.Write(Hz2Correction);
writer.Write((FWVersion != null) ? FWVersion : string.Empty);
#endif
#if TURA_SPECIAL
writer.Write(AssignedSerialNr);
writer.Write((CompleteSerialNr != null) ? CompleteSerialNr : string.Empty);
writer.Write((RadioAddress != null) ? RadioAddress : string.Empty);
writer.Write(PaletteNr);
writer.Write(UmkartonNr);
writer.Write((ProdTestBench != null) ? ProdTestBench : string.Empty);
writer.Write(ProdWMPosition);
writer.Write((ProdUserName != null) ? ProdUserName : string.Empty);
writer.Write((ProdPurchaseOrder != null) ? ProdPurchaseOrder : string.Empty);
writer.Write(ProdPassed);
writer.Write(ProdResultCode);
writer.Write(ProdQ2CorrRL);
writer.Write(ProdQ2CorrLR);
#endif
#if ORACLE_DB
writer.Write(Pruefindex);
writer.Write(HydrPruefung);
writer.Write(WMTypeRevision);
/// Write RawTestInfos
IList<Results.Output.SensusTestInfo> rawTestInfos = RawTestInfos as IList<Results.Output.SensusTestInfo>;
writer.Write((rawTestInfos != null) ? rawTestInfos.Count : 0);
if (rawTestInfos != null)
{
for (int i = 0; i < rawTestInfos.Count; i++) rawTestInfos[i].WriteBinary(writer);
}
/// Write CompleteTestInfos
Results.Output.SensusTestInfo[] completeTestInfos = CompleteTestInfos as Results.Output.SensusTestInfo[];
writer.Write((completeTestInfos != null) ? completeTestInfos.Length : 0);
if (completeTestInfos != null)
{
for (int i = 0; i < completeTestInfos.Length; i++) completeTestInfos[i].WriteBinary(writer);
}
#endif
writer.Write(ProcessId);
writer.Write(SessionId);
writer.Write(LastRecordIsNok);
/// Save WaterMeterData or WaterMeterData.Id
if (WaterMeterData != null && savedWMDatas != null && !savedWMDatas.Contains(WaterMeterData))
{
writer.Write(true);
WaterMeterData.WriteBinary(writer);
savedWMDatas.Add(WaterMeterData);
}
else
{
writer.Write(false);
}
/// Write MeterTestRslts
int meterTestRsltsCount = MeterTestRslts != null ? MeterTestRslts.Count : 0;
writer.Write(meterTestRsltsCount);
for (int i = 0; i < meterTestRsltsCount; i++)
{
MeterTestRslts[i].WriteBinary(writer);
}
}
public virtual void ReadBinary(BinaryReader reader, IList<WaterMeterData> wmDatasRetrievedSoFar, IList<TestRslt> testRslts)
{
Id = reader.ReadInt32();
SerialNr = reader.ReadString();
SerialNrAux = reader.ReadString();
PurchaseOrder = reader.ReadString();
YearOfProduction = reader.ReadInt32();
WMPosition = reader.ReadInt32();
EndState = reader.ReadString();
EndStateAux = reader.ReadString();
QRise = reader.ReadDouble();
QFall = reader.ReadDouble();
ErrorFlags = reader.ReadInt64();
InfoFlags = reader.ReadInt64();
Passed = reader.ReadBoolean();
ResultCode = reader.ReadInt32();
ArchivePath = reader.ReadString();
Remark = reader.ReadString();
#if IPERL
OrigCalibFactor = reader.ReadDouble();
CalibFactor = reader.ReadDouble();
OrigCalibFactorLNA = reader.ReadDouble();
CalibFactorLNA = reader.ReadDouble();
Q2ErrWOCorrection = reader.ReadDouble();
Q2CorrRL = reader.ReadInt32();
Q2CorrLR = reader.ReadInt32();
Q2CorrFlowRight = reader.ReadInt32();
Diff2Hz8Hz = reader.ReadDouble();
Hz2CorrectionDone = reader.ReadBoolean();
Hz2Correction = reader.ReadInt32();
FWVersion = reader.ReadString();
#endif
#if TURA_SPECIAL
AssignedSerialNr = reader.ReadInt32();
CompleteSerialNr = reader.ReadString();
RadioAddress = reader.ReadString();
PaletteNr = reader.ReadInt32();
UmkartonNr = reader.ReadInt32();
ProdTestBench = reader.ReadString();
ProdWMPosition = reader.ReadInt32();
ProdUserName = reader.ReadString();
ProdPurchaseOrder = reader.ReadString();
ProdPassed = reader.ReadBoolean();
ProdResultCode = reader.ReadInt32();
ProdQ2CorrRL = reader.ReadInt32();
ProdQ2CorrLR = reader.ReadInt32();
#endif
#if ORACLE_DB
Pruefindex = reader.ReadInt32();
HydrPruefung = reader.ReadInt32();
WMTypeRevision = reader.ReadInt32();
/// Read RawTestInfos
int rawTestInfosCount = reader.ReadInt32();
IList<Results.Output.SensusTestInfo> rawTestInfos = new List<Results.Output.SensusTestInfo>();
for (int i = 0; i < rawTestInfosCount; i++)
{
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
ti.ReadBinary(reader);
rawTestInfos.Add(ti);
}
RawTestInfos = rawTestInfos;
/// Read CompleteTestInfos
int completeTestInfosLen = reader.ReadInt32();
Results.Output.SensusTestInfo[] completeTestInfos = new Results.Output.SensusTestInfo[completeTestInfosLen];
for (int i = 0; i < completeTestInfosLen; i++)
{
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
ti.ReadBinary(reader);
completeTestInfos[i] = ti;
}
CompleteTestInfos = completeTestInfos;
#endif
ProcessId = reader.ReadInt32();
SessionId = reader.ReadInt32();
LastRecordIsNok = reader.ReadBoolean();
/// Retrieve TestData
if (reader.ReadBoolean())
{
(WaterMeterData = new WaterMeterData()).ReadBinary(reader);
if (wmDatasRetrievedSoFar != null) wmDatasRetrievedSoFar.Add(WaterMeterData);
}
else
{
WaterMeterData = null;
foreach (var wmd in wmDatasRetrievedSoFar)
{
WaterMeterData = wmd;
break;
}
}
/// Read MeterTestRslts
int meterTestRsltsCount = reader.ReadInt32();
MeterTestRslts = new List<MeterTestRslt>();
for (int i = 0; i < meterTestRsltsCount; i++)
{
MeterTestRslt mtr = new MeterTestRslt();
mtr.WaterMeter = this;
mtr.ReadBinary(reader, testRslts);
MeterTestRslts.Add(mtr);
}
}
}
}
+13 -89
View File
@@ -1,16 +1,16 @@
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace Results.Entities
{
public class WaterMeterData
public class WaterMeterData
{
public virtual int Id { get; protected set; }
public virtual int Id { get; protected set; }
public virtual string ProductName { get; set; }
public virtual string Producer { get; set; }
@@ -68,8 +68,8 @@ namespace Results.Entities
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(WaterMeterData wmd)
{
if (ProductName != wmd.ProductName) return false;
if (Producer != wmd.Producer) return false;
if (!ProductName.Equals(wmd.ProductName)) return false;
if (!Producer.Equals(wmd.Producer)) return false;
if (DN != wmd.DN) return false;
if (L != wmd.L) return false;
@@ -81,13 +81,13 @@ namespace Results.Entities
if (Q2_Qt != wmd.Q2_Qt) return false;
if (Q1_Qmin != wmd.Q1_Qmin) return false;
if (MetrologicalClass != wmd.MetrologicalClass) return false;
if (TemperatureClass != wmd.TemperatureClass) return false;
if (PressureLossClass != wmd.PressureLossClass) return false;
if (MaxAdmissiblePressure != wmd.MaxAdmissiblePressure) return false;
if (FlowProfileSensitivityClass != wmd.FlowProfileSensitivityClass) return false;
if (!MetrologicalClass.Equals(wmd.MetrologicalClass)) return false;
if (!TemperatureClass.Equals(wmd.TemperatureClass)) return false;
if (!PressureLossClass.Equals(wmd.PressureLossClass)) return false;
if (!MaxAdmissiblePressure.Equals(wmd.MaxAdmissiblePressure)) return false;
if (!FlowProfileSensitivityClass.Equals(wmd.FlowProfileSensitivityClass)) return false;
if (ApprovalInfo != wmd.ApprovalInfo) return false;
if (!ApprovalInfo.Equals(wmd.ApprovalInfo)) return false;
if (Certificate != wmd.Certificate) return false;
if (PulsesPerLtr != wmd.PulsesPerLtr) return false;
@@ -132,81 +132,5 @@ namespace Results.Entities
list.Add(item); /// Item not fund in the list, it is added to the list
return item;
}
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(Id);
writer.Write((ProductName != null) ? ProductName : string.Empty);
writer.Write((Producer != null) ? Producer : string.Empty);
writer.Write(DN);
writer.Write(L);
writer.Write((int)Mounting);
writer.Write(NewQnames);
writer.Write(Q4_Qmax);
writer.Write(Q3_Qn);
writer.Write(Q2_Qt);
writer.Write(Q1_Qmin);
writer.Write((MetrologicalClass != null) ? MetrologicalClass : string.Empty);
writer.Write((int)TemperatureClass);
writer.Write((int)PressureLossClass);
writer.Write((int)MaxAdmissiblePressure);
writer.Write((int)FlowProfileSensitivityClass);
writer.Write((ApprovalInfo != null) ? ApprovalInfo : string.Empty);
writer.Write((Certificate != null) ? Certificate : string.Empty);
writer.Write(PulsesPerLtr);
writer.Write((ProducerAux != null) ? ProducerAux : string.Empty);
writer.Write(Q3_Qn_Aux);
writer.Write((MetrologicalClassAux != null) ? MetrologicalClassAux : string.Empty);
writer.Write((ApprovalInfoAux != null) ? ApprovalInfoAux : string.Empty);
writer.Write((int)Medium);
writer.Write((Text1 != null) ? Text1 : string.Empty);
writer.Write((Text2 != null) ? Text2 : string.Empty);
writer.Write((Text3 != null) ? Text3 : string.Empty);
writer.Write((Text4 != null) ? Text4 : string.Empty);
writer.Write((Text5 != null) ? Text5 : string.Empty);
writer.Write(Compound);
writer.Write(HeatMeter);
#if ORACLE_DB
writer.Write(WMTypeId);
#endif
}
public virtual void ReadBinary(BinaryReader reader)
{
Id = reader.ReadInt32();
ProductName = reader.ReadString();
Producer = reader.ReadString();
DN = reader.ReadDouble();
L = reader.ReadDouble();
Mounting = (Config.Entities.Mounting)reader.ReadInt32();
NewQnames = reader.ReadBoolean();
Q4_Qmax = reader.ReadDouble();
Q3_Qn = reader.ReadDouble();
Q2_Qt = reader.ReadDouble();
Q1_Qmin = reader.ReadDouble();
MetrologicalClass = reader.ReadString();
TemperatureClass = (Config.Entities.TemperatureClass)reader.ReadInt32();
PressureLossClass = (Config.Entities.PressureLossClass)reader.ReadInt32();
MaxAdmissiblePressure = (Config.Entities.MaxAdmissiblePressure)reader.ReadInt32();
FlowProfileSensitivityClass = (Config.Entities.FlowProfileSensitivityClass)reader.ReadInt32();
ApprovalInfo = reader.ReadString();
Certificate = reader.ReadString();
PulsesPerLtr = reader.ReadDouble();
ProducerAux = reader.ReadString();
Q3_Qn_Aux = reader.ReadDouble();
MetrologicalClassAux = reader.ReadString();
ApprovalInfoAux = reader.ReadString();
Medium = (Config.Entities.Medium)reader.ReadInt32();
Text1 = reader.ReadString();
Text2 = reader.ReadString();
Text3 = reader.ReadString();
Text4 = reader.ReadString();
Text5 = reader.ReadString();
Compound = reader.ReadBoolean();
HeatMeter = reader.ReadBoolean();
#if ORACLE_DB
WMTypeId = reader.ReadInt32();
#endif
}
}
}
}
+21 -24
View File
@@ -78,11 +78,11 @@ namespace Results.Forms
///
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
{
if (args.WMPosition > 0)
if (Results.WaterMeters != null && args.WMPosition > 0)
{
foreach (var wm in Results.Batch.WaterMeters)
foreach (var wm in Results.WaterMeters)
{
if (!wm.Disabled && (wm.WMPosition == args.WMPosition))
if ((wm != null) && (wm.WMPosition == args.WMPosition))
{
ShowMoreWMResults(wm);
return;
@@ -124,9 +124,9 @@ namespace Results.Forms
/// Determine water meter positions count
///
int displayedControlsCount = 0;
for (int i = 0; i < results.Batch.WaterMeters.Count; i++)
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if ((!results.Batch.WaterMeters[i].Disabled) || ShowDisabledPositions)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
displayedControlsCount++;
}
@@ -165,9 +165,9 @@ namespace Results.Forms
wmRsltsCtrl = new IOneWMResultsCtrl[displayedControlsCount];
int ix = 0;
firstEnabledControl = null;
for (int i = 0; i < results.Batch.WaterMeters.Count; i++)
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (!results.Batch.WaterMeters[i].Disabled || ShowDisabledPositions)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
/// Create one water meter position / control
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
@@ -176,9 +176,9 @@ namespace Results.Forms
wmRsltsCtrl[ix].Width = oneWidth;
wmRsltsCtrl[ix].Height = oneHeight;
if (!results.Batch.WaterMeters[i].Disabled)
if ((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
{
if ((firstEnabledControl == null) && !results.Batch.WaterMeters[i].Disabled)
if ((firstEnabledControl == null) && (results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
{
firstEnabledControl = wmRsltsCtrl[ix];
}
@@ -211,14 +211,14 @@ namespace Results.Forms
void UpdateResults(Results.BatchResults results)
{
if (results != null && results.Batch != null && results.Batch.WaterMeters != null)
if ((results != null) && (results.WaterMeters != null))
{
int ctrlIx = 0;
for (int wmNr0 = 0; wmNr0 < results.Batch.WaterMeters.Count; wmNr0++)
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (!results.Batch.WaterMeters[wmNr0].Disabled || ShowDisabledPositions)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.Batch.WaterMeters[wmNr0]);
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.WaterMeters[i]);
}
}
}
@@ -310,19 +310,16 @@ namespace Results.Forms
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
}
if (wmRsltsCtrl != null)
/// Update size of controls
flowLayoutPanel.SuspendLayout();
///
foreach (var oneCtrl in wmRsltsCtrl)
{
/// Update size of controls
flowLayoutPanel.SuspendLayout();
///
foreach (var oneCtrl in wmRsltsCtrl)
{
oneCtrl.Width = oneWidth;
oneCtrl.Height = oneHeight;
}
///
flowLayoutPanel.ResumeLayout();
oneCtrl.Width = oneWidth;
oneCtrl.Height = oneHeight;
}
///
flowLayoutPanel.ResumeLayout();
}
}
}
+3 -3
View File
@@ -146,13 +146,13 @@ namespace Results.Forms
tracingResultsListView.Items.Add(new ListViewItem(new string[]
{
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
(rr.Workstep != null) ? rr.Workstep.Name : string.Empty,
rr.Workstep.Name,
rr.Workplace,
rr.UserName,
rr.Result == 0 ? "OK" : "NOK",
(rr.Workstep != null && rr.Workstep.ReferencePart != null) ? rr.Workstep.ReferencePart.Name : string.Empty,
rr.Workstep.ReferencePart.Name,
rr.Code,
(rr.Process != null) ? rr.Process.Name : string.Empty,
rr.Process.Name,
}));
for (int i = 0; i < isMissing.Length; i++)

Some files were not shown because too many files have changed in this diff Show More