Generic results items improvement: enum values used to create result items to guarantee uniqueness.

This commit is contained in:
Milan Hanajik 2016-08-01 15:40:51 +02:00
parent 63abe74aed
commit 69f7e62e4e
9 changed files with 202 additions and 90 deletions

86
Results/ItemID.cs Normal file
View File

@ -0,0 +1,86 @@
using System;
namespace Results
{
public enum ItemID
{
String, /// 0
Test_name, /// 1
Procedure_name, /// 2
Batch_number, /// 3
Test_method, /// 4
Density, /// 5
Q_from, /// 6
Q_to, /// 7
Test_volume, /// 8
Error_limit_Lo, /// 9
Error_limit_Hi, /// 10
Uncertainty, /// 11
Test_start_time, /// 12
Test_end_time, /// 13
Test_time, /// 14
Flow, /// 15
T_in, /// 16
T_out, /// 17
T_div, /// 18
P_up, /// 19
P_up_start, /// 20
P_up_end, /// 21
P_down, /// 22
P_down_start, /// 23
P_down_end, /// 24
Reference_error, /// 25
Ambient_temperature, /// 26
Ambient_pressure, /// 27
Ambient_humidity, /// 28
Volume, /// 29
Reference_volume, /// 30
Error, /// 31
Passed, /// 32
Watermeter_type, /// 33
Producer, /// 34
DN, /// 35
L, /// 36
Mounting, /// 37
Q4, /// 38
Q3, /// 39
Q2, /// 40
Q1, /// 41
Metrological_class, /// 42
Temperature_class, /// 43
Pressure_loss_class, /// 44
Max_admissible_pressure, /// 45
Flow_profile_sensitivity_class, /// 46
Approval_info, /// 47
Certificate, /// 48
Pulses_per_liter, /// 49
Text1, /// 50
Text2, /// 51
Text3, /// 52
Text4, /// 53
Text5, /// 54
Serial_Nr, /// 55
Purchase_order, /// 56
Year_of_production, /// 57
WM_Position, /// 58
End_state, /// 59
Pulses, /// 60
Pulses__liter, /// 61
Reference_pulses, /// 62
spare_63,
Test_bench_ID, /// 64
Program_version, /// 65
User_name, /// 66
User_nr, /// 67
spare_68,
Watermeters, /// 69
Protocol_title, /// 70
Batch_start_time, /// 71
Batch_end_time, /// 72
Lite_per_pulse_Read, /// 73
Result_code, /// 74
Remark, /// 75
Count,
}
}

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.9.326.0")]
[assembly: AssemblyFileVersion("2.9.326.0")]
[assembly: AssemblyVersion("2.9.329.0")]
[assembly: AssemblyFileVersion("2.9.329.0")]

View File

