diff --git a/Config/Entities/Enums.cs b/Config/Entities/Enums.cs
index 67b649e9e..97f869dc3 100644
--- a/Config/Entities/Enums.cs
+++ b/Config/Entities/Enums.cs
@@ -86,8 +86,8 @@ namespace Config.Entities
public enum ProfileType
{
Q3R,
- QnClassLT15,
- QnClassGT15,
+ QnClassColdWater,
+ QnClassHotWater,
QpQi,
Manual,
Count,
@@ -327,6 +327,14 @@ namespace Config.Entities
Count
}
+ public enum TestProfile
+ {
+ UserDefined,
+ UserDefinedHeatMeter,
+ Protected, /// The first protected one
+ ProtectedHeatMeter,
+ }
+
public enum Progress
{
JustStarted,
diff --git a/Config/Entities/Procedure.cs b/Config/Entities/Procedure.cs
index cbdce59a7..a09c60c3e 100644
--- a/Config/Entities/Procedure.cs
+++ b/Config/Entities/Procedure.cs
@@ -86,12 +86,10 @@ namespace Config.Entities
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.LongDescription = LongDescription;
-
result.ProcedureState = ProcedureState;
result.Revision = Revision;
result.PredecessorId = Id;
result.ObtainedByCopy = ObtainedByCopy;
-
result.MetersKind = MetersKind;
result.Watermeters = Watermeters;
result.Protected = Protected;
@@ -102,6 +100,8 @@ namespace Config.Entities
result.ResultsWriter = ResultsWriter;
result.TransitionStart = TransitionStart;
result.TransitionEnd = TransitionEnd;
+ result.AltProcName = AltProcName;
+ result.AltProcPeriod = AltProcPeriod;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); }
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
diff --git a/Config/Entities/Profile.cs b/Config/Entities/Profile.cs
index 99f918019..cc11fd36e 100644
--- a/Config/Entities/Profile.cs
+++ b/Config/Entities/Profile.cs
@@ -61,6 +61,7 @@ namespace Config.Entities
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.ProfileType = ProfileType;
+ result.ErrorLimitType = ErrorLimitType;
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
diff --git a/Config/Entities/Test.cs b/Config/Entities/Test.cs
index 1707c386f..42b0b85f0 100644
--- a/Config/Entities/Test.cs
+++ b/Config/Entities/Test.cs
@@ -1,5 +1,5 @@
///
-/// Copyright (c) 2013-2017 Sensus Metering Systems
+/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -18,7 +18,8 @@ namespace Config.Entities
public virtual string Name { get; set; }
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s
/// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
- public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
+ public virtual TestProfile Profile { get; set; } /// UserDefined, Protected, UserDefinedHeatMeter, ProtectedHeatMeter
+ public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual bool DoEvaluate { get; set; }
public virtual float Qtg { get; set; } /// Target water flow [m3/h]
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
@@ -54,7 +55,6 @@ namespace Config.Entities
#endif
public virtual string RelTransBefore { get; set; }
public virtual string RelTransBetween { get; set; }
- public virtual string RelTransAfter { get; set; }
public virtual string TransitionAfter { get; set; }
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
@@ -73,7 +73,9 @@ namespace Config.Entities
///
/// Default values
///
- Publish = (sbyte)Config.Entities.Publish.Always;
+ Part = 0;
+ Profile = TestProfile.UserDefined;
+ Publish = (sbyte)Config.Entities.Publish.Always;
DoEvaluate = true;
Repeats = 1;
DoDraining = false;
@@ -95,7 +97,6 @@ namespace Config.Entities
TolerRed = 0; /// = Filter parameter
RelTransBefore = string.Empty;
RelTransBetween = string.Empty;
- RelTransAfter = string.Empty;
TransitionAfter = string.Empty;
}
@@ -113,7 +114,8 @@ namespace Config.Entities
Test result = new Test(Name, ItemNr, Procedure);
result.Part = Part;
- result.Publish = Publish;
+ result.Profile = Profile;
+ result.Publish = Publish;
result.DoEvaluate = DoEvaluate;
result.Qtg = Qtg;
result.Qfrom = Qfrom;
@@ -149,7 +151,6 @@ namespace Config.Entities
#endif
result.RelTransBefore = RelTransBefore;
result.RelTransBetween = RelTransBetween;
- result.RelTransAfter = RelTransAfter;
result.TransitionAfter = TransitionAfter;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
@@ -193,7 +194,7 @@ namespace Config.Entities
output.WriteLine(MetersPath);
output.WriteLine(RelTransBefore);
output.WriteLine(RelTransBetween);
- output.WriteLine(RelTransAfter);
+ output.WriteLine(Profile);
output.WriteLine(TransitionAfter);
foreach (var prms in MoreParams) { prms.Export(output); }
@@ -244,7 +245,10 @@ namespace Config.Entities
tst.MetersPath = input.ReadLine();
tst.RelTransBefore = input.ReadLine();
tst.RelTransBetween = input.ReadLine();
- tst.RelTransAfter = input.ReadLine();
+ string line = input.ReadLine();
+ tst.Profile = line.Equals(TestProfile.ProtectedHeatMeter.ToString()) ? TestProfile.ProtectedHeatMeter
+ : line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
+ : line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
tst.TransitionAfter = input.ReadLine();
while (true)
@@ -285,7 +289,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); };
- ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
+ ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
@@ -303,7 +307,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != MetersPath) { diff.AppendFormat(fmt, "MetersPath", MetersPath, ln); };
ln = inp.ReadLine(); if (ln != RelTransBefore) { diff.AppendFormat(fmt, "RelTransBefore", RelTransBefore, ln); };
ln = inp.ReadLine(); if (ln != RelTransBetween) { diff.AppendFormat(fmt, "RelTransBetween", RelTransBetween, ln); };
- ln = inp.ReadLine(); if (ln != RelTransAfter) { diff.AppendFormat(fmt, "RelTransAfter", RelTransAfter, ln); };
+ ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
ln = inp.ReadLine(); if (ln != TransitionAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransitionAfter, ln); };
return diff.ToString();
diff --git a/Config/Mappings/PTestMap.cs b/Config/Mappings/PTestMap.cs
index 480cbdae0..89b750054 100644
--- a/Config/Mappings/PTestMap.cs
+++ b/Config/Mappings/PTestMap.cs
@@ -13,6 +13,7 @@ namespace Config.Mappings
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
+ Map(x => x.Part);
Map(x => x.CoefQfrom);
Map(x => x.CoefQto);
Map(x => x.ErrLimLo);
diff --git a/Config/Mappings/TestMap.cs b/Config/Mappings/TestMap.cs
index f3243fbe7..e2ed18e1c 100644
--- a/Config/Mappings/TestMap.cs
+++ b/Config/Mappings/TestMap.cs
@@ -14,7 +14,8 @@ namespace Config.Mappings
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Part);
- Map(x => x.Publish);
+ Map(x => x.Profile);
+ Map(x => x.Publish);
Map(x => x.DoEvaluate)
.Column("Evaluate");
#if TEST_PROFILES
@@ -56,11 +57,14 @@ namespace Config.Mappings
#if HEAT_METERS
Map(x => x.HeatMetersPath);
#endif
- Map(x => x.RelTransBefore);
- Map(x => x.RelTransBetween);
- Map(x => x.RelTransAfter);
- Map(x => x.TransitionAfter);
- HasMany(x => x.MoreParams)
+ Map(x => x.RelTransBefore)
+ .Column("RelTransBefore");
+ Map(x => x.RelTransBetween)
+ .Column("RelTransBetween");
+ Map(x => x.TransitionAfter)
+ .Column("TransitionAfter");
+
+ HasMany(x => x.MoreParams)
.Cascade.All();
References(x => x.Procedure);
}
diff --git a/Config/Utils.cs b/Config/Utils.cs
index 51b5562c4..a5d732007 100644
--- a/Config/Utils.cs
+++ b/Config/Utils.cs
@@ -138,5 +138,119 @@ namespace Config
/// pattern NOT found
return string.Empty;
}
+
+ ///
+ /// Get either Q1 or Qmin flow for a given Qn and metrological class
+ ///
+ /// Nominal flow in m3/h
+ /// Metrological class ("A" ,"B", "C" or "R#")
+ /// NotSpecified, ColdWater or HotWater
+ /// Default flow when metrologic does not match pattern
+ /// Q1 or Qmin flow in m3/h
+ public static double GetQ1Qmin(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
+ {
+ if (string.IsNullOrEmpty(metroClass)) return Qdflt;
+
+ int metroClassRatio;
+ if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
+ {
+ return Qn / (double)metroClassRatio;
+ }
+ else
+ {
+ if (medium == Entities.Medium.HotWater)
+ {
+ switch (metroClass)
+ {
+ case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
+ case "B": return (Qn < 15) ? (0.02 * Qn) : (0.04 * Qn);
+ case "C": return (Qn < 15) ? (0.01 * Qn) : (0.02 * Qn);
+ case "D": return (Qn < 15) ? (0.01 * Qn) : Qdflt;
+ default: break;
+ }
+ }
+ else
+ {
+ switch (metroClass)
+ {
+ case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
+ case "B": return (Qn < 15) ? (0.02 * Qn) : (0.03 * Qn);
+ case "C": return (Qn < 15) ? (0.01 * Qn) : (0.006 * Qn);
+ default: break;
+ }
+ }
+ }
+
+ return Qdflt;
+ }
+
+ ///
+ /// Get either Q2 or Qt flow for a given Qn and metrological class
+ ///
+ /// Nominal flow in m3/h
+ /// Metrological class ("A" ,"B", "C" or "R#")
+ /// NotSpecified, ColdWater or HotWater
+ /// Default flow when metrologic does not match pattern
+ /// Q2 or Qt flow in m3/h
+ public static double GetQ2Qt(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
+ {
+ if (string.IsNullOrEmpty(metroClass)) return Qdflt;
+
+ int metroClassRatio;
+ if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
+ {
+ return 1.6 * Qn / (double)metroClassRatio;
+ }
+
+ if (medium == Entities.Medium.HotWater)
+ {
+ switch (metroClass)
+ {
+ case "A": return (Qn < 15) ? (0.1 * Qn) : (0.2 * Qn);
+ case "B": return (Qn < 15) ? (0.08 * Qn) : (0.15 * Qn);
+ case "C": return (Qn < 15) ? (0.06 * Qn) : (0.1 * Qn);
+ case "D": return (Qn < 15) ? (0.015 * Qn) : Qdflt;
+ default: break;
+ }
+ }
+ else
+ {
+ switch (metroClass)
+ {
+ case "A": return (Qn < 15) ? (0.1 * Qn) : (0.3 * Qn);
+ case "B": return (Qn < 15) ? (0.08 * Qn) : (0.2 * Qn);
+ case "C": return (Qn < 15) ? (0.015 * Qn) : (0.015 * Qn);
+ default: break;
+ }
+ }
+
+ return Qdflt;
+ }
+
+ ///
+ /// Get either Q4 or Qmax flow for a given Qn and metrological class
+ ///
+ /// Nominal flow in m3/h
+ /// Metrological class ("A" ,"B", "C" or "R#")
+ /// NotSpecified, ColdWater or HotWater
+ /// Default flow when metrologic does not match pattern
+ /// Q4 or Qmax flow in m3/h
+ public static double GetQ4Qmax(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
+ {
+ if (string.IsNullOrEmpty(metroClass)) return Qdflt;
+
+ switch (metroClass[0])
+ {
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ return 2 * Qn;
+ case 'R':
+ return 1.25 * Qn;
+ default:
+ return Qdflt;
+ }
+ }
}
}
diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs
index 3572fb407..e4719e649 100644
--- a/TBF/Properties/AssemblyInfo.cs
+++ b/TBF/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.24.1368.0")]
-[assembly: AssemblyFileVersion("2.24.1368.0")]
+[assembly: AssemblyVersion("2.24.1369.0")]
+[assembly: AssemblyFileVersion("2.24.1369.0")]
diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs
index a30950dd3..aa5d648c9 100644
--- a/TBF/Resources/Strings.Designer.cs
+++ b/TBF/Resources/Strings.Designer.cs
@@ -564,6 +564,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to calculated.
+ ///
+ internal static string calculated {
+ get {
+ return ResourceManager.GetString("calculated", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Calibration.
///
diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx
index c632a8f02..ef861b9f3 100644
--- a/TBF/Resources/Strings.resx
+++ b/TBF/Resources/Strings.resx
@@ -2125,4 +2125,7 @@
Test profiles selection
+
+ calculated
+
\ No newline at end of file
diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj
index 2a90159d2..7d45575c9 100644
--- a/TBF/TBF.csproj
+++ b/TBF/TBF.csproj
@@ -2274,6 +2274,12 @@
PressureSelection.cs
+
+ Form
+
+
+ TestProfileSelection.cs
+
Form
@@ -3234,6 +3240,9 @@
PressureSelection.cs
+
+ TestProfileSelection.cs
+
Roi1.cs
diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs b/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs
index d4ab3dfd6..385a5f5c1 100644
--- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs
+++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs
@@ -171,11 +171,11 @@ namespace TBF.UI.Bench.TestProfiles
switch(LoadedProfile.ProfileType)
{
default:
- case ProfileType.Q3R: profileTypeRadioButton1.Checked = true; break;
- case ProfileType.QnClassLT15: profileTypeRadioButton2.Checked = true; break;
- case ProfileType.QnClassGT15: profileTypeRadioButton3.Checked = true; break;
- case ProfileType.QpQi: profileTypeRadioButton4.Checked = true; break;
- case ProfileType.Manual: profileTypeRadioButton5.Checked = true; break;
+ case ProfileType.Q3R: profileTypeRadioButton1.Checked = true; break;
+ case ProfileType.QnClassColdWater: profileTypeRadioButton2.Checked = true; break;
+ case ProfileType.QnClassHotWater: profileTypeRadioButton3.Checked = true; break;
+ case ProfileType.QpQi: profileTypeRadioButton4.Checked = true; break;
+ case ProfileType.Manual: profileTypeRadioButton5.Checked = true; break;
}
switch(LoadedProfile.ErrorLimitType)
@@ -194,8 +194,8 @@ namespace TBF.UI.Bench.TestProfiles
LoadedProfile.Description = descriptionTextBox.Text;
LoadedProfile.ProfileType = profileTypeRadioButton1.Checked ? ProfileType.Q3R :
- (profileTypeRadioButton2.Checked ? ProfileType.QnClassLT15 :
- (profileTypeRadioButton3.Checked ? ProfileType.QnClassGT15 :
+ (profileTypeRadioButton2.Checked ? ProfileType.QnClassColdWater :
+ (profileTypeRadioButton3.Checked ? ProfileType.QnClassHotWater :
(profileTypeRadioButton4.Checked ? ProfileType.QpQi
: ProfileType.Manual)));
@@ -212,6 +212,7 @@ namespace TBF.UI.Bench.TestProfiles
public enum MtrlgyClmn
{
Name,
+ Part,
CoefQfrom,
CoefQto,
ErrLimLo,
@@ -227,10 +228,11 @@ namespace TBF.UI.Bench.TestProfiles
{
ListViewEx lv = metrologyListViewEx;
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
+ lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("Coef. {0}", Strings.Q_from), Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("Coef. {0}", Strings.Q_to), Width = 80 });
- lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_neg_pct_chdr, Width = 80 });
- lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_pos_pct_chdr, Width = 80 });
+ lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_neg_pct_chdr, Width = 80 });
+ lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_pos_pct_chdr, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_lo_chdr), Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_hi_chdr), Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Press_lim_lo_chdr, Width = 80 });
@@ -239,6 +241,7 @@ namespace TBF.UI.Bench.TestProfiles
metrologyEditors = new Control[]
{
new TextBox(), /// Name
+ new TextBox(), /// Part
new TextBox(), /// CoefQfrom
new TextBox(), /// CoefQto
new TextBox(), /// Err.Lim. -
@@ -273,10 +276,19 @@ namespace TBF.UI.Bench.TestProfiles
///
ListViewItem lvi = new ListViewItem(pTest.Name);
lvi.Tag = pTest;
+ lvi.SubItems.Add((pTest.Part == 0) ? "-" : pTest.Part.ToString());
lvi.SubItems.Add(pTest.CoefQfrom.ToString());
lvi.SubItems.Add(pTest.CoefQto.ToString());
- lvi.SubItems.Add(pTest.ErrLimLo.ToString());
- lvi.SubItems.Add(pTest.ErrLimHi.ToString());
+ if (LoadedProfile.ProfileType != ProfileType.QpQi)
+ {
+ lvi.SubItems.Add(pTest.ErrLimLo.ToString());
+ lvi.SubItems.Add(pTest.ErrLimHi.ToString());
+ }
+ else
+ {
+ lvi.SubItems.Add(Strings.calculated);
+ lvi.SubItems.Add(Strings.calculated);
+ }
lvi.SubItems.Add(pTest.TempLimLo.ToString());
lvi.SubItems.Add(pTest.TempLimHi.ToString());
lvi.SubItems.Add(pTest.PressLimLo.ToString());
@@ -295,20 +307,44 @@ namespace TBF.UI.Bench.TestProfiles
entity.Name = lvi.Text;
entity.ItemNr = i;
- float tmp;
- if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.CoefQfrom].Text, out tmp)) entity.CoefQfrom = tmp;
- if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text, out tmp)) entity.CoefQto = tmp;
- if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) entity.ErrLimLo = tmp;
- if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text, out tmp)) entity.ErrLimHi = tmp;
- if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp;
- if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp;
- if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.PressLimLo].Text, out tmp)) entity.PressLimLo = tmp;
- if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.PressLimHi].Text, out tmp)) entity.PressLimHi = tmp;
+ int part = entity.Part;
+ if (lvi.SubItems[(int)MtrlgyClmn.Part].Text.Equals("-"))
+ {
+ entity.Part = 0;
+ }
+ else if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Part].Text, out part))
+ {
+ entity.Part = part;
+ }
+
+ double tmp;
+ if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQfrom].Text, out tmp)) entity.CoefQfrom = tmp;
+ if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text, out tmp)) entity.CoefQto = tmp;
+ if (LoadedProfile.ProfileType != ProfileType.QpQi)
+ {
+ if (Utils.TryParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) entity.ErrLimLo = tmp;
+ if (Utils.TryParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text, out tmp)) entity.ErrLimHi = tmp;
+ }
+ else
+ {
+ entity.ErrLimLo = +1.0;
+ entity.ErrLimHi = -1.0;
+ }
+ if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp;
+ if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp;
+ if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.PressLimLo].Text, out tmp)) entity.PressLimLo = tmp;
+ if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.PressLimHi].Text, out tmp)) entity.PressLimHi = tmp;
}
}
private void metrologyListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
+ if (LoadedProfile.ProfileType == ProfileType.QpQi &&
+ ((e.SubItem == (int)MtrlgyClmn.ErrLimLo) || (e.SubItem == (int)MtrlgyClmn.ErrLimHi)))
+ {
+ return; /// Prevent editing calculated error limits
+ }
+
if (unlocked && (e.SubItem < (int)MtrlgyClmn.ColumnsCount))
{
metrologyListViewEx.StartEditing(metrologyEditors[e.SubItem], e.Item, e.SubItem);
@@ -353,15 +389,27 @@ namespace TBF.UI.Bench.TestProfiles
}
}
- float fdummy;
- if ((e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
- (e.SubItem == (int)MtrlgyClmn.CoefQto && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
- (e.SubItem == (int)MtrlgyClmn.ErrLimLo && !Utils.TryParseSFloat(e.DisplayText, out fdummy)) ||
- (e.SubItem == (int)MtrlgyClmn.ErrLimHi && !Utils.TryParseSFloat(e.DisplayText, out fdummy)) ||
- (e.SubItem == (int)MtrlgyClmn.TempLimLo && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
- (e.SubItem == (int)MtrlgyClmn.TempLimHi && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
- (e.SubItem == (int)MtrlgyClmn.PressLimLo && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
- (e.SubItem == (int)MtrlgyClmn.PressLimHi && !Utils.TryParseUFloat(e.DisplayText, out fdummy)))
+ int idummy;
+ if (e.SubItem == (int)MtrlgyClmn.Part)
+ {
+ if (e.DisplayText.Equals("-")) return; /// OK
+ if (!int.TryParse(e.DisplayText, out idummy) || !Test.IsGoodPartNr(idummy))
+ {
+ e.DisplayText = e.Item.SubItems[e.SubItem].Text;
+ e.Cancel = true;
+ return; /// NOK
+ }
+ }
+
+ double dummy;
+ if ((e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
+ (e.SubItem == (int)MtrlgyClmn.CoefQto && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
+ (e.SubItem == (int)MtrlgyClmn.ErrLimLo && !Utils.TryParseSDouble(e.DisplayText, out dummy)) ||
+ (e.SubItem == (int)MtrlgyClmn.ErrLimHi && !Utils.TryParseSDouble(e.DisplayText, out dummy)) ||
+ (e.SubItem == (int)MtrlgyClmn.TempLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
+ (e.SubItem == (int)MtrlgyClmn.TempLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
+ (e.SubItem == (int)MtrlgyClmn.PressLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
+ (e.SubItem == (int)MtrlgyClmn.PressLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy)))
{
/// Cannot parse => revert content of the cell
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
@@ -654,19 +702,19 @@ namespace TBF.UI.Bench.TestProfiles
entity.ItemNr = i;
int j = 1;
- entity.Delta_Q_pct = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.Delta_T = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.Delta_Tup_Tdn = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.TestTime_min = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.TestTime_max = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.AmbTemp_min = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.AmbTemp_max = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.Coef_E9 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.Coef_E10 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.Coef_E11 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.Coef_E12 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.Offset_E9 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
- entity.Offset_E12 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
+ entity.Delta_Q_pct = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.Delta_T = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.Delta_Tup_Tdn = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.TestTime_min = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.TestTime_max = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.AmbTemp_min = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.AmbTemp_max = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.Coef_E9 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.Coef_E10 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.Coef_E11 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.Coef_E12 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.Offset_E9 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
+ entity.Offset_E12 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
}
}
@@ -721,8 +769,8 @@ namespace TBF.UI.Bench.TestProfiles
}
}
- float dummy;
- if ((e.SubItem >= 1) && (e.SubItem < (int)ErrorFlags2Clmn.ColumnsCount) && !Utils.TryParseUFloat(e.DisplayText, out dummy))
+ double dummy;
+ if ((e.SubItem >= 1) && (e.SubItem < (int)ErrorFlags2Clmn.ColumnsCount) && !Utils.TryParseUDouble(e.DisplayText, out dummy))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
@@ -791,7 +839,7 @@ namespace TBF.UI.Bench.TestProfiles
//foreach (var ctrl in testParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
//foreach (var ctrl in procedureParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
- if (usedNames != null && usedNames.Contains(LoadedProfile.Name))
+ if (usedNames != null && usedNames.Contains(LoadedProfile.Name.ToLower()))
{
MessageBox.Show(string.Format("There is already a procedure named '{0}'.{1}Choose another name please.", LoadedProfile.Name, Environment.NewLine),
Strings.Warning,
@@ -953,19 +1001,118 @@ namespace TBF.UI.Bench.TestProfiles
default: return;
}
-
+ ///
/// Find an unused test name
+ ///
string newName;
for (int nameId = 1; true; nameId++)
{
- newName = Strings.New_test_name + nameId.ToString();
+ if (nameId >= 5 || (nameId >= 4 && LoadedProfile.ProfileType == ProfileType.QpQi) || LoadedProfile.ProfileType == ProfileType.Manual)
+ {
+ newName = Strings.New_test_name + nameId.ToString();
+ }
+ else
+ {
+ switch (LoadedProfile.ProfileType)
+ {
+ default:
+ case ProfileType.Q3R:
+ newName = string.Format("Q{0}", 5 - nameId);
+ break;
+
+ case ProfileType.QnClassColdWater:
+ case ProfileType.QnClassHotWater:
+ newName = (nameId == 1) ? "Qmax" : (nameId == 2) ? "Qn" : (nameId == 3) ? "Qt" : "Qmin";
+ break;
+
+ case ProfileType.QpQi:
+ newName = (nameId == 1) ? "qp" : (nameId == 2) ? "0,1qp" : "qi";
+ break;
+ }
+ }
+
bool notUsed = true;
foreach (var t in LoadedProfile.Tests) if (t.Name.Equals(newName)) notUsed = false;
if (notUsed) break;
}
+ ///
/// Add a profile test
- PTest ptest = new PTest(newName, listViewEx.Items.Count, LoadedProfile);
+ ///
+ int count = listViewEx.Items.Count;
+ PTest ptest = new PTest(newName, count, LoadedProfile);
+
+ ///
+ /// Upper and lower limits of flow
+ ///
+ switch (LoadedProfile.ProfileType)
+ {
+ case ProfileType.Q3R:
+ case ProfileType.QnClassColdWater:
+ case ProfileType.QnClassHotWater:
+ switch (count)
+ {
+ case 0:
+ case 1:
+ ptest.CoefQfrom = 0.9;
+ ptest.CoefQto = 1.0;
+ break;
+ default:
+ ptest.CoefQfrom = 1.0;
+ ptest.CoefQto = 1.1;
+ break;
+ }
+ break;
+
+ case ProfileType.QpQi:
+ switch (count)
+ {
+ case 0:
+ ptest.CoefQfrom = 0.9;
+ ptest.CoefQto = 1.0;
+ break;
+ default:
+ ptest.CoefQfrom = 1.0;
+ ptest.CoefQto = 1.1;
+ break;
+ }
+ break;
+ }
+
+ ///
+ /// Upper and lower limits of relative error
+ ///
+ switch (LoadedProfile.ProfileType)
+ {
+ case ProfileType.Q3R:
+ case ProfileType.QnClassColdWater:
+ switch (count)
+ {
+ case 3:
+ ptest.ErrLimLo = -5.0;
+ ptest.ErrLimHi = 5.0;
+ break;
+ default:
+ ptest.ErrLimLo = -2.0;
+ ptest.ErrLimHi = 2.0;
+ break;
+ }
+ break;
+
+ case ProfileType.QnClassHotWater:
+ switch (count)
+ {
+ case 3:
+ ptest.ErrLimLo = -5.0;
+ ptest.ErrLimHi = 5.0;
+ break;
+ default:
+ ptest.ErrLimLo = -3.0;
+ ptest.ErrLimHi = 3.0;
+ break;
+ }
+ break;
+ }
LoadedProfile.Tests.Add(ptest);
AddToMetrologyTab(ptest);
diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx b/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx
index adb821873..50cc9f78a 100644
--- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx
+++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx
@@ -147,6 +147,9 @@
Qp and Class
+
+ False
+
errorCalculationRadioButton2
@@ -177,6 +180,9 @@
Entering numbers manually
+
+ False
+
errorCalculationRadioButton1
@@ -201,6 +207,9 @@
Error bounds calculation
+
+ False
+
groupBox2
@@ -283,13 +292,13 @@
28, 42
- 169, 17
+ 146, 17
35
- Qn and Class (Qn <= 15 m3/h)
+ Qn and Class - cold water
profileTypeRadioButton2
@@ -343,13 +352,13 @@
28, 63
- 163, 17
+ 141, 17
36
- Qn and Class (Qn > 15 m3/h)
+ Qn and Class - hot water
profileTypeRadioButton3
@@ -736,7 +745,7 @@
metrologyListViewEx
- Results.Forms.ListViewEx, Results, Version=2.24.1359.0, Culture=neutral, PublicKeyToken=null
+ Results.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null
metrologyTabPage
@@ -787,7 +796,7 @@
errorFlagsListViewEx
- Results.Forms.ListViewEx, Results, Version=2.24.1359.0, Culture=neutral, PublicKeyToken=null
+ Results.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null
errorFlagsTabPage
@@ -835,7 +844,7 @@
errorFlags2ListViewEx
- Results.Forms.ListViewEx, Results, Version=2.24.1359.0, Culture=neutral, PublicKeyToken=null
+ Results.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null
errorFlags2TabPage
@@ -919,7 +928,7 @@
sharedButtons
- TBF.UI.Shared.SharedButtons, TBF, Version=2.24.1365.0, Culture=neutral, PublicKeyToken=null
+ TBF.UI.Shared.SharedButtons, TBF, Version=2.24.1372.0, Culture=neutral, PublicKeyToken=null
mainSplitContainer.Panel2
diff --git a/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs b/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs
index a478a81f1..db96655a6 100644
--- a/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs
+++ b/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs
@@ -49,6 +49,10 @@ namespace TBF.UI.Bench.TestProfiles
public void Initialize(TestProfilesDlg parent, Control parentControl)
{
+ if (Parent == null) return;
+
+ session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
+
this.parent = parent;
this.parentControl = parentControl;
@@ -83,12 +87,20 @@ namespace TBF.UI.Bench.TestProfiles
void ReloadAndRedrawAll()
{
- /// Load the procedures
- if (session == null) session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
+ if (session == null) return;
- MyItems = session.QueryOver()
- .OrderBy(x => x.ItemNr).Asc
- .List();
+ try
+ {
+ MyItems = session.QueryOver()
+ .OrderBy(x => x.ItemNr).Asc
+ .List();
+ }
+ catch (Exception exc)
+ {
+ log.ErrorFormat("Loading Profiles from DB failed: {0}", exc.Message);
+ MyItems = new List();
+ return;
+ }
base.RedrawAll();
}
@@ -197,7 +209,7 @@ namespace TBF.UI.Bench.TestProfiles
{
newName = Strings.New_profile_name + nameId.ToString();
bool notUsed = true;
- foreach (var t in MyItems) if (t.Name.Equals(newName)) notUsed = false;
+ foreach (var t in MyItems) if (t.Name.ToLower().Equals(newName.ToLower())) notUsed = false;
if (notUsed) break;
}
@@ -205,7 +217,7 @@ namespace TBF.UI.Bench.TestProfiles
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProfile.CreationTime = DateTime.Now;
- if (new TestProfileDlg(newProfile, GetUsedNames(), true).ShowDialog() == DialogResult.OK)
+ if (new TestProfileDlg(newProfile, GetUsedNames(false), true).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@@ -252,7 +264,8 @@ namespace TBF.UI.Bench.TestProfiles
{
try
{
- foreach (var entity in ToBeRemovedItems) session.Delete(entity);
+ foreach (var entity in ToBeRemovedItems)
+ session.Delete(entity);
ToBeRemovedItems.Clear();
int itemNr = 0;
@@ -281,8 +294,8 @@ namespace TBF.UI.Bench.TestProfiles
Profile editedProfile = SelectedItems[0].Tag as Profile;
- IList usedNames = GetUsedNames();
- usedNames.Remove(editedProfile.Name); /// Allow original procedure name
+ IList usedNames = GetUsedNames(false);
+ usedNames.Remove(editedProfile.Name.ToLower()); /// Allow original procedure name
///
if (new TestProfileDlg(editedProfile, usedNames).ShowDialog() == DialogResult.OK)
{
@@ -329,7 +342,7 @@ namespace TBF.UI.Bench.TestProfiles
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProfile.CreationTime = DateTime.Now;
- if ((new TestProfileDlg(newProfile, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
+ if ((new TestProfileDlg(newProfile, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@@ -378,7 +391,7 @@ namespace TBF.UI.Bench.TestProfiles
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProfile.CreationTime = DateTime.Now;
- if ((new TestProfileDlg(newProfile, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
+ if ((new TestProfileDlg(newProfile, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
diff --git a/TBF/UI/Bench/TestProfiles/TestProfilesDlg.cs b/TBF/UI/Bench/TestProfiles/TestProfilesDlg.cs
index 57ea92f76..094097f95 100644
--- a/TBF/UI/Bench/TestProfiles/TestProfilesDlg.cs
+++ b/TBF/UI/Bench/TestProfiles/TestProfilesDlg.cs
@@ -46,7 +46,7 @@ namespace TBF.UI.Bench.TestProfiles
sharedButtons.CompareClicked += testProfilesCtrl.compareButton_Click;
}
- private void ProceduresDlg_Load(object sender, EventArgs e)
+ private void TestProfilesDlg_Load(object sender, EventArgs e)
{
LoadUISettings();
Text = Strings.Test_profiles;
diff --git a/TBF/UI/Bench/TestProfiles/TestProfilesDlg.designer.cs b/TBF/UI/Bench/TestProfiles/TestProfilesDlg.designer.cs
index ce59a06c1..ed349e73e 100644
--- a/TBF/UI/Bench/TestProfiles/TestProfilesDlg.designer.cs
+++ b/TBF/UI/Bench/TestProfiles/TestProfilesDlg.designer.cs
@@ -89,7 +89,7 @@ namespace TBF.UI.Bench.TestProfiles
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "TestProfilesDlg";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ProceduresDlg_FormClosed);
- this.Load += new System.EventHandler(this.ProceduresDlg_Load);
+ this.Load += new System.EventHandler(this.TestProfilesDlg_Load);
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
diff --git a/TBF/UI/Procedures/ProcedureDlg.Designer.cs b/TBF/UI/Procedures/ProcedureDlg.Designer.cs
index 3e53dc7e6..db0eb330d 100644
--- a/TBF/UI/Procedures/ProcedureDlg.Designer.cs
+++ b/TBF/UI/Procedures/ProcedureDlg.Designer.cs
@@ -86,6 +86,8 @@ namespace TBF.UI.Procedures
this.parametersTabPage = new System.Windows.Forms.TabPage();
this.parametersListViewEx = new Results.Forms.ListViewEx();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
+ this.testProfileLabel = new System.Windows.Forms.Label();
+ this.testProfileTextBox = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
this.mainSplitContainer.Panel1.SuspendLayout();
this.mainSplitContainer.Panel2.SuspendLayout();
@@ -128,6 +130,8 @@ namespace TBF.UI.Procedures
//
// generalTabPage
//
+ this.generalTabPage.Controls.Add(this.testProfileTextBox);
+ this.generalTabPage.Controls.Add(this.testProfileLabel);
this.generalTabPage.Controls.Add(this.altProcPeriodTextBox);
this.generalTabPage.Controls.Add(this.altProcPeriodLabel);
this.generalTabPage.Controls.Add(this.altProcNameTextBox);
@@ -489,6 +493,16 @@ namespace TBF.UI.Procedures
resources.ApplyResources(this.sharedButtons, "sharedButtons");
this.sharedButtons.Name = "sharedButtons";
//
+ // testProfileLabel
+ //
+ resources.ApplyResources(this.testProfileLabel, "testProfileLabel");
+ this.testProfileLabel.Name = "testProfileLabel";
+ //
+ // testProfileTextBox
+ //
+ resources.ApplyResources(this.testProfileTextBox, "testProfileTextBox");
+ this.testProfileTextBox.Name = "testProfileTextBox";
+ //
// ProcedureDlg
//
resources.ApplyResources(this, "$this");
@@ -568,5 +582,7 @@ namespace TBF.UI.Procedures
private System.Windows.Forms.Label altProcNameLabel;
private System.Windows.Forms.TextBox altProcPeriodTextBox;
private System.Windows.Forms.Label altProcPeriodLabel;
+ private System.Windows.Forms.Label testProfileLabel;
+ private System.Windows.Forms.TextBox testProfileTextBox;
}
}
\ No newline at end of file
diff --git a/TBF/UI/Procedures/ProcedureDlg.cs b/TBF/UI/Procedures/ProcedureDlg.cs
index 09b81c80d..1a9d943da 100644
--- a/TBF/UI/Procedures/ProcedureDlg.cs
+++ b/TBF/UI/Procedures/ProcedureDlg.cs
@@ -416,6 +416,7 @@ namespace TBF.UI.Procedures
label15.Text = Strings.Date;
label18.Text = Strings.Notes;
watermetersLabel.Text = Strings.Meter_types_tested;
+ testProfileLabel.Text = Strings.Test_profiles;
altProcNameLabel.Text = Strings.Conditions;
protectedCheckBox.Text = Strings.Protected_procedure;
mustBeCompleteCheckBox.Text = Strings.All_tests_must_be_completed;
@@ -454,8 +455,9 @@ namespace TBF.UI.Procedures
transitionStartComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.TransitionStart) ? "---" : LoadedProcedure.TransitionStart;
transitionEndComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.TransitionEnd) ? "---" : LoadedProcedure.TransitionEnd;
- altProcNameTextBox.Text = string.IsNullOrEmpty(LoadedProcedure.AltProcName) ? "---" : LoadedProcedure.AltProcName;
- altProcPeriodTextBox.Text = LoadedProcedure.AltProcPeriod.ToString();
+ testProfileTextBox.Text = string.IsNullOrEmpty(LoadedProcedure.AltProcName) ? "---" : LoadedProcedure.AltProcName;
+ //altProcNameTextBox.Text = string.IsNullOrEmpty(LoadedProcedure.AltProcName) ? "---" : LoadedProcedure.AltProcName;
+ //altProcPeriodTextBox.Text = LoadedProcedure.AltProcPeriod.ToString();
if (string.IsNullOrEmpty(LoadedProcedure.ResultsPrinter))
{
@@ -505,13 +507,9 @@ namespace TBF.UI.Procedures
LoadedProcedure.MustBeComplete = mustBeCompleteCheckBox.Checked;
LoadedProcedure.ManualCtrlDisabled = manualControlDisabledCheckBox.Checked;
- LoadedProcedure.AltProcName = altProcNameTextBox.Text.Equals("---") ? string.Empty : altProcNameTextBox.Text;
-
- int itmp;
- if (int.TryParse(altProcPeriodTextBox.Text, out itmp) && itmp >= 0)
- {
- LoadedProcedure.AltProcPeriod = itmp;
- }
+ //LoadedProcedure.AltProcName = altProcNameTextBox.Text.Equals("---") ? string.Empty : altProcNameTextBox.Text;
+ //int itmp;
+ //if (int.TryParse(altProcPeriodTextBox.Text, out itmp) && itmp >= 0) { LoadedProcedure.AltProcPeriod = itmp; }
if (transitionStartComboBox.Items.Contains(transitionStartComboBox.Text))
{
@@ -805,10 +803,18 @@ namespace TBF.UI.Procedures
#if TEST_PROFILES
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
#endif
- if (unlocked && (e.SubItem < (int)MtrlgyClmn.CoulumnsCount))
- {
- metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem);
- }
+ if (!unlocked || (e.SubItem >= (int)MtrlgyClmn.CoulumnsCount)) return;
+
+ MtrlgyClmn[] protectedColumns = new MtrlgyClmn[]
+ {
+ MtrlgyClmn.Name,
+ MtrlgyClmn.Qfrom, MtrlgyClmn.Qto,
+ MtrlgyClmn.ErrLimLo, MtrlgyClmn.ErrLimHi,
+ MtrlgyClmn.TempLimLo, MtrlgyClmn.TempLimHi
+ };
+ if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains((MtrlgyClmn)e.SubItem)) return;
+
+ metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem);
}
void metrology1ListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
@@ -1060,10 +1066,14 @@ namespace TBF.UI.Procedures
private void metrology2ListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
- if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.ColumnsCount)
- {
- return;
- }
+ if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.ColumnsCount) return;
+
+ Mtrlgy2Clmn[] protectedColumns = new Mtrlgy2Clmn[]
+ {
+ Mtrlgy2Clmn.Name,
+ Mtrlgy2Clmn.Publish, Mtrlgy2Clmn.Evaluate
+ };
+ if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains((Mtrlgy2Clmn)e.SubItem)) return;
metrology2ListViewEx.StartEditing(metrology2Editors[e.SubItem], e.Item, e.SubItem);
}
@@ -1256,6 +1266,7 @@ namespace TBF.UI.Procedures
void AddToProcessTab(Test test)
{
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent(test.Method, TbfComponents) as ITestMethod;
+ bool isNotAHydroTest = (tm != null) && !tm.DoTransitions();
///
/// Process item with subitems
@@ -1263,23 +1274,8 @@ namespace TBF.UI.Procedures
ListViewItem lvi = new ListViewItem(test.Name); /// Name
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
-
- if (tm != null && tm.DoTransitions())
- {
- lvi.SubItems.Add(test.DoDraining ? Strings.yes : Strings.no); /// Draining before test
- lvi.SubItems.Add(test.DoDrainingAfter ? Strings.yes : Strings.no); /// Draining after test
- lvi.SubItems.Add(test.FeedingPath);
- lvi.SubItems.Add(test.BenchPath);
- lvi.SubItems.Add(test.OutputPath);
-#if HEAT_METERS
- lvi.SubItems.Add(test.HeatMetersPath);
-#endif
- lvi.SubItems.Add(test.MetersPath);
- lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
- lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
- lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
- }
- else
+
+ if (isNotAHydroTest)
{
lvi.SubItems.Add(string.Empty); /// Draining before test N/A
lvi.SubItems.Add(string.Empty); /// Draining after test N/A
@@ -1294,6 +1290,21 @@ namespace TBF.UI.Procedures
lvi.SubItems.Add(string.Empty); /// RelTransBetween N/A
lvi.SubItems.Add(string.Empty); /// TransitionAfter N/A
}
+ else
+ {
+ lvi.SubItems.Add(test.DoDraining ? Strings.yes : Strings.no); /// Draining before test
+ lvi.SubItems.Add(test.DoDrainingAfter ? Strings.yes : Strings.no); /// Draining after test
+ lvi.SubItems.Add(test.FeedingPath);
+ lvi.SubItems.Add(test.BenchPath);
+ lvi.SubItems.Add(test.OutputPath);
+#if HEAT_METERS
+ lvi.SubItems.Add(test.HeatMetersPath);
+#endif
+ lvi.SubItems.Add(test.MetersPath);
+ lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
+ lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
+ lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
+ }
processListViewEx.Items.Add(lvi);
}
@@ -1303,77 +1314,87 @@ namespace TBF.UI.Procedures
for (int i = 0; i < processListViewEx.Items.Count; i++)
{
ListViewItem lvi = processListViewEx.Items[i];
- Test entity = (Test)lvi.Tag;
+ Test test = (Test)lvi.Tag;
- entity.Name = lvi.Text;
- entity.ItemNr = i;
+ ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent(test.Method, TbfComponents) as ITestMethod;
+ bool isNotAHydroTest = (tm != null) && !tm.DoTransitions();
- int part = entity.Part;
+ test.Name = lvi.Text;
+ test.ItemNr = i;
+
+ int part = test.Part;
if (lvi.SubItems[(int)ProcessClmn.Part].Text.Equals("-"))
{
- entity.Part = 0;
+ test.Part = 0;
}
else if (int.TryParse(lvi.SubItems[(int)ProcessClmn.Part].Text, out part))
{
- entity.Part = part;
+ test.Part = part;
}
- entity.DoDraining = lvi.SubItems[(int)ProcessClmn.DrainingBefore].Text.Equals(Strings.yes);
- entity.DoDrainingAfter = lvi.SubItems[(int)ProcessClmn.DrainingAfter].Text.Equals(Strings.yes);
+ int column;
+ string subItemText;
+ if (!isNotAHydroTest)
+ {
+ /// Is a hydraulical test or test.Method component == null
+ test.DoDraining = lvi.SubItems[(int)ProcessClmn.DrainingBefore].Text.Equals(Strings.yes);
+ test.DoDrainingAfter = lvi.SubItems[(int)ProcessClmn.DrainingAfter].Text.Equals(Strings.yes);
- int column = (int)ProcessClmn.Feeding;
- string subItemText = lvi.SubItems[column].Text;
- if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
- {
- entity.FeedingPath = subItemText;
- }
+ column = (int)ProcessClmn.Feeding;
+ subItemText = lvi.SubItems[column].Text;
+ if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
+ {
+ test.FeedingPath = subItemText;
+ }
- column = (int)ProcessClmn.Bench;
- subItemText = lvi.SubItems[column].Text;
- if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
- {
- entity.BenchPath = subItemText;
- }
+ column = (int)ProcessClmn.Bench;
+ subItemText = lvi.SubItems[column].Text;
+ if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
+ {
+ test.BenchPath = subItemText;
+ }
- column = (int)ProcessClmn.Output;
- subItemText = lvi.SubItems[column].Text;
- if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
- {
- entity.OutputPath = subItemText;
- }
+ column = (int)ProcessClmn.Output;
+ subItemText = lvi.SubItems[column].Text;
+ if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
+ {
+ test.OutputPath = subItemText;
+ }
+
+ column = (int)ProcessClmn.TrnStart;
+ subItemText = lvi.SubItems[column].Text;
+ if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
+ {
+ test.RelTransBefore = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
+ }
+
+ column = (int)ProcessClmn.TrnBetween;
+ subItemText = lvi.SubItems[column].Text;
+ if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
+ {
+ test.RelTransBetween = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
+ }
+
+ column = (int)ProcessClmn.TrnStop;
+ subItemText = lvi.SubItems[column].Text;
+ if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
+ {
+ test.TransitionAfter = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
+ }
+ }
column = (int)ProcessClmn.Sensor;
subItemText = lvi.SubItems[column].Text;
if ((processEditors[column] as ComboBox).Items.Contains(subItemText))
- {
- entity.MetersPath = subItemText;
- }
+ {
+ test.MetersPath = subItemText;
+ }
#if HEAT_METERS
if ((processEditors[(int)ProcessClmn.HeatMeterSensors] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text))
{
entity.HeatMetersPath = lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text;
}
#endif
- column = (int)ProcessClmn.TrnStart;
- subItemText = lvi.SubItems[column].Text;
- if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
- {
- entity.RelTransBefore = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
- }
-
- column = (int)ProcessClmn.TrnBetween;
- subItemText = lvi.SubItems[column].Text;
- if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
- {
- entity.RelTransBetween = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
- }
-
- column = (int)ProcessClmn.TrnStop;
- subItemText = lvi.SubItems[column].Text;
- if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
- {
- entity.TransitionAfter = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
- }
}
}
@@ -1384,18 +1405,22 @@ namespace TBF.UI.Procedures
return;
}
- ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent((e.Item.Tag as Test).Method, TbfComponents) as ITestMethod;
+ ProcessClmn[] protectedColumns = new ProcessClmn[] { ProcessClmn.Name };
+ if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains((ProcessClmn)e.SubItem)) return;
- if (tm != null && (tm.DoTransitions() == false) && ((e.SubItem == (int)ProcessClmn.DrainingBefore) ||
- (e.SubItem == (int)ProcessClmn.DrainingAfter) ||
- (e.SubItem == (int)ProcessClmn.Feeding) ||
- (e.SubItem == (int)ProcessClmn.Bench) ||
- (e.SubItem == (int)ProcessClmn.Output) ||
- (e.SubItem == (int)ProcessClmn.TrnStart) ||
- (e.SubItem == (int)ProcessClmn.TrnBetween) ||
- (e.SubItem == (int)ProcessClmn.TrnStop)))
+ ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent((e.Item.Tag as Test).Method, TbfComponents) as ITestMethod;
+ bool isNotAHydroTest = (tm != null) && !tm.DoTransitions();
+
+ if (isNotAHydroTest && ((e.SubItem == (int)ProcessClmn.DrainingBefore) ||
+ (e.SubItem == (int)ProcessClmn.DrainingAfter) ||
+ (e.SubItem == (int)ProcessClmn.Feeding) ||
+ (e.SubItem == (int)ProcessClmn.Bench) ||
+ (e.SubItem == (int)ProcessClmn.Output) ||
+ (e.SubItem == (int)ProcessClmn.TrnStart) ||
+ (e.SubItem == (int)ProcessClmn.TrnBetween) ||
+ (e.SubItem == (int)ProcessClmn.TrnStop)))
{
- return;
+ return; /// Prevent editing these cells
}
processListViewEx.StartEditing(processEditors[e.SubItem], e.Item, e.SubItem);
@@ -1651,6 +1676,9 @@ namespace TBF.UI.Procedures
return;
}
+ ProcessClmn[] protectedColumns = new ProcessClmn[] { ProcessClmn.Name };
+ if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains((ProcessClmn)e.SubItem)) return;
+
parametersListViewEx.StartEditing(parametersEditors[e.SubItem], e.Item, e.SubItem);
}
@@ -1865,7 +1893,7 @@ namespace TBF.UI.Procedures
foreach (var ctrl in testParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
foreach (var ctrl in procedureParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
- if (usedNames != null && usedNames.Contains(LoadedProcedure.Name))
+ if (usedNames != null && usedNames.Contains(LoadedProcedure.Name.ToLower()))
{
MessageBox.Show(string.Format("There is already a procedure named '{0}'.{1}Choose another name please.", LoadedProcedure.Name, Environment.NewLine),
Strings.Warning,
@@ -2245,7 +2273,13 @@ namespace TBF.UI.Procedures
/// Check the selected index validity
if (listViewEx.SelectedItems.Count != 1) return;
int removeItemNr = listViewEx.SelectedIndices[0];
-
+
+ if (LoadedProcedure.Tests[removeItemNr].Profile >= TestProfile.Protected)
+ {
+ MessageBox.Show("This test is protected and cannot be deleted.");
+ return;
+ }
+
/// Remove the selected test
Test toBeDeleted = LoadedProcedure.Tests[removeItemNr];
LoadedProcedure.Tests.Remove(toBeDeleted);
diff --git a/TBF/UI/Procedures/ProcedureDlg.resx b/TBF/UI/Procedures/ProcedureDlg.resx
index 5b88076a0..e670c6edd 100644
--- a/TBF/UI/Procedures/ProcedureDlg.resx
+++ b/TBF/UI/Procedures/ProcedureDlg.resx
@@ -129,14 +129,68 @@
0, 0
+
+ False
+
+
+ 188, 128
+
+
+ 522, 20
+
+
+ 15
+
+
+ testProfileTextBox
+
+
+ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ generalTabPage
+
+
+ 0
+
+
+ True
+
+
+ NoControl
+
+
+ 20, 131
+
+
+ 64, 13
+
+
+ 14
+
+
+ Test profiles
+
+
+ testProfileLabel
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ generalTabPage
+
+
+ 1
+
- 676, 128
+ 676, 361
34, 20
- 19
+ 41
False
@@ -151,7 +205,7 @@
generalTabPage
- 0
+ 2
True
@@ -160,13 +214,13 @@
NoControl
- 542, 131
+ 542, 364
116, 13
- 18
+ 40
Alternative proc. period
@@ -184,16 +238,16 @@
generalTabPage
- 1
+ 3
- 188, 128
+ 188, 361
217, 20
- 17
+ 39
False
@@ -208,7 +262,7 @@
generalTabPage
- 2
+ 4
True
@@ -217,13 +271,13 @@
NoControl
- 20, 131
+ 20, 364
113, 13
- 16
+ 38
Alternative proc. name
@@ -241,7 +295,7 @@
generalTabPage
- 3
+ 5
True
@@ -256,7 +310,7 @@
138, 17
- 39
+ 35
Manual control disabled
@@ -271,7 +325,7 @@
generalTabPage
- 4
+ 6
True
@@ -286,7 +340,7 @@
152, 17
- 38
+ 34
All tests must be competed
@@ -301,7 +355,7 @@
generalTabPage
- 5
+ 7
True
@@ -316,7 +370,7 @@
123, 17
- 37
+ 33
Protected procedure
@@ -331,7 +385,7 @@
generalTabPage
- 6
+ 8
True
@@ -346,7 +400,7 @@
77, 17
- 36
+ 32
Heat meter
@@ -361,7 +415,7 @@
generalTabPage
- 7
+ 9
188, 336
@@ -370,7 +424,7 @@
121, 21
- 33
+ 29
fileWriter4ComboBox
@@ -382,7 +436,7 @@
generalTabPage
- 8
+ 10
188, 312
@@ -391,7 +445,7 @@
121, 21
- 32
+ 28
fileWriter3ComboBox
@@ -403,7 +457,7 @@
generalTabPage
- 9
+ 11
188, 243
@@ -412,7 +466,7 @@
121, 21
- 28
+ 24
printer2ComboBox
@@ -424,7 +478,7 @@
generalTabPage
- 10
+ 12
188, 289
@@ -433,7 +487,7 @@
121, 21
- 31
+ 27
fileWriter2ComboBox
@@ -445,7 +499,7 @@
generalTabPage
- 11
+ 13
True
@@ -460,7 +514,7 @@
72, 17
- 35
+ 31
Combined
@@ -475,7 +529,7 @@
generalTabPage
- 12
+ 14
True
@@ -490,7 +544,7 @@
54, 17
- 34
+ 30
Single
@@ -505,7 +559,7 @@
generalTabPage
- 13
+ 15
188, 197
@@ -514,7 +568,7 @@
121, 21
- 25
+ 21
transitionEndComboBox
@@ -526,7 +580,7 @@
generalTabPage
- 14
+ 16
True
@@ -541,7 +595,7 @@
63, 13
- 24
+ 20
Purge - End
@@ -556,7 +610,7 @@
generalTabPage
- 15
+ 17
188, 174
@@ -565,7 +619,7 @@
121, 21
- 23
+ 19
transitionStartComboBox
@@ -577,7 +631,7 @@
generalTabPage
- 16
+ 18
True
@@ -592,7 +646,7 @@
71, 13
- 22
+ 18
Purge - Begin
@@ -607,7 +661,7 @@
generalTabPage
- 17
+ 19
188, 266
@@ -616,7 +670,7 @@
121, 21
- 30
+ 26
fileWriter1ComboBox
@@ -628,7 +682,7 @@
generalTabPage
- 18
+ 20
188, 220
@@ -637,7 +691,7 @@
121, 21
- 27
+ 23
printer1ComboBox
@@ -649,7 +703,7 @@
generalTabPage
- 19
+ 21
188, 151
@@ -658,7 +712,7 @@
121, 21
- 21
+ 17
dataEntryComboBox
@@ -670,7 +724,7 @@
generalTabPage
- 20
+ 22
True
@@ -685,7 +739,7 @@
70, 13
- 29
+ 25
Results writer
@@ -700,7 +754,7 @@
generalTabPage
- 21
+ 23
True
@@ -715,7 +769,7 @@
42, 13
- 26
+ 22
Printers
@@ -730,7 +784,7 @@
generalTabPage
- 22
+ 24
True
@@ -745,7 +799,7 @@
57, 13
- 20
+ 16
Data Entry
@@ -760,7 +814,7 @@
generalTabPage
- 23
+ 25
393, 243
@@ -772,7 +826,7 @@
317, 113
- 41
+ 37
notesTextBox
@@ -784,7 +838,7 @@
generalTabPage
- 24
+ 26
True
@@ -799,7 +853,7 @@
35, 13
- 40
+ 36
Notes
@@ -814,7 +868,7 @@
generalTabPage
- 25
+ 27
188, 105
@@ -835,7 +889,7 @@
generalTabPage
- 26
+ 28
True
@@ -865,7 +919,7 @@
generalTabPage
- 27
+ 29
402, 82
@@ -886,7 +940,7 @@
generalTabPage
- 28
+ 30
True
@@ -916,7 +970,7 @@
generalTabPage
- 29
+ 31
188, 82
@@ -937,7 +991,7 @@
generalTabPage
- 30
+ 32
True
@@ -967,7 +1021,7 @@
generalTabPage
- 31
+ 33
402, 59
@@ -988,7 +1042,7 @@
generalTabPage
- 32
+ 34
True
@@ -1018,7 +1072,7 @@
generalTabPage
- 33
+ 35
188, 59
@@ -1039,7 +1093,7 @@
generalTabPage
- 34
+ 36
True
@@ -1069,7 +1123,7 @@
generalTabPage
- 35
+ 37
188, 36
@@ -1090,7 +1144,7 @@
generalTabPage
- 36
+ 38
True
@@ -1120,7 +1174,7 @@
generalTabPage
- 37
+ 39
188, 13
@@ -1141,7 +1195,7 @@
generalTabPage
- 38
+ 40
True
@@ -1171,7 +1225,7 @@
generalTabPage
- 39
+ 41
4, 34
@@ -1180,7 +1234,7 @@
3, 3, 3, 3
- 923, 366
+ 923, 391
0
@@ -1216,7 +1270,7 @@
historyListViewEx
- Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null
+ Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null
historyTabPage
@@ -1267,7 +1321,7 @@
metrology1ListViewEx
- Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null
+ Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null
metrology1TabPage
@@ -1318,7 +1372,7 @@
metrology2ListViewEx
- Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null
+ Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null
metrology2TabPage
@@ -1369,7 +1423,7 @@
processListViewEx
- Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null
+ Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null
processTabPage
@@ -1420,7 +1474,7 @@
parametersListViewEx
- Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null
+ Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null
parametersTabPage
@@ -1462,7 +1516,7 @@
0, 0
- 931, 404
+ 931, 429
0
@@ -1504,7 +1558,7 @@
sharedButtons
- TBF.UiControls.SharedButtons, TBF, Version=2.18.901.0, Culture=neutral, PublicKeyToken=null
+ TBF.UI.Shared.SharedButtons, TBF, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null
mainSplitContainer.Panel2
@@ -1525,7 +1579,7 @@
1
- 1034, 404
+ 1034, 429
931
@@ -1552,7 +1606,7 @@
6, 13
- 1034, 404
+ 1034, 429
CenterParent
diff --git a/TBF/UI/Procedures/ProceduresCtrl.cs b/TBF/UI/Procedures/ProceduresCtrl.cs
index e4f32f2ef..468c9b6fc 100644
--- a/TBF/UI/Procedures/ProceduresCtrl.cs
+++ b/TBF/UI/Procedures/ProceduresCtrl.cs
@@ -40,6 +40,7 @@ namespace TBF.UI.Procedures
Control[] editors;
ISession session;
+ IErrorFlags errorFlagsCmpnt;
public ProceduresCtrl()
: base()
@@ -49,7 +50,10 @@ namespace TBF.UI.Procedures
public void Initialize(ProceduresDlg parent, Control parentControl)
{
- this.parent = parent;
+ /// Create a DB session
+ session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
+
+ this.parent = parent;
this.parentControl = parentControl;
SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
@@ -57,10 +61,10 @@ namespace TBF.UI.Procedures
/// ListViewEx columns
TBF.LocalSettings ls = Program.LocalSettings;
- Columns.Add(Strings.Nr, (ls.ProceduresColumnCount > 0) ? ls.ProceduresColumnWidths[0] : (30 * parent.Dpi / Constants.Dpi100pct));
- Columns.Add(Strings.Name, (ls.ProceduresColumnCount > 1) ? ls.ProceduresColumnWidths[1] : (100 * parent.Dpi / Constants.Dpi100pct));
+ Columns.Add(Strings.Nr, (ls.ProceduresColumnCount > 0) ? ls.ProceduresColumnWidths[0] : ( 30 * parent.Dpi / Constants.Dpi100pct));
+ Columns.Add(Strings.Name, (ls.ProceduresColumnCount > 1) ? ls.ProceduresColumnWidths[1] : (100 * parent.Dpi / Constants.Dpi100pct));
Columns.Add(Strings.DescriptionColHdr, (ls.ProceduresColumnCount > 2) ? ls.ProceduresColumnWidths[2] : (300 * parent.Dpi / Constants.Dpi100pct));
- Columns.Add(Strings.More, (ls.ProceduresColumnCount > 3) ? ls.ProceduresColumnWidths[3] : (300 * parent.Dpi / Constants.Dpi100pct));
+ Columns.Add(Strings.More, (ls.ProceduresColumnCount > 3) ? ls.ProceduresColumnWidths[3] : (300 * parent.Dpi / Constants.Dpi100pct));
editors = new Control[columnsCount];
///
@@ -83,13 +87,29 @@ namespace TBF.UI.Procedures
void ReloadAndRedrawAll()
{
- /// Load the procedures
- if (session == null) session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
+ try
+ {
+ /// Find ErrorFlags component
+ foreach (var cmpnt in TBF.BenchControl.TbfComponents.LoadComponentsFromDB(session))
+ {
+ if (cmpnt is IErrorFlags)
+ {
+ errorFlagsCmpnt = cmpnt as IErrorFlags;
+ break;
+ }
+ }
- MyItems = session.QueryOver()
- .Where(x => (x.ProcedureState == ProcedureState.Active))
- .OrderBy(x => x.ItemNr).Asc
- .List();
+ /// Load the procedures
+ MyItems = session.QueryOver()
+ .Where(x => (x.ProcedureState == ProcedureState.Active))
+ .OrderBy(x => x.ItemNr).Asc
+ .List();
+ }
+ catch (Exception exc)
+ {
+ log.ErrorFormat("Loading Procedures from DB failed: {0}", exc.Message);
+ MyItems = new List();
+ }
base.RedrawAll();
}
@@ -198,7 +218,7 @@ namespace TBF.UI.Procedures
{
newName = Strings.New_procedure_name + nameId.ToString();
bool notUsed = true;
- foreach (var t in MyItems) if (t.Name.Equals(newName)) notUsed = false;
+ foreach (var t in MyItems) if (t.Name.ToLower().Equals(newName.ToLower())) notUsed = false;
if (notUsed) break;
}
@@ -210,7 +230,7 @@ namespace TBF.UI.Procedures
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProcedure.CreationTime = DateTime.Now;
- if (new ProcedureDlg(newProcedure, GetUsedNames(), true).ShowDialog() == DialogResult.OK)
+ if (new ProcedureDlg(newProcedure, GetUsedNames(false), true).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@@ -290,8 +310,8 @@ namespace TBF.UI.Procedures
modifiedProcedure.Revision = originalProcedure.Revision + 1;
modifiedProcedure.ObtainedByCopy = false;
- IList usedNames = GetUsedNames();
- usedNames.Remove(originalProcedure.Name); /// Allow original procedure name
+ IList usedNames = GetUsedNames(false);
+ usedNames.Remove(originalProcedure.Name.ToLower()); /// Allow original procedure name
///
if (new ProcedureDlg(modifiedProcedure, usedNames).ShowDialog() == DialogResult.OK)
{
@@ -346,7 +366,7 @@ namespace TBF.UI.Procedures
newProcedure.CreationTime = DateTime.Now;
newProcedure.Protected = false;
- if ((new ProcedureDlg(newProcedure, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
+ if ((new ProcedureDlg(newProcedure, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@@ -399,7 +419,7 @@ namespace TBF.UI.Procedures
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProcedure.CreationTime = DateTime.Now;
- if ((new ProcedureDlg(newProcedure, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
+ if ((new ProcedureDlg(newProcedure, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@@ -442,6 +462,217 @@ namespace TBF.UI.Procedures
}
}
+ public void CreateFromProfile()
+ {
+ IList profiles;
+
+ try
+ {
+ profiles = session.QueryOver().List();
+ }
+ catch (Exception)
+ {
+ log.Error("Reading Profiles failed");
+ MessageBox.Show("Reading Profiles failed");
+ return;
+ }
+
+ TestWizard.TestProfileSelection dlg = new TestWizard.TestProfileSelection(profiles);
+ if (dlg.ShowDialog() != DialogResult.OK) return;
+
+ /// Find an unused procedure name
+ string newName;
+ for (int nameId = 1; true; nameId++)
+ {
+ newName = Strings.New_procedure_name + nameId.ToString();
+ bool notUsed = true;
+ foreach (var t in MyItems) if (t.Name.ToLower().Equals(newName.ToLower())) notUsed = false;
+ if (notUsed) break;
+ }
+
+ ProfileType pt = dlg.SelectedProfile.ProfileType;
+
+ Procedure newProcedure = new Procedure(newName, MyItems.Count);
+ Medium medium = (pt == ProfileType.QnClassHotWater) ? Medium.HotWater : Medium.ColdWater;
+ IList errorFlagsParamsOfCreatedTests = new List();
+ IList waterMeterParamsOfNewProcedure = new List();
+
+ IList cmpntEntities = session.QueryOver()
+ .OrderBy(x => x.ItemNr).Asc
+ .List();
+
+ IList components = BenchControl.TbfComponents.LoadComponentsFromDB(session);
+ foreach (var cmptn in components)
+ {
+ if (cmptn.ClassName == "WaterMeter")
+ {
+ IParamsProvider waterMeterParams = cmptn.Cfg.GetUIProcParamsProvider(newProcedure);
+
+ TBF.BenchControl.WaterMeters.WaterMeter.ProcParams wmParams = waterMeterParams as TBF.BenchControl.WaterMeters.WaterMeter.ProcParams;
+ if (wmParams != null)
+ {
+ wmParams.NewQnames = (pt == ProfileType.Q3R);
+ wmParams.Qmax = (float)((pt == ProfileType.Manual) ? 0 : Config.Utils.GetQ4Qmax(dlg.Qn, dlg.MetroClass, medium));
+ wmParams.Qn = (float)dlg.Qn;
+ wmParams.Qt = (float)((pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQi) ? (0.1 * dlg.Qn) : Config.Utils.GetQ2Qt(dlg.Qn, dlg.MetroClass, medium));
+ wmParams.Qmin = (float)((pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQi) ? dlg.Qn / dlg.QpQiRatio : Config.Utils.GetQ1Qmin(dlg.Qn, dlg.MetroClass, medium));
+ wmParams.MetrologicalClass = dlg.MetroClass;
+ wmParams.WaterTemp = medium;
+ }
+
+ waterMeterParamsOfNewProcedure.Add(waterMeterParams);
+ }
+ }
+
+
+ int itemNr = 0;
+ foreach (var ptest in dlg.SelectedProfile.Tests)
+ {
+ double Qtg;
+ if (ptest.Name.Contains("Q4") || ptest.Name.Contains("Qmax"))
+ {
+ Qtg = Config.Utils.GetQ4Qmax(dlg.Qn, dlg.MetroClass, medium, ptest.CoefQto);
+ }
+ else if (ptest.Name.Contains("Q3") || ptest.Name.Contains("Qn") || ptest.Name.Equals("qp"))
+ {
+ Qtg = dlg.Qn;
+ }
+ else if (ptest.Name.Contains("Q2") || ptest.Name.Contains("Qt"))
+ {
+ Qtg = Config.Utils.GetQ2Qt(dlg.Qn, dlg.MetroClass, medium, ptest.CoefQto);
+ }
+ else if (ptest.Name.Contains("Q1") || ptest.Name.Contains("Qmin"))
+ {
+ Qtg = Config.Utils.GetQ1Qmin(dlg.Qn, dlg.MetroClass, medium, ptest.CoefQto);
+ }
+ else if (ptest.Name.Contains("0,1qp") || ptest.Name.Contains("0.1qp"))
+ {
+ Qtg = 0.1 * dlg.Qn;
+ }
+ else if (ptest.Name.Contains("qi"))
+ {
+ Qtg = dlg.Qn / dlg.QpQiRatio;
+ }
+ else
+ {
+ Qtg = dlg.Qn; /// Manual flow selection: CoefQfrom and CoefQto are used to calculate Qfrom and Qto from Qn
+ }
+
+ Test test = new Test(ptest.Name, itemNr++, newProcedure);
+ test.Part = ptest.Part;
+ test.Profile = (pt == ProfileType.QpQi) ? TestProfile.ProtectedHeatMeter : TestProfile.Protected;
+ test.Qtg = (float)Qtg;
+ test.Qfrom = (float)(Qtg * ptest.CoefQfrom);
+ test.Qto = (float)(Qtg * ptest.CoefQto);
+ test.TempLimLo = (float)ptest.TempLimLo;
+ test.TempLimHi = (float)ptest.TempLimHi;
+ test.DoEvaluate = true;
+ test.Publish = (sbyte)Publish.Always;
+
+ if (pt != ProfileType.QpQi)
+ {
+ test.ErrLimLo = (float)ptest.ErrLimLo;
+ test.ErrLimHi = (float)ptest.ErrLimHi;
+ }
+ else
+ {
+ int metroClass;
+ if (int.TryParse(dlg.MetroClass, out metroClass)) test.ErrLimLo = (float)metroClass;
+ test.ErrLimHi = -(float)dlg.Qn;
+ }
+
+ newProcedure.Tests.Add(test);
+
+ if (errorFlagsCmpnt != null)
+ {
+ IParamsProvider errorFlagsParams = errorFlagsCmpnt.Cfg.GetUITestParamsProvider(test);
+
+ TBF.BenchControl.Various.ErrorFlags.TestParams eFlagParams = errorFlagsParams as TBF.BenchControl.Various.ErrorFlags.TestParams;
+ if (eFlagParams != null)
+ {
+ eFlagParams.E1 = ptest.E1;
+ eFlagParams.E2 = ptest.E2;
+ eFlagParams.E3 = ptest.E3;
+ eFlagParams.E4 = ptest.E4;
+ eFlagParams.E5 = ptest.E5;
+ eFlagParams.E6 = ptest.E6;
+ eFlagParams.E7 = ptest.E7;
+ eFlagParams.E8 = ptest.E8;
+ eFlagParams.E9 = ptest.E9;
+ eFlagParams.E10 = ptest.E10;
+ eFlagParams.E11 = ptest.E11;
+ eFlagParams.E12 = ptest.E12;
+ eFlagParams.E13 = ptest.E13;
+ eFlagParams.E14 = ptest.E14;
+ eFlagParams.E15 = ptest.E15;
+ eFlagParams.E16 = ptest.E16;
+ eFlagParams.E21 = ptest.E21;
+
+ eFlagParams.Delta_Q_pct = ptest.Delta_Q_pct;
+ eFlagParams.Delta_T = ptest.Delta_T;
+ eFlagParams.Delta_Tup_Tdn = ptest.Delta_Tup_Tdn;
+ eFlagParams.TestTime_min = ptest.TestTime_min;
+ eFlagParams.TestTime_max = ptest.TestTime_max;
+ eFlagParams.AmbTemp_min = ptest.AmbTemp_min;
+ eFlagParams.AmbTemp_max = ptest.AmbTemp_max;
+ eFlagParams.Pressure_min = ptest.PressLimLo;
+ eFlagParams.Pressure_max = ptest.PressLimHi;
+ eFlagParams.Coef_E9 = ptest.Coef_E9;
+ eFlagParams.Coef_E10 = ptest.Coef_E10;
+ eFlagParams.Coef_E11 = ptest.Coef_E11;
+ eFlagParams.Coef_E12 = ptest.Coef_E12;
+ eFlagParams.Offset_E9 = ptest.Offset_E9;
+ eFlagParams.Offset_E12 = ptest.Offset_E12;
+ }
+
+ errorFlagsParamsOfCreatedTests.Add(errorFlagsParams);
+ }
+ }
+
+ newProcedure.AltProcName = dlg.SelectedProfile.Name;
+ newProcedure.ProcedureState = ProcedureState.Active;
+ newProcedure.Revision = 1;
+ newProcedure.PredecessorId = 0;
+ newProcedure.ObtainedByCopy = false;
+ newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
+ newProcedure.CreationTime = DateTime.Now;
+
+ if (new ProcedureDlg(newProcedure, GetUsedNames(false), true).ShowDialog() == DialogResult.OK)
+ {
+ /// TODO: Make name uniqueness test
+ parent.Unlock();
+
+ using (var transaction = session.BeginTransaction())
+ {
+ try
+ {
+ newProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName;
+ newProcedure.LastChgTime = DateTime.Now;
+
+ base.AddOne(newProcedure);
+ session.SaveOrUpdate(newProcedure);
+
+ foreach (var efp in errorFlagsParamsOfCreatedTests)
+ {
+ efp.UpdateEmbeddedDbEntity();
+ }
+
+ transaction.Commit();
+
+ MessageBox.Show(string.Format(Strings.Procedure_0_added, newProcedure.Name),
+ Strings.Confirmation,
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Information);
+ }
+ catch (Exception exc)
+ {
+ transaction.Rollback();
+ log.ErrorFormat("Exception when saving Procedure '{0}' : {1}", newProcedure.Name, exc.Message);
+ }
+ }
+ }
+ }
+
public string GetWarningsBeforeSaving(ref Dictionary renmInfo)
{
return string.Empty;
diff --git a/TBF/UI/Procedures/ProceduresDlg.cs b/TBF/UI/Procedures/ProceduresDlg.cs
index a24bfc59f..4940ed9c5 100644
--- a/TBF/UI/Procedures/ProceduresDlg.cs
+++ b/TBF/UI/Procedures/ProceduresDlg.cs
@@ -7,6 +7,7 @@ using System.Windows.Forms;
using log4net;
using TBF.Resources;
using TBF.UI.Shared;
+using Config.Entities;
namespace TBF.UI.Procedures
{
@@ -26,11 +27,22 @@ namespace TBF.UI.Procedures
/// SharedDlgButtons configuration
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
+
+#if TEST_PROFILES
+ sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
+ SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |
+ SharedButtons.Buttons.Edit | SharedButtons.Buttons.Copy |
+ SharedButtons.Buttons.Export | SharedButtons.Buttons.Import |
+ SharedButtons.Buttons.Compare |SharedButtons.Buttons.Custom1;
+ sharedButtons.Custom1Caption = string.Format("Create from{0}test profiles", Environment.NewLine);
+ sharedButtons.Custom1Clicked += custom1Button_Click;
+#else
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |
SharedButtons.Buttons.Edit | SharedButtons.Buttons.Copy |
SharedButtons.Buttons.Export | SharedButtons.Buttons.Import |
SharedButtons.Buttons.Compare;
+#endif
sharedButtons.Unlocked += Unlocked;
sharedButtons.OKClicked += okButton_Click;
@@ -209,6 +221,11 @@ namespace TBF.UI.Procedures
}
}
+ private void custom1Button_Click(object sender, EventArgs e)
+ {
+ proceduresCtrl.CreateFromProfile();
+ }
+
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
{
if (selectedItemPos == SharedButtons.SelectedItemPos.None)
diff --git a/TBF/UI/Procedures/TestParamsCtrl.cs b/TBF/UI/Procedures/TestParamsCtrl.cs
index 1b1a51f48..499471e80 100644
--- a/TBF/UI/Procedures/TestParamsCtrl.cs
+++ b/TBF/UI/Procedures/TestParamsCtrl.cs
@@ -189,11 +189,11 @@ namespace TBF.UI.Procedures
listViewEx.Items.Clear();
for (int i = 0; i < testParamsProviders.Count && i < parent.LoadedProcedure.Tests.Count; i++)
{
- DrawOne(testParamsProviders[i], parent.LoadedProcedure.Tests[i].Name);
+ DrawOne(testParamsProviders[i], parent.LoadedProcedure.Tests[i]);
}
}
- void DrawOne(IParamsProvider item, string testName)
+ void DrawOne(IParamsProvider item, Test test)
{
if (item == null)
{
@@ -204,7 +204,7 @@ namespace TBF.UI.Procedures
ListViewItem lvi;
if (showTestsColumn)
{
- lvi = new ListViewItem(testName);
+ lvi = new ListViewItem(test.Name);
lvi.SubItems.Add(item.ToString(0));
}
else
@@ -213,7 +213,9 @@ namespace TBF.UI.Procedures
}
for (int i = 1; i < paramsCount; i++) lvi.SubItems.Add(item.ToString(i));
- lvi.Tag = item;
+ /// Setting Tag to 'null' in case of ErrorFlags.TestParams and protected tests prevents editing ListViewEx items
+ lvi.Tag = (item is TBF.BenchControl.Various.ErrorFlags.TestParams && (test.Profile >= TestProfile.Protected)) ? null : item;
+
listViewEx.Items.Add(lvi);
}
@@ -231,7 +233,7 @@ namespace TBF.UI.Procedures
entity.SetParamsProvider(testParams);
testParamsProviders.Add(testParams);
}
- DrawOne(testParams, test.Name);
+ DrawOne(testParams, test);
}
else
{
diff --git a/TBF/UI/Procedures/TestWizard/TestProfileSelection.cs b/TBF/UI/Procedures/TestWizard/TestProfileSelection.cs
new file mode 100644
index 000000000..44a9031a5
--- /dev/null
+++ b/TBF/UI/Procedures/TestWizard/TestProfileSelection.cs
@@ -0,0 +1,356 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using log4net;
+using Config.Entities;
+using TBF.BenchControl.GenericDevices;
+using TBF.Resources;
+
+namespace TBF.UI.Procedures.TestWizard
+{
+ public partial class TestProfileSelection : Form
+ {
+ static readonly ILog log = LogManager.GetLogger(typeof(TestProfileSelection));
+
+ IList profiles;
+
+ public Profile SelectedProfile;
+ public double Qn;
+ public string MetroClass;
+ public double QpQiRatio;
+
+ public TestProfileSelection(IList profiles)
+ {
+ this.profiles = profiles;
+
+ InitializeComponent();
+
+ listView.Columns.Add(Strings.Name, 70);
+ listView.Columns.Add(Strings.Part, 40);
+ listView.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_tg), 80);
+ listView.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), 80);
+ listView.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), 70);
+ listView.Columns.Add(Strings.Err_limit_neg_pct_chdr, 80);
+ listView.Columns.Add(Strings.Err_limit_pos_pct_chdr, 80);
+
+ if (profiles != null)
+ {
+ foreach (var p in profiles) profileComboBox.Items.Add(p.Name);
+ }
+
+ foreach (var s in new string[] { "10", "25", "50", "100", "250" }) qpQiRatioComboBox.Items.Add(s);
+
+ nextButton.Enabled = false;
+ }
+
+ private void TestProfileSelection_Load(object sender, EventArgs e)
+ {
+ Localize();
+ }
+
+ void Localize()
+ {
+ Text = Strings.Test_profiles_selection;
+ nextButton.Text = Strings.NextBtnText;
+ cancelButton.Text = Strings.CancelBtnText;
+ }
+
+ void RedrawQn(Profile profile)
+ {
+ switch (profile.ProfileType)
+ {
+ case ProfileType.Q3R:
+ qnLabel.Text = "Q3";
+ break;
+ case ProfileType.QpQi:
+ qnLabel.Text = "qp";
+ break;
+ case ProfileType.QnClassColdWater:
+ case ProfileType.QnClassHotWater:
+ case ProfileType.Manual:
+ default:
+ qnLabel.Text = "Qn";
+ break;
+ }
+ }
+
+ void RedrawMClassCombo(Profile profile)
+ {
+ string oriText = metroClassComboBox.Text;
+ metroClassComboBox.Items.Clear();
+ bool clearTextFlag = true;
+
+ if (profile != null)
+ {
+ string[] mClasses;
+ switch (profile.ProfileType)
+ {
+ default:
+ case ProfileType.Q3R:
+ mClasses = new string[] { "R40", "R50", "R63", "R80", "R100", "R125", "R160", "R200", "R250", "R315",
+ "R400", "R500", "R630", "R800", "R1000", "R1250", "R1600", "R2000", "R2500" };
+ break;
+ case ProfileType.QnClassColdWater:
+ mClasses = new string[] { "A", "B", "C" };
+ break;
+ case ProfileType.QnClassHotWater:
+ mClasses = new string[] { "A", "B", "C", "D" };
+ break;
+ case ProfileType.QpQi:
+ mClasses = new string[] { "1", "2", "3" };
+ break;
+ }
+
+ foreach (var mc in mClasses)
+ {
+ metroClassComboBox.Items.Add(mc);
+ if (oriText == mc) clearTextFlag = false;
+ }
+ }
+
+ if (clearTextFlag) metroClassComboBox.Text = string.Empty;
+ }
+
+
+ void RedrawPTests(Profile profile)
+ {
+ listView.Items.Clear();
+
+ if (profile == null) return;
+
+ try
+ {
+ foreach (var ptest in profile.Tests)
+ {
+ Medium medium = (profile.ProfileType == ProfileType.QnClassHotWater) ? Medium.HotWater : Medium.ColdWater;
+
+ double Qtg;
+ if (ptest.Name.Contains("Q4") || ptest.Name.Contains("Qmax"))
+ {
+ Qtg = Config.Utils.GetQ4Qmax(Qn, MetroClass, medium, ptest.CoefQto);
+ }
+ else if (ptest.Name.Contains("Q3") || ptest.Name.Contains("Qn") || ptest.Name.Equals("qp"))
+ {
+ Qtg = Qn;
+ }
+ else if (ptest.Name.Contains("Q2") || ptest.Name.Contains("Qt"))
+ {
+ Qtg = Config.Utils.GetQ2Qt(Qn, MetroClass, medium, ptest.CoefQto);
+ }
+ else if (ptest.Name.Contains("Q1") || ptest.Name.Contains("Qmin"))
+ {
+ Qtg = Config.Utils.GetQ1Qmin(Qn, MetroClass, medium, ptest.CoefQto);
+ }
+ else if (ptest.Name.Contains("0,1qp") || ptest.Name.Contains("0.1qp"))
+ {
+ Qtg = 0.1 * Qn;
+ }
+ else if (ptest.Name.Contains("qi"))
+ {
+ Qtg = Qn / QpQiRatio;
+ }
+ else
+ {
+ Qtg = Qn; /// Manual flow selection: CoefQfrom and CoefQto are used to calculate Qfrom and Qto from Qn
+ }
+
+ double Qfrom = Qtg * ptest.CoefQfrom;
+ double Qto = Qtg * ptest.CoefQto;
+
+ ListViewItem lvi;
+ if (profile.ProfileType != ProfileType.QpQi)
+ {
+ lvi = new ListViewItem(new string[] { ptest.Name,
+ (ptest.Part > 0) ? ptest.Part.ToString() : "-",
+ Qtg.ToString(),
+ Qfrom.ToString(),
+ Qto.ToString(),
+ ptest.ErrLimLo.ToString(),
+ ptest.ErrLimHi.ToString() });
+ }
+ else
+ {
+ lvi = new ListViewItem(new string[] { ptest.Name,
+ (ptest.Part > 0) ? ptest.Part.ToString() : "-",
+ Qtg.ToString(),
+ Qfrom.ToString(),
+ Qto.ToString(),
+ Strings.calculated,
+ Strings.calculated });
+ }
+
+ lvi.Tag = ptest;
+ listView.Items.Add(lvi);
+ }
+ }
+ catch (Exception)
+ {
+ MessageBox.Show("Something went wrong");
+ }
+ }
+
+
+ private void profileComboBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ Profile newProfile = null;
+ foreach (var p in profiles)
+ {
+ if (profileComboBox.Text == p.Name)
+ {
+ newProfile = p;
+ break;
+ }
+ }
+
+ if (SelectedProfile != newProfile)
+ {
+ SelectedProfile = newProfile;
+
+ qpQiRatioGroupBox.Visible = (SelectedProfile.ProfileType == ProfileType.QpQi);
+ metroClassGroupBox.Visible = (SelectedProfile.ProfileType != ProfileType.Manual);
+
+ profileTypeLabel.Text = (newProfile != null) ? newProfile.ProfileType.ToString() : string.Empty;
+ profileDescriptionLabel.Text = (newProfile != null) ? newProfile.Description : string.Empty;
+ RedrawQn(newProfile);
+ RedrawMClassCombo(newProfile);
+
+ if (IsFormValid())
+ {
+ RedrawPTests(newProfile);
+ nextButton.Enabled = true;
+ }
+ else
+ {
+ RedrawPTests(null);
+ nextButton.Enabled = false;
+ }
+ }
+ }
+
+ private void qnComboBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (IsFormValid())
+ {
+ RedrawPTests(SelectedProfile);
+ nextButton.Enabled = true;
+ }
+ else
+ {
+ RedrawPTests(null);
+ nextButton.Enabled = false;
+ }
+ }
+
+ private void metroClassComboBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (IsFormValid())
+ {
+ RedrawPTests(SelectedProfile);
+ nextButton.Enabled = true;
+ }
+ else
+ {
+ RedrawPTests(null);
+ nextButton.Enabled = false;
+ }
+ }
+
+ private void qpQiRatioComboBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (IsFormValid())
+ {
+ RedrawPTests(SelectedProfile);
+ nextButton.Enabled = true;
+ }
+ else
+ {
+ RedrawPTests(null);
+ nextButton.Enabled = false;
+ }
+ }
+
+
+ bool IsProfileValid()
+ {
+ return profileComboBox.Items.Contains(profileComboBox.Text); /// CB text must be one of the items
+ }
+
+ bool IsQnValid()
+ {
+ if (!string.IsNullOrEmpty(qnTextBox.Text) && Utils.TryParseUDouble(qnTextBox.Text, out Qn) && (Qn > 0))
+ {
+ return true;
+ }
+ else
+ {
+ Qn = 0;
+ return false;
+ }
+ }
+
+ bool IsMetroClassValid()
+ {
+ if (SelectedProfile.ProfileType == ProfileType.Manual)
+ {
+ MetroClass = string.Empty;
+ return true;
+ }
+
+ if (!string.IsNullOrEmpty(metroClassComboBox.Text) &&
+ (metroClassComboBox.Items.Count == 0 || metroClassComboBox.Items.Contains(metroClassComboBox.Text)))
+ {
+ MetroClass = metroClassComboBox.Text;
+ return true;
+ }
+
+ MetroClass = string.Empty;
+ return false;
+ }
+
+ bool IsQpQiRatioValid()
+ {
+ if (SelectedProfile.ProfileType != ProfileType.QpQi)
+ {
+ QpQiRatio = 1.0;
+ return true;
+ }
+
+ if (!string.IsNullOrEmpty(qpQiRatioComboBox.Text) && qpQiRatioComboBox.Items.Contains(qpQiRatioComboBox.Text))
+ {
+ QpQiRatio = double.Parse(qpQiRatioComboBox.Text);
+ return true;
+ }
+
+ QpQiRatio = 1.0;
+ return false;
+ }
+
+ bool IsFormValid()
+ {
+ return IsProfileValid() && IsQnValid() && IsMetroClassValid() && IsQpQiRatioValid();
+ }
+
+ private void nextButton_Click(object sender, EventArgs e)
+ {
+ if (IsFormValid())
+ {
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ else
+ {
+ MessageBox.Show("Something's wrong");
+ }
+ }
+
+ private void cancelButton_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/TBF/UI/Procedures/TestWizard/TestProfileSelection.designer.cs b/TBF/UI/Procedures/TestWizard/TestProfileSelection.designer.cs
new file mode 100644
index 000000000..881cb9468
--- /dev/null
+++ b/TBF/UI/Procedures/TestWizard/TestProfileSelection.designer.cs
@@ -0,0 +1,292 @@
+///
+/// Copyright (c) 2019 Sensus Slovensko a.s.
+///
+namespace TBF.UI.Procedures.TestWizard
+{
+ partial class TestProfileSelection
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
+ this.horizSplitContainer2 = new System.Windows.Forms.SplitContainer();
+ this.qpQiRatioGroupBox = new System.Windows.Forms.GroupBox();
+ this.qpQiRatioComboBox = new System.Windows.Forms.ComboBox();
+ this.profileGroupBox = new System.Windows.Forms.GroupBox();
+ this.profileTypeLabel = new System.Windows.Forms.Label();
+ this.profileDescriptionLabel = new System.Windows.Forms.Label();
+ this.profileComboBox = new System.Windows.Forms.ComboBox();
+ this.qnGroupBox = new System.Windows.Forms.GroupBox();
+ this.qnLabel = new System.Windows.Forms.Label();
+ this.metroClassGroupBox = new System.Windows.Forms.GroupBox();
+ this.metroClassComboBox = new System.Windows.Forms.ComboBox();
+ this.listView = new System.Windows.Forms.ListView();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.nextButton = new System.Windows.Forms.Button();
+ this.qnTextBox = new System.Windows.Forms.TextBox();
+ ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
+ this.horizSplitContainer.Panel1.SuspendLayout();
+ this.horizSplitContainer.Panel2.SuspendLayout();
+ this.horizSplitContainer.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).BeginInit();
+ this.horizSplitContainer2.Panel1.SuspendLayout();
+ this.horizSplitContainer2.Panel2.SuspendLayout();
+ this.horizSplitContainer2.SuspendLayout();
+ this.qpQiRatioGroupBox.SuspendLayout();
+ this.profileGroupBox.SuspendLayout();
+ this.qnGroupBox.SuspendLayout();
+ this.metroClassGroupBox.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // horizSplitContainer
+ //
+ this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
+ this.horizSplitContainer.Location = new System.Drawing.Point(0, 0);
+ this.horizSplitContainer.Name = "horizSplitContainer";
+ this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // horizSplitContainer.Panel1
+ //
+ this.horizSplitContainer.Panel1.Controls.Add(this.horizSplitContainer2);
+ //
+ // horizSplitContainer.Panel2
+ //
+ this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton);
+ this.horizSplitContainer.Panel2.Controls.Add(this.nextButton);
+ this.horizSplitContainer.Size = new System.Drawing.Size(850, 363);
+ this.horizSplitContainer.SplitterDistance = 283;
+ this.horizSplitContainer.TabIndex = 0;
+ //
+ // horizSplitContainer2
+ //
+ this.horizSplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.horizSplitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+ this.horizSplitContainer2.IsSplitterFixed = true;
+ this.horizSplitContainer2.Location = new System.Drawing.Point(0, 0);
+ this.horizSplitContainer2.Name = "horizSplitContainer2";
+ this.horizSplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // horizSplitContainer2.Panel1
+ //
+ this.horizSplitContainer2.Panel1.Controls.Add(this.qpQiRatioGroupBox);
+ this.horizSplitContainer2.Panel1.Controls.Add(this.profileGroupBox);
+ this.horizSplitContainer2.Panel1.Controls.Add(this.qnGroupBox);
+ this.horizSplitContainer2.Panel1.Controls.Add(this.metroClassGroupBox);
+ //
+ // horizSplitContainer2.Panel2
+ //
+ this.horizSplitContainer2.Panel2.Controls.Add(this.listView);
+ this.horizSplitContainer2.Size = new System.Drawing.Size(850, 283);
+ this.horizSplitContainer2.SplitterDistance = 115;
+ this.horizSplitContainer2.TabIndex = 0;
+ //
+ // qpQiRatioGroupBox
+ //
+ this.qpQiRatioGroupBox.Controls.Add(this.qpQiRatioComboBox);
+ this.qpQiRatioGroupBox.Location = new System.Drawing.Point(724, 12);
+ this.qpQiRatioGroupBox.Name = "qpQiRatioGroupBox";
+ this.qpQiRatioGroupBox.Size = new System.Drawing.Size(103, 75);
+ this.qpQiRatioGroupBox.TabIndex = 3;
+ this.qpQiRatioGroupBox.TabStop = false;
+ this.qpQiRatioGroupBox.Text = "4. Qp / Qi";
+ this.qpQiRatioGroupBox.Visible = false;
+ //
+ // qpQiRatioComboBox
+ //
+ this.qpQiRatioComboBox.FormattingEnabled = true;
+ this.qpQiRatioComboBox.Location = new System.Drawing.Point(23, 22);
+ this.qpQiRatioComboBox.Name = "qpQiRatioComboBox";
+ this.qpQiRatioComboBox.Size = new System.Drawing.Size(55, 21);
+ this.qpQiRatioComboBox.TabIndex = 0;
+ this.qpQiRatioComboBox.SelectedIndexChanged += new System.EventHandler(this.qpQiRatioComboBox_SelectedIndexChanged);
+ //
+ // profileGroupBox
+ //
+ this.profileGroupBox.Controls.Add(this.profileTypeLabel);
+ this.profileGroupBox.Controls.Add(this.profileDescriptionLabel);
+ this.profileGroupBox.Controls.Add(this.profileComboBox);
+ this.profileGroupBox.Location = new System.Drawing.Point(12, 12);
+ this.profileGroupBox.Name = "profileGroupBox";
+ this.profileGroupBox.Size = new System.Drawing.Size(386, 75);
+ this.profileGroupBox.TabIndex = 0;
+ this.profileGroupBox.TabStop = false;
+ this.profileGroupBox.Text = "1. Test profile";
+ //
+ // profileTypeLabel
+ //
+ this.profileTypeLabel.AutoSize = true;
+ this.profileTypeLabel.Location = new System.Drawing.Point(31, 51);
+ this.profileTypeLabel.Name = "profileTypeLabel";
+ this.profileTypeLabel.Size = new System.Drawing.Size(85, 13);
+ this.profileTypeLabel.TabIndex = 25;
+ this.profileTypeLabel.Text = "profileTypeLabel";
+ //
+ // profileDescriptionLabel
+ //
+ this.profileDescriptionLabel.AutoSize = true;
+ this.profileDescriptionLabel.Location = new System.Drawing.Point(132, 51);
+ this.profileDescriptionLabel.Name = "profileDescriptionLabel";
+ this.profileDescriptionLabel.Size = new System.Drawing.Size(114, 13);
+ this.profileDescriptionLabel.TabIndex = 24;
+ this.profileDescriptionLabel.Text = "profileDescriptionLabel";
+ //
+ // profileComboBox
+ //
+ this.profileComboBox.FormattingEnabled = true;
+ this.profileComboBox.Location = new System.Drawing.Point(32, 22);
+ this.profileComboBox.Name = "profileComboBox";
+ this.profileComboBox.Size = new System.Drawing.Size(318, 21);
+ this.profileComboBox.TabIndex = 0;
+ this.profileComboBox.SelectedIndexChanged += new System.EventHandler(this.profileComboBox_SelectedIndexChanged);
+ //
+ // qnGroupBox
+ //
+ this.qnGroupBox.Controls.Add(this.qnTextBox);
+ this.qnGroupBox.Controls.Add(this.qnLabel);
+ this.qnGroupBox.Location = new System.Drawing.Point(406, 12);
+ this.qnGroupBox.Name = "qnGroupBox";
+ this.qnGroupBox.Size = new System.Drawing.Size(156, 75);
+ this.qnGroupBox.TabIndex = 1;
+ this.qnGroupBox.TabStop = false;
+ this.qnGroupBox.Text = "2. Nominal flow";
+ //
+ // qnLabel
+ //
+ this.qnLabel.AutoSize = true;
+ this.qnLabel.Location = new System.Drawing.Point(17, 26);
+ this.qnLabel.Name = "qnLabel";
+ this.qnLabel.Size = new System.Drawing.Size(21, 13);
+ this.qnLabel.TabIndex = 10;
+ this.qnLabel.Text = "Q3";
+ //
+ // metroClassGroupBox
+ //
+ this.metroClassGroupBox.Controls.Add(this.metroClassComboBox);
+ this.metroClassGroupBox.Location = new System.Drawing.Point(571, 12);
+ this.metroClassGroupBox.Name = "metroClassGroupBox";
+ this.metroClassGroupBox.Size = new System.Drawing.Size(144, 75);
+ this.metroClassGroupBox.TabIndex = 2;
+ this.metroClassGroupBox.TabStop = false;
+ this.metroClassGroupBox.Text = "3. Metrological class";
+ //
+ // metroClassComboBox
+ //
+ this.metroClassComboBox.FormattingEnabled = true;
+ this.metroClassComboBox.Location = new System.Drawing.Point(23, 22);
+ this.metroClassComboBox.Name = "metroClassComboBox";
+ this.metroClassComboBox.Size = new System.Drawing.Size(100, 21);
+ this.metroClassComboBox.TabIndex = 0;
+ this.metroClassComboBox.SelectedIndexChanged += new System.EventHandler(this.metroClassComboBox_SelectedIndexChanged);
+ //
+ // listView
+ //
+ this.listView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listView.GridLines = true;
+ this.listView.Location = new System.Drawing.Point(0, 0);
+ this.listView.Name = "listView";
+ this.listView.Size = new System.Drawing.Size(850, 164);
+ this.listView.TabIndex = 0;
+ this.listView.UseCompatibleStateImageBehavior = false;
+ this.listView.View = System.Windows.Forms.View.Details;
+ //
+ // cancelButton
+ //
+ this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.cancelButton.Location = new System.Drawing.Point(752, 17);
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.Size = new System.Drawing.Size(75, 42);
+ this.cancelButton.TabIndex = 1;
+ this.cancelButton.Text = "&Cancel";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
+ //
+ // nextButton
+ //
+ this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.nextButton.Location = new System.Drawing.Point(671, 17);
+ this.nextButton.Name = "nextButton";
+ this.nextButton.Size = new System.Drawing.Size(75, 42);
+ this.nextButton.TabIndex = 0;
+ this.nextButton.Text = "&Next >";
+ this.nextButton.UseVisualStyleBackColor = true;
+ this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
+ //
+ // qnTextBox
+ //
+ this.qnTextBox.Location = new System.Drawing.Point(50, 22);
+ this.qnTextBox.Name = "qnTextBox";
+ this.qnTextBox.Size = new System.Drawing.Size(82, 20);
+ this.qnTextBox.TabIndex = 11;
+ //
+ // TestProfileSelection
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(850, 363);
+ this.Controls.Add(this.horizSplitContainer);
+ this.Name = "TestProfileSelection";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Test profile selection";
+ this.Load += new System.EventHandler(this.TestProfileSelection_Load);
+ this.horizSplitContainer.Panel1.ResumeLayout(false);
+ this.horizSplitContainer.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
+ this.horizSplitContainer.ResumeLayout(false);
+ this.horizSplitContainer2.Panel1.ResumeLayout(false);
+ this.horizSplitContainer2.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).EndInit();
+ this.horizSplitContainer2.ResumeLayout(false);
+ this.qpQiRatioGroupBox.ResumeLayout(false);
+ this.profileGroupBox.ResumeLayout(false);
+ this.profileGroupBox.PerformLayout();
+ this.qnGroupBox.ResumeLayout(false);
+ this.qnGroupBox.PerformLayout();
+ this.metroClassGroupBox.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.SplitContainer horizSplitContainer;
+ private System.Windows.Forms.Button cancelButton;
+ private System.Windows.Forms.Button nextButton;
+ private System.Windows.Forms.SplitContainer horizSplitContainer2;
+ private System.Windows.Forms.Label qnLabel;
+ private System.Windows.Forms.ComboBox profileComboBox;
+ private System.Windows.Forms.GroupBox qnGroupBox;
+ private System.Windows.Forms.GroupBox metroClassGroupBox;
+ private System.Windows.Forms.GroupBox profileGroupBox;
+ private System.Windows.Forms.ComboBox metroClassComboBox;
+ private System.Windows.Forms.ListView listView;
+ private System.Windows.Forms.Label profileDescriptionLabel;
+ private System.Windows.Forms.Label profileTypeLabel;
+ private System.Windows.Forms.GroupBox qpQiRatioGroupBox;
+ private System.Windows.Forms.ComboBox qpQiRatioComboBox;
+ private System.Windows.Forms.TextBox qnTextBox;
+ }
+}
\ No newline at end of file
diff --git a/TBF/UI/Procedures/TestWizard/TestProfileSelection.resx b/TBF/UI/Procedures/TestWizard/TestProfileSelection.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TBF/UI/Procedures/TestWizard/TestProfileSelection.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TBF/UI/Settings/UpgradeSelectionDlg.cs b/TBF/UI/Settings/UpgradeSelectionDlg.cs
index 286d07d90..276604db3 100644
--- a/TBF/UI/Settings/UpgradeSelectionDlg.cs
+++ b/TBF/UI/Settings/UpgradeSelectionDlg.cs
@@ -609,6 +609,7 @@ namespace TBF.UI.Settings
" PRIMARY KEY (`Id`)," +
" KEY `Component_id` (`Component_id`)" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;",
+ "UPDATE `test` SET `RelTransAfter`='UserDefined';",
};
string[] resultsDbCommands = new string[]
diff --git a/TBF/UI/Shared/BaseWithListViewEx.cs b/TBF/UI/Shared/BaseWithListViewEx.cs
index afbc5c2d6..c720c434b 100644
--- a/TBF/UI/Shared/BaseWithListViewEx.cs
+++ b/TBF/UI/Shared/BaseWithListViewEx.cs
@@ -202,13 +202,26 @@ namespace TBF.UI.Shared
}
- public IList GetUsedNames()
+ public IList GetUsedNames(bool caseSensitive = true)
{
IList usedNames = new List();
if (MyItems != null)
{
- foreach (var item in MyItems) if (item is IHasName) usedNames.Add((item as IHasName).Name);
+ if (caseSensitive)
+ {
+ foreach (var item in MyItems)
+ {
+ if (item is IHasName) usedNames.Add((item as IHasName).Name);
+ }
+ }
+ else
+ {
+ foreach (var item in MyItems)
+ {
+ if (item is IHasName) usedNames.Add((item as IHasName).Name.ToLower());
+ }
+ }
}
return usedNames;