MySQL query works OK.
This commit is contained in:
parent
9689080387
commit
c6ef378bc9
@ -118,6 +118,7 @@
|
||||
<Compile Include="Mappings\WMTypeMap.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\Strings.Designer.cs" />
|
||||
<Compile Include="ResultItemSpec.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="DatabaseSettingsDlg.resx">
|
||||
|
||||
@ -162,5 +162,10 @@ namespace Config.Entities
|
||||
OutputPath = test.OutputPath;
|
||||
MetersPath = test.MetersPath;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("batch={0} proc.={1} time={2}", BatchNr, ProcedureName, TimeStart.ToShortDateString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
232
Config/ResultItemSpec.cs
Normal file
232
Config/ResultItemSpec.cs
Normal file
@ -0,0 +1,232 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
using Config.Resources;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
public class ResultItemSpec
|
||||
{
|
||||
///
|
||||
/// Public fields
|
||||
///
|
||||
public readonly string Name; /// Name-s of all items must be unique
|
||||
public readonly string ClmnHeaderText; /// Text printed in the column header
|
||||
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintDlgt(MeterTestResult meterTestResult);
|
||||
|
||||
private readonly PrintDlgt printDlgt;
|
||||
|
||||
public bool CanPrintSingle { get { return (printDlgt != null); } }
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string Print(MeterTestResult meterTestResult)
|
||||
{
|
||||
string str = printDlgt(meterTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintCombinedDlgt(MeterTestResult largeMeterTestResult,
|
||||
MeterTestResult smallMeterTestResult,
|
||||
MeterTestResult combinedMeterTestResult);
|
||||
private readonly PrintCombinedDlgt printCombinedDlgt;
|
||||
|
||||
public bool CanPrintCombined { get { return (printCombinedDlgt != null); } }
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string PrintCombined(MeterTestResult largeMeterTestResult,
|
||||
MeterTestResult smallMeterTestResult,
|
||||
MeterTestResult combinedMeterTestResult)
|
||||
{
|
||||
string str = printCombinedDlgt(largeMeterTestResult, smallMeterTestResult, combinedMeterTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// Public constructor
|
||||
///
|
||||
public ResultItemSpec(string name, string clmnHeaderText, PrintDlgt printDlgt, PrintCombinedDlgt printCombinedDlgt)
|
||||
{
|
||||
Name = name;
|
||||
ClmnHeaderText = clmnHeaderText;
|
||||
this.printDlgt = printDlgt;
|
||||
this.printCombinedDlgt = printCombinedDlgt;
|
||||
}
|
||||
|
||||
|
||||
/// Static list of all available items
|
||||
public static readonly IList<ResultItemSpec> AllItems;
|
||||
|
||||
/// Static constructor that initializes the list of all items
|
||||
static ResultItemSpec()
|
||||
{
|
||||
AllItems = new List<ResultItemSpec>();
|
||||
|
||||
/// Common
|
||||
AllItems.Add(new ResultItemSpec("Test name", "Test", x => x.TestResult.TestName,
|
||||
(x, y, z) => x.TestResult.TestName));
|
||||
AllItems.Add(new ResultItemSpec("Procedure name", "Procedure", x => x.TestResult.ProcedureName,
|
||||
(x, y, z) => x.TestResult.ProcedureName));
|
||||
AllItems.Add(new ResultItemSpec("Batch number", "Batch nr.", x => x.TestResult.BatchNr.ToString(),
|
||||
(x, y, z) => x.TestResult.BatchNr.ToString()));
|
||||
|
||||
/// Target values
|
||||
AllItems.Add(new ResultItemSpec("Q from", "Q from [l/h]", x => x.TestResult.Qfrom.ToString("F3"),
|
||||
(x, y, z) => x.TestResult.Qfrom.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Q to", "Q to [l/h]", x => x.TestResult.Qto.ToString("F3"),
|
||||
(x, y, z) => x.TestResult.Qto.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Test volume", "Test vol. [l]", x => x.TestResult.Volume.ToString("F1"),
|
||||
(x, y, z) => x.TestResult.Volume.ToString("F1")));
|
||||
AllItems.Add(new ResultItemSpec("Error limit Lo", "Err.Lim.Lo [%]", x => x.TestResult.ErrLimLo.ToString("F1"),
|
||||
(x, y, z) => x.TestResult.ErrLimLo.ToString("F1")));
|
||||
AllItems.Add(new ResultItemSpec("Error limit Hi", "Err.Lim.Hi [%]", x => x.TestResult.ErrLimHi.ToString("F1"),
|
||||
(x, y, z) => x.TestResult.ErrLimHi.ToString("F1")));
|
||||
AllItems.Add(new ResultItemSpec("Error limit sum", "Err.Lim.Sum [%]", x => (x.TestResult.ErrLimHi - x.TestResult.ErrLimLo).ToString("F1"),
|
||||
(x, y, z) => (x.TestResult.ErrLimHi - x.TestResult.ErrLimLo).ToString("F1")));
|
||||
|
||||
/// Test results
|
||||
AllItems.Add(new ResultItemSpec("Start time", "T start", x => x.TestResult.TimeStart.ToShortTimeString(),
|
||||
(x, y, z) => z.TestResult.TimeStart.ToShortTimeString()));
|
||||
AllItems.Add(new ResultItemSpec("End time", "T end", x => x.TestResult.TimeEnd.ToShortTimeString(),
|
||||
(x, y, z) => z.TestResult.TimeEnd.ToShortTimeString()));
|
||||
AllItems.Add(new ResultItemSpec("Test time", "T [s]", x => x.TestResult.Time.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.Time.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Flow", "Flow [m3/h]", x => FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
|
||||
(x, y, z) => FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
|
||||
AllItems.Add(new ResultItemSpec("T in", "T in", x => x.TestResult.TempInAvrg.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.TempInAvrg.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("T out", "T out", x => x.TestResult.TempOutAvrg.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.TempOutAvrg.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("T div", "T div", x => x.TestResult.TempDivAvrg.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.TempDivAvrg.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("P up", "P up", x => x.TestResult.PressInAvrg.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressInAvrg.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P up start", "P up start", x => x.TestResult.PressInStart.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressInStart.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P up end", "P up end", x => x.TestResult.PressInEnd.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressInEnd.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P down", "P down", x => x.TestResult.PressOutAvrg.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressOutAvrg.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P down start", "P down start", x => x.TestResult.PressOutStart.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressOutStart.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P down end", "P down end", x => x.TestResult.PressOutEnd.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressOutEnd.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Reference error", "Err.ref. [%]", x => x.TestResult.ErrorMaster.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.ErrorMaster.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Ambient temperature", "T amb", x => x.TestResult.AmbientTempAve.ToString("F1"),
|
||||
(x, y, z) => z.TestResult.AmbientTempAve.ToString("F1")));
|
||||
AllItems.Add(new ResultItemSpec("Ambient pressure", "P amb", x => x.TestResult.AmbientPressAve.ToString("F0"),
|
||||
(x, y, z) => z.TestResult.AmbientPressAve.ToString("F0")));
|
||||
AllItems.Add(new ResultItemSpec("Ambient humidity", "H amb [%]", x => x.TestResult.AmbientHumiAve.ToString("F1"),
|
||||
(x, y, z) => z.TestResult.AmbientHumiAve.ToString("F1")));
|
||||
|
||||
/// Single and combined meter results
|
||||
AllItems.Add(new ResultItemSpec("Volume", "Volume [l]", x => x.VolumeMeter.ToString("F3"),
|
||||
(x, y, z) => z.VolumeMeter.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Reference volume", "Vol.ref. [l]", x => x.VolumeRef.ToString("F3"),
|
||||
(x, y, z) => z.VolumeRef.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Error", "Error [%]", x => x.VolumeErrorPct.ToString("F2"),
|
||||
(x, y, z) => z.VolumeErrorPct.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Passed", "Result", x => (x.Passed ? Strings.Passed + "|Green" : Strings.Failed + "|Red"),
|
||||
(x, y, z) => (z.Passed ? Strings.Passed + "|Green" : Strings.Failed + "|Red")));
|
||||
|
||||
/// Single water meters only results
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr", "s/n", x => x.SerialNr, null));
|
||||
AllItems.Add(new ResultItemSpec("End state", "End state", x => x.EndState, null));
|
||||
AllItems.Add(new ResultItemSpec("Pulses", "Pulses", x => x.PulsesMeter.ToString(), null));
|
||||
AllItems.Add(new ResultItemSpec("Pulses/liter", "Pulses/liter", x => x.PulsesPerLiter.ToString(), null));
|
||||
AllItems.Add(new ResultItemSpec("Reference pulses", "Ref.pulses", x => x.PulsesMaster.ToString(), null));
|
||||
|
||||
/// Combined water meters only results
|
||||
AllItems.Add(new ResultItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (x.TestResult.QRise == 0) ? "-" : FloatToStr(x.TestResult.QRise, 4)));
|
||||
AllItems.Add(new ResultItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (x.TestResult.QFall == 0) ? "-" : FloatToStr(x.TestResult.QFall, 4)));
|
||||
AllItems.Add(new ResultItemSpec("Error large WM", "Error-L [%]", null, (x, y, z) => x.VolumeErrorPct.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Error small WM", "Error-S [%]", null, (x, y, z) => y.VolumeErrorPct.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr large WM", "s/n", null, (x, y, z) => x.SerialNr));
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr small WM", "s/n", null, (x, y, z) => y.SerialNr));
|
||||
AllItems.Add(new ResultItemSpec("End state large WM", "End state", null, (x, y, z) => x.EndState));
|
||||
AllItems.Add(new ResultItemSpec("End state small WM", "End state", null, (x, y, z) => y.EndState));
|
||||
}
|
||||
|
||||
public static ResultItemSpec GetItem(string name)
|
||||
{
|
||||
foreach (var item in AllItems) if (item.Name.Equals(name)) return item;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string[] ToStrArray(IList<ResultItemSpec> items)
|
||||
{
|
||||
int count = (items != null) ? items.Count : 0;
|
||||
string[] result = new string[count];
|
||||
for (int i = 0; i < count; i++) result[i] = items[i].Name;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IList<ResultItemSpec> FromStrArray(string[] strArray)
|
||||
{
|
||||
IList<ResultItemSpec> result = new List<ResultItemSpec>();
|
||||
if (strArray != null)
|
||||
{
|
||||
for (int i = 0; i < strArray.Length; i++)
|
||||
{
|
||||
ResultItemSpec item = GetItem(strArray[i]);
|
||||
if (item != null) result.Add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts float number to a string with the specified number of valid digits
|
||||
/// </summary>
|
||||
/// <param name="value">Float value to be converted to a string</param>
|
||||
/// <param name="validDigits">Number of valid digits: 4, 3, or 2 (otherwise a full precision number is printed)</param>
|
||||
/// <returns>String representation of the float number</returns>
|
||||
public static string FloatToStr(float value, int validDigits)
|
||||
{
|
||||
if (validDigits == 4)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return value.ToString("F0");
|
||||
else if (value >= 99.95 || value < -99.95) return value.ToString("F1");
|
||||
else if (value >= 9.995 || value < -9.995) return value.ToString("F2");
|
||||
else if (value >= 0.9995 || value < -0.9995) return value.ToString("F3");
|
||||
else if (value >= 0.09995 || value < -0.09995) return value.ToString("F4");
|
||||
else if (value >= 0.009995 || value < -0.009995) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
}
|
||||
else if (validDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return value.ToString("F0");
|
||||
else if (value >= 9.95 || value < -9.95) return value.ToString("F1");
|
||||
else if (value >= 0.995 || value < -0.995) return value.ToString("F2");
|
||||
else if (value >= 0.0995 || value < -0.0995) return value.ToString("F3");
|
||||
else if (value >= 0.00995 || value < -0.00995) return value.ToString("F4");
|
||||
else if (value >= 0.000995 || value < -0.000995) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
}
|
||||
else if (validDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return value.ToString("F0");
|
||||
else if (value >= 0.95 || value < -0.95) return value.ToString("F1");
|
||||
else if (value >= 0.095 || value < -0.095) return value.ToString("F2");
|
||||
else if (value >= 0.0095 || value < -0.0095) return value.ToString("F3");
|
||||
else if (value >= 0.00095 || value < -0.00095) return value.ToString("F4");
|
||||
else return value.ToString("F5");
|
||||
}
|
||||
else return value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@ namespace ResultsBrowser
|
||||
/// </summary>
|
||||
public string Language = "en";
|
||||
|
||||
/// <summary>
|
||||
/// <summary>C:\VSProjects\TBF\TestBenchFramework\LocalSettings.cs
|
||||
/// Names and database settings of test benches.
|
||||
/// </summary>
|
||||
[XmlArrayAttribute("TestBenches")]
|
||||
@ -45,6 +45,11 @@ namespace ResultsBrowser
|
||||
public int MainWndHeight;
|
||||
public bool ManiWndMaximized;
|
||||
|
||||
/// Purchase order history
|
||||
public string[] PurchaseOrderHistory;
|
||||
[XmlIgnore]
|
||||
public int PurchaseOrderHistoryCount { get { return (PurchaseOrderHistory != null) ? PurchaseOrderHistory.Length : 0; } }
|
||||
|
||||
|
||||
public LocalSettings()
|
||||
{
|
||||
|
||||
195
ResultsBrowser/MainWnd.Designer.cs
generated
195
ResultsBrowser/MainWnd.Designer.cs
generated
@ -28,12 +28,201 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Text = "Form1";
|
||||
this.queryButton = new System.Windows.Forms.Button();
|
||||
this.outputTextBox = new System.Windows.Forms.TextBox();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.fromGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.filterDateCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.toDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.fromDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.purchaseOrderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.purchaseOrderCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.purchaseOrderComboBox = new System.Windows.Forms.ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.fromGroupBox.SuspendLayout();
|
||||
this.purchaseOrderGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// queryButton
|
||||
//
|
||||
this.queryButton.Location = new System.Drawing.Point(15, 199);
|
||||
this.queryButton.Name = "queryButton";
|
||||
this.queryButton.Size = new System.Drawing.Size(108, 40);
|
||||
this.queryButton.TabIndex = 3;
|
||||
this.queryButton.Text = "Query";
|
||||
this.queryButton.UseVisualStyleBackColor = true;
|
||||
this.queryButton.Click += new System.EventHandler(this.queryButton_Click);
|
||||
//
|
||||
// outputTextBox
|
||||
//
|
||||
this.outputTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.outputTextBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.outputTextBox.Multiline = true;
|
||||
this.outputTextBox.Name = "outputTextBox";
|
||||
this.outputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.outputTextBox.Size = new System.Drawing.Size(767, 370);
|
||||
this.outputTextBox.TabIndex = 4;
|
||||
//
|
||||
// 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.clearButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.fromGroupBox);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.queryButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.purchaseOrderGroupBox);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.outputTextBox);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(767, 624);
|
||||
this.splitContainer1.SplitterDistance = 250;
|
||||
this.splitContainer1.TabIndex = 5;
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
this.clearButton.Location = new System.Drawing.Point(149, 199);
|
||||
this.clearButton.Name = "clearButton";
|
||||
this.clearButton.Size = new System.Drawing.Size(108, 40);
|
||||
this.clearButton.TabIndex = 4;
|
||||
this.clearButton.Text = "Clear";
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// fromGroupBox
|
||||
//
|
||||
this.fromGroupBox.Controls.Add(this.label2);
|
||||
this.fromGroupBox.Controls.Add(this.label1);
|
||||
this.fromGroupBox.Controls.Add(this.filterDateCheckBox);
|
||||
this.fromGroupBox.Controls.Add(this.toDateTimePicker);
|
||||
this.fromGroupBox.Controls.Add(this.fromDateTimePicker);
|
||||
this.fromGroupBox.Location = new System.Drawing.Point(15, 92);
|
||||
this.fromGroupBox.Name = "fromGroupBox";
|
||||
this.fromGroupBox.Size = new System.Drawing.Size(242, 97);
|
||||
this.fromGroupBox.TabIndex = 3;
|
||||
this.fromGroupBox.TabStop = false;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(16, 64);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(20, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "To";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(16, 33);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(30, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "From";
|
||||
//
|
||||
// filterDateCheckBox
|
||||
//
|
||||
this.filterDateCheckBox.AutoSize = true;
|
||||
this.filterDateCheckBox.Location = new System.Drawing.Point(19, -1);
|
||||
this.filterDateCheckBox.Name = "filterDateCheckBox";
|
||||
this.filterDateCheckBox.Size = new System.Drawing.Size(72, 17);
|
||||
this.filterDateCheckBox.TabIndex = 1;
|
||||
this.filterDateCheckBox.Text = "Filter date";
|
||||
this.filterDateCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// toDateTimePicker
|
||||
//
|
||||
this.toDateTimePicker.Location = new System.Drawing.Point(68, 58);
|
||||
this.toDateTimePicker.Name = "toDateTimePicker";
|
||||
this.toDateTimePicker.Size = new System.Drawing.Size(151, 20);
|
||||
this.toDateTimePicker.TabIndex = 0;
|
||||
//
|
||||
// fromDateTimePicker
|
||||
//
|
||||
this.fromDateTimePicker.Location = new System.Drawing.Point(68, 26);
|
||||
this.fromDateTimePicker.Name = "fromDateTimePicker";
|
||||
this.fromDateTimePicker.Size = new System.Drawing.Size(151, 20);
|
||||
this.fromDateTimePicker.TabIndex = 0;
|
||||
//
|
||||
// purchaseOrderGroupBox
|
||||
//
|
||||
this.purchaseOrderGroupBox.Controls.Add(this.purchaseOrderCheckBox);
|
||||
this.purchaseOrderGroupBox.Controls.Add(this.purchaseOrderComboBox);
|
||||
this.purchaseOrderGroupBox.Location = new System.Drawing.Point(15, 14);
|
||||
this.purchaseOrderGroupBox.Name = "purchaseOrderGroupBox";
|
||||
this.purchaseOrderGroupBox.Size = new System.Drawing.Size(242, 63);
|
||||
this.purchaseOrderGroupBox.TabIndex = 2;
|
||||
this.purchaseOrderGroupBox.TabStop = false;
|
||||
//
|
||||
// purchaseOrderCheckBox
|
||||
//
|
||||
this.purchaseOrderCheckBox.AutoSize = true;
|
||||
this.purchaseOrderCheckBox.Location = new System.Drawing.Point(19, 0);
|
||||
this.purchaseOrderCheckBox.Name = "purchaseOrderCheckBox";
|
||||
this.purchaseOrderCheckBox.Size = new System.Drawing.Size(98, 17);
|
||||
this.purchaseOrderCheckBox.TabIndex = 1;
|
||||
this.purchaseOrderCheckBox.Text = "Purchase order";
|
||||
this.purchaseOrderCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// purchaseOrderComboBox
|
||||
//
|
||||
this.purchaseOrderComboBox.FormattingEnabled = true;
|
||||
this.purchaseOrderComboBox.Location = new System.Drawing.Point(18, 26);
|
||||
this.purchaseOrderComboBox.Name = "purchaseOrderComboBox";
|
||||
this.purchaseOrderComboBox.Size = new System.Drawing.Size(201, 21);
|
||||
this.purchaseOrderComboBox.TabIndex = 0;
|
||||
//
|
||||
// MainWnd
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(767, 624);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "MainWnd";
|
||||
this.Text = "Form1";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainWnd_FormClosing);
|
||||
this.Load += new System.EventHandler(this.MainWnd_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.fromGroupBox.ResumeLayout(false);
|
||||
this.fromGroupBox.PerformLayout();
|
||||
this.purchaseOrderGroupBox.ResumeLayout(false);
|
||||
this.purchaseOrderGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button queryButton;
|
||||
private System.Windows.Forms.TextBox outputTextBox;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.GroupBox fromGroupBox;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.CheckBox filterDateCheckBox;
|
||||
private System.Windows.Forms.DateTimePicker toDateTimePicker;
|
||||
private System.Windows.Forms.DateTimePicker fromDateTimePicker;
|
||||
private System.Windows.Forms.GroupBox purchaseOrderGroupBox;
|
||||
private System.Windows.Forms.CheckBox purchaseOrderCheckBox;
|
||||
private System.Windows.Forms.ComboBox purchaseOrderComboBox;
|
||||
private System.Windows.Forms.Button clearButton;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using NHibernate;
|
||||
using Config.Entities;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
@ -15,5 +17,97 @@ namespace ResultsBrowser
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void MainWnd_Load(object sender, EventArgs e)
|
||||
{
|
||||
PreparePurchaseOrderCombo(purchaseOrderComboBox);
|
||||
}
|
||||
|
||||
private void MainWnd_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
Program.LocalSettings.UpdateHistory(purchaseOrderComboBox.Text, ref Program.LocalSettings.PurchaseOrderHistory);
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
/// <param name="comboBox">Puchase order ComboBox</param>
|
||||
void PreparePurchaseOrderCombo(ComboBox comboBox)
|
||||
{
|
||||
for (int i = 0; i < Program.LocalSettings.PurchaseOrderHistoryCount; i++)
|
||||
{
|
||||
comboBox.Items.Add(Program.LocalSettings.PurchaseOrderHistory[i]);
|
||||
}
|
||||
if (comboBox.Items.Count > 0) comboBox.Text = comboBox.Items[0].ToString();
|
||||
}
|
||||
|
||||
private void filterDateCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
fromDateTimePicker.Enabled = toDateTimePicker.Enabled = filterDateCheckBox.Checked;
|
||||
}
|
||||
|
||||
private void purchaseOrderCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
purchaseOrderComboBox.Enabled = purchaseOrderCheckBox.Checked;
|
||||
}
|
||||
|
||||
private void queryButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!purchaseOrderCheckBox.Checked && !filterDateCheckBox.Checked) return;
|
||||
try
|
||||
{
|
||||
ISession session = Config.FluentCommon.CreateSession(Config.Database.Procedures);
|
||||
|
||||
IList<TestResult> testResults;
|
||||
|
||||
if (!purchaseOrderCheckBox.Checked)
|
||||
{
|
||||
testResults = session.QueryOver<TestResult>()
|
||||
.WhereRestrictionOn(x => x.TimeStart)
|
||||
.IsBetween(fromDateTimePicker.MinDate)
|
||||
.And(toDateTimePicker.MaxDate)
|
||||
.OrderBy(x => x.BatchNr).Desc
|
||||
.List<TestResult>();
|
||||
}
|
||||
else if (!filterDateCheckBox.Checked)
|
||||
{
|
||||
testResults = session.QueryOver<TestResult>()
|
||||
.Where(x => (x.PurchaseOrder == purchaseOrderComboBox.Text))
|
||||
.OrderBy(x => x.BatchNr).Desc
|
||||
.List<TestResult>();
|
||||
}
|
||||
else
|
||||
{
|
||||
testResults = session.QueryOver<TestResult>()
|
||||
.WhereRestrictionOn(x => x.TimeStart)
|
||||
.IsBetween(fromDateTimePicker.MinDate)
|
||||
.And(toDateTimePicker.MaxDate)
|
||||
.Where(x => (x.PurchaseOrder == purchaseOrderComboBox.Text))
|
||||
.OrderBy(x => x.BatchNr).Desc
|
||||
.List<TestResult>();
|
||||
}
|
||||
|
||||
IList<int> batchNrs = new List<int>();
|
||||
|
||||
foreach (var tr in testResults)
|
||||
{
|
||||
if (!batchNrs.Contains(tr.BatchNr))
|
||||
{
|
||||
batchNrs.Insert(0, tr.BatchNr);
|
||||
outputTextBox.Text += string.Format("Batch {0}\r\n", tr.BatchNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(exc.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
outputTextBox.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
120
ResultsBrowser/MainWnd.resx
Normal file
120
ResultsBrowser/MainWnd.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@ -124,6 +124,9 @@
|
||||
<EmbeddedResource Include="Forms\NoBenchOrDatabaseDlg.resx">
|
||||
<DependentUpon>NoBenchOrDatabaseDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainWnd.resx">
|
||||
<DependentUpon>MainWnd.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
@ -10,6 +10,10 @@ EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Config", "Config\Config.csproj", "{743DF7DB-C7B6-42EB-986D-0F485E5588E4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsBrowser", "ResultsBrowser\ResultsBrowser.csproj", "{07BA543A-54CA-4A59-9AD9-DDE7038E1BF9}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB} = {9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}
|
||||
{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48} = {8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@ -26,7 +26,7 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
/// <summary>
|
||||
/// Result items to print
|
||||
/// </summary>
|
||||
IList<TBF.Forms.ResultItemSpec> resultItems;
|
||||
IList<Config.ResultItemSpec> resultItems;
|
||||
bool combined;
|
||||
|
||||
/// <summary>
|
||||
@ -195,11 +195,11 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
combined = (procedure.MetersKind == MetersKind.Combined);
|
||||
if (combined)
|
||||
{
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_SingleWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_SingleWM);
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@ -41,7 +41,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
readonly IList<TBF.Forms.ResultItemSpec> resultItems;
|
||||
readonly IList<Config.ResultItemSpec> resultItems;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
@ -78,12 +78,12 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
|
||||
if ((unsortedResults != null) && (unsortedResults.Count != 0) && (unsortedResults[0].MetersKind == MetersKind.Single))
|
||||
{
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
combined = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
combined = true;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
readonly IList<TBF.Forms.ResultItemSpec> resultItems;
|
||||
readonly IList<Config.ResultItemSpec> resultItems;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
@ -70,12 +70,12 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
|
||||
if ((unsortedResults != null) && (unsortedResults.Count != 0) && (unsortedResults[0].MetersKind == MetersKind.Single))
|
||||
{
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
combined = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
combined = true;
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ namespace TBF.BenchControl.ResultsPrinters.Zapiska
|
||||
///
|
||||
readonly IList<string> testNames;
|
||||
readonly int testsPerMeter;
|
||||
readonly IList<TBF.Forms.ResultItemSpec> resultItems;
|
||||
readonly IList<Config.ResultItemSpec> resultItems;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
@ -92,7 +92,7 @@ namespace TBF.BenchControl.ResultsPrinters.Zapiska
|
||||
if (tr.BatchNr > batchMax) batchMax = tr.BatchNr;
|
||||
}
|
||||
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
|
||||
testNames = Utils.GetDecoratedTestNames(procedure, 1);
|
||||
testsPerMeter = testNames.Count;
|
||||
|
||||
@ -21,7 +21,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
/// <summary>
|
||||
/// Result items to print
|
||||
/// </summary>
|
||||
IList<TBF.Forms.ResultItemSpec> resultItems;
|
||||
IList<Config.ResultItemSpec> resultItems;
|
||||
bool combined;
|
||||
|
||||
/// <summary>
|
||||
@ -150,11 +150,11 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
combined = (procedure.MetersKind == MetersKind.Combined);
|
||||
if (combined)
|
||||
{
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_SingleWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_SingleWM);
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@ -104,8 +104,8 @@ namespace TBF.Forms
|
||||
(x, y, z) => z.TestResult.TimeEnd.ToShortTimeString()));
|
||||
AllItems.Add(new ResultItemSpec("Test time", "T [s]", x => x.TestResult.Time.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.Time.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Flow", Strings.Flow_m3h, x => Utils.FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
|
||||
(x, y, z) => Utils.FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
|
||||
AllItems.Add(new ResultItemSpec("Flow", Strings.Flow_m3h, x => FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
|
||||
(x, y, z) => FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
|
||||
AllItems.Add(new ResultItemSpec("T in", Strings.T_in, x => x.TestResult.TempInAvrg.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.TempInAvrg.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("T out", Strings.T_out, x => x.TestResult.TempOutAvrg.ToString("F2"),
|
||||
@ -188,5 +188,45 @@ namespace TBF.Forms
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts float number to a string with the specified number of valid digits
|
||||
/// </summary>
|
||||
/// <param name="value">Float value to be converted to a string</param>
|
||||
/// <param name="validDigits">Number of valid digits: 4, 3, or 2 (otherwise a full precision number is printed)</param>
|
||||
/// <returns>String representation of the float number</returns>
|
||||
public static string FloatToStr(float value, int validDigits)
|
||||
{
|
||||
if (validDigits == 4)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return value.ToString("F0");
|
||||
else if (value >= 99.95 || value < -99.95) return value.ToString("F1");
|
||||
else if (value >= 9.995 || value < -9.995) return value.ToString("F2");
|
||||
else if (value >= 0.9995 || value < -0.9995) return value.ToString("F3");
|
||||
else if (value >= 0.09995 || value < -0.09995) return value.ToString("F4");
|
||||
else if (value >= 0.009995 || value < -0.009995) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
}
|
||||
else if (validDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return value.ToString("F0");
|
||||
else if (value >= 9.95 || value < -9.95) return value.ToString("F1");
|
||||
else if (value >= 0.995 || value < -0.995) return value.ToString("F2");
|
||||
else if (value >= 0.0995 || value < -0.0995) return value.ToString("F3");
|
||||
else if (value >= 0.00995 || value < -0.00995) return value.ToString("F4");
|
||||
else if (value >= 0.000995 || value < -0.000995) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
}
|
||||
else if (validDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return value.ToString("F0");
|
||||
else if (value >= 0.95 || value < -0.95) return value.ToString("F1");
|
||||
else if (value >= 0.095 || value < -0.095) return value.ToString("F2");
|
||||
else if (value >= 0.0095 || value < -0.0095) return value.ToString("F3");
|
||||
else if (value >= 0.00095 || value < -0.00095) return value.ToString("F4");
|
||||
else return value.ToString("F5");
|
||||
}
|
||||
else return value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using TBF.Resources;
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ namespace TBF
|
||||
///
|
||||
readonly IList<string> testNames;
|
||||
readonly int testsPerMeter;
|
||||
readonly IList<TBF.Forms.ResultItemSpec> resultItems;
|
||||
readonly IList<Config.ResultItemSpec> resultItems;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
@ -90,7 +90,7 @@ namespace TBF
|
||||
if (tr.BatchNr > batchMax) batchMax = tr.BatchNr;
|
||||
}
|
||||
|
||||
resultItems = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
|
||||
testNames = Utils.GetDecoratedTestNames(procedure, 1);
|
||||
testsPerMeter = testNames.Count;
|
||||
|
||||
@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
@ -22,12 +23,12 @@ namespace TBF.Screens
|
||||
public TestsArrangement TestsArrangement;
|
||||
public int NrMetersInOneGroup;
|
||||
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Screen_SingleWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Screen_CombinedWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Printer_SingleWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Printer_CombinedWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Disk_SingleWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Disk_CombinedWM;
|
||||
public IList<ResultItemSpec> RsltItems_Screen_SingleWM;
|
||||
public IList<ResultItemSpec> RsltItems_Screen_CombinedWM;
|
||||
public IList<ResultItemSpec> RsltItems_Printer_SingleWM;
|
||||
public IList<ResultItemSpec> RsltItems_Printer_CombinedWM;
|
||||
public IList<ResultItemSpec> RsltItems_Disk_SingleWM;
|
||||
public IList<ResultItemSpec> RsltItems_Disk_CombinedWM;
|
||||
|
||||
Procedure procedure;
|
||||
IList<TestResult> testResults;
|
||||
@ -71,12 +72,12 @@ namespace TBF.Screens
|
||||
MetersArrangement = Program.LocalSettings.ResultsConfigMeters;
|
||||
TestsArrangement = Program.LocalSettings.ResultsConfigTests;
|
||||
NrMetersInOneGroup = Math.Max(1, Program.LocalSettings.ResultsConfigMetersInOneGroup);
|
||||
RsltItems_Screen_SingleWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
|
||||
RsltItems_Screen_CombinedWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
|
||||
RsltItems_Printer_SingleWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
RsltItems_Printer_CombinedWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
RsltItems_Disk_SingleWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_SingleWM);
|
||||
RsltItems_Disk_CombinedWM = Forms.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
|
||||
RsltItems_Screen_SingleWM = ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
|
||||
RsltItems_Screen_CombinedWM = ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
|
||||
RsltItems_Printer_SingleWM = ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
RsltItems_Printer_CombinedWM = ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
RsltItems_Disk_SingleWM = ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_SingleWM);
|
||||
RsltItems_Disk_CombinedWM = ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
|
||||
|
||||
RedrawAll();
|
||||
}
|
||||
@ -87,36 +88,41 @@ namespace TBF.Screens
|
||||
private void configureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
TBF.Forms.ResultsConfig dlg = new TBF.Forms.ResultsConfig(combined);
|
||||
|
||||
dlg.TestsArrangement = TestsArrangement;
|
||||
dlg.MetersArrangement = MetersArrangement;
|
||||
dlg.NrMetersInOneGroup = NrMetersInOneGroup;
|
||||
dlg.RsltItems_Screen_SingleWM = RsltItems_Screen_SingleWM;
|
||||
dlg.RsltItems_Screen_CombinedWM = RsltItems_Screen_CombinedWM;
|
||||
dlg.RsltItems_Printer_SingleWM = RsltItems_Printer_SingleWM;
|
||||
|
||||
dlg.RsltItems_Screen_SingleWM = RsltItems_Screen_SingleWM;
|
||||
dlg.RsltItems_Screen_CombinedWM = RsltItems_Screen_CombinedWM;
|
||||
dlg.RsltItems_Printer_SingleWM = RsltItems_Printer_SingleWM;
|
||||
dlg.RsltItems_Printer_CombinedWM = RsltItems_Printer_CombinedWM;
|
||||
dlg.RsltItems_Disk_SingleWM = RsltItems_Disk_SingleWM;
|
||||
dlg.RsltItems_Disk_CombinedWM = RsltItems_Disk_CombinedWM;
|
||||
dlg.RsltItems_Disk_SingleWM = RsltItems_Disk_SingleWM;
|
||||
dlg.RsltItems_Disk_CombinedWM = RsltItems_Disk_CombinedWM;
|
||||
|
||||
if (DialogResult.OK == dlg.ShowDialog())
|
||||
{
|
||||
MetersArrangement = dlg.MetersArrangement;
|
||||
TestsArrangement = dlg.TestsArrangement;
|
||||
NrMetersInOneGroup = dlg.NrMetersInOneGroup;
|
||||
RsltItems_Screen_SingleWM = dlg.RsltItems_Screen_SingleWM;
|
||||
RsltItems_Screen_CombinedWM = dlg.RsltItems_Screen_CombinedWM;
|
||||
RsltItems_Printer_SingleWM = dlg.RsltItems_Printer_SingleWM;
|
||||
|
||||
RsltItems_Screen_SingleWM = dlg.RsltItems_Screen_SingleWM;
|
||||
RsltItems_Screen_CombinedWM = dlg.RsltItems_Screen_CombinedWM;
|
||||
RsltItems_Printer_SingleWM = dlg.RsltItems_Printer_SingleWM;
|
||||
RsltItems_Printer_CombinedWM = dlg.RsltItems_Printer_CombinedWM;
|
||||
RsltItems_Disk_SingleWM = dlg.RsltItems_Disk_SingleWM;
|
||||
RsltItems_Disk_CombinedWM = dlg.RsltItems_Disk_CombinedWM;
|
||||
RsltItems_Disk_SingleWM = dlg.RsltItems_Disk_SingleWM;
|
||||
RsltItems_Disk_CombinedWM = dlg.RsltItems_Disk_CombinedWM;
|
||||
|
||||
Program.LocalSettings.ResultsConfigMeters = MetersArrangement;
|
||||
Program.LocalSettings.ResultsConfigTests = TestsArrangement;
|
||||
Program.LocalSettings.ResultsConfigMetersInOneGroup = NrMetersInOneGroup;
|
||||
Program.LocalSettings.RsltItems_Screen_SingleWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Screen_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Screen_CombinedWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Screen_CombinedWM);
|
||||
Program.LocalSettings.RsltItems_Printer_SingleWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Printer_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Printer_CombinedWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Printer_CombinedWM);
|
||||
Program.LocalSettings.RsltItems_Disk_SingleWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Disk_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Disk_CombinedWM = Forms.ResultItemSpec.ToStrArray(RsltItems_Disk_CombinedWM);
|
||||
|
||||
Program.LocalSettings.RsltItems_Screen_SingleWM = ResultItemSpec.ToStrArray(RsltItems_Screen_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Screen_CombinedWM = ResultItemSpec.ToStrArray(RsltItems_Screen_CombinedWM);
|
||||
Program.LocalSettings.RsltItems_Printer_SingleWM = ResultItemSpec.ToStrArray(RsltItems_Printer_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Printer_CombinedWM = ResultItemSpec.ToStrArray(RsltItems_Printer_CombinedWM);
|
||||
Program.LocalSettings.RsltItems_Disk_SingleWM = ResultItemSpec.ToStrArray(RsltItems_Disk_SingleWM);
|
||||
Program.LocalSettings.RsltItems_Disk_CombinedWM = ResultItemSpec.ToStrArray(RsltItems_Disk_CombinedWM);
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
RedrawAll();
|
||||
@ -284,7 +290,7 @@ namespace TBF.Screens
|
||||
/// <returns>ListView object</returns>
|
||||
ListView GetResultsTestsAreRows(int mtr, int printedWMNr)
|
||||
{
|
||||
IList<Forms.ResultItemSpec> items = (combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
|
||||
IList<ResultItemSpec> items = (combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
|
||||
if (procedure == null || procedure.Tests == null || items == null) return null;
|
||||
|
||||
ListView lview = GetListView();
|
||||
@ -367,7 +373,7 @@ namespace TBF.Screens
|
||||
/// <returns>ListView object</returns>
|
||||
ListView GetResultsTestsAreColumns(int mtr, int printedWMNr)
|
||||
{
|
||||
IList<Forms.ResultItemSpec> items = (combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
|
||||
IList<ResultItemSpec> items = (combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
|
||||
if (procedure == null || procedure.Tests == null || items == null) return null;
|
||||
|
||||
ListView lview = GetListView();
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@ -83,7 +83,7 @@
|
||||
<ManifestKeyFile>TBF_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
@ -92,7 +92,7 @@
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ControlComponent3Munich">
|
||||
@ -978,7 +978,6 @@
|
||||
<Compile Include="Forms\PrintOrderForm.Designer.cs">
|
||||
<DependentUpon>PrintOrderForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ResultItemSpec.cs" />
|
||||
<Compile Include="Forms\ResultsConfig.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user