@ -294,6 +294,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Mounting.
/// </summary>
internal static string Mounting {
get {
return ResourceManager.GetString("Mounting", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>

View File

@ -183,4 +183,7 @@
<data name="Width" xml:space="preserve">
<value>Šířka</value>
</data>
<data name="Mounting" xml:space="preserve">
<value>Montáž</value>
</data>
</root>

View File

@ -381,4 +381,7 @@
<data name="Result_code" xml:space="preserve">
<value>Ergebniscode</value>
</data>
<data name="Mounting" xml:space="preserve">
<value>Montage</value>
</data>
</root>

View File

@ -384,4 +384,7 @@
<data name="Result_code" xml:space="preserve">
<value>Result code</value>
</data>
<data name="Mounting" xml:space="preserve">
<value>Mounting</value>
</data>
</root>

View File

@ -82,6 +82,7 @@
<Compile Include="Forms\ResultsConfigDlg.designer.cs">
<DependentUpon>ResultsConfigDlg.cs</DependentUpon>
</Compile>
<Compile Include="ItemID.cs" />
<Compile Include="Mappings\BatchMap.cs" />
<Compile Include="Mappings\ComponentsMap.cs" />
<Compile Include="Mappings\MeterTestRsltMap.cs" />

View File

@ -27,7 +27,7 @@ namespace Results
public WMeterRsltItemSpec Clone()
{
WMeterRsltItemSpec item2 = new WMeterRsltItemSpec(Uid, OldUid, Name, printDlgt);
WMeterRsltItemSpec item2 = new WMeterRsltItemSpec((ItemID)Uid, Name, printDlgt);
item2.Caption = Caption;
item2.TestID = TestID;
item2.Units = Units;
@ -79,10 +79,10 @@ namespace Results
///
/// Public constructor
///
public WMeterRsltItemSpec(int uid, string oldUid, string name, PrintDlgt printDlgt)
public WMeterRsltItemSpec(ItemID itemId, string name, PrintDlgt printDlgt)
{
Uid = uid;
OldUid = oldUid;
Uid = (int)itemId;
OldUid = itemId.ToString().Replace("__", "/").Replace('_', ' ');
Name = name;
this.printDlgt = printDlgt;
}
@ -96,101 +96,101 @@ namespace Results
{
AllItems = new List<WMeterRsltItemSpec>();
AllItems.Add(new WMeterRsltItemSpec(0, null, "String", (w, t, u, f, p) => f));
AllItems.Add(new WMeterRsltItemSpec(ItemID.String, "String", (w, t, u, f, p) => f));
/// Common
AllItems.Add(new WMeterRsltItemSpec(1, "Test name", Strings.Test + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name()));
AllItems.Add(new WMeterRsltItemSpec(2, "Procedure name", Strings.Procedure, (w, t, u, f, p) => w.ProcedureName()));
AllItems.Add(new WMeterRsltItemSpec(3, "Batch number", Strings.Batch_nr, (w, t, u, f, p) => w.BatchNr().ToString()));
AllItems.Add(new WMeterRsltItemSpec(4, "Test method", Strings.Test_method + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method()));
AllItems.Add(new WMeterRsltItemSpec(5, "Density", Strings.Density + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).DensityOut.ToString(string.IsNullOrEmpty(p) ? "F1" : p))); /// [kg/m3]
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, (w, t, u, f, p) => w.ProcedureName()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, (w, t, u, f, p) => w.BatchNr().ToString()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).DensityOut.ToString(string.IsNullOrEmpty(p) ? "F1" : p))); /// [kg/m3]
/// Target values
AllItems.Add(new WMeterRsltItemSpec(6, "Q from", Strings.Q_from_m3ph + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Qfrom().ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(7, "Q to", Strings.Q_to_m3ph + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Qto().ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(8, "Test volume", Strings.Test_vol_l + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TargetVolume()).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(9, "Error limit Lo", Strings.ErrLimLo_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrLimLo()).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(10, "Error limit Hi", Strings.ErrLimHi_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrLimHi()).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(11, "Uncertainty", Strings.Uncertainty_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Uncertainty().ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_from, Strings.Q_from_m3ph + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Qfrom().ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_to, Strings.Q_to_m3ph + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Qto().ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol_l + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TargetVolume()).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Lo, Strings.ErrLimLo_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrLimLo()).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrLimHi()).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Uncertainty().ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
/// Test results
AllItems.Add(new WMeterRsltItemSpec(12, "Test start time", Strings.T_start + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(f) ? w.GetTestRslt(t).StartTime.ToString() : string.Format(f, w.GetTestRslt(t).StartTime))));
AllItems.Add(new WMeterRsltItemSpec(13, "Test end time", Strings.T_end + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(f) ? w.GetTestRslt(t).EndTime.ToString() : string.Format(f, w.GetTestRslt(t).EndTime))));
AllItems.Add(new WMeterRsltItemSpec(14, "Test time", Strings.T_s + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).TestTime.ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(15, "Flow", Strings.Flow_m3ph + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Utils.DoubleToStr(Config.Units.ConvertTo(u, w.GetTestRslt(t).FlowVolume), 4)));
AllItems.Add(new WMeterRsltItemSpec(16, "T in", Strings.T_in_degC + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempInAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(17, "T out", Strings.T_out_degC + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempOutAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(18, "T div", Strings.T_div_degC + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(19, "P up", Strings.P_up_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpAvrg).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(20, "P up start", Strings.P_up_start_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpStart).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(21, "P up end", Strings.P_up_end_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpEnd).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(22, "P down", Strings.P_dn_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownAvrg).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(23, "P down start", Strings.P_dn_start_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownStart).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(24, "P down end", Strings.P_dn_end_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownEnd).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(25, "Reference error", Strings.ErrRef_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrorMaster).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(26, "Ambient temperature", Strings.T_amb_degC + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbientTempAve()).ToString(string.IsNullOrEmpty(p) ? "F1" : p) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientTempAve).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(27, "Ambient pressure", Strings.P_amb_mbar + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbientPressAve()).ToString(string.IsNullOrEmpty(p) ? "F0" : p) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientPressAve).ToString(string.IsNullOrEmpty(p) ? "F0" : p)));
AllItems.Add(new WMeterRsltItemSpec(28, "Ambient humidity", Strings.H_amb_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbientHumiAve()).ToString(string.IsNullOrEmpty(p) ? "F1" : p) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientHumiAve).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_start_time, Strings.T_start + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(f) ? w.GetTestRslt(t).StartTime.ToString() : string.Format(f, w.GetTestRslt(t).StartTime))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_end_time, Strings.T_end + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(f) ? w.GetTestRslt(t).EndTime.ToString() : string.Format(f, w.GetTestRslt(t).EndTime))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).TestTime.ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow, Strings.Flow_m3ph + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Utils.DoubleToStr(Config.Units.ConvertTo(u, w.GetTestRslt(t).FlowVolume), 4)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_in, Strings.T_in_degC + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempInAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_out, Strings.T_out_degC + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempOutAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div, Strings.T_div_degC + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up, Strings.P_up_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpAvrg).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_start, Strings.P_up_start_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpStart).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_end, Strings.P_up_end_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpEnd).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down, Strings.P_dn_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownAvrg).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_start, Strings.P_dn_start_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownStart).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_end, Strings.P_dn_end_kPa + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownEnd).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, Strings.ErrRef_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrorMaster).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_temperature, Strings.T_amb_degC + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbientTempAve()).ToString(string.IsNullOrEmpty(p) ? "F1" : p) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientTempAve).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_pressure, Strings.P_amb_mbar + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbientPressAve()).ToString(string.IsNullOrEmpty(p) ? "F0" : p) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientPressAve).ToString(string.IsNullOrEmpty(p) ? "F0" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_humidity, Strings.H_amb_pct + "()", (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbientHumiAve()).ToString(string.IsNullOrEmpty(p) ? "F1" : p) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientHumiAve).ToString(string.IsNullOrEmpty(p) ? "F1" : p)));
/// Single and combined meter results
AllItems.Add(new WMeterRsltItemSpec(29, "Volume", Strings.Volume_l + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(30, "Reference volume", Strings.VolRef_l + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeRef).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, Strings.Volume_l + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, Strings.VolRef_l + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeRef).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
#if IPERLST || IPERLST_SPECIAL
AllItems.Add(new WMeterRsltItemSpec(31, "Error", Strings.Error_pct + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, Strings.Error_pct + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
#else
AllItems.Add(new WMeterRsltItemSpec(31, "Error", Strings.Error_pct + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, Strings.Error_pct + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
#endif
AllItems.Add(new WMeterRsltItemSpec(32, "Passed", Strings.Result + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr()));
/// Water meter info
AllItems.Add(new WMeterRsltItemSpec(33, "Watermeter type", Strings.WM_Type, (w, t, u, f, p) => w.WaterMeterData.ProductName));
AllItems.Add(new WMeterRsltItemSpec(34, "Producer", Strings.Producer, (w, t, u, f, p) => w.WaterMeterData.Producer));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeter_type, Strings.WM_Type, (w, t, u, f, p) => w.WaterMeterData.ProductName));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Producer, Strings.Producer, (w, t, u, f, p) => w.WaterMeterData.Producer));
AllItems.Add(new WMeterRsltItemSpec(35, null, "DN", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.DN).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.DN).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(36, null, "L", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.L).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.L).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(37, null, "Mounting", (w, t, u, f, p) => w.WaterMeterData.Mounting.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.DN, "DN", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.DN).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.DN).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.L, "L", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.L).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.L).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mounting, Strings.Mounting, (w, t, u, f, p) => w.WaterMeterData.Mounting.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(38, "Q4", "Q4_Qmax", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(39, "Q3", "Q3_Qn", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q3_Qn).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.Q3_Qn).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(40, "Q2", "Q2_Qt", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(41, "Q1", "Q1_Qmin", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q4, "Q4_Qmax", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q3, "Q3_Qn", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q3_Qn).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.Q3_Qn).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2, "Q2_Qt", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q1, "Q1_Qmin", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString()
: Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(42, "Metrological class", Strings.MClass, (w, t, u, f, p) => w.WaterMeterData.MetrologicalClass));
AllItems.Add(new WMeterRsltItemSpec(43, null, "Temperature class", (w, t, u, f, p) => w.WaterMeterData.TemperatureClass.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(44, null, "Preasure loss class", (w, t, u, f, p) => w.WaterMeterData.PressureLossClass.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(45, null, "Max. admissible pressure",(w, t, u, f, p) => w.WaterMeterData.MaxAdmissiblePressure.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(46, null, "Flow profile sensitivity class",(w, t, u, f, p) => w.WaterMeterData.FlowProfileSensitivityClass.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Metrological_class, Strings.MClass, (w, t, u, f, p) => w.WaterMeterData.MetrologicalClass));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Temperature_class, "Temperature class", (w, t, u, f, p) => w.WaterMeterData.TemperatureClass.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pressure_loss_class, "Pressure loss class", (w, t, u, f, p) => w.WaterMeterData.PressureLossClass.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_admissible_pressure, "Max. admissible pressure",(w, t, u, f, p) => w.WaterMeterData.MaxAdmissiblePressure.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_profile_sensitivity_class, "Flow profile sensitivity class",(w, t, u, f, p) => w.WaterMeterData.FlowProfileSensitivityClass.ToDescription()));
AllItems.Add(new WMeterRsltItemSpec(47, "Approval info", Strings.Approval, (w, t, u, f, p) => w.WaterMeterData.ApprovalInfo));
AllItems.Add(new WMeterRsltItemSpec(48, null, "Certificate", (w, t, u, f, p) => w.WaterMeterData.Certificate));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Approval_info, Strings.Approval, (w, t, u, f, p) => w.WaterMeterData.ApprovalInfo));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Certificate, "Certificate", (w, t, u, f, p) => w.WaterMeterData.Certificate));
AllItems.Add(new WMeterRsltItemSpec(49, null, Strings.PulsesLiter, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? w.WaterMeterData.PulsesPerLtr.ToString()
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? w.WaterMeterData.PulsesPerLtr.ToString()
: w.WaterMeterData.PulsesPerLtr.ToString(p)));
AllItems.Add(new WMeterRsltItemSpec(50, null, "Text1", (w, t, u, f, p) => w.WaterMeterData.Text1));
AllItems.Add(new WMeterRsltItemSpec(51, null, "Text2", (w, t, u, f, p) => w.WaterMeterData.Text2));
AllItems.Add(new WMeterRsltItemSpec(52, null, "Text3", (w, t, u, f, p) => w.WaterMeterData.Text3));
AllItems.Add(new WMeterRsltItemSpec(53, null, "Text4", (w, t, u, f, p) => w.WaterMeterData.Text4));
AllItems.Add(new WMeterRsltItemSpec(54, null, "Text5", (w, t, u, f, p) => w.WaterMeterData.Text5));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text1, "Text1", (w, t, u, f, p) => w.WaterMeterData.Text1));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text2, "Text2", (w, t, u, f, p) => w.WaterMeterData.Text2));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text3, "Text3", (w, t, u, f, p) => w.WaterMeterData.Text3));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text4, "Text4", (w, t, u, f, p) => w.WaterMeterData.Text4));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text5, "Text5", (w, t, u, f, p) => w.WaterMeterData.Text5));
/// Water meters results
AllItems.Add(new WMeterRsltItemSpec(55, "Serial Nr", Strings.sn, (w, t, u, f, p) => w.SerialNr));
AllItems.Add(new WMeterRsltItemSpec(56, "Purchase order", Strings.PO, (w, t, u, f, p) => w.PurchaseOrder));
AllItems.Add(new WMeterRsltItemSpec(57, "Year of production", Strings.Year, (w, t, u, f, p) => w.YearOfProduction.ToString()));
AllItems.Add(new WMeterRsltItemSpec(58, "WM Position", Strings.Pos, (w, t, u, f, p) => w.WMPosition.ToString()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr, Strings.sn, (w, t, u, f, p) => w.SerialNr));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Purchase_order, Strings.PO, (w, t, u, f, p) => w.PurchaseOrder));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Year_of_production, Strings.Year, (w, t, u, f, p) => w.YearOfProduction.ToString()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_Position, Strings.Pos, (w, t, u, f, p) => w.WMPosition.ToString()));
/// Water meters results (single)
AllItems.Add(new WMeterRsltItemSpec(59, "End state", Strings.End_state, (w, t, u, f, p) => w.EndState));
AllItems.Add(new WMeterRsltItemSpec(60, "Pulses", Strings.Pulses + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PulsesMeter.ToString()));
AllItems.Add(new WMeterRsltItemSpec(61, "Pulses/liter", Strings.PulsesLiter + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t).PulsesPerLiter.ToString()
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, (w, t, u, f, p) => w.EndState));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PulsesMeter.ToString()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses__liter, Strings.PulsesLiter + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t).PulsesPerLiter.ToString()
: w.GetMeterTestRslt(t).PulsesPerLiter.ToString(p))));
AllItems.Add(new WMeterRsltItemSpec(62, "Reference pulses", Strings.RefPulses + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PulsesMaster.ToString()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses, Strings.RefPulses + "()", (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PulsesMaster.ToString()));
/// Water meters results (combined)
//AllItems.Add(new ItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (z.QRise() == 0) ? "-" : Utils.DoubleToStr(z.QRise(), 4)));
@ -203,21 +203,19 @@ namespace Results
//AllItems.Add(new ItemSpec("End state small WM", "End state", null, (x, y, z) => y.EndState()));
/// Batch info
AllItems.Add(new WMeterRsltItemSpec(63, "Batch number", Strings.Batch_nr, (w, t, u, f, p) => w.Batch.BatchNr.ToString()));
AllItems.Add(new WMeterRsltItemSpec(64, "Test bench ID", Strings.Bench, (w, t, u, f, p) => w.Batch.TestBenchId.ToString()));
AllItems.Add(new WMeterRsltItemSpec(65, "Program version", Strings.Ver, (w, t, u, f, p) => w.Batch.ProgramVersion));
AllItems.Add(new WMeterRsltItemSpec(66, "User name", Strings.User, (w, t, u, f, p) => w.Batch.UserName));
AllItems.Add(new WMeterRsltItemSpec(67, "User nr.", Strings.User_nr, (w, t, u, f, p) => w.Batch.UserNumber.ToString()));
AllItems.Add(new WMeterRsltItemSpec(68, "Procedure name", Strings.Procedure, (w, t, u, f, p) => w.Batch.ProcedureName));
AllItems.Add(new WMeterRsltItemSpec(69, "Watermeters", Strings.WMs, (w, t, u, f, p) => w.Batch.WatermetersStr));
AllItems.Add(new WMeterRsltItemSpec(70, "Protocol title", Strings.Protocol, (w, t, u, f, p) => w.Batch.ProtocolTitle));
AllItems.Add(new WMeterRsltItemSpec(71, "Batch start time", Strings.Start, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.StartTime.ToString() : string.Format(f, w.Batch.StartTime)));
AllItems.Add(new WMeterRsltItemSpec(72, "Batch end time", Strings.End, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.EndTime.ToString() : string.Format(f, w.Batch.EndTime)));
AllItems.Add(new WMeterRsltItemSpec(73, null, "1 / PlsPerLtr_Read", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? ((w.WaterMeterData.PulsesPerLtr != 0) ? 1 / w.WaterMeterData.PulsesPerLtr : 0).ToString()
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_bench_ID, Strings.Bench, (w, t, u, f, p) => w.Batch.TestBenchId.ToString()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, (w, t, u, f, p) => w.Batch.ProgramVersion));
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_name, Strings.User, (w, t, u, f, p) => w.Batch.UserName));
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_nr, Strings.User_nr, (w, t, u, f, p) => w.Batch.UserNumber.ToString()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeters, Strings.WMs, (w, t, u, f, p) => w.Batch.WatermetersStr));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Protocol_title, Strings.Protocol, (w, t, u, f, p) => w.Batch.ProtocolTitle));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_start_time, Strings.Start, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.StartTime.ToString() : string.Format(f, w.Batch.StartTime)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_end_time, Strings.End, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.EndTime.ToString() : string.Format(f, w.Batch.EndTime)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Lite_per_pulse_Read, "1 / PlsPerLtr_Read", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? ((w.WaterMeterData.PulsesPerLtr != 0) ? 1 / w.WaterMeterData.PulsesPerLtr : 0).ToString()
: ((w.WaterMeterData.PulsesPerLtr != 0) ? 1 / w.WaterMeterData.PulsesPerLtr : 0).ToString(p)));
/// Extra water meter data
AllItems.Add(new WMeterRsltItemSpec(74, null, Strings.Result_code, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.ResultCode.ToString() : string.Format(f, w.ResultCode)));
AllItems.Add(new WMeterRsltItemSpec(75, null, Strings.Remark, (w, t, u, f, p) => w.Batch.Remark));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Result_code, Strings.Result_code, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.ResultCode.ToString() : string.Format(f, w.ResultCode)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, Strings.Remark, (w, t, u, f, p) => w.Batch.Remark));
}
/// <summary>
@ -285,7 +283,7 @@ namespace Results
}
private static WMeterRsltItemSpec GetItem(int uid)
public static WMeterRsltItemSpec GetItem(int uid)
{
foreach (var item in AllItems)
{
@ -293,5 +291,11 @@ namespace Results
}
return null;
}
public static WMeterRsltItemSpec GetItem(ItemID itemId)
{
return GetItem((int)itemId);
}
}
}

View File

@ -1275,4 +1275,7 @@
<data name="Header" xml:space="preserve">
<value>Hlavička</value>
</data>
<data name="Mounting" xml:space="preserve">
<value>Montáž</value>
</data>
</root>