Compare commits
111
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
890b6016cf | ||
|
|
5efaac94cb | ||
|
|
c5752f21a9 | ||
|
|
8c30cb21e2 | ||
|
|
5181f75217 | ||
|
|
7ee41afba2 | ||
|
|
5bb99bbf86 | ||
|
|
6fd67cdf08 | ||
|
|
e1bfa71310 | ||
|
|
2476ed7681 | ||
|
|
e413b55c6a | ||
|
|
7d2da63071 | ||
|
|
9aad4a60ab | ||
|
|
6ffbda6e96 | ||
|
|
72a8f1dac6 | ||
|
|
d2631c8c88 | ||
|
|
66b463c468 | ||
|
|
af38dbe81b | ||
|
|
42010a6c26 | ||
|
|
21d3f5e835 | ||
|
|
e93aa6a21e | ||
|
|
812ac96284 | ||
|
|
363f42e75b | ||
|
|
2232c31451 | ||
|
|
1c6e3c17fa | ||
|
|
4d0c34b544 | ||
|
|
93c2338d6c | ||
|
|
a455d62e9e | ||
|
|
aed42818b5 | ||
|
|
281aa93b4b | ||
|
|
3fee487c5d | ||
|
|
e50c636a34 | ||
|
|
1cbab1acd7 | ||
|
|
3bc8b55429 | ||
|
|
e6fc3c25d6 | ||
|
|
b965541b1c | ||
|
|
02fae9b11e | ||
|
|
1eda22a391 | ||
|
|
15c916ae66 | ||
|
|
03fb87e6ed | ||
|
|
bf67b4a4ec | ||
|
|
78d05fb1b9 | ||
|
|
0d47578441 | ||
|
|
07d75b7d00 | ||
|
|
cc88308513 | ||
|
|
bdf3d155f4 | ||
|
|
fe4531ad4c | ||
|
|
23f9331460 | ||
|
|
0d6875065c | ||
|
|
b56f712c71 | ||
|
|
7cc20771fe | ||
|
|
3efb042d18 | ||
|
|
fba8c52dfb | ||
|
|
aa10ea5c04 | ||
|
|
f457278342 | ||
|
|
a0c45d2b39 | ||
|
|
799e5be919 | ||
|
|
08c4541914 | ||
|
|
7b95f5f436 | ||
|
|
f0e57554f2 | ||
|
|
c8a5640ddc | ||
|
|
1a7a5661c4 | ||
|
|
94e83ad63a | ||
|
|
5d2008a6dd | ||
|
|
c315c8a42b | ||
|
|
aaa78d60db | ||
|
|
4b42b5ba7a | ||
|
|
6e04933eeb | ||
|
|
f47e7670a3 | ||
|
|
78575e4f6f | ||
|
|
b38ee92fe4 | ||
|
|
4ac72c6bbf | ||
|
|
c0e7eab3b2 | ||
|
|
5081969fdc | ||
|
|
df386a14f8 | ||
|
|
2b0ee55901 | ||
|
|
5b893d69b4 | ||
|
|
a50c867b7e | ||
|
|
ebcbd47f91 | ||
|
|
310ed6158a | ||
|
|
c64e8e773f | ||
|
|
56275063f7 | ||
|
|
d7401cfec4 | ||
|
|
0849467857 | ||
|
|
d83762ddec | ||
|
|
4640018e78 | ||
|
|
67ebe0718a | ||
|
|
b1bebbff50 | ||
|
|
26126d380b | ||
|
|
c6a2965faf | ||
|
|
77c713425a | ||
|
|
604120e2b8 | ||
|
|
d29d8be81a | ||
|
|
6a374c5af0 | ||
|
|
a14e21eb57 | ||
|
|
100a357fc1 | ||
|
|
75fcffc9c3 | ||
|
|
8d6d0c011b | ||
|
|
be8f6814c8 | ||
|
|
75766938be | ||
|
|
08b3ab45ba | ||
|
|
0539844d85 | ||
|
|
da7ac83c75 | ||
|
|
01f0c03f62 | ||
|
|
9ac1b0b6fa | ||
|
|
685d57db8b | ||
|
|
7de5551c24 | ||
|
|
36c52e5d7e | ||
|
|
9f6bfc6410 | ||
|
|
81498a6db4 | ||
|
|
a595b6cd8d |
@@ -42,6 +42,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BackgroundBeep.cs" />
|
||||
<Compile Include="Const.cs" />
|
||||
<Compile Include="DatabaseSettings.cs" />
|
||||
<Compile Include="DBSettings.cs" />
|
||||
<Compile Include="Enums.cs" />
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public static class Const
|
||||
{
|
||||
public const string MySqlConnectTimeoutSec = "120";
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace Common
|
||||
{
|
||||
public DBType DbType;
|
||||
public string ConnectionString;
|
||||
public bool IsValid { get { return (DbType != DBType.None) && !string.IsNullOrEmpty(ConnectionString); } }
|
||||
|
||||
public DBSettings()
|
||||
{
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace Common
|
||||
// Public fields
|
||||
public string BenchName;
|
||||
public bool IsRealBench;
|
||||
public DBSettings ProceduresDBSettings; /// Configuration database settings
|
||||
public DBSettings ProceduresDBSettings; /// Configuration database settings
|
||||
public DBSettings WaterMetersDBSettings; /// Results database settings
|
||||
public DBSettings EventsDBSettings; /// Events database settings
|
||||
public DBSettings UsersDBSettings; /// Shared configuration database settings
|
||||
public DBSettings EventsDBSettings; /// Events database settings
|
||||
public DBSettings UsersDBSettings; /// Shared configuration database settings
|
||||
|
||||
// Constructor
|
||||
public DatabaseSettings()
|
||||
|
||||
+27
-14
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -49,15 +49,6 @@ namespace Common
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary> Identifies the database based on the content </summary>
|
||||
public enum DBKind
|
||||
{
|
||||
Config,
|
||||
Results,
|
||||
RemoteConfig,
|
||||
Count
|
||||
}
|
||||
|
||||
public enum ProcedureSelection
|
||||
{
|
||||
#if LANG_CS
|
||||
@@ -103,6 +94,17 @@ namespace Common
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test designation mode for IperlLogger and IperlHead opto data files
|
||||
/// </summary>
|
||||
public enum DesigMode
|
||||
{
|
||||
Auto,
|
||||
Based_on_procedure,
|
||||
As_specified,
|
||||
Count
|
||||
}
|
||||
|
||||
public enum LoginMethod
|
||||
{
|
||||
UserName, /// = alias, abbreviation
|
||||
@@ -212,6 +214,14 @@ namespace Common
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum FlowNames
|
||||
{
|
||||
QnQtQmin = 0,
|
||||
Q3Q2Q1 = 1,
|
||||
QpQi = 2,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ProfileType
|
||||
{
|
||||
Q3R,
|
||||
@@ -293,11 +303,13 @@ namespace Common
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("STR")] S, /// standrohre
|
||||
[Description("F")] F, /// fall
|
||||
[Description("H/V")] HV, /// horizontal / vertical
|
||||
#else
|
||||
[Description("H")] H, /// horizontal
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("S")] S, /// steig
|
||||
[Description("F")] F, /// fall
|
||||
[Description("H")] H, /// horizontal
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("S")] S, /// steig
|
||||
[Description("F")] F, /// fall
|
||||
[Description("H/V")] HV, /// horizontal / vertical
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
@@ -329,6 +341,7 @@ namespace Common
|
||||
[Description("")] NotSpecified,
|
||||
[Description("U0")] U0, /// ?
|
||||
[Description("D0")] D0, /// ?
|
||||
///
|
||||
Count
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Common")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020-2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/// Copyright (c) 2021-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO.Ports;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
@@ -20,6 +21,18 @@ namespace Common
|
||||
return (format == "F0") ? value.ToString("F0") : value.ToString(format).TrimEnd(new char[] { '0' });
|
||||
}
|
||||
|
||||
public static FlowNames ProfileType2FlowNames(ProfileType pt)
|
||||
{
|
||||
switch (pt)
|
||||
{
|
||||
case ProfileType.Q3R: return FlowNames.Q3Q2Q1;
|
||||
case ProfileType.QnClassColdWater: return FlowNames.QnQtQmin;
|
||||
case ProfileType.QnClassHotWater: return FlowNames.QnQtQmin;
|
||||
case ProfileType.QpQi: return FlowNames.QpQi;
|
||||
default: return FlowNames.Q3Q2Q1;
|
||||
}
|
||||
}
|
||||
|
||||
public static string SignificantDigitsToFmt(double value, int sigDigits)
|
||||
{
|
||||
if (sigDigits == 6)
|
||||
@@ -92,5 +105,33 @@ namespace Common
|
||||
else return "F5";
|
||||
}
|
||||
}
|
||||
|
||||
public static Parity GetParity(string str, Parity defaultParity = Parity.None)
|
||||
{
|
||||
if (str.Equals(Parity.None.ToString())) return Parity.None;
|
||||
if (str.Equals(Parity.Even.ToString())) return Parity.Even;
|
||||
if (str.Equals(Parity.Odd.ToString())) return Parity.Odd;
|
||||
if (str.Equals(Parity.Mark.ToString())) return Parity.Mark;
|
||||
if (str.Equals(Parity.Space.ToString())) return Parity.Space;
|
||||
return defaultParity;
|
||||
}
|
||||
|
||||
public static StopBits GetStopBits(string str, StopBits defaultStopBits = StopBits.One)
|
||||
{
|
||||
if (str.Equals(StopBits.None.ToString())) return StopBits.None;
|
||||
if (str.Equals(StopBits.One.ToString())) return StopBits.One;
|
||||
if (str.Equals(StopBits.OnePointFive.ToString())) return StopBits.OnePointFive;
|
||||
if (str.Equals(StopBits.Two.ToString())) return StopBits.Two;
|
||||
return defaultStopBits;
|
||||
}
|
||||
|
||||
public static Handshake GetHandshake(string str, Handshake defaultHandshake = Handshake.None)
|
||||
{
|
||||
if (str.Equals(Handshake.None.ToString())) return Handshake.None;
|
||||
if (str.Equals(Handshake.RequestToSend.ToString())) return Handshake.RequestToSend;
|
||||
if (str.Equals(Handshake.XOnXOff.ToString())) return Handshake.XOnXOff;
|
||||
if (str.Equals(Handshake.RequestToSendXOnXOff.ToString())) return Handshake.RequestToSendXOnXOff;
|
||||
return defaultHandshake;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Config.CalendarEvent
|
||||
}
|
||||
|
||||
|
||||
public static bool IsCalendarEventTrigerred(ICalendarEvent evnt, DateTime currentDate)
|
||||
public static bool IsCalendarEventTrigerred(ICalendarEvent evnt, DateTime dateTimeNow)
|
||||
{
|
||||
DateTime evntDT = evnt.AllDay
|
||||
? new DateTime(evnt.Date.Year, evnt.Date.Month, evnt.Date.Day, 0, 0, 0)
|
||||
@@ -133,17 +133,17 @@ namespace Config.CalendarEvent
|
||||
DateTime dt1 = evntDT;
|
||||
DateTime dt2 = evntDT + new TimeSpan(8, 0, 0);
|
||||
DateTime dt3 = evntDT + new TimeSpan(16, 0, 0);
|
||||
return (currentDate >= dt1) || (currentDate >= dt1) || (currentDate >= dt3);
|
||||
return (dateTimeNow >= dt1) || (dateTimeNow >= dt1) || (dateTimeNow >= dt3);
|
||||
}
|
||||
else if (!evnt.TriggerOnExactDayOnly)
|
||||
{
|
||||
/// Trigger after event expires
|
||||
return (currentDate >= evntDT);
|
||||
return (dateTimeNow >= evntDT);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Trigger event on exact date only
|
||||
return (currentDate >= evntDT) && DayMatchesExactly(evnt, currentDate);
|
||||
return (dateTimeNow >= evntDT) && DayMatchesExactly(evnt, dateTimeNow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -30,7 +30,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 0;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 1;
|
||||
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50 || TURA_SPECIAL
|
||||
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
@@ -38,7 +38,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 3;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif RUM_MOB
|
||||
#elif RUM_MOB || TURA_SPECIAL
|
||||
public const int WMsCount = 8;
|
||||
public const int LineSize = 8;
|
||||
public const int CompoundWMsCount = 1;
|
||||
|
||||
@@ -46,8 +46,8 @@ namespace Config.Entities
|
||||
Rank = 2;
|
||||
Hidden = false;
|
||||
ReadOnly = false;
|
||||
BackColor = unchecked((int)0xFFFF5050);
|
||||
TextColor = unchecked((int)0xFFFFFFFF);
|
||||
BackColor = unchecked((int)0xFFFF5050); /// (MSB)AARRGGBB(LSB) ... pink
|
||||
TextColor = unchecked((int)0xFFFFFFFF); /// (MSB)AARRGGBB(LSB) ... white
|
||||
TooltipEnabled = true;
|
||||
CustomRecurringFunction = null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Globalization;
|
||||
@@ -27,6 +27,7 @@ namespace Config.Entities
|
||||
public virtual double PressLimHi { get; set; } /// [bar] max. water pressure
|
||||
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
|
||||
public virtual bool Evaluate { get; set; }
|
||||
public virtual string Method { get; set; } /// Test method (component name)
|
||||
|
||||
public virtual sbyte E1 { get; set; } ///
|
||||
public virtual sbyte E2 { get; set; } ///
|
||||
@@ -81,6 +82,7 @@ namespace Config.Entities
|
||||
PressLimHi = 16.0; /// [bar]
|
||||
Publish = (sbyte)Common.Publish.Always;
|
||||
Evaluate = true;
|
||||
Method = string.Empty;
|
||||
|
||||
E1 = (sbyte)ErrorFlagsMode.On;
|
||||
E2 = (sbyte)ErrorFlagsMode.On;
|
||||
@@ -140,6 +142,7 @@ namespace Config.Entities
|
||||
result.PressLimHi = PressLimHi;
|
||||
result.Publish = Publish;
|
||||
result.Evaluate = Evaluate;
|
||||
result.Method = Method;
|
||||
|
||||
result.E1 = E1;
|
||||
result.E2 = E2;
|
||||
@@ -193,6 +196,7 @@ namespace Config.Entities
|
||||
output.WriteLine(PressLimHi.ToString(ci));
|
||||
output.WriteLine(Publish.ToString());
|
||||
output.WriteLine(Evaluate.ToString());
|
||||
output.WriteLine(Method);
|
||||
|
||||
output.WriteLine(E1.ToString());
|
||||
output.WriteLine(E2.ToString());
|
||||
@@ -247,10 +251,29 @@ namespace Config.Entities
|
||||
tst.ErrLimHi = double.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimLo = double.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimHi = double.Parse(input.ReadLine(), ci);
|
||||
tst.Publish = sbyte.Parse(input.ReadLine());
|
||||
tst.PressLimLo = double.Parse(input.ReadLine(), ci);
|
||||
tst.PressLimHi = double.Parse(input.ReadLine(), ci);
|
||||
tst.Publish = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.Evaluate = bool.Parse(input.ReadLine());
|
||||
tst.Method = input.ReadLine();
|
||||
|
||||
/// TODO (E1 .. E21)
|
||||
tst.E1 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E2 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E3 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E4 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E5 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E6 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E7 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E8 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E9 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E10 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E11 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E12 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E13 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E14 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E15 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E16 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E21 = sbyte.Parse(input.ReadLine(), ci);
|
||||
|
||||
tst.Delta_Q_pct = double.Parse(input.ReadLine(), ci);
|
||||
tst.Delta_T = double.Parse(input.ReadLine(), ci);
|
||||
@@ -293,6 +316,7 @@ namespace Config.Entities
|
||||
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", PressLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Publish.ToString()) { diff.AppendFormat(fmt, "Publish", Publish.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Evaluate.ToString()) { diff.AppendFormat(fmt, "Evaluate", Evaluate.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Method) { diff.AppendFormat(fmt, "Method", Method, ln); };
|
||||
|
||||
ln = inp.ReadLine(); if (ln != E1.ToString()) { diff.AppendFormat(fmt, "E1", E1.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E2.ToString()) { diff.AppendFormat(fmt, "E2", E2.ToString(), ln); };
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Config.Entities
|
||||
public virtual int AltProcPeriod { get; set; } /// Period of alternative procedures (0 = no alt. procedure)
|
||||
|
||||
public virtual float DN { get; set; } /// Not mapped to DB, valid in ProceduresCtrl for procedure filtering only
|
||||
public virtual float Qn { get; set; } /// - ' ' -
|
||||
public virtual double Qn { get; set; } /// - ' ' -
|
||||
public virtual string MClass { get; set; } /// - ' ' -
|
||||
public virtual string Producer { get; set; } /// - ' ' -
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ namespace Config.Entities
|
||||
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(LastChgUser);
|
||||
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(((sbyte)ProfileType).ToString());
|
||||
output.WriteLine(((sbyte)ErrorLimitType).ToString());
|
||||
|
||||
foreach (var test in Tests) { test.Export(output); }
|
||||
output.WriteLine();
|
||||
@@ -96,7 +98,8 @@ namespace Config.Entities
|
||||
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.LastChgUser = input.ReadLine();
|
||||
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
string line = input.ReadLine();
|
||||
result.ProfileType = (ProfileType)sbyte.Parse(input.ReadLine());
|
||||
result.ErrorLimitType = (ErrorLimitType)sbyte.Parse(input.ReadLine());
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
+60
-15
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -22,11 +22,11 @@ namespace Config.Entities
|
||||
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]
|
||||
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
|
||||
public virtual float Volume { get; set; } /// Test volume (target) in [l]
|
||||
public virtual float TestTime { get; set; } /// Test time (estimate) in [s]
|
||||
public virtual double Qtg { get; set; } /// Target water flow [m3/h]
|
||||
public virtual double Qfrom { get; set; } /// Water flow low limit in [m3/h]
|
||||
public virtual double Qto { get; set; } /// Water flow high limit in [m3/h]
|
||||
public virtual double Volume { get; set; } /// Test volume (target) in [l]
|
||||
public virtual double TestTime { get; set; } /// Test time (estimate) in [s]
|
||||
public virtual string Method { get; set; }
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
|
||||
@@ -57,7 +57,14 @@ namespace Config.Entities
|
||||
public virtual string TransBefore { get; set; }
|
||||
public virtual string TransBetween { get; set; }
|
||||
public virtual string TransAfter { get; set; }
|
||||
|
||||
#if ORACLE_DB
|
||||
public virtual int OraId { get; set; }
|
||||
public virtual int OraIdRepetMulti { get; set; }
|
||||
public virtual string OraDesignation { get; set; }
|
||||
public virtual int RawDataId { get; set; }
|
||||
public virtual int RawDataIdRepetMulti { get; set; }
|
||||
public virtual string RawDataDesignation { get; set; }
|
||||
#endif
|
||||
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
|
||||
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
|
||||
|
||||
@@ -112,7 +119,15 @@ namespace Config.Entities
|
||||
TransBefore = string.Empty;
|
||||
TransBetween = string.Empty;
|
||||
TransAfter = string.Empty;
|
||||
}
|
||||
#if ORACLE_DB
|
||||
OraId = 0;
|
||||
OraIdRepetMulti = 0;
|
||||
OraDesignation = string.Empty;
|
||||
RawDataId = 0;
|
||||
RawDataIdRepetMulti = 0;
|
||||
RawDataDesignation = string.Empty;
|
||||
#endif
|
||||
}
|
||||
|
||||
public Test(string name, int itemNr, Procedure procedure)
|
||||
: this()
|
||||
@@ -192,6 +207,14 @@ namespace Config.Entities
|
||||
result.TransBefore = TransBefore;
|
||||
result.TransBetween = TransBetween;
|
||||
result.TransAfter = TransAfter;
|
||||
#if ORACLE_DB
|
||||
result.OraId = OraId;
|
||||
result.OraIdRepetMulti = OraIdRepetMulti;
|
||||
result.OraDesignation = OraDesignation;
|
||||
result.RawDataId = RawDataId;
|
||||
result.RawDataIdRepetMulti = RawDataIdRepetMulti;
|
||||
result.RawDataDesignation = RawDataDesignation;
|
||||
#endif
|
||||
result.VolumeUnit = VolumeUnit;
|
||||
result.FlowUnit = FlowUnit;
|
||||
result.MassUnit = MassUnit;
|
||||
@@ -242,7 +265,14 @@ namespace Config.Entities
|
||||
output.WriteLine(TransBetween);
|
||||
output.WriteLine(Profile);
|
||||
output.WriteLine(TransAfter);
|
||||
|
||||
#if ORACLE_DB
|
||||
output.WriteLine(OraId);
|
||||
output.WriteLine(OraIdRepetMulti);
|
||||
output.WriteLine(OraDesignation);
|
||||
output.WriteLine(RawDataId);
|
||||
output.WriteLine(RawDataIdRepetMulti);
|
||||
output.WriteLine(RawDataDesignation);
|
||||
#endif
|
||||
foreach (var prms in MoreParams) { prms.Export(output); }
|
||||
output.WriteLine();
|
||||
}
|
||||
@@ -262,11 +292,11 @@ namespace Config.Entities
|
||||
tst.Part = int.Parse(input.ReadLine(), ci);
|
||||
tst.Publish = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.DoEvaluate = bool.Parse(input.ReadLine());
|
||||
tst.Qtg = float.Parse(input.ReadLine(), ci);
|
||||
tst.Qfrom = float.Parse(input.ReadLine(), ci);
|
||||
tst.Qto = float.Parse(input.ReadLine(), ci);
|
||||
tst.Volume = float.Parse(input.ReadLine(), ci);
|
||||
tst.TestTime = float.Parse(input.ReadLine(), ci);
|
||||
tst.Qtg = double.Parse(input.ReadLine(), ci);
|
||||
tst.Qfrom = double.Parse(input.ReadLine(), ci);
|
||||
tst.Qto = double.Parse(input.ReadLine(), ci);
|
||||
tst.Volume = double.Parse(input.ReadLine(), ci);
|
||||
tst.TestTime = double.Parse(input.ReadLine(), ci);
|
||||
tst.Method = input.ReadLine();
|
||||
tst.ErrLimLo = float.Parse(input.ReadLine(), ci);
|
||||
tst.ErrLimHi = float.Parse(input.ReadLine(), ci);
|
||||
@@ -296,6 +326,14 @@ namespace Config.Entities
|
||||
: line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
|
||||
: line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
|
||||
tst.TransAfter = input.ReadLine();
|
||||
#if ORACLE_DB
|
||||
tst.OraId = int.Parse(input.ReadLine(), ci);
|
||||
tst.OraIdRepetMulti = int.Parse(input.ReadLine(), ci);
|
||||
tst.OraDesignation = input.ReadLine();
|
||||
tst.RawDataId = int.Parse(input.ReadLine(), ci);
|
||||
tst.RawDataIdRepetMulti = int.Parse(input.ReadLine(), ci);
|
||||
tst.RawDataDesignation = input.ReadLine();
|
||||
#endif
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -355,7 +393,14 @@ namespace Config.Entities
|
||||
ln = inp.ReadLine(); if (ln != TransBetween) { diff.AppendFormat(fmt, "RelTransBetween", TransBetween, ln); };
|
||||
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
|
||||
ln = inp.ReadLine(); if (ln != TransAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransAfter, ln); };
|
||||
|
||||
#if ORACLE_DB
|
||||
ln = inp.ReadLine(); if (ln != OraId.ToString(ci)) { diff.AppendFormat(fmt, "OraId", OraId.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != OraIdRepetMulti.ToString(ci)) { diff.AppendFormat(fmt, "OraIdRepetMulti", OraIdRepetMulti.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != OraDesignation) { diff.AppendFormat(fmt, "OraDesignation", OraDesignation, ln); };
|
||||
ln = inp.ReadLine(); if (ln != RawDataId.ToString(ci)) { diff.AppendFormat(fmt, "RawDataId", RawDataId.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != RawDataIdRepetMulti.ToString(ci)){ diff.AppendFormat(fmt, "RawDataIdRepetMulti", RawDataIdRepetMulti.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != RawDataDesignation) { diff.AppendFormat(fmt, "RawDataDesignation", RawDataDesignation, ln); };
|
||||
#endif
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,148 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using Config.Resources;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
public static class FluentCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <returns>A database session</returns>
|
||||
public static ISessionFactory CreateSessionFactory(Common.DBKind database, Common.DBType dbType, string connectionString, bool createDB)
|
||||
{
|
||||
try
|
||||
{
|
||||
FluentConfiguration cfg = Fluently.Configure();
|
||||
|
||||
switch (dbType)
|
||||
{
|
||||
default:
|
||||
case Common.DBType.MySql:
|
||||
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
|
||||
break;
|
||||
case Common.DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
|
||||
break;
|
||||
}
|
||||
|
||||
switch (database)
|
||||
{
|
||||
default:
|
||||
case Common.DBKind.Config:
|
||||
case Common.DBKind.RemoteConfig:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
case Common.DBKind.Results:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
}
|
||||
|
||||
if (createDB)
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchemaCreate).BuildSessionFactory();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(string.Format(Strings.Cannot_open_DB_Cause_0, exc.Message),
|
||||
Strings.Error,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void BuildSchemaDlgt(Configuration config);
|
||||
|
||||
static void BuildSchema(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration (with mapping info in)
|
||||
/// and exports a database schema from it
|
||||
new SchemaExport(config).SetOutputFile("db_schema");
|
||||
}
|
||||
|
||||
static void BuildSchemaCreate(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration (with mapping info in)
|
||||
/// and exports a database schema from it
|
||||
new SchemaExport(config).Create(true, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty users database.
|
||||
/// Database contains only the user 'admin' and the control board component 'CB'.
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyConfigDB(Common.DBType dbType, string connectionString)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Common.DBKind.Config, dbType, connectionString, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
using (var session = sessionFactory.OpenSession())
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
///
|
||||
/// Create user 'admin'
|
||||
///
|
||||
var admin = new Config.Entities.User
|
||||
{
|
||||
UserName = Data.AdminUsername,
|
||||
FullName = Strings.Administrator,
|
||||
LastPwChange = DateTime.Now
|
||||
};
|
||||
admin.SetPassword(Data.AdminPassword);
|
||||
|
||||
///
|
||||
/// Prepare all groups, add some of them to admin
|
||||
///
|
||||
for (Common.GID gid = 0; gid < Common.GID.NrOfGroups; gid++)
|
||||
{
|
||||
Config.Entities.Group group = new Config.Entities.Group(gid);
|
||||
switch (gid)
|
||||
{
|
||||
case Common.GID.Testers:
|
||||
case Common.GID.TestingSpecialists:
|
||||
case Common.GID.HeadOfLab:
|
||||
case Common.GID.MaintenanceSpecialists:
|
||||
case Common.GID.Metrologists:
|
||||
case Common.GID.CalibrationSpecialists:
|
||||
case Common.GID.Administrators:
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
case Common.GID.TraceabilityManagement:
|
||||
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_END
|
||||
case Common.GID.MetrologicalAuthority:
|
||||
case Common.GID.WaterMeterAuthority:
|
||||
#endif
|
||||
admin.AddGroup(group);
|
||||
session.SaveOrUpdate(group); /// Save this group
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
session.SaveOrUpdate(admin); /// Save user 'admin'
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -214,9 +214,9 @@ namespace Config
|
||||
/// </summary>
|
||||
public static double ErrorFromVolumes(double measuredVolume, double trueVolume)
|
||||
{
|
||||
if (trueVolume <= float.Epsilon)
|
||||
if (-float.Epsilon <= trueVolume && trueVolume <= float.Epsilon)
|
||||
{
|
||||
if (measuredVolume <= float.Epsilon)
|
||||
if (-float.Epsilon <= measuredVolume && measuredVolume <= float.Epsilon)
|
||||
{
|
||||
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, -100.0);
|
||||
return -100.0;
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Config.Mappings
|
||||
Map(x => x.PressLimHi);
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.Evaluate);
|
||||
Map(x => x.Method);
|
||||
Map(x => x.E1);
|
||||
Map(x => x.E2);
|
||||
Map(x => x.E3);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
@@ -62,6 +62,14 @@ namespace Config.Mappings
|
||||
.Column("RelTransBetween");
|
||||
Map(x => x.TransAfter)
|
||||
.Column("TransitionAfter");
|
||||
#if ORACLE_DB
|
||||
Map(x => x.OraId);
|
||||
Map(x => x.OraIdRepetMulti);
|
||||
Map(x => x.OraDesignation);
|
||||
Map(x => x.RawDataId);
|
||||
Map(x => x.RawDataIdRepetMulti);
|
||||
Map(x => x.RawDataDesignation);
|
||||
#endif
|
||||
|
||||
HasMany(x => x.MoreParams)
|
||||
.Cascade.All();
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("Config")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2018 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.26.1519.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1519.0")]
|
||||
[assembly: AssemblyVersion("2.31.1990.0")]
|
||||
[assembly: AssemblyFileVersion("2.31.1990.0")]
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using Common;
|
||||
using Events;
|
||||
|
||||
namespace EventViewer
|
||||
{
|
||||
public static class EViewerDB
|
||||
{
|
||||
/// <summary> Session factory for all regular sessions, not for CreateEmptyResultsDB(). </summary>
|
||||
public static ISessionFactory SessionFactory;
|
||||
|
||||
/// <summary> Connection string for all sessions </summary>
|
||||
static string connectionString;
|
||||
///
|
||||
public static string ConnectionString
|
||||
{
|
||||
get { return connectionString; }
|
||||
set
|
||||
{
|
||||
if (value != connectionString)
|
||||
{
|
||||
connectionString = value;
|
||||
SessionFactory = null; /// Clear SessionFactory on connection string change
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Database type (MySQL or SQLite) for all sessions </summary>
|
||||
private static DBType dbType;
|
||||
///
|
||||
public static DBType DbType
|
||||
{
|
||||
get { return dbType; }
|
||||
set { dbType = value; SessionFactory = null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <returns>A database session</returns>
|
||||
static ISessionFactory CreateSessionFactory()
|
||||
{
|
||||
return CreateSessionFactory(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <param name="createDB">true = Create a new DB, false = Regular DB</param>
|
||||
/// <returns>A database session</returns>
|
||||
public static ISessionFactory CreateSessionFactory(bool createDB)
|
||||
{
|
||||
FluentConfiguration cfg = Fluently.Configure();
|
||||
|
||||
switch (dbType)
|
||||
{
|
||||
default:
|
||||
case DBType.MySql:
|
||||
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
|
||||
break;
|
||||
case DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
|
||||
break;
|
||||
}
|
||||
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<global::Events.Entities.Event>());
|
||||
|
||||
if (createDB)
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchemaCreate)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchema)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
}
|
||||
|
||||
static void BuildSchema(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
|
||||
new SchemaExport(config).SetOutputFile("db_schema");
|
||||
}
|
||||
|
||||
static void BuildSchemaCreate(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
|
||||
new SchemaExport(config).Create(true, true);
|
||||
}
|
||||
|
||||
/// Create a NHibernate session for the given database
|
||||
public static ISession CreateSession()
|
||||
{
|
||||
if (string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
throw new Exception("Connection string was not specified");
|
||||
}
|
||||
|
||||
if (SessionFactory == null) SessionFactory = CreateSessionFactory();
|
||||
|
||||
return SessionFactory.OpenSession();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty users database.
|
||||
/// Database contains only the user 'admin' and the control board component 'CB'.
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyDB()
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
using (var session = sessionFactory.OpenSession())
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@
|
||||
<Compile Include="EventViewerWnd.Designer.cs">
|
||||
<DependentUpon>EventViewerWnd.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EViewerDB.cs" />
|
||||
<Compile Include="Forms\EventDetailsDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -102,9 +102,9 @@ namespace EventViewer
|
||||
{
|
||||
try
|
||||
{
|
||||
DB.DbType = DBType.MySql;
|
||||
DB.ConnectionString = Program.LocalSettings.ConnectionString;
|
||||
session = DB.CreateSession();
|
||||
EViewerDB.DbType = DBType.MySql;
|
||||
EViewerDB.ConnectionString = Program.LocalSettings.ConnectionString;
|
||||
session = EViewerDB.CreateSession();
|
||||
subscribers = session.QueryOver<Subscriber>().List();
|
||||
unreadEventsRadioButton.Checked = true;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ namespace EventViewer
|
||||
private void settingsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Common.GID[] groupsWithAccess = new Common.GID[] { Common.GID.Administrators };
|
||||
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg(true);
|
||||
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg();
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if ((new Forms.SettingsDlg()).ShowDialog() == DialogResult.OK)
|
||||
|
||||
+7
-155
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -15,156 +15,6 @@ namespace Events
|
||||
{
|
||||
public static class DB
|
||||
{
|
||||
/// <summary> Session factory for all regular sessions, not for CreateEmptyResultsDB(). </summary>
|
||||
public static ISessionFactory SessionFactory;
|
||||
|
||||
/// <summary> Connection string for all sessions </summary>
|
||||
static string connectionString;
|
||||
///
|
||||
public static string ConnectionString
|
||||
{
|
||||
get { return connectionString; }
|
||||
set
|
||||
{
|
||||
if (value != connectionString)
|
||||
{
|
||||
connectionString = value;
|
||||
SessionFactory = null; /// Clear SessionFactory on connection string change
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Database type (MySQL or SQLite) for all sessions </summary>
|
||||
private static DBType dbType;
|
||||
///
|
||||
public static DBType DbType
|
||||
{
|
||||
get { return dbType; }
|
||||
set { dbType = value; SessionFactory = null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <returns>A database session</returns>
|
||||
static ISessionFactory CreateSessionFactory()
|
||||
{
|
||||
return CreateSessionFactory(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <param name="createDB">true = Create a new DB, false = Regular DB</param>
|
||||
/// <returns>A database session</returns>
|
||||
public static ISessionFactory CreateSessionFactory(bool createDB)
|
||||
{
|
||||
FluentConfiguration cfg = Fluently.Configure();
|
||||
|
||||
switch (dbType)
|
||||
{
|
||||
default:
|
||||
case DBType.MySql:
|
||||
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
|
||||
break;
|
||||
case DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
|
||||
break;
|
||||
}
|
||||
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.Event>());
|
||||
|
||||
if (createDB)
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchemaCreate).BuildSessionFactory();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
|
||||
}
|
||||
}
|
||||
|
||||
static void BuildSchema(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
|
||||
new SchemaExport(config).SetOutputFile("db_schema");
|
||||
}
|
||||
|
||||
static void BuildSchemaCreate(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
|
||||
new SchemaExport(config).Create(true, true);
|
||||
}
|
||||
|
||||
/// Create a NHibernate session for the given database
|
||||
public static ISession CreateSession()
|
||||
{
|
||||
if (string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
throw new Exception("Connection string was not specified");
|
||||
}
|
||||
|
||||
if (SessionFactory == null) SessionFactory = CreateSessionFactory();
|
||||
|
||||
return SessionFactory.OpenSession();
|
||||
}
|
||||
|
||||
|
||||
public static void SaveObject(object obj)
|
||||
{
|
||||
SaveObject(CreateSession(), obj);
|
||||
}
|
||||
///
|
||||
public static void SaveObject(ISession session, object obj)
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
session.SaveOrUpdate(obj);
|
||||
try { transaction.Commit(); }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void DeleteObject(object obj)
|
||||
{
|
||||
DeleteObject(CreateSession(), obj);
|
||||
}
|
||||
///
|
||||
public static void DeleteObject(ISession session, object obj)
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
session.Delete(obj);
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty users database.
|
||||
/// Database contains only the user 'admin' and the control board component 'CB'.
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyDB()
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
using (var session = sessionFactory.OpenSession())
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shared data (initially empty)
|
||||
/// </summary>
|
||||
@@ -180,7 +30,7 @@ namespace Events
|
||||
DB.BenchName = benchName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Loads shared data from the database
|
||||
/// </summary>
|
||||
public static void LoadSubscribers(ISession session)
|
||||
@@ -193,6 +43,7 @@ namespace Events
|
||||
/// </summary>
|
||||
public static void LoadRecentEvents(ISession session, string benchName, int days)
|
||||
{
|
||||
BenchName = benchName;
|
||||
RecentEvents = session.QueryOver<Event>()
|
||||
.Where(e => (e.Bench == benchName))
|
||||
.And(e => (e.TimeStamp >= DateTime.Now - new TimeSpan(days, 0, 0, 0)))
|
||||
@@ -201,7 +52,8 @@ namespace Events
|
||||
|
||||
public static void SaveEvent(ISession session, Event evnt, SubscriberGroup groups)
|
||||
{
|
||||
if (allSubscribers == null) return;
|
||||
if (allSubscribers == null) LoadSubscribers(session);
|
||||
|
||||
IList<Subscriber> thisEventSubscribers = new List<Subscriber>();
|
||||
foreach (var s in allSubscribers)
|
||||
{
|
||||
@@ -211,10 +63,10 @@ namespace Events
|
||||
thisEventSubscribers.Add(s);
|
||||
}
|
||||
}
|
||||
evnt.Bench = BenchName;
|
||||
evnt.Subscribers = thisEventSubscribers;
|
||||
|
||||
evnt.Bench = BenchName;
|
||||
session.SaveOrUpdate(evnt);
|
||||
session.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ namespace Results
|
||||
foreach (var ti in procedure.GetTestInstances())
|
||||
{
|
||||
TestData td = TestData.UpdateList(d.TestDataList, new TestData(ti.Test));
|
||||
if (!d.Batch.Tests.Contains(td)) d.Batch.Tests.Add(td);
|
||||
|
||||
/// Create an empty test result and add it to the list
|
||||
TestRslt tr = new TestRslt(d.Batch, td, ti.Test.Part, ti.Repetition);
|
||||
@@ -173,7 +174,7 @@ namespace Results
|
||||
return Batch.GetTestRslt(name, part);
|
||||
}
|
||||
|
||||
public MeterTestRslt GetMeterTestRslt(string name, int wmNr0, CompoundMeterId meterId)
|
||||
public MeterTestRslt GetMeterTestRslt(string name, int wmNr0, CompoundMeterId meterId = CompoundMeterId.Single)
|
||||
{
|
||||
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0 && !Batch.WaterMeters[wmNr0].Disabled)
|
||||
{
|
||||
|
||||
+48
-16
@@ -78,11 +78,17 @@ namespace Results
|
||||
|
||||
if (createDB)
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchemaCreate).BuildSessionFactory();
|
||||
return cfg.ExposeConfiguration(BuildSchemaCreate)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Common.Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
|
||||
return cfg.ExposeConfiguration(BuildSchema)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Common.Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,29 +186,55 @@ namespace Results
|
||||
/// Loads shared data from the database
|
||||
/// </summary>
|
||||
/// <exception>Throws NHibernate exceptions</exception>
|
||||
public static void LoadSharedData()
|
||||
public static void LoadSharedData(ISession session = null)
|
||||
{
|
||||
ISession session = DB.CreateSession();
|
||||
bool openAndCloseSession = (session == null);
|
||||
|
||||
TestDataList = session.QueryOver<TestData>().List();
|
||||
ComponentsList = session.QueryOver<Components>().List();
|
||||
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
|
||||
}
|
||||
try
|
||||
{
|
||||
if (openAndCloseSession) session = Results.DB.CreateSession();
|
||||
TestDataList = session.QueryOver<TestData>().List();
|
||||
ComponentsList = session.QueryOver<Components>().List();
|
||||
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("Cannot open results DB: {0}", e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (openAndCloseSession && session != null && session.IsOpen) session.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads shared data from the database
|
||||
/// </summary>
|
||||
/// <exception>Throws NHibernate exceptions</exception>
|
||||
public static int GetMaxSavedBatchNr()
|
||||
public static int GetMaxSavedBatchNr(ISession session = null)
|
||||
{
|
||||
ISession session = DB.CreateSession();
|
||||
IList<Entities.Batch> batches = session.QueryOver<Batch>().List();
|
||||
bool openAndCloseSession = (session == null);
|
||||
int maxBatchNr = 0;
|
||||
|
||||
try
|
||||
{
|
||||
if (openAndCloseSession) session = Results.DB.CreateSession();
|
||||
IList<Entities.Batch> batches = session.QueryOver<Batch>().List();
|
||||
|
||||
foreach (var b in batches)
|
||||
{
|
||||
if (b.BatchNr > maxBatchNr) maxBatchNr = b.BatchNr;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("Cannot open results DB: {0}", e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (openAndCloseSession && session != null && session.IsOpen) session.Close();
|
||||
}
|
||||
|
||||
int maxBatchNr = 0;
|
||||
foreach (var b in batches)
|
||||
{
|
||||
if (b.BatchNr > maxBatchNr) maxBatchNr = b.BatchNr;
|
||||
}
|
||||
return maxBatchNr;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ namespace Results
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(connectionString))
|
||||
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.WaterMeterData>())
|
||||
.ExposeConfiguration(BuildSchema)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Common.Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -24,6 +24,8 @@ namespace Results.Entities
|
||||
public virtual int UserNumber { get; set; }
|
||||
public virtual string ProcedureName { get; set; }
|
||||
public virtual bool IsRemoteProcedure { get; set; } /// Stara Tura, not mapped to DB
|
||||
public virtual string PurchaseOrder { get; set; } /// Stara Tura, Nanjing, not mapped to DB
|
||||
public virtual string Workflow { get; set; } /// Stara Tura, Nanjing, not mapped to DB
|
||||
public virtual string ProcedureDescription { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual int ProcedureRevision { get; set; }
|
||||
public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB
|
||||
@@ -39,6 +41,7 @@ namespace Results.Entities
|
||||
public virtual int Counter10 { get; set; }
|
||||
public virtual DateTime StartTime { get; set; }
|
||||
public virtual DateTime EndTime { get; set; }
|
||||
public virtual DateTime SaveTime { get; set; }
|
||||
public virtual bool Dirty { get; set; }
|
||||
public virtual bool RsltsSent { get; set; }
|
||||
public virtual bool RsltsPrinted { get; set; }
|
||||
@@ -157,6 +160,7 @@ namespace Results.Entities
|
||||
Counter10 = oriBatch.Counter10;
|
||||
StartTime = oriBatch.StartTime;
|
||||
EndTime = oriBatch.EndTime;
|
||||
SaveTime = oriBatch.SaveTime;
|
||||
Dirty = oriBatch.Dirty;
|
||||
RsltsSent = oriBatch.RsltsSent;
|
||||
RsltsPrinted = oriBatch.RsltsPrinted;
|
||||
@@ -321,16 +325,19 @@ namespace Results.Entities
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Batch #{0}, Start:{1}, End:{2}, Procedure:{3}", BatchNr, StartTime, EndTime, ProcedureName);
|
||||
return string.Format("Batch {0} ({1}s) Start {2}, End {3}, Proc={4}",
|
||||
BatchNr, (EndTime - StartTime).TotalSeconds, StartTime, EndTime, ProcedureName);
|
||||
}
|
||||
|
||||
public virtual string ToString(int i)
|
||||
{
|
||||
return string.Format("Batch: BatchNr={0} ProgramVersion={1} TestBenchId={2} UserName={3} UserNumber={4} ProcedureName={5}{6} ProcRev={7} ProtocolTitle={8} Remark={9} RealDensity={10} AtTemperature={11} Buoyancy={12} StartTime={13} EndTime={14} Dirty={15} RsltsSent={16} RsltsPrinted={17}",
|
||||
BatchNr, ProgramVersion, TestBenchId, UserName, UserNumber,
|
||||
return string.Format("Batch {0} ({1}s) ver={2} TestBenchId={3} User={4}/{5} Proc={6}{7} Rev={8} Remark={9} RealDensity={10} AtTemperature={11} Buoyancy={12} StartTime={13} EndTime={14} SaveTime={15} RsltsSent={16} RsltsPrinted={17}",
|
||||
BatchNr,
|
||||
(EndTime - StartTime).TotalSeconds,
|
||||
ProgramVersion, TestBenchId, UserName, UserNumber,
|
||||
ProcedureName, (IsRemoteProcedure ? "(R)" : ""), ProcedureRevision,
|
||||
ProtocolTitle, Remark, RealDensity, AtTemperature, Buoyancy,
|
||||
StartTime, EndTime, Dirty, RsltsSent, RsltsPrinted);
|
||||
Remark, RealDensity, AtTemperature, Buoyancy,
|
||||
StartTime, EndTime, SaveTime, RsltsSent, RsltsPrinted);
|
||||
}
|
||||
|
||||
public virtual void WriteBinary(BinaryWriter writer)
|
||||
@@ -364,6 +371,7 @@ namespace Results.Entities
|
||||
writer.Write(Counter10);
|
||||
writer.Write(StartTime.ToString());
|
||||
writer.Write(EndTime.ToString());
|
||||
writer.Write(SaveTime.ToString());
|
||||
writer.Write(Dirty);
|
||||
writer.Write(RsltsSent);
|
||||
writer.Write(RsltsPrinted);
|
||||
@@ -431,6 +439,7 @@ namespace Results.Entities
|
||||
Counter10 = reader.ReadInt32();
|
||||
StartTime = DateTime.Parse(reader.ReadString());
|
||||
EndTime = DateTime.Parse(reader.ReadString());
|
||||
SaveTime = DateTime.Parse(reader.ReadString());
|
||||
Dirty = reader.ReadBoolean();
|
||||
RsltsSent = reader.ReadBoolean();
|
||||
RsltsPrinted = reader.ReadBoolean();
|
||||
|
||||
@@ -106,6 +106,13 @@ namespace Results.Entities
|
||||
public virtual bool IsDataStream() { return (RegReaderType == (int)RegisterReaderType.DataStream); }
|
||||
public virtual bool IsManual() { return (RegReaderType == (int)RegisterReaderType.Manual); }
|
||||
|
||||
public virtual string PassedOrErrorFlagsStr()
|
||||
{
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorIndicators);
|
||||
var str = string.IsNullOrEmpty(eFlags) ? PassedColorStr(null) : eFlags;
|
||||
return str;
|
||||
}
|
||||
|
||||
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
|
||||
{
|
||||
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Results.Entities
|
||||
@@ -31,7 +32,14 @@ namespace Results.Entities
|
||||
public virtual string TempControl { get; set; }
|
||||
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
|
||||
public virtual bool Evaluate { get; set; }
|
||||
|
||||
#if ORACLE_DB
|
||||
public virtual int OraId { get; set; }
|
||||
public virtual int OraIdRepetMulti { get; set; }
|
||||
public virtual string OraDesignation { get; set; }
|
||||
public virtual int RawDataId { get; set; }
|
||||
public virtual int RawDataIdRepetMulti { get; set; }
|
||||
public virtual string RawDataDesignation { get; set; }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor, safe values
|
||||
@@ -61,7 +69,15 @@ namespace Results.Entities
|
||||
TempControl = test.TempControl;
|
||||
Publish = test.Publish;
|
||||
Evaluate = test.DoEvaluate;
|
||||
}
|
||||
#if ORACLE_DB
|
||||
OraId = test.OraId;
|
||||
OraIdRepetMulti = test.OraIdRepetMulti;
|
||||
OraDesignation = test.OraDesignation;
|
||||
RawDataId = test.RawDataId;
|
||||
RawDataIdRepetMulti = test.RawDataIdRepetMulti;
|
||||
RawDataDesignation = test.RawDataDesignation;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor, copies all except of Id
|
||||
@@ -84,6 +100,14 @@ namespace Results.Entities
|
||||
TempControl = oriTestData.TempControl;
|
||||
Publish = oriTestData.Publish;
|
||||
Evaluate = oriTestData.Evaluate;
|
||||
#if ORACLE_DB
|
||||
OraId = oriTestData.OraId;
|
||||
OraIdRepetMulti = oriTestData.OraIdRepetMulti;
|
||||
OraDesignation = oriTestData.OraDesignation;
|
||||
RawDataId = oriTestData.RawDataId;
|
||||
RawDataIdRepetMulti = oriTestData.RawDataIdRepetMulti;
|
||||
RawDataDesignation = oriTestData.RawDataDesignation;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +134,14 @@ namespace Results.Entities
|
||||
if (TempControl != td.TempControl) return false;
|
||||
if (Publish != td.Publish) return false;
|
||||
if (Evaluate != td.Evaluate) return false;
|
||||
|
||||
#if ORACLE_DB
|
||||
if (OraId != td.OraId) return false;
|
||||
if (OraIdRepetMulti != td.OraIdRepetMulti) return false;
|
||||
if (OraDesignation != td.OraDesignation) return false;
|
||||
if (RawDataId != td.RawDataId) return false;
|
||||
if (RawDataIdRepetMulti != td.RawDataIdRepetMulti) return false;
|
||||
if (RawDataDesignation != td.RawDataDesignation) return false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -152,6 +183,14 @@ namespace Results.Entities
|
||||
writer.Write((TempControl != null) ? TempControl : string.Empty);
|
||||
writer.Write(Publish);
|
||||
writer.Write(Evaluate);
|
||||
#if ORACLE_DB
|
||||
writer.Write(OraId);
|
||||
writer.Write(OraIdRepetMulti);
|
||||
writer.Write((OraDesignation != null) ? OraDesignation : string.Empty);
|
||||
writer.Write(RawDataId);
|
||||
writer.Write(RawDataIdRepetMulti);
|
||||
writer.Write((RawDataDesignation != null) ? RawDataDesignation : string.Empty);
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual void ReadBinary(BinaryReader reader)
|
||||
@@ -173,6 +212,19 @@ namespace Results.Entities
|
||||
TempControl = reader.ReadString();
|
||||
Publish = reader.ReadSByte();
|
||||
Evaluate = reader.ReadBoolean();
|
||||
#if ORACLE_DB
|
||||
OraId = reader.ReadInt32();
|
||||
OraIdRepetMulti = reader.ReadInt32();
|
||||
OraDesignation = reader.ReadString();
|
||||
RawDataId = reader.ReadInt32();
|
||||
RawDataIdRepetMulti = reader.ReadInt32();
|
||||
RawDataDesignation = reader.ReadString();
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} (P.{1},{2})", Name, ((Publish)Publish).ToString(), Evaluate ? "E" : "-");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -147,7 +147,8 @@ namespace Results.Entities
|
||||
public virtual int Counter5 { get; set; }
|
||||
|
||||
/// Wrappers
|
||||
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
|
||||
public virtual string Name() { return Common.Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
|
||||
public virtual string Key() { return string.Format("{0}~{1}~{2}~{3}", TestData.Name, Part, TestData.Repeats, RepetitionNr); } /// Unique key
|
||||
public virtual int Repeats() { return TestData.Repeats; }
|
||||
public virtual double Qfrom() { return TestData.Qfrom; }
|
||||
public virtual double Qto() { return TestData.Qto; }
|
||||
@@ -164,6 +165,15 @@ namespace Results.Entities
|
||||
public virtual bool IsDiverter() { return (MethodClass != null) ? ((MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) || MethodClass.Contains("DiverterTest")) : true; }
|
||||
public virtual bool IsVolumeMethod() { return (MethodClass != null) ? (MethodClass.Contains("TestMethods.FixedStart.") || MethodClass.Contains("TestMethods.FlyingStart.")) : false; }
|
||||
|
||||
#if ORACLE_DB
|
||||
public virtual int OraId() { return TestData.OraId; }
|
||||
public virtual int OraIdRepetMulti() { return TestData.OraIdRepetMulti; }
|
||||
public virtual string OraDesignation() { return TestData.OraDesignation; }
|
||||
public virtual int RawDataId() { return TestData.RawDataId; }
|
||||
public virtual int RawDataIdRepetMulti() { return TestData.RawDataIdRepetMulti; }
|
||||
public virtual string RawDataDesignation() { return TestData.RawDataDesignation; }
|
||||
#endif
|
||||
|
||||
public virtual string MethodElde()
|
||||
{
|
||||
if (MethodClass == null) return string.Empty;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -97,8 +97,6 @@ namespace Results.Entities
|
||||
public virtual int WMTypeRevision { get; set; }
|
||||
public virtual int Pruefindex { get; set; } /// >=1 ... pruefindex, 0 ... unknown (no reading from DB yet)
|
||||
public virtual int HydrPruefung { get; set; }
|
||||
public virtual object RawTestInfos { get; set; } /// Not mapped to DB !!! IList<SensusTestInfo> fetched from Oracle at the beginning of the cycle, not mapped to DB !!!
|
||||
public virtual object CompleteTestInfos { get; set; } /// Not mapped to DB !!! SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!!
|
||||
#endif
|
||||
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
|
||||
public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session)
|
||||
@@ -111,15 +109,23 @@ namespace Results.Entities
|
||||
///
|
||||
/// Wrappers
|
||||
///
|
||||
public virtual string ProductName() { return WaterMeterData.ProductName; }
|
||||
public virtual string GetEndStateAux() { return Compound() ? EndStateAux : string.Empty; }
|
||||
public virtual void SetEndStateAux(string s) { if (Compound()) EndStateAux = s; }
|
||||
|
||||
public virtual string GetStartState() { return Compound() ? string.Empty : EndStateAux; }
|
||||
public virtual void SetStartState(string s) { if (!Compound()) EndStateAux = s; }
|
||||
|
||||
public virtual string ProductName() { return WaterMeterData.ProductName; }
|
||||
public virtual string Producer() { return WaterMeterData.Producer; }
|
||||
public virtual string MetrologicalClass() { return WaterMeterData.MetrologicalClass; }
|
||||
public virtual string ApprovalInfo() { return WaterMeterData.ApprovalInfo; }
|
||||
public virtual bool NewQnames() { return WaterMeterData.NewQnames; }
|
||||
public virtual FlowNames Qnames() { return (FlowNames)WaterMeterData.Qnames; }
|
||||
public virtual double Q4_Qmax() { return WaterMeterData.Q4_Qmax; }
|
||||
public virtual double Q3_Qn() { return WaterMeterData.Q3_Qn; }
|
||||
public virtual double Q2_Qt() { return WaterMeterData.Q2_Qt; }
|
||||
public virtual double Q1_Qmin() { return WaterMeterData.Q1_Qmin; }
|
||||
public virtual double ErrLimHiQ() { return WaterMeterData.ErrLimHiQ; }
|
||||
public virtual double ErrLimLoQ() { return WaterMeterData.ErrLimLoQ; }
|
||||
|
||||
public virtual bool Compound() { return WaterMeterData.Compound; }
|
||||
public virtual bool HeatMeter() { return WaterMeterData.HeatMeter; }
|
||||
@@ -128,8 +134,10 @@ namespace Results.Entities
|
||||
public virtual double Q3_Qn_Aux() { return WaterMeterData.Q3_Qn_Aux; }
|
||||
public virtual string MetrologicalClassAux() { return WaterMeterData.MetrologicalClassAux; }
|
||||
public virtual string ApprovalInfoAux() { return WaterMeterData.ApprovalInfoAux; }
|
||||
|
||||
public virtual int BatchNr() { return Batch.BatchNr; }
|
||||
#if ORACLE_DB
|
||||
public virtual int WMTypeId() { return WaterMeterData.WMTypeId; }
|
||||
#endif
|
||||
public virtual int BatchNr() { return Batch.BatchNr; }
|
||||
public virtual int BenchId() { return Batch.TestBenchId; }
|
||||
public virtual string ProcedureName() { return Batch.ProcedureName; }
|
||||
public virtual int ProcedureRevision() { return Batch.ProcedureRevision; }
|
||||
@@ -252,7 +260,9 @@ namespace Results.Entities
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if ORACLE_DB
|
||||
if (Utils.MaxTestIndex != 0 && (Pruefindex % 100) > Utils.MaxTestIndex) passed = false;
|
||||
#endif
|
||||
return passed;
|
||||
}
|
||||
|
||||
@@ -330,7 +340,7 @@ namespace Results.Entities
|
||||
return GetMeterTestRslt(testName, CompoundMeterId.SingleOrCompound);
|
||||
}
|
||||
|
||||
public virtual MeterTestRslt GetMeterTestRslt(string testName, CompoundMeterId meterId)
|
||||
public virtual MeterTestRslt GetMeterTestRslt(string testName, CompoundMeterId meterId = CompoundMeterId.Single)
|
||||
{
|
||||
if (string.IsNullOrEmpty(testName)) return null;
|
||||
if (Disabled) return null;
|
||||
@@ -446,8 +456,6 @@ namespace Results.Entities
|
||||
WMTypeRevision = 0;
|
||||
Pruefindex = 0;
|
||||
HydrPruefung = 0;
|
||||
RawTestInfos = null;
|
||||
CompleteTestInfos = null;
|
||||
#endif
|
||||
ProcessId = 0;
|
||||
SessionId = 0;
|
||||
@@ -510,8 +518,6 @@ namespace Results.Entities
|
||||
WMTypeRevision = src.WMTypeRevision;
|
||||
Pruefindex = src.Pruefindex;
|
||||
HydrPruefung = src.HydrPruefung;
|
||||
RawTestInfos = src.RawTestInfos; /// Not mapped to DB
|
||||
CompleteTestInfos = src.CompleteTestInfos; /// Not mapped to DB
|
||||
#endif
|
||||
ProcessId = src.ProcessId; /// Not mapped to DB
|
||||
SessionId = src.SessionId; /// Not mapped to DB
|
||||
@@ -692,22 +698,6 @@ namespace Results.Entities
|
||||
writer.Write(WMTypeRevision);
|
||||
writer.Write(Pruefindex);
|
||||
writer.Write(HydrPruefung);
|
||||
|
||||
/// Write RawTestInfos
|
||||
IList<Results.Output.SensusTestInfo> rawTestInfos = RawTestInfos as IList<Results.Output.SensusTestInfo>;
|
||||
writer.Write((rawTestInfos != null) ? rawTestInfos.Count : 0);
|
||||
if (rawTestInfos != null)
|
||||
{
|
||||
for (int i = 0; i < rawTestInfos.Count; i++) rawTestInfos[i].WriteBinary(writer);
|
||||
}
|
||||
|
||||
/// Write CompleteTestInfos
|
||||
Results.Output.SensusTestInfo[] completeTestInfos = CompleteTestInfos as Results.Output.SensusTestInfo[];
|
||||
writer.Write((completeTestInfos != null) ? completeTestInfos.Length : 0);
|
||||
if (completeTestInfos != null)
|
||||
{
|
||||
for (int i = 0; i < completeTestInfos.Length; i++) completeTestInfos[i].WriteBinary(writer);
|
||||
}
|
||||
#endif
|
||||
writer.Write(ProcessId);
|
||||
writer.Write(SessionId);
|
||||
@@ -788,28 +778,6 @@ namespace Results.Entities
|
||||
WMTypeRevision = reader.ReadInt32();
|
||||
Pruefindex = reader.ReadInt32();
|
||||
HydrPruefung = reader.ReadInt32();
|
||||
|
||||
/// Read RawTestInfos
|
||||
int rawTestInfosCount = reader.ReadInt32();
|
||||
IList<Results.Output.SensusTestInfo> rawTestInfos = new List<Results.Output.SensusTestInfo>();
|
||||
for (int i = 0; i < rawTestInfosCount; i++)
|
||||
{
|
||||
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
|
||||
ti.ReadBinary(reader);
|
||||
rawTestInfos.Add(ti);
|
||||
}
|
||||
RawTestInfos = rawTestInfos;
|
||||
|
||||
/// Read CompleteTestInfos
|
||||
int completeTestInfosLen = reader.ReadInt32();
|
||||
Results.Output.SensusTestInfo[] completeTestInfos = new Results.Output.SensusTestInfo[completeTestInfosLen];
|
||||
for (int i = 0; i < completeTestInfosLen; i++)
|
||||
{
|
||||
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
|
||||
ti.ReadBinary(reader);
|
||||
completeTestInfos[i] = ti;
|
||||
}
|
||||
CompleteTestInfos = completeTestInfos;
|
||||
#endif
|
||||
ProcessId = reader.ReadInt32();
|
||||
SessionId = reader.ReadInt32();
|
||||
|
||||
@@ -17,11 +17,14 @@ namespace Results.Entities
|
||||
public virtual double DN { get; set; } /// [mm]
|
||||
public virtual double L { get; set; } /// [mm]
|
||||
public virtual Mounting Mounting { get; set; } /// H / V / S / F
|
||||
public virtual bool NewQnames { get; set; } /// Yes = Q3... No = Qn...
|
||||
public virtual sbyte Qnames { get; set; } /// see Common.Enums.FlowNames
|
||||
public virtual double Q4_Qmax { get; set; } /// [m3/h]
|
||||
public virtual double Q3_Qn { get; set; } /// [m3/h]
|
||||
public virtual double Q2_Qt { get; set; } /// [m3/h]
|
||||
public virtual double Q1_Qmin { get; set; } /// [m3/h]
|
||||
public virtual double ErrLimHiQ { get; set; } /// [%]
|
||||
public virtual double ErrLimLoQ { get; set; } /// [%]
|
||||
|
||||
public virtual string MetrologicalClass { get; set; }
|
||||
public virtual TemperatureClass TemperatureClass { get; set; }
|
||||
public virtual PressureLossClass PressureLossClass { get; set; }
|
||||
@@ -66,11 +69,13 @@ namespace Results.Entities
|
||||
DN = oriWMData.DN;
|
||||
L = oriWMData.L;
|
||||
Mounting = oriWMData.Mounting;
|
||||
NewQnames = oriWMData.NewQnames;
|
||||
Qnames = oriWMData.Qnames;
|
||||
Q4_Qmax = oriWMData.Q4_Qmax;
|
||||
Q3_Qn = oriWMData.Q3_Qn;
|
||||
Q2_Qt = oriWMData.Q2_Qt;
|
||||
Q1_Qmin = oriWMData.Q1_Qmin;
|
||||
ErrLimHiQ = oriWMData.ErrLimHiQ;
|
||||
ErrLimLoQ = oriWMData.ErrLimLoQ;
|
||||
MetrologicalClass = oriWMData.MetrologicalClass;
|
||||
TemperatureClass = oriWMData.TemperatureClass;
|
||||
PressureLossClass = oriWMData.PressureLossClass;
|
||||
@@ -109,11 +114,13 @@ namespace Results.Entities
|
||||
if (DN != wmd.DN) return false;
|
||||
if (L != wmd.L) return false;
|
||||
if (Mounting != wmd.Mounting) return false;
|
||||
if (NewQnames != wmd.NewQnames) return false;
|
||||
if (Qnames != wmd.Qnames) return false;
|
||||
if (Q4_Qmax != wmd.Q4_Qmax) return false;
|
||||
if (Q3_Qn != wmd.Q3_Qn) return false;
|
||||
if (Q2_Qt != wmd.Q2_Qt) return false;
|
||||
if (Q1_Qmin != wmd.Q1_Qmin) return false;
|
||||
if (ErrLimHiQ != wmd.ErrLimHiQ) return false;
|
||||
if (ErrLimLoQ != wmd.ErrLimLoQ) return false;
|
||||
if (MetrologicalClass != wmd.MetrologicalClass) return false;
|
||||
if (TemperatureClass != wmd.TemperatureClass) return false;
|
||||
if (PressureLossClass != wmd.PressureLossClass) return false;
|
||||
@@ -167,11 +174,13 @@ namespace Results.Entities
|
||||
writer.Write(DN);
|
||||
writer.Write(L);
|
||||
writer.Write((int)Mounting);
|
||||
writer.Write(NewQnames);
|
||||
writer.Write((int)Qnames);
|
||||
writer.Write(Q4_Qmax);
|
||||
writer.Write(Q3_Qn);
|
||||
writer.Write(Q2_Qt);
|
||||
writer.Write(Q1_Qmin);
|
||||
writer.Write(ErrLimHiQ);
|
||||
writer.Write(ErrLimLoQ);
|
||||
writer.Write((MetrologicalClass != null) ? MetrologicalClass : string.Empty);
|
||||
writer.Write((int)TemperatureClass);
|
||||
writer.Write((int)PressureLossClass);
|
||||
@@ -205,11 +214,13 @@ namespace Results.Entities
|
||||
DN = reader.ReadDouble();
|
||||
L = reader.ReadDouble();
|
||||
Mounting = (Mounting)reader.ReadInt32();
|
||||
NewQnames = reader.ReadBoolean();
|
||||
Qnames = (sbyte)reader.ReadInt32();
|
||||
Q4_Qmax = reader.ReadDouble();
|
||||
Q3_Qn = reader.ReadDouble();
|
||||
Q2_Qt = reader.ReadDouble();
|
||||
Q1_Qmin = reader.ReadDouble();
|
||||
ErrLimHiQ = reader.ReadDouble();
|
||||
ErrLimLoQ = reader.ReadDouble();
|
||||
MetrologicalClass = reader.ReadString();
|
||||
TemperatureClass = (TemperatureClass)reader.ReadInt32();
|
||||
PressureLossClass = (PressureLossClass)reader.ReadInt32();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,6 +14,13 @@ namespace Results.Forms
|
||||
{
|
||||
public partial class MoreWMResultsDlg : Form
|
||||
{
|
||||
enum Tabs
|
||||
{
|
||||
Results = 0,
|
||||
Graph,
|
||||
Tracing,
|
||||
}
|
||||
|
||||
public MoreWMResultsDlg(Results.Entities.WaterMeter wm, IList<ReferenceRecord> refRecords)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -23,14 +30,15 @@ namespace Results.Forms
|
||||
ShowAllResults(wm);
|
||||
ShowChart(wm);
|
||||
|
||||
/// Select the initial tab page to be displayed
|
||||
if (refRecords == null)
|
||||
{
|
||||
tabControl1.SelectTab(1);
|
||||
tabControl1.TabPages.RemoveAt(2);
|
||||
tabControl1.SelectTab((int)Tabs.Graph);
|
||||
tabControl1.TabPages.RemoveAt((int)Tabs.Tracing);
|
||||
}
|
||||
else
|
||||
{
|
||||
tabControl1.SelectTab(2);
|
||||
tabControl1.SelectTab((int)Tabs.Tracing);
|
||||
ShowTracingResults(wm, refRecords);
|
||||
}
|
||||
}
|
||||
@@ -39,9 +47,9 @@ namespace Results.Forms
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Water_meter_results;
|
||||
tabControl1.TabPages[0].Text = Strings.All_results;
|
||||
tabControl1.TabPages[1].Text = Strings.Graphs;
|
||||
tabControl1.TabPages[2].Text = Strings.Production_tracing_results;
|
||||
tabControl1.TabPages[(int)Tabs.Results].Text = Strings.All_results;
|
||||
tabControl1.TabPages[(int)Tabs.Graph].Text = Strings.Graphs;
|
||||
tabControl1.TabPages[(int)Tabs.Tracing].Text = Strings.Production_tracing_results;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,11 +115,7 @@ namespace Results.Forms
|
||||
|
||||
void ShowChart(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
//chart.ChartAreas[0].AxisX.LabelStyle.Format = "dd.MM.yy";
|
||||
//chart.ChartAreas[0].AxisX.Interval = 1;
|
||||
//chart.ChartAreas[0].AxisX.IntervalType = ;
|
||||
|
||||
tabControl1.TabPages[1].Controls.Add(Results.Output.WMChart.GetChart(wm, false));
|
||||
tabControl1.TabPages[(int)Tabs.Graph].Controls.Add(Results.Output.WMChart.GetChart(wm, false));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -79,18 +79,18 @@ namespace Results.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
/// Update background color and caption
|
||||
string message = string.Empty;
|
||||
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
bool maxRepeatsExceeded = (Utils.MaxTestIndex != 0 && (wMtr.Pruefindex % 100) > Utils.MaxTestIndex);
|
||||
UpdateBkColor(wMtr.GetColorOfResults(maxRepeatsExceeded, out message));
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2} {3}",
|
||||
wMtr.WMPosition,
|
||||
wMtr.Pruefindex == 0 ? "?" : string.Format("{0}x", wMtr.Pruefindex % 100),
|
||||
(string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr),
|
||||
message);
|
||||
#else
|
||||
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -91,21 +91,21 @@ namespace Results.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
/// Update background color and caption
|
||||
string message = string.Empty;
|
||||
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
bool maxRepeatsExceeded = (Utils.MaxTestIndex != 0 && (wMtr.Pruefindex % 100) > Utils.MaxTestIndex);
|
||||
UpdateBkColor(wMtr.GetColorOfResults(maxRepeatsExceeded, out message));
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2} {3}",
|
||||
wMtr.WMPosition,
|
||||
wMtr.Pruefindex == 0 ? "?" : string.Format("{0}x", wMtr.Pruefindex % 100),
|
||||
(string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr),
|
||||
message);
|
||||
#else
|
||||
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
|
||||
UpdateWMPos(wMtr.WMPosition);
|
||||
|
||||
/// Update test results
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -35,6 +35,7 @@ namespace Results.Mappings
|
||||
|
||||
Map(x => x.StartTime);
|
||||
Map(x => x.EndTime);
|
||||
Map(x => x.SaveTime);
|
||||
Map(x => x.Dirty);
|
||||
Map(x => x.RsltsSent);
|
||||
Map(x => x.RsltsPrinted);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -24,6 +24,14 @@ namespace Results.Mappings
|
||||
Map(x => x.ErrLimMargin).Column("Uncertainty");
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.Evaluate);
|
||||
}
|
||||
#if ORACLE_DB
|
||||
Map(x => x.OraId);
|
||||
Map(x => x.OraIdRepetMulti);
|
||||
Map(x => x.OraDesignation);
|
||||
Map(x => x.RawDataId);
|
||||
Map(x => x.RawDataIdRepetMulti);
|
||||
Map(x => x.RawDataDesignation);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace Results.Mappings
|
||||
Map(x => x.L);
|
||||
Map(x => x.Mounting);
|
||||
|
||||
#if MUNICH && LANG_DE
|
||||
Map(x => x.NewQnames);
|
||||
#endif
|
||||
Map(x => x.Qnames);
|
||||
Map(x => x.Q4_Qmax);
|
||||
Map(x => x.Q3_Qn);
|
||||
Map(x => x.Q2_Qt);
|
||||
Map(x => x.Q1_Qmin);
|
||||
Map(x => x.ErrLimHiQ);
|
||||
Map(x => x.ErrLimLoQ);
|
||||
|
||||
Map(x => x.MetrologicalClass);
|
||||
Map(x => x.TemperatureClass);
|
||||
|
||||
@@ -526,11 +526,11 @@ namespace Results.Output.Printers.Munich
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, wm.NewQnames() ? "Q3 :" : "Qn :");
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, (wm.Qnames() == FlowNames.Q3Q2Q1) ? "Q3 :" : (wm.Qnames() == FlowNames.QpQi) ? "qp :" : "Qn :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Q3_Qn().ToString());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, wm.NewQnames() ? "Q3 :" : "Qn :");
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, (wm.Qnames() == FlowNames.Q3Q2Q1) ? "Q3 :" : (wm.Qnames() == FlowNames.QpQi) ? "qp :" : "Qn :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.Q3_Qn_Aux().ToString());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
+108
-15
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2022 Sensus Metering Systems
|
||||
/// Copyright (c) 2019-2023 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -55,6 +55,9 @@ namespace Results.Output
|
||||
chArea.AxisX.LogarithmBase = 10;
|
||||
chArea.AxisX.IsLabelAutoFit = true;
|
||||
|
||||
Series upperLimit = new Series { Name = Strings.Upper_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red };
|
||||
Series lowerLimit = new Series { Name = Strings.Lower_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red };
|
||||
|
||||
List<double> xs = new List<double>() { 0.0001, 0.0002, 0.0005,
|
||||
0.001, 0.002, 0.005,
|
||||
0.01, 0.02, 0.05,
|
||||
@@ -71,6 +74,8 @@ namespace Results.Output
|
||||
double from = Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin);
|
||||
double to = Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn);
|
||||
bool inRange = false;
|
||||
double qSharp = (wm.WaterMeterData.Qnames == (sbyte)FlowNames.QpQi) ? GetQsharp(wm, flowUnit) : 0;
|
||||
double lastXs = 0;
|
||||
for (int i = 0; i < xs.Count - 3; i += 3)
|
||||
{
|
||||
if (xs[i] <= from && from < xs[i + 3])
|
||||
@@ -88,6 +93,37 @@ namespace Results.Output
|
||||
cl.FromPosition = Math.Log10(xs[j] * spacer);
|
||||
cl.ToPosition = Math.Log10(xs[j] / spacer);
|
||||
chArea.AxisX.CustomLabels.Add(cl);
|
||||
|
||||
if (wm.WaterMeterData.Qnames == (sbyte)FlowNames.QpQi)
|
||||
{
|
||||
if (lastXs != 0)
|
||||
{
|
||||
double insertedXs = Math.Sqrt(lastXs * xs[j]);
|
||||
|
||||
if (lastXs < qSharp && qSharp < insertedXs)
|
||||
{
|
||||
double errLim3 = GetErrorLimit(wm, flowUnit, qSharp);
|
||||
lowerLimit.Points.AddXY(qSharp, -errLim3);
|
||||
upperLimit.Points.AddXY(qSharp, +errLim3);
|
||||
}
|
||||
|
||||
double errLim2 = GetErrorLimit(wm, flowUnit, insertedXs);
|
||||
lowerLimit.Points.AddXY(insertedXs, -errLim2);
|
||||
upperLimit.Points.AddXY(insertedXs, +errLim2);
|
||||
|
||||
if (insertedXs < qSharp && qSharp < xs[j])
|
||||
{
|
||||
double errLim3 = GetErrorLimit(wm, flowUnit, qSharp);
|
||||
lowerLimit.Points.AddXY(qSharp, -errLim3);
|
||||
upperLimit.Points.AddXY(qSharp, +errLim3);
|
||||
}
|
||||
}
|
||||
lastXs = xs[j];
|
||||
|
||||
double errLim = GetErrorLimit(wm, flowUnit, xs[j]);
|
||||
lowerLimit.Points.AddXY(xs[j], -errLim);
|
||||
upperLimit.Points.AddXY(xs[j], +errLim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +137,36 @@ namespace Results.Output
|
||||
cl.ToPosition = Math.Log10(xs[i + 3] / spacer);
|
||||
chArea.AxisX.CustomLabels.Add(cl);
|
||||
|
||||
if (wm.WaterMeterData.Qnames == (sbyte)FlowNames.QpQi)
|
||||
{
|
||||
if (lastXs != 0)
|
||||
{
|
||||
double insertedXs = Math.Sqrt(lastXs * xs[i + 3]);
|
||||
|
||||
if (lastXs < qSharp && qSharp < insertedXs)
|
||||
{
|
||||
double errLim3 = GetErrorLimit(wm, flowUnit, qSharp);
|
||||
lowerLimit.Points.AddXY(qSharp, -errLim3);
|
||||
upperLimit.Points.AddXY(qSharp, +errLim3);
|
||||
}
|
||||
|
||||
double errLim2 = GetErrorLimit(wm, flowUnit, insertedXs);
|
||||
lowerLimit.Points.AddXY(insertedXs, -errLim2);
|
||||
upperLimit.Points.AddXY(insertedXs, +errLim2);
|
||||
|
||||
if (insertedXs < qSharp && qSharp < xs[i + 3])
|
||||
{
|
||||
double errLim3 = GetErrorLimit(wm, flowUnit, qSharp);
|
||||
lowerLimit.Points.AddXY(qSharp, -errLim3);
|
||||
upperLimit.Points.AddXY(qSharp, +errLim3);
|
||||
}
|
||||
}
|
||||
|
||||
double errLim = GetErrorLimit(wm, flowUnit, xs[i + 3]);
|
||||
lowerLimit.Points.AddXY(xs[i + 3], -errLim);
|
||||
upperLimit.Points.AddXY(xs[i + 3], +errLim);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -111,19 +177,20 @@ namespace Results.Output
|
||||
|
||||
Legend legend1 = new Legend { Name = "Legend1" };
|
||||
|
||||
Series upperLimit = new Series { Name = Strings.Upper_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red };
|
||||
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), 5);
|
||||
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 5);
|
||||
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 2);
|
||||
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), 2);
|
||||
if (isQ4) upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), 2);
|
||||
if (wm.WaterMeterData.Qnames == (sbyte)FlowNames.Q3Q2Q1 || wm.WaterMeterData.Qnames == (sbyte)FlowNames.QnQtQmin)
|
||||
{
|
||||
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), wm.WaterMeterData.ErrLimLoQ);
|
||||
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), wm.WaterMeterData.ErrLimLoQ);
|
||||
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), wm.WaterMeterData.ErrLimHiQ);
|
||||
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), wm.WaterMeterData.ErrLimHiQ);
|
||||
if (isQ4) upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), wm.WaterMeterData.ErrLimHiQ);
|
||||
|
||||
Series lowerLimit = new Series { Name = Strings.Lower_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red };
|
||||
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), -5);
|
||||
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -5);
|
||||
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -2);
|
||||
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), -2);
|
||||
if (isQ4) lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), -2);
|
||||
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), -wm.WaterMeterData.ErrLimLoQ);
|
||||
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -wm.WaterMeterData.ErrLimLoQ);
|
||||
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -wm.WaterMeterData.ErrLimHiQ);
|
||||
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), -wm.WaterMeterData.ErrLimHiQ);
|
||||
if (isQ4) lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), -wm.WaterMeterData.ErrLimHiQ);
|
||||
}
|
||||
|
||||
Series line = new Series { Name = Strings.Relative_error, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.DeepSkyBlue };
|
||||
Series dots = new Series { Name = Strings.Relative_error + " ", ChartArea = "ChartArea1", ChartType = SeriesChartType.Point, Color = Color.RoyalBlue };
|
||||
@@ -137,12 +204,38 @@ namespace Results.Output
|
||||
|
||||
chart.ChartAreas.Add(chArea);
|
||||
chart.Legends.Add(legend1);
|
||||
chart.Series.Add(upperLimit);
|
||||
chart.Series.Add(lowerLimit);
|
||||
if (upperLimit.Points.Count > 1) chart.Series.Add(upperLimit);
|
||||
if (lowerLimit.Points.Count > 1) chart.Series.Add(lowerLimit);
|
||||
chart.Series.Add(dots);
|
||||
chart.Series.Add(line);
|
||||
|
||||
return chart;
|
||||
}
|
||||
|
||||
static double GetErrorLimit(WaterMeter wm, Unit flowUnit, double x)
|
||||
{
|
||||
double flow_m3 = Units.ConvertFrom(flowUnit, x);
|
||||
switch (Convert.ToInt32(wm.WaterMeterData.Q2_Qt))
|
||||
{
|
||||
default:
|
||||
case 1: return Math.Min(3.5, 1.0 + 0.01 * wm.WaterMeterData.Q3_Qn / flow_m3);
|
||||
case 2: return Math.Min(5.0, 2.0 + 0.02 * wm.WaterMeterData.Q3_Qn / flow_m3);
|
||||
case 3: return Math.Min(5.0, 3.0 + 0.05 * wm.WaterMeterData.Q3_Qn / flow_m3);
|
||||
}
|
||||
}
|
||||
|
||||
static double GetQsharp(WaterMeter wm, Unit flowUnit)
|
||||
{
|
||||
double qSharp;
|
||||
switch (Convert.ToInt32(wm.WaterMeterData.Q2_Qt))
|
||||
{
|
||||
default:
|
||||
case 1: qSharp = (0.01 / 2.5) * wm.WaterMeterData.Q3_Qn; break;
|
||||
case 2: qSharp = (0.02 / 3.0) * wm.WaterMeterData.Q3_Qn; break;
|
||||
case 3: qSharp = (0.05 / 2.0) * wm.WaterMeterData.Q3_Qn; break;
|
||||
}
|
||||
return Units.ConvertTo(flowUnit, qSharp);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("Results")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2019 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.27.1844.0")]
|
||||
[assembly: AssemblyFileVersion("2.27.1844.0")]
|
||||
[assembly: AssemblyVersion("2.31.1990.0")]
|
||||
[assembly: AssemblyFileVersion("2.31.1990.0")]
|
||||
|
||||
+2
-11
@@ -19,7 +19,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -29,7 +29,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
@@ -75,12 +75,6 @@
|
||||
<Compile Include="Entities\WaterMeterData.cs" />
|
||||
<Compile Include="Entities\WaterMeter.cs" />
|
||||
<Compile Include="DB.cs" />
|
||||
<Compile Include="Forms\BatchResultsDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\BatchResultsDlg.Designer.cs">
|
||||
<DependentUpon>BatchResultsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\IOneWMResultsCtrl.cs" />
|
||||
<Compile Include="Forms\ManualEntryConfigCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
@@ -213,9 +207,6 @@
|
||||
<Folder Include="Output\FileWriters\OneFilePerMeter\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Forms\BatchResultsDlg.resx">
|
||||
<DependentUpon>BatchResultsDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ManualEntryConfigCtrl.resx">
|
||||
<DependentUpon>ManualEntryConfigCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
+3
-6
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Text;
|
||||
@@ -9,12 +9,9 @@ namespace Results
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static string GetTestName(string name, int repeats, int repetitionNr)
|
||||
{
|
||||
return Common.Utils.GetTestName(name, repeats, repetitionNr);
|
||||
}
|
||||
public static int MaxTestIndex = 0;
|
||||
|
||||
|
||||
|
||||
public static int BenchIdOracle2Asc(int benchIdOracle)
|
||||
{
|
||||
switch (benchIdOracle)
|
||||
|
||||
@@ -331,11 +331,12 @@ namespace Results
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enumerated, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter, "Diverter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Diverter()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RegValve, "Reg. valve", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RegValve()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter, "Diverter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Diverter()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RegValve, "Reg. valve", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RegValve()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult,(w, t, u, f, p) => (w.GetMeterTestRslt(t) != null) ? FormatStr(f, w.GetMeterTestRslt(t).PassedOrErrorFlagsStr())
|
||||
: FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
|
||||
|
||||
///
|
||||
/// Water meter info
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("ResultsBrowser")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015 - 2020 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015 - 2022 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.26.1577.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1577.0")]
|
||||
[assembly: AssemblyVersion("2.31.1990.0")]
|
||||
[assembly: AssemblyFileVersion("2.31.1990.0")]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -32,7 +32,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace ResultsParser
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(connStr))
|
||||
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<WaterMeterData>())
|
||||
.ExposeConfiguration(BuildSchema)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Common.Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory()
|
||||
.OpenSession();
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace Statistics
|
||||
"SERVER=localhost; DATABASE=genesis-r; UID=root; PASSWORD=; CHARSET=utf8;",
|
||||
};
|
||||
#else
|
||||
BenchNames = new string[] { "WR10", "WR11", "WR13", "WR14", "WR15", "WR18", "WR19", "WR20", "WR21", "PT7" };
|
||||
BenchNames = new string[] { "WR10", "WR11", "WR13", "WR14", "WR15", "WR18", "WR19", "PT7" };
|
||||
MidNames = new string[] { string.Empty, "I1", "I2", "I3", "I4" }; /// Index is MID-id
|
||||
#if true
|
||||
/// Production Stara Tura
|
||||
@@ -247,16 +247,14 @@ namespace Statistics
|
||||
|
||||
ConnectionStrings = new string[]
|
||||
{
|
||||
"SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.129.242; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.61; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.0; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.146; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.70; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.156; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.131; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.89; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
};
|
||||
#else
|
||||
/// Off-line demo
|
||||
|
||||
@@ -133,6 +133,10 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Common.csproj">
|
||||
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Results\Results.csproj">
|
||||
<Project>{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}</Project>
|
||||
<Name>Results</Name>
|
||||
|
||||
@@ -13,6 +13,7 @@ using NHibernate;
|
||||
using FluentNHibernate;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using Common;
|
||||
using Results;
|
||||
using Results.Entities;
|
||||
using Statistics.Resources;
|
||||
@@ -98,6 +99,8 @@ namespace Statistics
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(connStr))
|
||||
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Results.Entities.Batch>())
|
||||
.ExposeConfiguration(BuildSchema)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33424.131
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TBF", "TBF\TBF.csproj", "{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C8939821-BA5C-4988-A3D0-BF53B74865C7} = {C8939821-BA5C-4988-A3D0-BF53B74865C7}
|
||||
@@ -8,11 +10,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TBF", "TBF\TBF.csproj", "{8
|
||||
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA} = {0C0A1F4D-1363-4544-A7C5-196C76D26CCA}
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE} = {46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}
|
||||
{5D9B49E3-CDF9-4A27-80B4-58141D0EB0E0} = {5D9B49E3-CDF9-4A27-80B4-58141D0EB0E0}
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B} = {6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Results", "Results\Results.csproj", "{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B} = {6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Config", "Config\Config.csproj", "{743DF7DB-C7B6-42EB-986D-0F485E5588E4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B} = {6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsBrowser", "ResultsBrowser\ResultsBrowser.csproj", "{07BA543A-54CA-4A59-9AD9-DDE7038E1BF9}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@@ -85,6 +94,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FeatureVectorCalculator", "
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsParser", "ResultsParser\ResultsParser.csproj", "{2E08C19B-C0A9-4056-8564-E5B74477959D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sensus.iPerl.RfidCom", "..\iPerlHead\Sensus.iPerl.RfidCom\Sensus.iPerl.RfidCom.csproj", "{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -379,8 +390,23 @@ Global
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A7C8EF35-DF72-4DFC-83F7-9641AC1178CF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using Common;
|
||||
using Config;
|
||||
using Users.Entities;
|
||||
using Events;
|
||||
using TBF.Resources;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF
|
||||
{
|
||||
@@ -16,52 +22,196 @@ namespace TBF
|
||||
///
|
||||
public static DatabaseSettings CurrentBench;
|
||||
|
||||
/// <summary>
|
||||
/// Session factories for regular sessions.
|
||||
/// </summary>
|
||||
public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)DBKind.Count];
|
||||
public static ISessionFactory ConfigDBSessionFactory = null; /// Configuration DB session factory (always != null)
|
||||
public static ISessionFactory SharedDBSessionFactory = null; /// Shared configuration DB session factory or null
|
||||
public static ISessionFactory ResultsDBSessionFactory = null; /// Results DB session factory (always != null)
|
||||
public static ISessionFactory EventsDBSessionFactory = null; /// Events DB session factory or null
|
||||
|
||||
/// Create a NHibernate session for the given database
|
||||
public static ISession CreateSession(DBKind database)
|
||||
public static ISessionFactory LocalUsersDBSessionFactory = null; /// Local users DB session factory (always != null)
|
||||
public static ISessionFactory SharedUsersDBSessionFactory = null; /// Shared users DB session factory or null
|
||||
|
||||
public static ISessionFactory[] UserSessionFactories
|
||||
{
|
||||
if (database < 0 || database >= DBKind.Count) return null;
|
||||
|
||||
int ix = (int)database;
|
||||
if (SessionFactories[ix] == null)
|
||||
get
|
||||
{
|
||||
SessionFactories[ix] = CreateSessionFactory(database);
|
||||
return (SharedUsersDBSessionFactory != null)
|
||||
? new ISessionFactory[] { SharedUsersDBSessionFactory, LocalUsersDBSessionFactory }
|
||||
: new ISessionFactory[] { LocalUsersDBSessionFactory };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create all database session factories
|
||||
/// </summary>
|
||||
public static void CreateSessionFactories(DatabaseSettings dbSettings)
|
||||
{
|
||||
/// Configuration database (local, always non-null)
|
||||
if (dbSettings.ProceduresDBSettings != null && dbSettings.ProceduresDBSettings.IsValid)
|
||||
{
|
||||
ConfigDBSessionFactory =
|
||||
CreateSessionFactory(m => m.FluentMappings.AddFromAssemblyOf<Config.Entities.Procedure>(),
|
||||
dbSettings.ProceduresDBSettings.DbType,
|
||||
dbSettings.ProceduresDBSettings.ConnectionString);
|
||||
|
||||
LocalUsersDBSessionFactory =
|
||||
CreateSessionFactory(m => m.FluentMappings.AddFromAssemblyOf<Users.Entities.User>(),
|
||||
dbSettings.ProceduresDBSettings.DbType,
|
||||
dbSettings.ProceduresDBSettings.ConnectionString);
|
||||
}
|
||||
|
||||
return SessionFactories[ix].OpenSession();
|
||||
/// Shared configuration database (remote)
|
||||
if (dbSettings.UsersDBSettings != null && dbSettings.UsersDBSettings.IsValid)
|
||||
{
|
||||
SharedDBSessionFactory =
|
||||
CreateSessionFactory(m => m.FluentMappings.AddFromAssemblyOf<Config.Entities.Procedure>(),
|
||||
dbSettings.UsersDBSettings.DbType,
|
||||
dbSettings.UsersDBSettings.ConnectionString);
|
||||
|
||||
SharedUsersDBSessionFactory =
|
||||
CreateSessionFactory(m => m.FluentMappings.AddFromAssemblyOf<Users.Entities.User>(),
|
||||
dbSettings.UsersDBSettings.DbType,
|
||||
dbSettings.UsersDBSettings.ConnectionString);
|
||||
}
|
||||
|
||||
/// Results database (local, always non-null)
|
||||
if (dbSettings.WaterMetersDBSettings != null && dbSettings.WaterMetersDBSettings.IsValid)
|
||||
{
|
||||
Results.DB.SessionFactory = ResultsDBSessionFactory =
|
||||
CreateSessionFactory(m => m.FluentMappings.AddFromAssemblyOf<Results.Entities.Batch>(),
|
||||
dbSettings.WaterMetersDBSettings.DbType,
|
||||
dbSettings.WaterMetersDBSettings.ConnectionString);
|
||||
}
|
||||
|
||||
/// Events database (remote or local)
|
||||
if (dbSettings.EventsDBSettings != null && dbSettings.EventsDBSettings.IsValid)
|
||||
{
|
||||
EventsDBSessionFactory =
|
||||
CreateSessionFactory(m => m.FluentMappings.AddFromAssemblyOf<Events.Entities.Event>(),
|
||||
dbSettings.EventsDBSettings.DbType,
|
||||
dbSettings.EventsDBSettings.ConnectionString);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <returns>A database session</returns>
|
||||
static ISessionFactory CreateSessionFactory(DBKind database)
|
||||
public static ISessionFactory CreateSessionFactory(Action<MappingConfiguration> mappings, DBType dbType,
|
||||
string connectionString, bool createDB = false)
|
||||
{
|
||||
DBType dbType;
|
||||
string connectionString;
|
||||
|
||||
switch (database)
|
||||
try
|
||||
{
|
||||
default:
|
||||
case DBKind.Config:
|
||||
dbType = CurrentBench.ProceduresDBSettings.DbType;
|
||||
connectionString = CurrentBench.ProceduresDBSettings.ConnectionString;
|
||||
break;
|
||||
case DBKind.Results:
|
||||
dbType = CurrentBench.WaterMetersDBSettings.DbType;
|
||||
connectionString = CurrentBench.WaterMetersDBSettings.ConnectionString;
|
||||
break;
|
||||
case DBKind.RemoteConfig:
|
||||
dbType = CurrentBench.UsersDBSettings.DbType;
|
||||
connectionString = CurrentBench.UsersDBSettings.ConnectionString;
|
||||
break;
|
||||
var buildSchema = createDB ? (Action<Configuration>)BuildSchemaCreate : (Action<Configuration>)BuildSchema;
|
||||
|
||||
switch (dbType)
|
||||
{
|
||||
default:
|
||||
case DBType.MySql:
|
||||
|
||||
return Fluently.Configure()
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(connectionString))
|
||||
.Mappings(mappings)
|
||||
.ExposeConfiguration(buildSchema)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
|
||||
case DBType.SQLite:
|
||||
|
||||
return Fluently.Configure()
|
||||
.Database(SQLiteConfiguration.Standard.UsingFile(connectionString))
|
||||
.Mappings(mappings)
|
||||
.ExposeConfiguration(buildSchema)
|
||||
.BuildSessionFactory();
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(string.Format("{0}: {1}", Strings.Cannot_connect_to_the_database, exc.Message),
|
||||
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static void BuildSchema(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration (with mapping info in)
|
||||
/// and exports a database schema from it
|
||||
new SchemaExport(config).SetOutputFile("db_schema");
|
||||
}
|
||||
|
||||
static void BuildSchemaCreate(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration (with mapping info in)
|
||||
/// and exports a database schema from it
|
||||
new SchemaExport(config).Create(true, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty users database.
|
||||
/// Database contains only the user 'admin' and the control board component 'CB'.
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyConfigDB(Common.DBType dbType, string connectionString)
|
||||
{
|
||||
ISessionFactory sessionFactory =
|
||||
CreateSessionFactory(m => m.FluentMappings.AddFromAssemblyOf<Config.Entities.Procedure>(),
|
||||
dbType, connectionString, true);
|
||||
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
using (var session = sessionFactory.OpenSession())
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
///
|
||||
/// Create user 'admin'
|
||||
///
|
||||
var admin = new Config.Entities.User
|
||||
{
|
||||
UserName = Config.Data.AdminUsername,
|
||||
FullName = Strings.Administrator,
|
||||
LastPwChange = DateTime.Now
|
||||
};
|
||||
admin.SetPassword(Config.Data.AdminPassword);
|
||||
|
||||
///
|
||||
/// Prepare all groups, add some of them to admin
|
||||
///
|
||||
for (Common.GID gid = 0; gid < Common.GID.NrOfGroups; gid++)
|
||||
{
|
||||
Config.Entities.Group group = new Config.Entities.Group(gid);
|
||||
switch (gid)
|
||||
{
|
||||
case Common.GID.Testers:
|
||||
case Common.GID.TestingSpecialists:
|
||||
case Common.GID.HeadOfLab:
|
||||
case Common.GID.MaintenanceSpecialists:
|
||||
case Common.GID.Metrologists:
|
||||
case Common.GID.CalibrationSpecialists:
|
||||
case Common.GID.Administrators:
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
case Common.GID.TraceabilityManagement:
|
||||
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
|
||||
case Common.GID.MetrologicalAuthority:
|
||||
case Common.GID.WaterMeterAuthority:
|
||||
#endif
|
||||
admin.AddGroup(group);
|
||||
session.SaveOrUpdate(group); /// Save this group
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
session.SaveOrUpdate(admin); /// Save user 'admin'
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
return Config.FluentCommon.CreateSessionFactory(database, dbType, connectionString, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,27 @@ namespace TBF
|
||||
public string LastText3;
|
||||
public string LastRemark;
|
||||
|
||||
/// DataEntry.Uni history
|
||||
public string[] LastBgComm1;
|
||||
public string[] LastBgComm2;
|
||||
public string[] LastBgComm3;
|
||||
///
|
||||
public string[] LastBgColA;
|
||||
public string[] LastBgColB;
|
||||
public string[] LastBgColC;
|
||||
public string[] LastBgColD;
|
||||
public string[] LastBgColE;
|
||||
///
|
||||
public string[] LastEnComm1;
|
||||
public string[] LastEnComm2;
|
||||
public string[] LastEnComm3;
|
||||
///
|
||||
public string[] LastEnColA;
|
||||
public string[] LastEnColB;
|
||||
public string[] LastEnColC;
|
||||
public string[] LastEnColD;
|
||||
public string[] LastEnColE;
|
||||
|
||||
/// Purchase order history
|
||||
public string[] PurchaseOrderHistory;
|
||||
[XmlIgnore]
|
||||
|
||||
+119
-73
@@ -1,19 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using NHibernate;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using Users;
|
||||
using Users.Entities;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.Sequences;
|
||||
using TBF.UI.Shared;
|
||||
using NHibernate;
|
||||
|
||||
namespace TBF
|
||||
{
|
||||
@@ -214,7 +214,7 @@ namespace TBF
|
||||
|
||||
/// Ask what to do, ask for the password, open 'DatabaseSetingsDlg' and continue on OK
|
||||
if ((new NoBenchOrDatabaseDlg { Message = Strings.NoBenchMsg }.ShowDialog() != DialogResult.OK) ||
|
||||
(new Users.Forms.LoginDlg(true).ShowDialog() == DialogResult.Cancel) ||
|
||||
(new Users.Forms.LoginDlg().ShowDialog() == DialogResult.Cancel) ||
|
||||
(new TBF.UI.Settings.BenchesDlg().ShowDialog() == DialogResult.Cancel))
|
||||
{
|
||||
return; /// Exit program
|
||||
@@ -229,6 +229,8 @@ namespace TBF
|
||||
bool retryLogin = true; /// true = stay in a login loop
|
||||
do
|
||||
{
|
||||
LoadingConfigEnd();
|
||||
|
||||
LoginDlgWithBenchSelection loginDlgBench;
|
||||
if (LocalSettings.LastBenchName != null)
|
||||
{
|
||||
@@ -251,10 +253,11 @@ namespace TBF
|
||||
{
|
||||
if (LocalSettings.TestBenches[i].BenchName == loginDlgBench.BenchName)
|
||||
{
|
||||
log.FatalFormat("Test bench name: {0}", loginDlgBench.BenchName);
|
||||
log.FatalFormat("Test bench name: {0}", loginDlgBench.BenchName);
|
||||
|
||||
Users.CurrentUser.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings;
|
||||
Users.CurrentUser.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings;
|
||||
LoadingConfigStart();
|
||||
TBF.DB.CurrentBench = LocalSettings.TestBenches[i].Clone() as DatabaseSettings;
|
||||
TBF.DB.CreateSessionFactories(LocalSettings.TestBenches[i]);
|
||||
|
||||
Users.Entities.User loadedUser = null;
|
||||
try
|
||||
@@ -270,11 +273,10 @@ namespace TBF
|
||||
if (Users.Entities.User.IsPowerUser(loginDlgBench.Alias, loginDlgBench.Password))
|
||||
{
|
||||
loadedUser = new Users.Entities.User(loginDlgBench.Alias, 6, true);
|
||||
authorized = loadedUser.Authorize(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership, null);
|
||||
if (authorized)
|
||||
{
|
||||
Users.CurrentUser.AuthorizedAs = Common.AuthorizedAs.PowerUser;
|
||||
}
|
||||
CurrentUser.Change(loadedUser, null);
|
||||
CurrentUser.LastAuthorization = DateTime.Now;
|
||||
CurrentUser.AuthorizedAs = Common.AuthorizedAs.PowerUser;
|
||||
authorized = true;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -282,42 +284,57 @@ namespace TBF
|
||||
///
|
||||
if (!authorized)
|
||||
{
|
||||
DBSettings[] dbs = new DBSettings[] { Users.CurrentUser.RemoteUsersDB, Users.CurrentUser.LocalUsersDB };
|
||||
|
||||
authorizedAs = Common.AuthorizedAs.RemoteUser; /// Try remote DB first
|
||||
|
||||
foreach (var db in dbs)
|
||||
foreach (var sf in TBF.DB.UserSessionFactories)
|
||||
{
|
||||
/// Load and authorise user from the UsersDB database
|
||||
try
|
||||
{
|
||||
if (loginDlgBench.Password == LoginDlgWithBenchSelection.UseTheTagPassword)
|
||||
|
||||
if (sf != null)
|
||||
{
|
||||
loadedUser = Users.Entities.User.LoadUserByTag(loginDlgBench.Alias, db);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeTag(loginDlgBench.Alias, reqGrpMembership, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (loginDlgBench.Method)
|
||||
var session = sf.OpenSession();
|
||||
|
||||
if (loginDlgBench.Password == LoginDlgWithBenchSelection.UseTheTagPassword)
|
||||
{
|
||||
default:
|
||||
case Common.LoginMethod.UserName:
|
||||
loadedUser = Users.Entities.User.LoadUserByName(loginDlgBench.Alias, db);
|
||||
if (loadedUser != null) authorized = loadedUser.Authorize(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership, null);
|
||||
break;
|
||||
case Common.LoginMethod.FullName:
|
||||
loadedUser = Users.Entities.User.LoadUserByFullName(loginDlgBench.Alias, db);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeFullName(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership, null);
|
||||
break;
|
||||
case Common.LoginMethod.Number:
|
||||
int number;
|
||||
if (!int.TryParse(loginDlgBench.Alias, out number)) break;
|
||||
loadedUser = Users.Entities.User.LoadUserByNumber(number, db);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeNumber(number, loginDlgBench.Password, reqGrpMembership, null);
|
||||
break;
|
||||
loadedUser = Users.Entities.User.LoadUserByTag(session, loginDlgBench.Alias);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeTag(loginDlgBench.Alias, reqGrpMembership, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (loginDlgBench.Method)
|
||||
{
|
||||
default:
|
||||
case Common.LoginMethod.UserName:
|
||||
loadedUser = Users.Entities.User.LoadUserByName(session, loginDlgBench.Alias);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
authorized = loadedUser.Authorize(session, loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership, null);
|
||||
}
|
||||
break;
|
||||
case Common.LoginMethod.FullName:
|
||||
loadedUser = Users.Entities.User.LoadUserByFullName(session, loginDlgBench.Alias);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
authorized = loadedUser.AuthorizeFullName(session, loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership, null);
|
||||
}
|
||||
break;
|
||||
case Common.LoginMethod.Number:
|
||||
int number;
|
||||
if (!int.TryParse(loginDlgBench.Alias, out number)) break;
|
||||
loadedUser = Users.Entities.User.LoadUserByNumber(session, number);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
authorized = loadedUser.AuthorizeNumber(session, number, loginDlgBench.Password, reqGrpMembership, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
session.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
authorized = false;
|
||||
@@ -353,7 +370,11 @@ namespace TBF
|
||||
/// Copy the selected bench settings to CurrentBench.
|
||||
/// Clone() guarantees that current bench settings wont be modified
|
||||
/// when user modifies the database settings in DatabaseSettingsDlg.
|
||||
TBF.DB.CurrentBench = (DatabaseSettings)LocalSettings.TestBenches[i].Clone();
|
||||
if (TBF.DB.CurrentBench == null)
|
||||
{
|
||||
TBF.DB.CurrentBench = LocalSettings.TestBenches[i].Clone() as DatabaseSettings;
|
||||
TBF.DB.CreateSessionFactories(TBF.DB.CurrentBench);
|
||||
}
|
||||
Results.DB.DbType = TBF.DB.CurrentBench.WaterMetersDBSettings.DbType;
|
||||
Results.DB.ConnectionString = TBF.DB.CurrentBench.WaterMetersDBSettings.ConnectionString;
|
||||
|
||||
@@ -364,7 +385,7 @@ namespace TBF
|
||||
/// Connect to Config database.
|
||||
/// This triggers an exception in case user is a power user and there is no Config database.
|
||||
///
|
||||
ISession session = TBF.DB.CreateSession(DBKind.Config);
|
||||
var session = TBF.DB.ConfigDBSessionFactory.OpenSession();
|
||||
|
||||
if (!string.IsNullOrEmpty(LocalSettings.LastProcedureName))
|
||||
{
|
||||
@@ -380,9 +401,9 @@ namespace TBF
|
||||
.List();
|
||||
if (components.Count > 0)
|
||||
{
|
||||
var factory = new TBF.Rig.DataContainers.BenchInfo.Extended.ComponentFactory();
|
||||
var factory = new TBF.Rig.DataContainers.BenchInfo.Extended.ComponentFactory();
|
||||
var cfg = factory.CmpntCfgFromCmpntEntity(components[0])
|
||||
as TBF.Rig.DataContainers.BenchInfo.Extended.ComponentCfg;
|
||||
as TBF.Rig.DataContainers.BenchInfo.Extended.ComponentCfg;
|
||||
ProcessData.BenchInfo = new TBF.Rig.DataContainers.BenchInfo.Extended.Component(cfg);
|
||||
}
|
||||
else
|
||||
@@ -393,20 +414,20 @@ namespace TBF
|
||||
.List();
|
||||
if (components.Count > 0)
|
||||
{
|
||||
var factory = new TBF.Rig.DataContainers.BenchInfo.iPerl.ComponentFactory();
|
||||
var factory = new TBF.Rig.DataContainers.BenchInfo.iPerl.ComponentFactory();
|
||||
var cfg = factory.CmpntCfgFromCmpntEntity(components[0])
|
||||
as TBF.Rig.DataContainers.BenchInfo.iPerl.ComponentCfg;
|
||||
as TBF.Rig.DataContainers.BenchInfo.iPerl.ComponentCfg;
|
||||
ProcessData.BenchInfo = new TBF.Rig.DataContainers.BenchInfo.iPerl.Component(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
session.Close();
|
||||
|
||||
///
|
||||
/// Connect to Results database and determine the last saved batch number.
|
||||
///
|
||||
Results.DB.LoadSharedData();
|
||||
int maxBatchNr = Results.DB.GetMaxSavedBatchNr();
|
||||
var rsltDBSession = TBF.DB.ResultsDBSessionFactory.OpenSession();
|
||||
Results.DB.LoadSharedData(rsltDBSession);
|
||||
int maxBatchNr = Results.DB.GetMaxSavedBatchNr(rsltDBSession);
|
||||
if (!TBF.DB.CurrentBench.IsRealBench || Program.LocalSettings.BatchNr <= maxBatchNr)
|
||||
{
|
||||
log.FatalFormat("Max. BatchNr in DB = {0}, LocalSettings.BatchNr = {1}", maxBatchNr, Program.LocalSettings.BatchNr);
|
||||
@@ -414,17 +435,7 @@ namespace TBF
|
||||
Program.LocalSettings.Save();
|
||||
log.FatalFormat("LocalSettings.BatchNr updated to {0}", Program.LocalSettings.BatchNr);
|
||||
}
|
||||
|
||||
///
|
||||
/// Connect to Events database (if any) and load recent events from this test bench.
|
||||
///
|
||||
if (TBF.DB.CurrentBench.EventsDBSettings.DbType != Common.DBType.None &&
|
||||
!string.IsNullOrEmpty(TBF.DB.CurrentBench.EventsDBSettings.ConnectionString))
|
||||
{
|
||||
Events.DB.DbType = (DBType)TBF.DB.CurrentBench.EventsDBSettings.DbType;
|
||||
Events.DB.ConnectionString = TBF.DB.CurrentBench.EventsDBSettings.ConnectionString;
|
||||
Events.DB.LoadRecentEvents(Events.DB.CreateSession(), loginDlgBench.BenchName, 7); /// Last 7 days
|
||||
}
|
||||
if (rsltDBSession != null && rsltDBSession.IsOpen) rsltDBSession.Close();
|
||||
|
||||
retryLogin = false;
|
||||
break;
|
||||
@@ -460,7 +471,7 @@ namespace TBF
|
||||
|
||||
default:
|
||||
/// Open 'DatabaseSetingsDlg' and retry DB connect on OK
|
||||
if (new Users.Forms.LoginDlg(true).ShowDialog() == DialogResult.Cancel ||
|
||||
if (new Users.Forms.LoginDlg().ShowDialog() == DialogResult.Cancel ||
|
||||
new TBF.UI.Settings.BenchesDlg().ShowDialog() == DialogResult.Cancel)
|
||||
{
|
||||
return; /// Exit program
|
||||
@@ -482,26 +493,31 @@ namespace TBF
|
||||
///
|
||||
if (LocalSettings.LastProcedureName != null)
|
||||
{
|
||||
IList<Procedure> listOfProcedures = TBF.DB.CreateSession(Common.DBKind.Config)
|
||||
.QueryOver<Procedure>()
|
||||
.Where(x => (x.ProcedureState == Common.ProcedureState.Active))
|
||||
.And(x => (x.Name == LocalSettings.LastProcedureName))
|
||||
.List();
|
||||
|
||||
if (listOfProcedures.Count == 1)
|
||||
using (var session = TBF.DB.ConfigDBSessionFactory.OpenSession())
|
||||
{
|
||||
log.InfoFormat("Pre-selecting the procedure {0}", LocalSettings.LastProcedureName);
|
||||
SelectedProcedure = listOfProcedures[0];
|
||||
var listOfProcedures = session.QueryOver<Procedure>()
|
||||
.Where(x => (x.ProcedureState == Common.ProcedureState.Active))
|
||||
.And(x => (x.Name == LocalSettings.LastProcedureName))
|
||||
.List();
|
||||
|
||||
if (listOfProcedures.Count == 1)
|
||||
{
|
||||
log.InfoFormat("Pre-selecting the procedure {0}", LocalSettings.LastProcedureName);
|
||||
SelectedProcedure = listOfProcedures[0];
|
||||
}
|
||||
|
||||
session.Close();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
/// Open the main application window
|
||||
{
|
||||
/// Open the main application window
|
||||
log.Info("Creating the main window");
|
||||
MainWnd = new UI.MainWnd();
|
||||
log.Info("Opening the main window");
|
||||
Application.Run(MainWnd);
|
||||
LoadingConfigEnd();
|
||||
Application.Run(MainWnd);
|
||||
log.Info("The main window was closed");
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -536,5 +552,35 @@ namespace TBF
|
||||
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
|
||||
log.Fatal("--------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static UI.Shared.ModelessActivityForm form;
|
||||
static System.Threading.Thread formThread;
|
||||
|
||||
static void LoadingConfigStart()
|
||||
{
|
||||
form = new UI.Shared.ModelessActivityForm()
|
||||
{
|
||||
Message = Strings.Starting_system,
|
||||
FontFamily = "Arial",
|
||||
FontSize = 24,
|
||||
FontStyle = FontStyle.Regular,
|
||||
BackgroundColor = Color.LightBlue,
|
||||
};
|
||||
formThread = new System.Threading.Thread(() => form.ShowDialog());
|
||||
formThread.Start();
|
||||
System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
|
||||
static void LoadingConfigEnd()
|
||||
{
|
||||
if (form != null && formThread != null)
|
||||
{
|
||||
form.CloseForm(null, new EventArgs());
|
||||
formThread.Join();
|
||||
}
|
||||
form = null;
|
||||
formThread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("TestBenchFramework")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2023 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.30.1960.0")]
|
||||
[assembly: AssemblyFileVersion("2.30.1960.0")]
|
||||
[assembly: AssemblyVersion("2.33.2084.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2084.0")]
|
||||
|
||||
Generated
+58
-40
@@ -357,6 +357,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to any profile.
|
||||
/// </summary>
|
||||
internal static string any_profile {
|
||||
get {
|
||||
return ResourceManager.GetString("any_profile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Approval.
|
||||
/// </summary>
|
||||
@@ -664,7 +673,7 @@ namespace TBF.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Calibration Specialist.
|
||||
/// Looks up a localized string similar to Legalizator.
|
||||
/// </summary>
|
||||
internal static string Calibration_Specialist {
|
||||
get {
|
||||
@@ -1266,6 +1275,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to default printer.
|
||||
/// </summary>
|
||||
internal static string default_printer {
|
||||
get {
|
||||
return ResourceManager.GetString("default_printer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default units.
|
||||
/// </summary>
|
||||
@@ -1887,6 +1905,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error reading configuration database.
|
||||
/// </summary>
|
||||
internal static string Error_reading_configuration_database {
|
||||
get {
|
||||
return ResourceManager.GetString("Error_reading_configuration_database", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error saving parameters of {0}.
|
||||
/// </summary>
|
||||
@@ -3264,6 +3291,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to no profile.
|
||||
/// </summary>
|
||||
internal static string no_profile {
|
||||
get {
|
||||
return ResourceManager.GetString("no_profile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No results to print.
|
||||
/// </summary>
|
||||
@@ -3805,11 +3841,11 @@ namespace TBF.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Print again.
|
||||
/// Looks up a localized string similar to Print.
|
||||
/// </summary>
|
||||
internal static string Print_again {
|
||||
internal static string Print {
|
||||
get {
|
||||
return ResourceManager.GetString("Print_again", resourceCulture);
|
||||
return ResourceManager.GetString("Print", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3867,6 +3903,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Printer selection.
|
||||
/// </summary>
|
||||
internal static string Printer_selection {
|
||||
get {
|
||||
return ResourceManager.GetString("Printer_selection", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Printer.
|
||||
/// </summary>
|
||||
@@ -4263,33 +4308,6 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Qmax [m3/h].
|
||||
/// </summary>
|
||||
internal static string Qmax {
|
||||
get {
|
||||
return ResourceManager.GetString("Qmax", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Qmin [m3/h].
|
||||
/// </summary>
|
||||
internal static string Qmin {
|
||||
get {
|
||||
return ResourceManager.GetString("Qmin", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Qn [m3/h].
|
||||
/// </summary>
|
||||
internal static string Qn {
|
||||
get {
|
||||
return ResourceManager.GetString("Qn", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Qrise.
|
||||
/// </summary>
|
||||
@@ -4299,15 +4317,6 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Qt [m3/h].
|
||||
/// </summary>
|
||||
internal static string Qt {
|
||||
get {
|
||||
return ResourceManager.GetString("Qt", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Question.
|
||||
/// </summary>
|
||||
@@ -5415,6 +5424,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to .
|
||||
/// </summary>
|
||||
internal static string String1 {
|
||||
get {
|
||||
return ResourceManager.GetString("String1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sun.
|
||||
/// </summary>
|
||||
|
||||
@@ -673,10 +673,10 @@
|
||||
<value>Tiskárna</value>
|
||||
</data>
|
||||
<data name="Procedure" xml:space="preserve">
|
||||
<value>Postup</value>
|
||||
<value>Prodedura</value>
|
||||
</data>
|
||||
<data name="Procedures" xml:space="preserve">
|
||||
<value>Postupy</value>
|
||||
<value>Procedury</value>
|
||||
</data>
|
||||
<data name="Producer" xml:space="preserve">
|
||||
<value>Výrobce</value>
|
||||
@@ -688,7 +688,7 @@
|
||||
<value>Restart programu vyžaduje použít některá nastavení</value>
|
||||
</data>
|
||||
<data name="Progress" xml:space="preserve">
|
||||
<value>V činnosti</value>
|
||||
<value>Postup</value>
|
||||
</data>
|
||||
<data name="Properties" xml:space="preserve">
|
||||
<value>Vlastnosti</value>
|
||||
@@ -732,18 +732,9 @@
|
||||
<data name="Qfall" xml:space="preserve">
|
||||
<value>Qfall</value>
|
||||
</data>
|
||||
<data name="Qmin" xml:space="preserve">
|
||||
<value>Qmin</value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn</value>
|
||||
</data>
|
||||
<data name="Qrise" xml:space="preserve">
|
||||
<value>Qrise</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt</value>
|
||||
</data>
|
||||
<data name="Question" xml:space="preserve">
|
||||
<value>Otázka</value>
|
||||
</data>
|
||||
@@ -1683,4 +1674,13 @@
|
||||
<data name="Test_0_config_error_1_is_missing" xml:space="preserve">
|
||||
<value>Konfigurace testu {0} : chybí {1}</value>
|
||||
</data>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Vytisknout</value>
|
||||
</data>
|
||||
<data name="Printer_selection" xml:space="preserve">
|
||||
<value>Výběr tiskárny</value>
|
||||
</data>
|
||||
<data name="default_printer" xml:space="preserve">
|
||||
<value>předvolená tiskárna</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1278,8 +1278,8 @@
|
||||
<data name="Volume" xml:space="preserve">
|
||||
<value>Volumen</value>
|
||||
</data>
|
||||
<data name="Print_again" xml:space="preserve">
|
||||
<value>Druck wiederholen</value>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Drucken</value>
|
||||
</data>
|
||||
<data name="Show" xml:space="preserve">
|
||||
<value>Anzeigen</value>
|
||||
@@ -1545,9 +1545,6 @@
|
||||
<data name="Invalid_username_or_password" xml:space="preserve">
|
||||
<value>Ungültiger Benutzername oder Passwort </value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn [m3/h]</value>
|
||||
</data>
|
||||
<data name="Water_Meter_States" xml:space="preserve">
|
||||
<value>WZ-Stand</value>
|
||||
</data>
|
||||
@@ -1575,12 +1572,6 @@
|
||||
<data name="Main_" xml:space="preserve">
|
||||
<value>Hauptzähler</value>
|
||||
</data>
|
||||
<data name="Qmin" xml:space="preserve">
|
||||
<value>Qmin [m3/h]</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt [m3/h]</value>
|
||||
</data>
|
||||
<data name="Water" xml:space="preserve">
|
||||
<value>Wasser</value>
|
||||
</data>
|
||||
@@ -1644,9 +1635,6 @@
|
||||
<data name="Invalid_calib_info_Correct_pls" xml:space="preserve">
|
||||
<value>Ungültige Einstellung. Bitte um Korrektur!</value>
|
||||
</data>
|
||||
<data name="Qmax" xml:space="preserve">
|
||||
<value>Qmax [m3/h]</value>
|
||||
</data>
|
||||
<data name="L" xml:space="preserve">
|
||||
<value>Länge</value>
|
||||
</data>
|
||||
|
||||
@@ -633,9 +633,6 @@
|
||||
<data name="Producer" xml:space="preserve">
|
||||
<value>Producteur</value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn [m3/h]</value>
|
||||
</data>
|
||||
<data name="Water_meters" xml:space="preserve">
|
||||
<value>Compteurs eau</value>
|
||||
</data>
|
||||
@@ -987,12 +984,6 @@
|
||||
<data name="Main_" xml:space="preserve">
|
||||
<value>Principale</value>
|
||||
</data>
|
||||
<data name="Qmin" xml:space="preserve">
|
||||
<value>Qmin [m3/h]</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt [m3/h]</value>
|
||||
</data>
|
||||
<data name="Water" xml:space="preserve">
|
||||
<value>Eau</value>
|
||||
</data>
|
||||
@@ -1143,9 +1134,6 @@
|
||||
<data name="Invalid_calib_info_Correct_pls" xml:space="preserve">
|
||||
<value>Informations d'étalonnage non valides. Corrigez le s'il vous plaît.</value>
|
||||
</data>
|
||||
<data name="Qmax" xml:space="preserve">
|
||||
<value>Qmax</value>
|
||||
</data>
|
||||
<data name="Certificate" xml:space="preserve">
|
||||
<value>Certificat</value>
|
||||
</data>
|
||||
@@ -2010,4 +1998,7 @@
|
||||
<data name="Fill" xml:space="preserve">
|
||||
<value>Inonder</value>
|
||||
</data>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Imprimer</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -648,9 +648,6 @@
|
||||
<data name="Producer" xml:space="preserve">
|
||||
<value>produttore</value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn</value>
|
||||
</data>
|
||||
<data name="Water_meters" xml:space="preserve">
|
||||
<value>contatori acqua</value>
|
||||
</data>
|
||||
@@ -1002,12 +999,6 @@
|
||||
<data name="Main_" xml:space="preserve">
|
||||
<value>principale:</value>
|
||||
</data>
|
||||
<data name="Qmin" xml:space="preserve">
|
||||
<value>Q minimo</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt</value>
|
||||
</data>
|
||||
<data name="Water" xml:space="preserve">
|
||||
<value>acqua</value>
|
||||
</data>
|
||||
@@ -1158,9 +1149,6 @@
|
||||
<data name="Invalid_calib_info_Correct_pls" xml:space="preserve">
|
||||
<value>Informazioni di calibrazione non valida. Prego correggere</value>
|
||||
</data>
|
||||
<data name="Qmax" xml:space="preserve">
|
||||
<value>Q massimo</value>
|
||||
</data>
|
||||
<data name="Certificate" xml:space="preserve">
|
||||
<value>Certificato</value>
|
||||
</data>
|
||||
@@ -1533,9 +1521,6 @@
|
||||
<data name="P_delta" xml:space="preserve">
|
||||
<value>P delta</value>
|
||||
</data>
|
||||
<data name="Print_again" xml:space="preserve">
|
||||
<value>stampa ancora</value>
|
||||
</data>
|
||||
<data name="Show" xml:space="preserve">
|
||||
<value>mostrare</value>
|
||||
</data>
|
||||
@@ -1779,4 +1764,7 @@
|
||||
<data name="Start_cycle" xml:space="preserve">
|
||||
<value>Avviare il ciclo</value>
|
||||
</data>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Stampa</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -199,7 +199,8 @@
|
||||
<value>Parametry stanowiska</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>Specjalistyczna kalibracja</value>
|
||||
<value>Legalizator</value>
|
||||
<comment>Specjalistyczna kalibracja</comment>
|
||||
</data>
|
||||
<data name="Camera_error" xml:space="preserve">
|
||||
<value>Błąd kamery</value>
|
||||
@@ -690,9 +691,6 @@
|
||||
<data name="Qfall" xml:space="preserve">
|
||||
<value>Qopad</value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn</value>
|
||||
</data>
|
||||
<data name="Qrise" xml:space="preserve">
|
||||
<value>Qwzras</value>
|
||||
</data>
|
||||
@@ -1029,12 +1027,6 @@
|
||||
<data name="Main_" xml:space="preserve">
|
||||
<value>Główny:</value>
|
||||
</data>
|
||||
<data name="Qmin" xml:space="preserve">
|
||||
<value>Qmin</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt</value>
|
||||
</data>
|
||||
<data name="Water" xml:space="preserve">
|
||||
<value>Woda</value>
|
||||
</data>
|
||||
@@ -1176,9 +1168,6 @@
|
||||
<data name="Invalid_calib_info_Correct_pls" xml:space="preserve">
|
||||
<value>Nieprawidłowa nivormacje o kalibracji. Proszę poprawić.</value>
|
||||
</data>
|
||||
<data name="Qmax" xml:space="preserve">
|
||||
<value>Qmax</value>
|
||||
</data>
|
||||
<data name="Certificate" xml:space="preserve">
|
||||
<value>Certyfikat</value>
|
||||
</data>
|
||||
@@ -1542,9 +1531,6 @@
|
||||
<data name="P_delta" xml:space="preserve">
|
||||
<value>P delta</value>
|
||||
</data>
|
||||
<data name="Print_again" xml:space="preserve">
|
||||
<value>Wydrukuj jeszcze raz</value>
|
||||
</data>
|
||||
<data name="Show" xml:space="preserve">
|
||||
<value>Pokaż</value>
|
||||
</data>
|
||||
@@ -1626,4 +1612,7 @@
|
||||
<data name="Start_cycle" xml:space="preserve">
|
||||
<value>Start cyklu</value>
|
||||
</data>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Wydruk</value>
|
||||
</data>
|
||||
</root>
|
||||
+15
-15
@@ -424,7 +424,7 @@
|
||||
<value>Administrator</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>Calibration Specialist</value>
|
||||
<value>Legalizator</value>
|
||||
</data>
|
||||
<data name="Head_of_Lab" xml:space="preserve">
|
||||
<value>Head of Lab</value>
|
||||
@@ -643,9 +643,6 @@
|
||||
<data name="Producer" xml:space="preserve">
|
||||
<value>Producer</value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn [m3/h]</value>
|
||||
</data>
|
||||
<data name="Water_meters" xml:space="preserve">
|
||||
<value>Water meters</value>
|
||||
</data>
|
||||
@@ -997,12 +994,6 @@
|
||||
<data name="Main_" xml:space="preserve">
|
||||
<value>Main:</value>
|
||||
</data>
|
||||
<data name="Qmin" xml:space="preserve">
|
||||
<value>Qmin [m3/h]</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt [m3/h]</value>
|
||||
</data>
|
||||
<data name="Water" xml:space="preserve">
|
||||
<value>Water</value>
|
||||
</data>
|
||||
@@ -1153,9 +1144,6 @@
|
||||
<data name="Invalid_calib_info_Correct_pls" xml:space="preserve">
|
||||
<value>Invalid calibration information. Correct it please.</value>
|
||||
</data>
|
||||
<data name="Qmax" xml:space="preserve">
|
||||
<value>Qmax [m3/h]</value>
|
||||
</data>
|
||||
<data name="Certificate" xml:space="preserve">
|
||||
<value>Certificate</value>
|
||||
</data>
|
||||
@@ -1531,8 +1519,8 @@
|
||||
<data name="P_delta" xml:space="preserve">
|
||||
<value>P delta</value>
|
||||
</data>
|
||||
<data name="Print_again" xml:space="preserve">
|
||||
<value>Print again</value>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Print</value>
|
||||
</data>
|
||||
<data name="Show" xml:space="preserve">
|
||||
<value>Show</value>
|
||||
@@ -2314,4 +2302,16 @@
|
||||
<data name="Test_0_config_error_1_is_missing" xml:space="preserve">
|
||||
<value>Test {0} config. error : {1} is missing</value>
|
||||
</data>
|
||||
<data name="any_profile" xml:space="preserve">
|
||||
<value>any profile</value>
|
||||
</data>
|
||||
<data name="no_profile" xml:space="preserve">
|
||||
<value>no profile</value>
|
||||
</data>
|
||||
<data name="Printer_selection" xml:space="preserve">
|
||||
<value>Printer selection</value>
|
||||
</data>
|
||||
<data name="default_printer" xml:space="preserve">
|
||||
<value>default printer</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -546,12 +546,6 @@
|
||||
<data name="Q_to_lph" xml:space="preserve">
|
||||
<value>Q pana la [l/h]</value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt</value>
|
||||
</data>
|
||||
<data name="Question" xml:space="preserve">
|
||||
<value>Intrebare</value>
|
||||
</data>
|
||||
@@ -831,4 +825,7 @@
|
||||
<data name="Evaporation" xml:space="preserve">
|
||||
<value>Evaporare</value>
|
||||
</data>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Imprimanta</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -633,9 +633,6 @@
|
||||
<data name="Producer" xml:space="preserve">
|
||||
<value>Производитель</value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn</value>
|
||||
</data>
|
||||
<data name="Water_meters" xml:space="preserve">
|
||||
<value>Счетчики воды</value>
|
||||
</data>
|
||||
@@ -990,12 +987,6 @@
|
||||
<data name="Main_" xml:space="preserve">
|
||||
<value>Главн:</value>
|
||||
</data>
|
||||
<data name="Qmin" xml:space="preserve">
|
||||
<value>Qmin</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt</value>
|
||||
</data>
|
||||
<data name="cold" xml:space="preserve">
|
||||
<value>холодный</value>
|
||||
</data>
|
||||
@@ -1143,9 +1134,6 @@
|
||||
<data name="Invalid_calib_info_Correct_pls" xml:space="preserve">
|
||||
<value>Неверная информация калибровки. Исправьте это, пожалуйста.</value>
|
||||
</data>
|
||||
<data name="Qmax" xml:space="preserve">
|
||||
<value>Qmax</value>
|
||||
</data>
|
||||
<data name="Certificate" xml:space="preserve">
|
||||
<value>Сертификат</value>
|
||||
</data>
|
||||
@@ -1518,9 +1506,6 @@
|
||||
<data name="P_delta" xml:space="preserve">
|
||||
<value>P дельта</value>
|
||||
</data>
|
||||
<data name="Print_again" xml:space="preserve">
|
||||
<value>Печатать снова</value>
|
||||
</data>
|
||||
<data name="Show" xml:space="preserve">
|
||||
<value>Показать</value>
|
||||
</data>
|
||||
@@ -1599,4 +1584,7 @@
|
||||
<data name="Evaporation" xml:space="preserve">
|
||||
<value>испарение</value>
|
||||
</data>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Печатать</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -753,18 +753,9 @@
|
||||
<data name="Qfall" xml:space="preserve">
|
||||
<value>Q下降</value>
|
||||
</data>
|
||||
<data name="Qmin" xml:space="preserve">
|
||||
<value>Qmin</value>
|
||||
</data>
|
||||
<data name="Qn" xml:space="preserve">
|
||||
<value>Qn</value>
|
||||
</data>
|
||||
<data name="Qrise" xml:space="preserve">
|
||||
<value>Q上升</value>
|
||||
</data>
|
||||
<data name="Qt" xml:space="preserve">
|
||||
<value>Qt</value>
|
||||
</data>
|
||||
<data name="Question" xml:space="preserve">
|
||||
<value>问题</value>
|
||||
</data>
|
||||
@@ -1191,4 +1182,7 @@
|
||||
<data name="Evaporation" xml:space="preserve">
|
||||
<value>蒸发</value>
|
||||
</data>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>打印机</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -88,10 +88,10 @@ namespace TBF.Rig.Ambient.Comet
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.Parity = Common.Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = Utils.GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
config.StopBits = Common.Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = Common.Utils.GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
config.SetDtrToOne = setDtrCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
|
||||
@@ -86,10 +86,10 @@ namespace TBF.Rig.Ambient.Greco
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.Parity = Common.Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = Utils.GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
config.StopBits = Common.Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = Common.Utils.GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ namespace TBF.Rig.Danfoss.VLT2800
|
||||
config.BusAddress = int.Parse(busAddressTextBox.Text);
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.Parity = Common.Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.StopBits = Common.Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ using Config;
|
||||
using TBF.Rig;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Calendar;
|
||||
|
||||
namespace TBF.Rig.DataContainers.BenchInfo.iPerl
|
||||
{
|
||||
@@ -56,35 +57,51 @@ namespace TBF.Rig.DataContainers.BenchInfo.iPerl
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
public List<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
var calEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
DateTime calibDue = myCfg.CalibValidDate;
|
||||
if (calibDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
/// Five weekly notifications
|
||||
foreach (var days in new int[] { -35, -28, -21, -14 })
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
if (calibDue.Date.AddDays(days + 6) >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Notification,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
|
||||
/// Five daily warnings
|
||||
foreach (var days in new int[] { -7, -6, -5, -4, -3, -2, -1 })
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
if (calibDue.Date.AddDays(days) >= DateTime.Now.Date)
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Warning,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
|
||||
/// Calibration due date
|
||||
if (calibDue.Date >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationDueDateEvent(calibDue.Date,
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
|
||||
return calEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Calendar;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Buoyancy
|
||||
{
|
||||
@@ -36,35 +37,51 @@ namespace TBF.Rig.DataContainers.Buoyancy
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
public List<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
var calEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
DateTime calibDue = myCfg.CalibValidDate;
|
||||
if (calibDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
/// Five weekly notifications
|
||||
foreach (var days in new int[] { -35, -28, -21, -14 })
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
if (calibDue.Date.AddDays(days + 6) >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Notification,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
|
||||
/// Five daily warnings
|
||||
foreach (var days in new int[] { -7, -6, -5, -4, -3, -2, -1 })
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
if (calibDue.Date.AddDays(days) >= DateTime.Now.Date)
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Warning,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
|
||||
/// Calibration due date
|
||||
if (calibDue.Date >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationDueDateEvent(calibDue.Date,
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
|
||||
return calEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Calendar;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Density
|
||||
{
|
||||
@@ -39,35 +40,51 @@ namespace TBF.Rig.DataContainers.Density
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
public List<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
var calEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
DateTime calibDue = myCfg.CalibValidDate;
|
||||
if (calibDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
/// Five weekly notifications
|
||||
foreach (var days in new int[] { -35, -28, -21, -14 })
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
if (calibDue.Date.AddDays(days + 6) >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Notification,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
|
||||
/// Five daily warnings
|
||||
foreach (var days in new int[] { -7, -6, -5, -4, -3, -2, -1 })
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
if (calibDue.Date.AddDays(days) >= DateTime.Now.Date)
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Warning,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
|
||||
/// Calibration due date
|
||||
if (calibDue.Date >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationDueDateEvent(calibDue.Date,
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
|
||||
return calEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,6 +7,7 @@ using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Calendar;
|
||||
|
||||
namespace TBF.Rig.DataContainers.Evaporation
|
||||
{
|
||||
@@ -40,35 +41,51 @@ namespace TBF.Rig.DataContainers.Evaporation
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
public List<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
var calEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
DateTime calibDue = myCfg.CalibValidDate;
|
||||
if (calibDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
/// Five weekly notifications
|
||||
foreach (var days in new int[] { -35, -28, -21, -14 })
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
if (calibDue.Date.AddDays(days + 6) >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Notification,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
|
||||
/// Five daily warnings
|
||||
foreach (var days in new int[] { -7, -6, -5, -4, -3, -2, -1 })
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
if (calibDue.Date.AddDays(days) >= DateTime.Now.Date)
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Warning,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
|
||||
/// Calibration due date
|
||||
if (calibDue.Date >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationDueDateEvent(calibDue.Date,
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
|
||||
return calEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using Common;
|
||||
|
||||
namespace TBF.Rig.DataEntry
|
||||
{
|
||||
///
|
||||
/// Ac = Action
|
||||
///
|
||||
public enum Ac
|
||||
{
|
||||
[Description("Clear")] Clear, /// Clear when the form is open, save on OK
|
||||
[Description("Last from history")] HistoryLast,
|
||||
[Description("Load")] Load, /// Load from water meters when the form is open, save on OK
|
||||
[Description("Load (readonly)")] LoadReadOnly, /// Load from water meters when the form is open, prevent changes, do not save
|
||||
Count,
|
||||
}
|
||||
|
||||
///
|
||||
/// Ct = Content
|
||||
///
|
||||
public enum Ct
|
||||
{
|
||||
[Description("None")] None,
|
||||
[Description("Serial nr.")] SerialNr,
|
||||
[Description("Serial nr. aux")] SerialNrAux,
|
||||
[Description("Radio address")] RadioAddress,
|
||||
[Description("Year of calibration")] YearOfCalibration,
|
||||
[Description("Start state")] StartState,
|
||||
[Description("End state")] EndState,
|
||||
[Description("Archive path")] ArchivePath,
|
||||
[Description("WM Order")] WmOrder,
|
||||
[Description("Batch order")] BatchOrder,
|
||||
[Description("Batch and WM order")] BatchAndWmOrder,
|
||||
[Description("WM Remark")] WmRemark,
|
||||
[Description("Batch remark")] BatchRemark,
|
||||
[Description("Batch and WM remark")] BatchAndWmRemark,
|
||||
#if ORACLE_DB
|
||||
[Description("Prefix")] Prefix,
|
||||
[Description("Suffix")] Suffix,
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
|
||||
public class DEItem
|
||||
{
|
||||
public readonly Ct Content;
|
||||
public readonly string Caption;
|
||||
public readonly Ac Action;
|
||||
public readonly int Width;
|
||||
|
||||
public DEItem(Ct content, string caption, Ac action, int width)
|
||||
{
|
||||
Content = content;
|
||||
Caption = caption;
|
||||
Action = action;
|
||||
Width = width;
|
||||
}
|
||||
|
||||
|
||||
static IList<DEItem> items = new List<DEItem>();
|
||||
///
|
||||
public static void ClearItems() { items.Clear(); }
|
||||
public static void AddItem(DEItem item) { items.Add(item); }
|
||||
public static void AddItem(Ct content, string caption, Ac action, int width)
|
||||
{
|
||||
items.Add(new DEItem(content, caption, action, width));
|
||||
}
|
||||
public static IList<DEItem> GetItems() { return items; }
|
||||
|
||||
|
||||
static IList<DEItem> columns = new List<DEItem>();
|
||||
///
|
||||
public static void ClearColumns() { columns.Clear(); }
|
||||
public static void AddColumn(DEItem column) { columns.Add(column); }
|
||||
public static void AddColumn(Ct content, string caption, Ac action, int width)
|
||||
{
|
||||
columns.Add(new DEItem(content, caption, action, width));
|
||||
}
|
||||
public static IList<DEItem> GetColumns() { return columns; }
|
||||
|
||||
|
||||
static IList<DEItem> summaryColumns = new List<DEItem>();
|
||||
///
|
||||
public static void ClearSummaryColumns() { summaryColumns.Clear(); }
|
||||
public static void AddSummaryColumn(DEItem column) { summaryColumns.Add(column); }
|
||||
public static void AddSummaryColumn(Ct content, string caption, Ac action, int width)
|
||||
{
|
||||
summaryColumns.Add(new DEItem(content, caption, action, width));
|
||||
}
|
||||
public static IList<DEItem> GetSummaryColumns() { return summaryColumns; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,85 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Results.Entities;
|
||||
|
||||
namespace TBF.Rig.DataEntry
|
||||
{
|
||||
public class DEUtils
|
||||
{
|
||||
public static string GetContent(Ct content, WaterMeter wm)
|
||||
{
|
||||
if (wm == null) return string.Empty;
|
||||
|
||||
switch (content)
|
||||
{
|
||||
default:
|
||||
case Ct.None: return string.Empty;
|
||||
case Ct.SerialNr: return (!wm.Disabled && wm.SerialNr != null) ? wm.SerialNr : string.Empty;
|
||||
case Ct.SerialNrAux: return (!wm.Disabled && wm.SerialNrAux != null) ? wm.SerialNrAux : string.Empty;
|
||||
case Ct.RadioAddress: return (!wm.Disabled && wm.RadioAddress != null) ? wm.RadioAddress : string.Empty;
|
||||
case Ct.YearOfCalibration: return (!wm.Disabled) ? wm.YearOfProduction.ToString() : string.Empty;
|
||||
case Ct.StartState: return (!wm.Disabled && wm.GetStartState() != null) ? wm.GetStartState() : string.Empty;
|
||||
case Ct.EndState: return (!wm.Disabled && wm.EndState != null) ? wm.EndState : string.Empty;
|
||||
case Ct.ArchivePath: return (!wm.Disabled && wm.ArchivePath != null) ? wm.ArchivePath : string.Empty;
|
||||
|
||||
case Ct.WmOrder: return (!wm.Disabled && wm.PurchaseOrder != null) ? wm.PurchaseOrder : string.Empty;
|
||||
case Ct.BatchOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
|
||||
case Ct.BatchAndWmOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
|
||||
|
||||
case Ct.WmRemark: return (!wm.Disabled && wm.Remark != null) ? wm.Remark : string.Empty;
|
||||
case Ct.BatchRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
|
||||
case Ct.BatchAndWmRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
|
||||
#if ORACLE_DB
|
||||
case Ct.Prefix: return (!wm.Disabled && wm.Prefix != null) ? wm.Prefix : string.Empty;
|
||||
case Ct.Suffix: return (!wm.Disabled && wm.Suffix != null) ? wm.Suffix : string.Empty;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static void PutContent(Ct content, WaterMeter wm, string value)
|
||||
{
|
||||
if (wm == null || wm.Disabled) return;
|
||||
|
||||
int year;
|
||||
|
||||
switch (content)
|
||||
{
|
||||
default:
|
||||
case Ct.None: return;
|
||||
case Ct.SerialNr: wm.SerialNr = value; return;
|
||||
case Ct.SerialNrAux: wm.SerialNrAux = value; return;
|
||||
case Ct.RadioAddress: wm.RadioAddress = value; return;
|
||||
case Ct.YearOfCalibration: if (int.TryParse(value, out year)) wm.YearOfProduction = year; return;
|
||||
case Ct.StartState: wm.SetStartState(value); return;
|
||||
case Ct.EndState: wm.EndState = value; return;
|
||||
case Ct.ArchivePath: wm.ArchivePath = value; return;
|
||||
|
||||
case Ct.WmOrder:
|
||||
wm.PurchaseOrder = value;
|
||||
return;
|
||||
|
||||
case Ct.BatchOrder:
|
||||
case Ct.BatchAndWmOrder:
|
||||
if (wm.Batch != null) wm.Batch.PurchaseOrder = value;
|
||||
return;
|
||||
|
||||
case Ct.WmRemark:
|
||||
wm.Remark = value;
|
||||
return;
|
||||
|
||||
case Ct.BatchRemark:
|
||||
case Ct.BatchAndWmRemark:
|
||||
if (wm.Batch != null) wm.Batch.Remark = value;
|
||||
return;
|
||||
#if ORACLE_DB
|
||||
case Ct.Prefix: wm.Prefix = value; return;
|
||||
case Ct.Suffix: wm.Suffix = value; return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
|
||||
@@ -488,6 +488,13 @@ namespace TBF.Rig.DataEntry.S620
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, ComboBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == 'ľ' || e.KeyChar == 'š' || e.KeyChar == 'č' || e.KeyChar == 'ť' || e.KeyChar == 'ž' || e.KeyChar == 'ý' || e.KeyChar == 'á' || e.KeyChar == 'í' || e.KeyChar == 'é')
|
||||
{
|
||||
MessageBox.Show("Zlá klávesnica !!!");
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
|
||||
@@ -859,6 +859,13 @@ namespace TBF.Rig.DataEntry.S620
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void BodyNoTextBoxKeyPress(object sender, KeyPressEventArgs e, int wmNr0)
|
||||
{
|
||||
if (e.KeyChar == 'ľ' || e.KeyChar == 'š' || e.KeyChar == 'č' || e.KeyChar == 'ť' || e.KeyChar == 'ž' || e.KeyChar == 'ý' || e.KeyChar == 'á' || e.KeyChar == 'í' || e.KeyChar == 'é')
|
||||
{
|
||||
MessageBox.Show("Zlá klávesnica !!!");
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (closeButton != '\0' && e.KeyChar == closeButton)
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,8 +16,24 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
const string DfltOcrWorkspaceFolder = "C:\\TBF\\OCR\\";
|
||||
const string DfltOcrWorkspaceExt = ".vrws";
|
||||
|
||||
static Dictionary<string, OcrVidi> ocrDictionary = new Dictionary<string, OcrVidi>();
|
||||
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
|
||||
public string OcrWorkspace
|
||||
{
|
||||
get { return (entryFormCfg != null && entryFormCfg.ProcParams != null) ? entryFormCfg.ProcParams.OcrWorkspace : string.Empty; }
|
||||
}
|
||||
|
||||
public string OcrStream
|
||||
{
|
||||
get { return (entryFormCfg != null && entryFormCfg.ProcParams != null) ? entryFormCfg.ProcParams.OcrStream : string.Empty; }
|
||||
}
|
||||
|
||||
IRegReader[] regReaders;
|
||||
|
||||
|
||||
@@ -28,26 +44,13 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (entryFormCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
startImages = new string[] { "C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg" };
|
||||
startImages = new string[] { "C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg", "C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg", "C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg", "C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg", "C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg" };
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,7 +113,6 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
CurrentOp currentOp;
|
||||
|
||||
|
||||
public EntryForm() { }
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg)
|
||||
@@ -213,21 +215,75 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, startImages, disabled);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, endImages, wmStartState, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, wmStartState, wmStartStateStr, endImages, disabled,
|
||||
refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenDeferredTestEvalDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, startImages, endImages, disabled, refVolume, errLimLo, errLimHi);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, endImages, disabled,
|
||||
refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
OcrVidi GetOcr(string ocrWorkspace, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
if (string.IsNullOrEmpty(ocrWorkspace)) return null; /// No OCR was configured
|
||||
|
||||
string fullPath = (ocrWorkspace.Contains("\\") || ocrWorkspace.Contains("/"))
|
||||
? ocrWorkspace.Replace('/', '\\')
|
||||
: System.IO.Path.Combine(DfltOcrWorkspaceFolder, ocrWorkspace);
|
||||
if (!fullPath.Contains(".")) fullPath = fullPath + DfltOcrWorkspaceExt;
|
||||
|
||||
OcrVidi ocrVidi;
|
||||
if (ocrDictionary.TryGetValue(fullPath, out ocrVidi))
|
||||
{
|
||||
log.InfoFormat("existing OcrVidi({0}) was retrieved from dictionary", fullPath);
|
||||
return ocrVidi;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ocrVidi = new OcrVidi(fullPath);
|
||||
ocrDictionary.Add(fullPath, ocrVidi);
|
||||
log.WarnFormat("new OcrVidi({0}) was added to dictionary", fullPath);
|
||||
return ocrVidi;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.ErrorFormat("new OcrVidi({0}) thrown {1}: {2} / {3}",
|
||||
fullPath, e.GetType().ToString(), e.Message,e.InnerException.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("new OcrVidi({0}) thrown {1}: {2}",
|
||||
fullPath, e.GetType().ToString(), e.Message);
|
||||
}
|
||||
log.ErrorFormat("Stack trace:\r\n{0}", e.StackTrace);
|
||||
|
||||
message = string.Format("Cannot load OCR workspace:\r\n{0}\r\nOCR workspace file is {1}", e.Message, fullPath);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
@@ -349,7 +405,9 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
@@ -27,9 +28,18 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
public string ProtocolTitle3;
|
||||
public string ProtocolTitle4;
|
||||
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public ProcParams ProcParams;
|
||||
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new ProcParams(true); }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg()
|
||||
{
|
||||
ProcParams = new ProcParams(true);
|
||||
|
||||
Name = "DataEntry-for-Camera";
|
||||
ParentName = string.Empty;
|
||||
HideOrder = false;
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
using System.Collections.Generic;
|
||||
#if OCR
|
||||
using ViDi2;
|
||||
#endif
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
public class OcrVidi
|
||||
{
|
||||
#if OCR
|
||||
/// Static variable: OCR ViDi control can only have one instance
|
||||
static ViDi2.Runtime.IControl control;
|
||||
readonly IWorkspace workspace;
|
||||
#endif
|
||||
readonly string ocrWorkspaceFile;
|
||||
|
||||
/// <summary>
|
||||
/// Create OcrVidi wrapper class
|
||||
/// </summary>
|
||||
/// <param name="ocrWorkspaceFile">Cognex runtime workspace file (vrws)</param>
|
||||
public OcrVidi(string ocrWorkspaceFile)
|
||||
{
|
||||
this.ocrWorkspaceFile = ocrWorkspaceFile;
|
||||
#if OCR
|
||||
if (control == null)
|
||||
{
|
||||
/// Create and initialize the main control
|
||||
control = new ViDi2.Runtime.Local.Control(GpuMode.NoSupport);
|
||||
control.InitializeComputeDevices(GpuMode.NoSupport, new List<int>() { }); /// Initializes all CUDA devices
|
||||
}
|
||||
|
||||
/// Open a runtime workspace from file
|
||||
workspace = control.Workspaces.Add(string.Format("ws{0}", control.Workspaces.Count + 1), ocrWorkspaceFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
public string Recognize(string streamName, string imagePath, double denominator = 1000, string format = "F3")
|
||||
{
|
||||
#if OCR
|
||||
IStream stream;
|
||||
try { stream = workspace.Streams[streamName]; }
|
||||
catch (Exception) { return string.Empty; }
|
||||
if (stream == null) return string.Empty;
|
||||
|
||||
string findedText = string.Empty; /// Hladane cislo - stav vodomera - string
|
||||
double findedValue = 0; /// Hladane cislo - stav vodomera
|
||||
bool finded = false; /// Ci sme nasli hodnotu
|
||||
|
||||
// load an image from file
|
||||
using (IImage image = new ViDi2.Local.LibraryImage(imagePath)) //disposing the image when we do not need it anymore
|
||||
{
|
||||
// allocates a sample with the image
|
||||
using (ISample sample = stream.CreateSample(image))
|
||||
{
|
||||
ITool tool = stream.Tools["Read"];
|
||||
|
||||
// process image with the blue read tool
|
||||
sample.Process(tool);
|
||||
|
||||
IBlueMarking blueReadMarking = sample.Markings[tool.Name] as IBlueMarking;
|
||||
|
||||
foreach (IBlueView view in blueReadMarking.Views)
|
||||
{
|
||||
foreach (IMatch match in view.Matches)
|
||||
{
|
||||
//System.Console.WriteLine($"This model says \" {(match as IReadModelMatch).FeatureString} \" with a score of {match.Score}");
|
||||
string word = (match as IReadModelMatch).FeatureString;
|
||||
if (word.Length >= 7 && word.Length <= 8 // hladane cislo ma od 7 do 8 znakov
|
||||
&& double.TryParse(word,out findedValue)) // a ak najdeny text je cislo
|
||||
{
|
||||
findedValue /= denominator; // Convert to m3, red digits are fractions of m3
|
||||
finded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (finded) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (finded)
|
||||
{
|
||||
findedText = findedValue.ToString(format);
|
||||
}
|
||||
|
||||
return findedText;
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ocrWorkspaceFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
///
|
||||
/// Copyright (c) 2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public string OcrWorkspace; /// Path to a Cognex workspace file
|
||||
public string OcrStream; /// Cognex workspace stream name
|
||||
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
OcrWorkspace = string.Empty;
|
||||
OcrStream = "default";
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"OCR workspace file",
|
||||
"OCR stream",
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return OcrWorkspace;
|
||||
case 1: return OcrStream;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: OcrWorkspace = str; return CfgUpdateFlags.None;
|
||||
case 1: OcrStream = str; return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifiy the string representation of the parameter
|
||||
/// </summary>
|
||||
/// <param name="i">Parameter ID</param>
|
||||
/// <param name="str">String representation of the parameter</param>
|
||||
/// <param name="message">In case false is returned this is the error messsage to be displayed</param>
|
||||
/// <returns>true = parameter OK, false = parameter NOK</returns>
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
if (!string.IsNullOrEmpty(str)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ProcParams prms)
|
||||
{
|
||||
prms.OcrWorkspace = OcrWorkspace;
|
||||
prms.OcrStream = OcrStream;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ProcParams pars = new ProcParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentProcedure dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
ProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcParams;
|
||||
|
||||
procedureParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
procedure = dbEntity.Procedure;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public ProcParams()
|
||||
{
|
||||
}
|
||||
|
||||
public ProcParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public ProcParams(ComponentProcedure procParamsEntity, string componentName, Procedure procedure)
|
||||
{
|
||||
this.procedureParamsEntity = procParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.procedure = procedure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using System.IO;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
@@ -33,22 +35,30 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
const Unit unit = Unit.m3;
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
readonly Tst mode; /// Start, End or Deferred
|
||||
readonly Tst mode; /// Start, End or Deferred
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
readonly string[] startImages;
|
||||
readonly string[] endImages;
|
||||
readonly double refVolume;
|
||||
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
readonly OcrVidi ocrVidi;
|
||||
readonly string ocrMessage;
|
||||
readonly string streamName;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
double denominator; /// derived from PulsesPerLtr, passed to OcrVidi
|
||||
string format; /// derived from PulsesPerLtr, passed to OcrVidi
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -57,23 +67,26 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMEndState;
|
||||
|
||||
|
||||
const int TextBoxesCount = 24;
|
||||
|
||||
|
||||
string lastImageName;
|
||||
Bitmap lastImage; /// non-zoomed image
|
||||
int lastWmNr1;
|
||||
Bitmap lastImage; /// non-zoomed image
|
||||
Bitmap zoomedImage;
|
||||
|
||||
Thread imageProcessingThread; /// Thread to process images
|
||||
public delegate void OcrTextObtainedDelegate(int ix, bool isEnd, string text);
|
||||
OcrTextObtainedDelegate ocrTextObtained;
|
||||
|
||||
static int wmNr0b;
|
||||
static Rotation[] imageRotation;
|
||||
static Rotation imageRotation;
|
||||
static bool[] isZoomed;
|
||||
static Point[] zoomCenterLoc;
|
||||
///
|
||||
static TestStartEndForm()
|
||||
{
|
||||
wmNr0b = 0;
|
||||
imageRotation = new Rotation[TextBoxesCount];
|
||||
//imageRotation = new Rotation[TextBoxesCount];
|
||||
isZoomed = new bool[TextBoxesCount];
|
||||
zoomCenterLoc = new Point[TextBoxesCount];
|
||||
}
|
||||
@@ -127,6 +140,8 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
enabledTextBoxes = new List<TextBox>();
|
||||
|
||||
imageProcessingThread = null;
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
@@ -135,115 +150,141 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
/// Constructor to fill in start states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, bool[] disabled)
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="startImages">Array with paths to start images</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.Start;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.disabled = disabled;
|
||||
|
||||
if (startImages == null || startImages.Length != waterMetersCount)
|
||||
if (startImages == null || startImages.Length != WaterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid 'startImages' argument"));
|
||||
throw new Exception("Invalid 'startImages' argument");
|
||||
}
|
||||
|
||||
this.endImages = new string[waterMetersCount];
|
||||
this.endImages = new string[WaterMetersCount];
|
||||
WMStartState = new double[WaterMetersCount];
|
||||
WMStartStateStr = new string[WaterMetersCount];
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
}
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in end states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="endImages">Array with paths to end images</param>
|
||||
/// <param name="wmStartState">Array with start states in default volume units (liters)</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] endImages, double[] wmStartState, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, double[] wmStartState, string[] wmStartStateStr, string[] endImages,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.End;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
|
||||
if (endImages == null || endImages.Length != waterMetersCount ||
|
||||
wmStartState == null || wmStartState.Length != waterMetersCount ||
|
||||
wmStartStateStr == null || wmStartStateStr.Length != waterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid argument(s)"));
|
||||
}
|
||||
|
||||
this.endImages = endImages;
|
||||
this.WMStartState = wmStartState;
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.disabled = disabled;
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.WMStartState = wmStartState;
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
this.startImages = new string[waterMetersCount];
|
||||
if (startImages == null || startImages.Length != WaterMetersCount ||
|
||||
wmStartState == null || wmStartState.Length != WaterMetersCount ||
|
||||
wmStartStateStr == null || wmStartStateStr.Length != WaterMetersCount ||
|
||||
endImages == null || endImages.Length != WaterMetersCount)
|
||||
{
|
||||
throw new Exception("Invalid argument(s)");
|
||||
}
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
WMEndState = new double[WaterMetersCount];
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, string[] endImages,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
/// <summary>
|
||||
/// Constructor for deferred evaluation, to fill in both start- and end-states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="startImages">Array with paths to start images</param>
|
||||
/// <param name="endImages">Array with paths to end images</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, string[] endImages, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.Both;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
if (startImages == null || startImages.Length != waterMetersCount ||
|
||||
endImages == null || endImages.Length != waterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid argument(s)"));
|
||||
throw new Exception("Invalid argument(s)");
|
||||
}
|
||||
|
||||
this.startImages = startImages;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
WMEndState = new double[waterMetersCount];
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
WMEndState = new double[waterMetersCount];
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
void ConstructorCommon(IRegReader[] regReaders)
|
||||
{
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
int nrLines = (TBF.Data.WMsCount - 1) / TBF.Data.LineSize + 1;
|
||||
if (nrLines == 1)
|
||||
{
|
||||
Width = 1040;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
@@ -292,7 +333,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (wmPos > 0)
|
||||
{
|
||||
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, wmPos);
|
||||
labels[i].Text = wmPos.ToString();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
@@ -318,10 +359,11 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
else
|
||||
{
|
||||
endTextBoxes[i].Enabled = true;
|
||||
enabledTextBoxes.Add(endTextBoxes[i]);
|
||||
startTextBoxes[i].Enabled = false;
|
||||
startTextBoxes[i].Text = WMStartStateStr[wmPos - 1];
|
||||
startTextBoxes[i].Enabled = true;
|
||||
startTextBoxes[i].Text = WMStartStateStr[wmPos - 1];
|
||||
endTextBoxes[i].Enabled = true;
|
||||
enabledTextBoxes.Add(startTextBoxes[i]);
|
||||
enabledTextBoxes.Add(endTextBoxes[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -343,16 +385,176 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ocrMessage))
|
||||
{
|
||||
MessageBox.Show(ocrMessage, Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
|
||||
int imagesCount = ImagesToProcessCount();
|
||||
log.WarnFormat("Images to process count = {0}", imagesCount);
|
||||
///
|
||||
if (imagesCount > 0 && ocrVidi != null)
|
||||
{
|
||||
log.WarnFormat("Starting image processing thread with OcrVidi={0} and OcrStream={1}", ocrVidi, streamName);
|
||||
|
||||
/// Delegate for a thread->form communication
|
||||
ocrTextObtained = new OcrTextObtainedDelegate(OnOcrTextObtained);
|
||||
|
||||
/// Show and initalize the progress bar
|
||||
imageProcessingProgressLabel.Visible = true;
|
||||
imageProcessingProgressBar.Visible = true;
|
||||
imageProcessingProgressBar.Minimum = 0;
|
||||
imageProcessingProgressBar.Value = 0;
|
||||
imageProcessingProgressBar.Maximum = imagesCount;
|
||||
|
||||
/// Start the image processing thread
|
||||
imageProcessingThread = new Thread(new ThreadStart(ImageProcessingThread));
|
||||
imageProcessingThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void TestStartEndForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
if (imageProcessingThread != null && imageProcessingThread.IsAlive)
|
||||
{
|
||||
imageProcessingThread.Join(2000);
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Water_Meter_States;
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
Text = (ocrVidi != null)
|
||||
? string.Format("{0} ({1} / {2})", Strings.Water_Meter_States, ocrVidi, streamName)
|
||||
: Strings.Water_Meter_States;
|
||||
|
||||
startLabel.Text = startLabel2.Text = string.Format("{0} [{1}]", Strings.Start, unit.ToDescription());
|
||||
endLabel.Text = endLabel2.Text = string.Format("{0} [{1}]", Strings.End, unit.ToDescription());
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
int ImagesToProcessCount()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/// Count the images
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
if ((mode == Tst.Start || mode == Tst.Both) && startTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
startImages != null && startImages.Length > i && !string.IsNullOrEmpty(startImages[i]))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
if ((mode == Tst.End || mode == Tst.Both) && endTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
endImages != null && endImages.Length > i && !string.IsNullOrEmpty(endImages[i]))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void ImageProcessingThread()
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
|
||||
bool[] startImgProcessed = new bool[WaterMetersCount];
|
||||
bool[] endImgProcessed = new bool[WaterMetersCount];
|
||||
|
||||
for (int attempt = 1; attempt <= 3; attempt++)
|
||||
{
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
double pulsesPerLtr = (regReaders != null && regReaders.Length > i && regReaders[i] != null) ? regReaders[i].PulsesPerLtr : 1;
|
||||
GetOcrParameters(pulsesPerLtr, out denominator, out format);
|
||||
|
||||
if ((mode == Tst.Start || mode == Tst.Both) && startTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
startImages != null && startImages.Length > i && !string.IsNullOrEmpty(startImages[i]))
|
||||
{
|
||||
if (!startImgProcessed[i])
|
||||
{
|
||||
try
|
||||
{
|
||||
/// Process a start image
|
||||
var text = ocrVidi.Recognize(streamName, startImages[i], denominator, format); /// OCR
|
||||
this.Invoke(ocrTextObtained, new object[] { wm2phys[i + 1], false, text });
|
||||
startImgProcessed[i] = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((mode == Tst.End || mode == Tst.Both) && endTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
endImages != null && endImages.Length > i && !string.IsNullOrEmpty(endImages[i]))
|
||||
{
|
||||
if (!endImgProcessed[i])
|
||||
{
|
||||
try
|
||||
{
|
||||
/// Process an end image
|
||||
var text = ocrVidi.Recognize(streamName, endImages[i], denominator, format); /// OCR
|
||||
this.Invoke(ocrTextObtained, new object[] { wm2phys[i + 1], true, text });
|
||||
endImgProcessed[i] = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetOcrParameters(double pulsesPerLtr, out double denominator, out string format)
|
||||
{
|
||||
if (pulsesPerLtr == 0.1)
|
||||
{
|
||||
denominator = 100;
|
||||
format = "F2";
|
||||
}
|
||||
else if (pulsesPerLtr == 0.01)
|
||||
{
|
||||
denominator = 10;
|
||||
format = "F1";
|
||||
}
|
||||
else if (pulsesPerLtr == 10)
|
||||
{
|
||||
denominator = 10000;
|
||||
format = "F4";
|
||||
}
|
||||
else // if (pulsesPerLtr == 1)
|
||||
{
|
||||
denominator = 1000;
|
||||
format = "F3";
|
||||
}
|
||||
}
|
||||
|
||||
public void OnOcrTextObtained(int ix, bool isEnd, string text)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
if (ix < endTextBoxes.Length && endTextBoxes[ix].Enabled)
|
||||
{
|
||||
endTextBoxes[ix].Text = text;
|
||||
LoadImage(null, Tst.End, ix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ix < startTextBoxes.Length && startTextBoxes[ix].Enabled)
|
||||
{
|
||||
startTextBoxes[ix].Text = text;
|
||||
LoadImage(null, Tst.Start, ix);
|
||||
}
|
||||
}
|
||||
|
||||
imageProcessingProgressBar.Value++;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
try
|
||||
@@ -363,20 +565,28 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (wmPos > 0)
|
||||
{
|
||||
if (startTextBoxes[i].Enabled)
|
||||
if (startTextBoxes[i].Enabled && startTextBoxes[i].Text != WMStartStateStr[wmPos - 1])
|
||||
{
|
||||
WMStartStateStr[wmPos - 1] = startTextBoxes[i].Text;
|
||||
WMStartState[wmPos - 1] = Utils.ParseUDouble(startTextBoxes[i].Text) * regReaders[wmPos - 1].LtrsPerPulse;
|
||||
}
|
||||
double val;
|
||||
if (Utils.TryParseUDouble(startTextBoxes[i].Text, out val))
|
||||
{
|
||||
WMStartState[wmPos - 1] = Units.ConvertFrom(unit, val); /// Convert to liters
|
||||
WMStartStateStr[wmPos - 1] = startTextBoxes[i].Text;
|
||||
}
|
||||
}
|
||||
|
||||
if (endTextBoxes[i].Enabled)
|
||||
{
|
||||
WMEndState[wmPos - 1] = Utils.ParseUDouble(endTextBoxes[i].Text) * regReaders[wmPos - 1].LtrsPerPulse;
|
||||
double val;
|
||||
if (Utils.TryParseUDouble(endTextBoxes[i].Text, out val))
|
||||
{
|
||||
WMEndState[wmPos - 1] = Units.ConvertFrom(unit, val); /// Convert to liters
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
@@ -478,9 +688,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
try
|
||||
{
|
||||
double startVolumeLtr = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
|
||||
double endVolumeLtr = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
|
||||
double err = 100.0 * (endVolumeLtr - startVolumeLtr - refVolume) / refVolume;
|
||||
double startV = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text);
|
||||
double startVolumeL = (unit == Unit.pulse)
|
||||
? startV * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse
|
||||
: Units.ConvertFrom(unit, startV);
|
||||
|
||||
double endV = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text);
|
||||
double endVolumeL = (unit == Unit.pulse)
|
||||
? endV * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse
|
||||
: Units.ConvertFrom(unit, endV);
|
||||
|
||||
double err = 100.0 * (endVolumeL - startVolumeL - refVolume) / refVolume;
|
||||
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
catch
|
||||
@@ -572,7 +790,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (startTextBoxes[j] == currentTextBox)
|
||||
{
|
||||
LoadImage(Tst.Start, j);
|
||||
LoadImage(currentTextBox, Tst.Start, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -580,7 +798,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (endTextBoxes[j] == currentTextBox)
|
||||
{
|
||||
LoadImage(Tst.End, j);
|
||||
LoadImage(currentTextBox, Tst.End, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -593,103 +811,103 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
|
||||
private void startTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 0); }
|
||||
private void startTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 1); }
|
||||
private void startTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 2); }
|
||||
private void startTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 3); }
|
||||
private void startTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 4); }
|
||||
private void startTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 5); }
|
||||
private void startTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 6); }
|
||||
private void startTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 7); }
|
||||
private void startTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 8); }
|
||||
private void startTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 9); }
|
||||
private void startTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 10); }
|
||||
private void startTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 11); }
|
||||
private void startTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 12); }
|
||||
private void startTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 13); }
|
||||
private void startTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 14); }
|
||||
private void startTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 15); }
|
||||
private void startTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 16); }
|
||||
private void startTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 17); }
|
||||
private void startTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 18); }
|
||||
private void startTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 19); }
|
||||
private void startTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 20); }
|
||||
private void startTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 21); }
|
||||
private void startTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 22); }
|
||||
private void startTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 23); }
|
||||
private void startTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 0); }
|
||||
private void startTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 1); }
|
||||
private void startTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 2); }
|
||||
private void startTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 3); }
|
||||
private void startTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 4); }
|
||||
private void startTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 5); }
|
||||
private void startTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 6); }
|
||||
private void startTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 7); }
|
||||
private void startTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 8); }
|
||||
private void startTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 9); }
|
||||
private void startTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 10); }
|
||||
private void startTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 11); }
|
||||
private void startTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 12); }
|
||||
private void startTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 13); }
|
||||
private void startTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 14); }
|
||||
private void startTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 15); }
|
||||
private void startTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 16); }
|
||||
private void startTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 17); }
|
||||
private void startTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 18); }
|
||||
private void startTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 19); }
|
||||
private void startTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 20); }
|
||||
private void startTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 21); }
|
||||
private void startTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 22); }
|
||||
private void startTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 23); }
|
||||
private void startTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 0); }
|
||||
private void startTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 1); }
|
||||
private void startTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 2); }
|
||||
private void startTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 3); }
|
||||
private void startTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 4); }
|
||||
private void startTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 5); }
|
||||
private void startTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 6); }
|
||||
private void startTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 7); }
|
||||
private void startTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 8); }
|
||||
private void startTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 9); }
|
||||
private void startTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 10); }
|
||||
private void startTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 11); }
|
||||
private void startTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 12); }
|
||||
private void startTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 13); }
|
||||
private void startTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 14); }
|
||||
private void startTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 15); }
|
||||
private void startTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 16); }
|
||||
private void startTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 17); }
|
||||
private void startTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 18); }
|
||||
private void startTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 19); }
|
||||
private void startTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 20); }
|
||||
private void startTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 21); }
|
||||
private void startTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 22); }
|
||||
private void startTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 23); }
|
||||
private void startTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 0); }
|
||||
private void startTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 1); }
|
||||
private void startTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 2); }
|
||||
private void startTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 3); }
|
||||
private void startTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 4); }
|
||||
private void startTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 5); }
|
||||
private void startTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 6); }
|
||||
private void startTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 7); }
|
||||
private void startTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 8); }
|
||||
private void startTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 9); }
|
||||
private void startTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 10); }
|
||||
private void startTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 11); }
|
||||
private void startTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 12); }
|
||||
private void startTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 13); }
|
||||
private void startTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 14); }
|
||||
private void startTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 15); }
|
||||
private void startTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 16); }
|
||||
private void startTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 17); }
|
||||
private void startTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 18); }
|
||||
private void startTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 19); }
|
||||
private void startTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 20); }
|
||||
private void startTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 21); }
|
||||
private void startTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 22); }
|
||||
private void startTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 23); }
|
||||
|
||||
private void endTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 0); }
|
||||
private void endTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 1); }
|
||||
private void endTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 2); }
|
||||
private void endTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 3); }
|
||||
private void endTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 4); }
|
||||
private void endTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 5); }
|
||||
private void endTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 6); }
|
||||
private void endTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 7); }
|
||||
private void endTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 8); }
|
||||
private void endTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 9); }
|
||||
private void endTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 10); }
|
||||
private void endTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 11); }
|
||||
private void endTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 12); }
|
||||
private void endTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 13); }
|
||||
private void endTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 14); }
|
||||
private void endTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 15); }
|
||||
private void endTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 16); }
|
||||
private void endTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 17); }
|
||||
private void endTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 18); }
|
||||
private void endTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 19); }
|
||||
private void endTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 20); }
|
||||
private void endTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 21); }
|
||||
private void endTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 22); }
|
||||
private void endTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 23); }
|
||||
private void endTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 0); }
|
||||
private void endTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 1); }
|
||||
private void endTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 2); }
|
||||
private void endTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 3); }
|
||||
private void endTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 4); }
|
||||
private void endTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 5); }
|
||||
private void endTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 6); }
|
||||
private void endTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 7); }
|
||||
private void endTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 8); }
|
||||
private void endTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 9); }
|
||||
private void endTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 10); }
|
||||
private void endTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 11); }
|
||||
private void endTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 12); }
|
||||
private void endTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 13); }
|
||||
private void endTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 14); }
|
||||
private void endTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 15); }
|
||||
private void endTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 16); }
|
||||
private void endTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 17); }
|
||||
private void endTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 18); }
|
||||
private void endTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 19); }
|
||||
private void endTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 20); }
|
||||
private void endTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 21); }
|
||||
private void endTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 22); }
|
||||
private void endTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 23); }
|
||||
private void endTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 0); }
|
||||
private void endTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 1); }
|
||||
private void endTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 2); }
|
||||
private void endTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 3); }
|
||||
private void endTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 4); }
|
||||
private void endTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 5); }
|
||||
private void endTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 6); }
|
||||
private void endTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 7); }
|
||||
private void endTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 8); }
|
||||
private void endTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 9); }
|
||||
private void endTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 10); }
|
||||
private void endTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 11); }
|
||||
private void endTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 12); }
|
||||
private void endTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 13); }
|
||||
private void endTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 14); }
|
||||
private void endTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 15); }
|
||||
private void endTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 16); }
|
||||
private void endTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 17); }
|
||||
private void endTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 18); }
|
||||
private void endTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 19); }
|
||||
private void endTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 20); }
|
||||
private void endTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 21); }
|
||||
private void endTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 22); }
|
||||
private void endTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 23); }
|
||||
private void endTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 0); }
|
||||
private void endTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 1); }
|
||||
private void endTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 2); }
|
||||
private void endTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 3); }
|
||||
private void endTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 4); }
|
||||
private void endTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 5); }
|
||||
private void endTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 6); }
|
||||
private void endTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 7); }
|
||||
private void endTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 8); }
|
||||
private void endTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 9); }
|
||||
private void endTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 10); }
|
||||
private void endTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 11); }
|
||||
private void endTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 12); }
|
||||
private void endTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 13); }
|
||||
private void endTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 14); }
|
||||
private void endTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 15); }
|
||||
private void endTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 16); }
|
||||
private void endTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 17); }
|
||||
private void endTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 18); }
|
||||
private void endTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 19); }
|
||||
private void endTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 20); }
|
||||
private void endTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 21); }
|
||||
private void endTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 22); }
|
||||
private void endTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 23); }
|
||||
|
||||
/// <summary>
|
||||
/// Loads appropriate image into pictureBox1.Image
|
||||
@@ -697,17 +915,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
/// </summary>
|
||||
/// <param name="startOrEnd">Tst.Start or Tst.End</param>
|
||||
/// <param name="physPos">0..23</param>
|
||||
void LoadImage(Tst startOrEnd, int physPos)
|
||||
void LoadImage(object sender, Tst startOrEnd, int physPos)
|
||||
{
|
||||
ShowUnits(startOrEnd, physPos);
|
||||
|
||||
int wmNr1b = phys2wm[physPos]; /// 0 means no WM
|
||||
wmNr0b = Math.Max(0, wmNr1b - 1);
|
||||
if (wmNr1b <= 0) return;
|
||||
|
||||
wmNr0b = wmNr1b - 1;
|
||||
|
||||
string imageFileName;
|
||||
if ((startOrEnd == Tst.Start) && (wmNr1b > 0) && (startImages[wmNr0b] != null))
|
||||
if (startOrEnd == Tst.Start && startImages[wmNr0b] != null)
|
||||
imageFileName = startImages[wmNr0b];
|
||||
else if ((startOrEnd == Tst.End) && (wmNr1b > 0) && (endImages[wmNr0b] != null))
|
||||
else if (startOrEnd == Tst.End && endImages[wmNr0b] != null)
|
||||
imageFileName = endImages[wmNr0b];
|
||||
else
|
||||
imageFileName = string.Empty;
|
||||
@@ -718,6 +936,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
lastImageName = imageFileName;
|
||||
lastWmNr1 = wmNr1b;
|
||||
|
||||
if (string.IsNullOrEmpty(imageFileName) || !File.Exists(imageFileName))
|
||||
{
|
||||
@@ -725,16 +944,31 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Bitmap tempBmp = Image.FromFile(imageFileName) as Bitmap)
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
lastImage = new Bitmap(tempBmp.Clone(new Rectangle(leftMargin, 0, hght, hght), tempBmp.PixelFormat));
|
||||
if (isZoomed[wmNr0b])
|
||||
{
|
||||
zoomedImage = MakeZoomedImage(lastImage, zoomCenterLoc[wmNr0b]);
|
||||
}
|
||||
}
|
||||
using (Bitmap tempBmp = Image.FromFile(imageFileName) as Bitmap)
|
||||
{
|
||||
Rectangle rect;
|
||||
if (tempBmp.Height < tempBmp.Width)
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
rect = new Rectangle(leftMargin, 0, hght, hght);
|
||||
}
|
||||
else
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int wdth = tempBmp.Width;
|
||||
int margin = (hght - wdth) / 2;
|
||||
rect = new Rectangle(0, margin, wdth, wdth);
|
||||
}
|
||||
//int hght = tempBmp.Height;
|
||||
//int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
//lastImage = new Bitmap(tempBmp.Clone(new Rectangle(leftMargin, 0, hght, hght), tempBmp.PixelFormat));
|
||||
lastImage = new Bitmap(tempBmp.Clone(rect, tempBmp.PixelFormat));
|
||||
if (isZoomed[wmNr0b])
|
||||
{
|
||||
zoomedImage = MakeZoomedImage(lastImage, zoomCenterLoc[wmNr0b]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShowImage();
|
||||
@@ -752,7 +986,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (me.Button == MouseButtons.Left && !isZoomed[wmNr0b])
|
||||
{
|
||||
switch (imageRotation[wmNr0b])
|
||||
switch (imageRotation)
|
||||
{
|
||||
case Rotation.R0:
|
||||
zoomCenterLoc[wmNr0b] = me.Location;
|
||||
@@ -786,9 +1020,9 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (lastImage == null) return;
|
||||
|
||||
if (++imageRotation[wmNr0b] == Rotation.Count)
|
||||
if (++imageRotation == Rotation.Count)
|
||||
{
|
||||
imageRotation[wmNr0b] = Rotation.R0;
|
||||
imageRotation = Rotation.R0;
|
||||
}
|
||||
ShowImage();
|
||||
}
|
||||
@@ -807,9 +1041,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
return lastImage.Clone(newRect, oriImage.PixelFormat);
|
||||
}
|
||||
|
||||
///
|
||||
/// Used by ShowImage()
|
||||
///
|
||||
Brush lightBrush = new SolidBrush(Color.LightGreen);
|
||||
Brush darkBrush = new SolidBrush(Color.Green);
|
||||
Font largeFont = new Font("arial", 24.0F, FontStyle.Bold); /// normal image
|
||||
Font smallFont = new Font("arial", 12.0F, FontStyle.Bold); /// zoomed image
|
||||
|
||||
/// <summary>
|
||||
/// Show selected image in the picture box.
|
||||
/// lastImage, zoomedImage, isZoomed and imageRotation are used.
|
||||
/// lastWmNr1, lastImage, zoomedImage, isZoomed and imageRotation are used.
|
||||
/// </summary>
|
||||
void ShowImage()
|
||||
{
|
||||
@@ -823,96 +1065,37 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
? new Bitmap(zoomedImage.Clone(new Rectangle(0, 0, zoomedImage.Width, zoomedImage.Height), zoomedImage.PixelFormat))
|
||||
: new Bitmap(lastImage.Clone(new Rectangle(0, 0, lastImage.Width, lastImage.Height), lastImage.PixelFormat));
|
||||
|
||||
switch (imageRotation[wmNr0b])
|
||||
switch (imageRotation)
|
||||
{
|
||||
case Rotation.R90: tempBmp.RotateFlip(RotateFlipType.Rotate270FlipNone); break;
|
||||
case Rotation.R180: tempBmp.RotateFlip(RotateFlipType.Rotate180FlipNone); break;
|
||||
case Rotation.R270: tempBmp.RotateFlip(RotateFlipType.Rotate90FlipNone); break;
|
||||
}
|
||||
|
||||
/// Write water meter number to the bitmap
|
||||
using (var grph = Graphics.FromImage(tempBmp))
|
||||
{
|
||||
Font font = isZoomed[wmNr0b] ? smallFont : largeFont;
|
||||
int margin = isZoomed[wmNr0b] ? 1 : 2;
|
||||
|
||||
int pixelsCount = 0;
|
||||
int brightness = 0;
|
||||
for (int x = margin; x <= 8 * margin; x += margin)
|
||||
{
|
||||
for (int y = margin; y <= 8 * margin; y += margin)
|
||||
{
|
||||
brightness += (int)tempBmp.GetPixel(x, y).G;
|
||||
pixelsCount++;
|
||||
}
|
||||
}
|
||||
brightness /= pixelsCount;
|
||||
|
||||
Brush brush = (brightness > 160) ? darkBrush : lightBrush;
|
||||
|
||||
grph.DrawString(lastWmNr1.ToString(), font, brush, margin, margin);
|
||||
}
|
||||
|
||||
pictureBox1.Image = tempBmp;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates startLabel.Text, startLabel2.Text, endLabel.Text, endLabel2.Text
|
||||
/// Appends appropriate units of volume.
|
||||
/// Handles mouse clicks and Tab-changes inside text boxes.
|
||||
/// </summary>
|
||||
/// <param name="startEnd">Tst.Start or Tst.End</param>
|
||||
/// <param name="physPos">0..24</param>
|
||||
void ShowUnits(Tst startEnd, int physPos)
|
||||
{
|
||||
int wmNr = phys2wm[physPos];
|
||||
|
||||
if (wmNr > 0 && startEnd == Tst.Start)
|
||||
{
|
||||
if (regReaders[wmNr - 1] != null)
|
||||
{
|
||||
if (physPos < 12)
|
||||
{
|
||||
startLabel.Text = string.Format("{0} [{1}]", Strings.Start, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
startLabel2.Text = Strings.Start;
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = Strings.Start;
|
||||
startLabel2.Text = string.Format("{0} [{1}]", Strings.Start, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
}
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
else if (wmNr > 0 && startEnd == Tst.End)
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
|
||||
if (regReaders[wmNr - 1] != null)
|
||||
{
|
||||
if (physPos < 12)
|
||||
{
|
||||
endLabel.Text = string.Format("{0} [{1}]", Strings.End, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
endLabel2.Text = Strings.End;
|
||||
}
|
||||
else
|
||||
{
|
||||
endLabel.Text = Strings.End;
|
||||
endLabel2.Text = string.Format("{0} [{1}]", Strings.End, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
}
|
||||
///
|
||||
string GetUnitStr(double pulsesPerLtr)
|
||||
{
|
||||
if (pulsesPerLtr == 1 || pulsesPerLtr <= float.Epsilon)
|
||||
{
|
||||
return "l";
|
||||
}
|
||||
else if (pulsesPerLtr == 0.001)
|
||||
{
|
||||
return "m3";
|
||||
}
|
||||
else if (pulsesPerLtr == 1000)
|
||||
{
|
||||
return "ml";
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format("{0} l", 1 / pulsesPerLtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1549
-1522
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,736 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Results.Entities;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public partial class CycleBgEnForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBgEnForm));
|
||||
|
||||
/// Arguments
|
||||
public readonly IList<WaterMeter> WaterMeters;
|
||||
readonly int lineSize;
|
||||
readonly Sz sz;
|
||||
readonly bool isLrOrder; /// true = controls obtain focus after ENTER key in left-right order, false = top-down order
|
||||
readonly IList<DEItem> commonItems;
|
||||
readonly IList<DEItem> colItems;
|
||||
readonly bool isEnd;
|
||||
readonly string formCloseKeys;
|
||||
|
||||
/// Derived from arguments in the constructor
|
||||
readonly WaterMeter firstValidWM;
|
||||
readonly int wmsCount;
|
||||
readonly int linesCount;
|
||||
readonly int commonItemsCount;
|
||||
|
||||
/// Size and layout related values
|
||||
readonly Font font;
|
||||
readonly int meterHeight;
|
||||
readonly int meterWidth;
|
||||
readonly int margin;
|
||||
readonly int spacing;
|
||||
readonly int buttonsWidth;
|
||||
readonly int hdrHeight;
|
||||
readonly int labelWid;
|
||||
readonly int checkBoxWid;
|
||||
|
||||
/// UI elements
|
||||
readonly Label[] commonLabels;
|
||||
readonly ComboBox[] commonComboBoxes;
|
||||
readonly Label[] labels; /// Labels for water meter numbers
|
||||
readonly ComboBox[,] comboBoxes; /// Combo boxes for values in columns
|
||||
readonly CheckBox[] checkBoxes; /// Check boxes for water meter enable/disable
|
||||
|
||||
readonly LocalSettings ls;
|
||||
|
||||
bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor for common functionality
|
||||
/// </summary>
|
||||
public CycleBgEnForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Water meters</param>
|
||||
/// <param name="lineSize">Number of water meters in one (test bencch) line</param>
|
||||
/// <param name="title">Form title</param>
|
||||
/// <param name="sz">Font size</param>
|
||||
/// <param name="isLrOrder">true = controls obtain focus in left-right order, forls = top-down order</param>
|
||||
/// <param name="formCloseKeys">String containing keys to close this form</param>
|
||||
/// <param name="commonItems">Common items displayed in the upper part of the form</param>
|
||||
/// <param name="colItems">Water meter items displayed in columns (in the matrix in the main part of the form)</param>
|
||||
/// <param name="isEnd">true = This form is displayed at the end of cycle</param>
|
||||
public CycleBgEnForm(IList<WaterMeter> waterMeters, int lineSize, string title, Sz sz, bool isLrOrder, string formCloseKeys,
|
||||
IList<DEItem> commonItems, IList<DEItem> colItems, bool isEnd = false)
|
||||
: this()
|
||||
{
|
||||
/// Arguments
|
||||
this.WaterMeters = waterMeters;
|
||||
this.lineSize = lineSize;
|
||||
this.Text = !string.IsNullOrEmpty(title) ? title : string.Empty;
|
||||
this.sz = sz;
|
||||
this.isLrOrder = isLrOrder;
|
||||
this.formCloseKeys = !string.IsNullOrEmpty(formCloseKeys) ? formCloseKeys : string.Empty;
|
||||
this.commonItems = commonItems;
|
||||
this.colItems = colItems;
|
||||
this.isEnd = isEnd;
|
||||
|
||||
/// Preserve column items for use in SummaryResults
|
||||
if (!isEnd)
|
||||
{
|
||||
/// cycle beginning
|
||||
DEItem.ClearSummaryColumns();
|
||||
foreach (var it in colItems) if (it.Content != Ct.SerialNr) DEItem.AddSummaryColumn(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// cycle end
|
||||
foreach (var it in colItems) if (it.Content != Ct.SerialNr) DEItem.AddSummaryColumn(it);
|
||||
}
|
||||
|
||||
ls = Program.LocalSettings;
|
||||
|
||||
/// Readonly variables derived from arguments
|
||||
commonItemsCount = (commonItems == null) ? 0 : commonItems.Count;
|
||||
wmsCount = (waterMeters == null) ? 0 : waterMeters.Count;
|
||||
linesCount = (wmsCount + Math.Max(1, lineSize) - 1) / Math.Max(1, lineSize);
|
||||
firstValidWM = (waterMeters != null) ? waterMeters.FirstOrDefault(x => (x != null && !x.Disabled)) : null;
|
||||
///
|
||||
commonLabels = new Label[commonItemsCount];
|
||||
commonComboBoxes = new ComboBox[commonItemsCount];
|
||||
labels = new Label[wmsCount];
|
||||
comboBoxes = new ComboBox[colItems.Count, wmsCount];
|
||||
checkBoxes = new CheckBox[wmsCount];
|
||||
|
||||
/// Layout related readonly variables derived from argument 'sz'
|
||||
switch (sz)
|
||||
{
|
||||
case Sz.S:
|
||||
font = new Font("Verdana", 12, FontStyle.Regular);
|
||||
meterHeight = 26; /// Height of a ComboBox control
|
||||
margin = 20;
|
||||
spacing = 8;
|
||||
buttonsWidth = 350;
|
||||
hdrHeight = 120;
|
||||
labelWid = 31;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
|
||||
default:
|
||||
case Sz.M:
|
||||
font = new Font("Verdana", 14, FontStyle.Regular);
|
||||
meterHeight = 31; /// Height of a ComboBox control
|
||||
margin = 25;
|
||||
spacing = 10;
|
||||
buttonsWidth = 350;
|
||||
hdrHeight = 140;
|
||||
labelWid = 34;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
|
||||
case Sz.L:
|
||||
font = new Font("Verdana", 18, FontStyle.Regular);
|
||||
meterHeight = 37; /// Height of a ComboBox control
|
||||
margin = 30;
|
||||
spacing = 12;
|
||||
buttonsWidth = 350;
|
||||
hdrHeight = 160;
|
||||
labelWid = 40;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
}
|
||||
meterWidth = labelWid + checkBoxWid + spacing;
|
||||
foreach (var ci in colItems) { meterWidth += ci.Width + spacing; }
|
||||
|
||||
int tabIndex = 1;
|
||||
|
||||
///
|
||||
/// Group box with common items
|
||||
///
|
||||
int groupBoxWidth = 0;
|
||||
int groupBoxHeight = 0;
|
||||
if (commonItemsCount > 0)
|
||||
{
|
||||
var groupBox = new GroupBox();
|
||||
|
||||
int labelsWidth = 0;
|
||||
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||
{
|
||||
int oneLabelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(commonItems[ix].Caption, font).Width);
|
||||
var oneLabel = new Label
|
||||
{
|
||||
Text = commonItems[ix].Caption,
|
||||
Font = font,
|
||||
Location = new Point(margin, (ix + 2) * spacing + ix * meterHeight),
|
||||
Size = new Size(oneLabelWidth + spacing, meterHeight),
|
||||
TextAlign = ContentAlignment.MiddleLeft,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = groupBox,
|
||||
};
|
||||
groupBox.Controls.Add(oneLabel);
|
||||
labelsWidth = Math.Max(labelsWidth, oneLabelWidth);
|
||||
}
|
||||
|
||||
int combosWidth = 0;
|
||||
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||
{
|
||||
var cb = new ComboBox
|
||||
{
|
||||
Name = string.Format("-1~{0}", ix + 1),
|
||||
Location = new Point(margin + spacing + labelsWidth, (ix + 2) * spacing + ix * meterHeight),
|
||||
Size = new Size(commonItems[ix].Width, meterHeight),
|
||||
Enabled = (commonItems[ix].Action != Ac.LoadReadOnly),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = groupBox,
|
||||
};
|
||||
|
||||
cb.SelectedIndexChanged += new System.EventHandler(comboBox_SelectedIndexChanged);
|
||||
cb.TextChanged += new System.EventHandler(comboBox_TextChanged);
|
||||
cb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(comboBox_KeyPress);
|
||||
|
||||
switch (ix)
|
||||
{
|
||||
case 0: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm1 : ls.LastBgComm1); break;
|
||||
case 1: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm2 : ls.LastBgComm2); break;
|
||||
case 2: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm3 : ls.LastBgComm3); break;
|
||||
}
|
||||
|
||||
commonComboBoxes[ix] = cb;
|
||||
groupBox.Controls.Add(cb);
|
||||
combosWidth = Math.Max(combosWidth, commonItems[ix].Width);
|
||||
}
|
||||
///
|
||||
groupBox.Location = new Point(margin, margin - spacing);
|
||||
groupBoxWidth = labelsWidth + combosWidth + 2 * margin + spacing;
|
||||
groupBoxHeight = commonItemsCount * meterHeight + (commonItemsCount + 2) * spacing;
|
||||
groupBox.Size = new Size(groupBoxWidth, groupBoxHeight);
|
||||
groupBox.Font = font;
|
||||
groupBox.TabIndex = tabIndex++;
|
||||
groupBox.Parent = this;
|
||||
this.Controls.Add(groupBox);
|
||||
}
|
||||
|
||||
///
|
||||
/// Table
|
||||
///
|
||||
int columnsTop = Math.Max(hdrHeight, groupBoxHeight + 2 * margin + spacing);
|
||||
for (int j = 0; j < linesCount; j++)
|
||||
{
|
||||
/// Captions
|
||||
int capX = margin + j * (meterWidth + margin / 2) + labelWid + spacing;
|
||||
int capY = columnsTop - meterHeight;
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
int labelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(colItems[k].Caption, font).Width);
|
||||
var label = new Label
|
||||
{
|
||||
Text = colItems[k].Caption,
|
||||
Location = new Point(capX, capY),
|
||||
Size = new Size(labelWidth + spacing, meterHeight),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
capX += colItems[k].Width + spacing;
|
||||
}
|
||||
|
||||
/// Water meters
|
||||
for (int i = 0; i < lineSize; i++)
|
||||
{
|
||||
int wmPos0 = i + lineSize * j;
|
||||
if (wmPos0 > wmsCount) continue;
|
||||
|
||||
int left = margin + j * (meterWidth + margin / 2);
|
||||
int top = columnsTop + i * (meterHeight + spacing);
|
||||
|
||||
var label = new Label
|
||||
{
|
||||
Text = (wmPos0 + 1).ToString(),
|
||||
Location = new Point(left, top),
|
||||
Size = new Size(labelWid, meterHeight),
|
||||
Font = font,
|
||||
TextAlign = ContentAlignment.MiddleLeft,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
left += labelWid + spacing / 2;
|
||||
labels[wmPos0] = label;
|
||||
this.Controls.Add(label);
|
||||
|
||||
/// Columns
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
DEItem ci = colItems[k];
|
||||
var comboBox = new ComboBox
|
||||
{
|
||||
Name = string.Format("{0}~{1}", k, wmPos0),
|
||||
Location = new Point(left, top),
|
||||
Size = new Size(ci.Width, meterHeight),
|
||||
Enabled = (ci.Action != Ac.LoadReadOnly && !waterMeters[wmPos0].Disabled),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
|
||||
comboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
|
||||
comboBox.TextChanged += new System.EventHandler(this.comboBox_TextChanged);
|
||||
comboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox_KeyPress);
|
||||
|
||||
var lastVals = GetHistoryFromLS(isEnd, k);
|
||||
comboBox.Items.Add(lastVals.Length > wmPos0 ? lastVals[wmPos0] : string.Empty); /// History in drop-down menu
|
||||
|
||||
left += ci.Width + spacing;
|
||||
comboBoxes[k, wmPos0] = comboBox;
|
||||
this.Controls.Add(comboBox);
|
||||
}
|
||||
|
||||
var checkBox = new CheckBox
|
||||
{
|
||||
Location = new Point(left, top + 6),
|
||||
Size = new Size(checkBoxWid, 23),
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
checkBoxes[wmPos0] = checkBox;
|
||||
this.Controls.Add(checkBox);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Adjust window size
|
||||
///
|
||||
Rectangle screenRectangle = this.RectangleToScreen(this.ClientRectangle);
|
||||
int titleBarHeight = screenRectangle.Top - this.Top;
|
||||
Size = new Size(Math.Max(meterWidth * linesCount + margin * (linesCount + 1), margin + groupBoxWidth + buttonsWidth),
|
||||
titleBarHeight + columnsTop + lineSize * (meterHeight + spacing) + margin);
|
||||
|
||||
Localize();
|
||||
InitializeBoxes();
|
||||
|
||||
/// Set focus to the first enabled ComboBox
|
||||
bool activeControlFound = false;
|
||||
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||
{
|
||||
if (commonComboBoxes[ix].Enabled)
|
||||
{
|
||||
ActiveControl = commonComboBoxes[ix];
|
||||
activeControlFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!activeControlFound)
|
||||
{
|
||||
/// Initialize k,j so that after the 1st increment k = 0 and j = 0
|
||||
int k, j;
|
||||
if (isLrOrder) { k = -1; j = 0; }
|
||||
else { k = 0; j = -1; }
|
||||
|
||||
/// Change focus
|
||||
if (FindNextEnabledCombo(comboBoxes, ref k, ref j, isLrOrder))
|
||||
{
|
||||
ActiveControl = okButton;
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveControl = comboBoxes[k, j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add combo box items from a history stored in a string array (obtained usually from LocalSettings)
|
||||
/// </summary>
|
||||
/// <param name="comboBox">ComboBox to prepare</param>
|
||||
/// <param name="history">String array with a history</param>
|
||||
void AddHistoryToCombo(ComboBox comboBox, string[] history)
|
||||
{
|
||||
if (history != null)
|
||||
{
|
||||
for (int i = 0; i < history.Length; i++) comboBox.Items.Add(history[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array of strings from ls.
|
||||
/// Never returns null, null is converted to new string[0].
|
||||
/// </summary>
|
||||
/// <param name="isEnd">false = Beginning of cycle, true = End of cycle</param>
|
||||
/// <param name="k">Column number (0-based)</param>
|
||||
/// <returns>Array of strings</returns>
|
||||
string[] GetHistoryFromLS(bool isEnd, int k)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 0: if (ls.LastEnColA == null) ls.LastEnColA = new string[0]; return ls.LastEnColA;
|
||||
case 1: if (ls.LastEnColB == null) ls.LastEnColB = new string[0]; return ls.LastEnColB;
|
||||
case 2: if (ls.LastEnColC == null) ls.LastEnColC = new string[0]; return ls.LastEnColC;
|
||||
case 3: if (ls.LastEnColD == null) ls.LastEnColD = new string[0]; return ls.LastEnColD;
|
||||
case 4: if (ls.LastEnColE == null) ls.LastEnColE = new string[0]; return ls.LastEnColE;
|
||||
default: return new string[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 0: if (ls.LastBgColA == null) ls.LastBgColA = new string[0]; return ls.LastBgColA;
|
||||
case 1: if (ls.LastBgColB == null) ls.LastBgColB = new string[0]; return ls.LastBgColB;
|
||||
case 2: if (ls.LastBgColC == null) ls.LastBgColC = new string[0]; return ls.LastBgColC;
|
||||
case 3: if (ls.LastBgColD == null) ls.LastBgColD = new string[0]; return ls.LastBgColD;
|
||||
case 4: if (ls.LastBgColE == null) ls.LastBgColE = new string[0]; return ls.LastBgColE;
|
||||
default: return new string[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize combo boxes state defined by related 'Action'.
|
||||
/// Clear check boxes.
|
||||
/// </summary>
|
||||
void InitializeBoxes()
|
||||
{
|
||||
isHandlersEnabled = false;
|
||||
|
||||
/// Common combo boxes
|
||||
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||
{
|
||||
switch (commonItems[ix].Action)
|
||||
{
|
||||
default:
|
||||
case Ac.Clear:
|
||||
commonComboBoxes[ix].Text = string.Empty;
|
||||
break;
|
||||
|
||||
case Ac.HistoryLast:
|
||||
commonComboBoxes[ix].Text = (commonComboBoxes[ix].Items.Count > 0)
|
||||
? commonComboBoxes[ix].Items[0].ToString()
|
||||
: string.Empty;
|
||||
break;
|
||||
|
||||
case Ac.Load:
|
||||
case Ac.LoadReadOnly:
|
||||
commonComboBoxes[ix].Text = DEUtils.GetContent(commonItems[ix].Content, firstValidWM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// Table
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
switch (colItems[k].Action)
|
||||
{
|
||||
default:
|
||||
case Ac.Clear:
|
||||
for (int i = 0; i < wmsCount; i++) comboBoxes[k, i].Text = string.Empty;
|
||||
break;
|
||||
|
||||
case Ac.HistoryLast:
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
comboBoxes[k, i].Text = comboBoxes[k, i].Items.Count > 0 ? comboBoxes[k, i].Items[0].ToString() : string.Empty;
|
||||
}
|
||||
break;
|
||||
|
||||
case Ac.Load:
|
||||
case Ac.LoadReadOnly:
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
comboBoxes[k, i].Text = DEUtils.GetContent(colItems[k].Content, WaterMeters[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
checkBoxes[i].Checked = isEnd ? (WaterMeters[i] != null && !WaterMeters[i].Disabled) : false;
|
||||
}
|
||||
|
||||
isHandlersEnabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||
/// are updated by this function.
|
||||
/// </summary>
|
||||
void UpdateWMsFromBoxes()
|
||||
{
|
||||
for (int ix = 0; ix < commonItemsCount; ix++ )
|
||||
{
|
||||
DEUtils.PutContent(commonItems[ix].Content, firstValidWM, commonComboBoxes[ix].Text);
|
||||
if (commonItems[ix].Action != Ac.LoadReadOnly)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
switch (ix)
|
||||
{
|
||||
case 0: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm1); break;
|
||||
case 1: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm2); break;
|
||||
case 2: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm3); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (ix)
|
||||
{
|
||||
case 0: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm1); break;
|
||||
case 1: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm2); break;
|
||||
case 2: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm3); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Propagate common (batch) values to water meters in case of
|
||||
/// Content.BatchAndWmOrder, Content.BatchAndWmRemark, Content.YearOfCalibration and Content.ArchivePath
|
||||
///
|
||||
foreach (var wm in WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled)
|
||||
{
|
||||
switch (commonItems[ix].Content)
|
||||
{
|
||||
case Ct.BatchAndWmOrder: wm.PurchaseOrder = firstValidWM.Batch.PurchaseOrder; break;
|
||||
case Ct.BatchAndWmRemark: wm.Remark = firstValidWM.Batch.Remark; break;
|
||||
case Ct.YearOfCalibration: wm.YearOfProduction = firstValidWM.YearOfProduction; break;
|
||||
case Ct.ArchivePath: wm.ArchivePath = firstValidWM.ArchivePath; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
/// Store values to water meters and prepare an array for a history in the LocalSettings
|
||||
var currentVals = new string[wmsCount];
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
DEUtils.PutContent(colItems[k].Content, WaterMeters[i], comboBoxes[k, i].Text);
|
||||
currentVals[i] = comboBoxes[k, i].Text;
|
||||
}
|
||||
|
||||
/// Update history
|
||||
if (colItems[k].Action != Ac.LoadReadOnly)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 0: ls.LastEnColA = currentVals; break;
|
||||
case 1: ls.LastEnColB = currentVals; break;
|
||||
case 2: ls.LastEnColC = currentVals; break;
|
||||
case 3: ls.LastEnColD = currentVals; break;
|
||||
case 4: ls.LastEnColE = currentVals; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 0: ls.LastBgColA = currentVals; break;
|
||||
case 1: ls.LastBgColB = currentVals; break;
|
||||
case 2: ls.LastBgColC = currentVals; break;
|
||||
case 3: ls.LastBgColD = currentVals; break;
|
||||
case 4: ls.LastBgColE = currentVals; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
if (WaterMeters[i] != null) WaterMeters[i].Disabled = !checkBoxes[i].Checked;
|
||||
}
|
||||
}
|
||||
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
InitializeBoxes();
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateWMsFromBoxes();
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
private void comboBox_SelectedIndexChanged(object sndr, EventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
isHandlersEnabled = false;
|
||||
|
||||
if (k >= 0 && comboBoxes[k, j].Text == comboBoxes[k, j].Items[0].ToString())
|
||||
{
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
comboBoxes[k, i].Text = comboBoxes[k, i].Items[0].ToString();
|
||||
if (!string.IsNullOrEmpty(comboBoxes[k, i].Text)) checkBoxes[i].Checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
isHandlersEnabled = true;
|
||||
}
|
||||
|
||||
private void comboBox_KeyPress(object sndr, KeyPressEventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
/// Close the form if any 'form close key' was pressed
|
||||
for (int ix = 0; ix < formCloseKeys.Length; ix++)
|
||||
{
|
||||
if (e.KeyChar == formCloseKeys[ix])
|
||||
{
|
||||
okButton_Click(sndr, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
if (k < 0)
|
||||
{
|
||||
for (int ix = j; ix < commonItemsCount; ix++)
|
||||
{
|
||||
if (commonComboBoxes[ix].Enabled)
|
||||
{
|
||||
commonComboBoxes[ix].Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// No next enabled common item found:
|
||||
/// Initialize k,j so that after the 1st increment k = 0 and j = 0
|
||||
if (isLrOrder) { k = -1; j = 0; }
|
||||
else { k = 0; j = -1; }
|
||||
}
|
||||
|
||||
/// Change focus
|
||||
if (FindNextEnabledCombo(comboBoxes, ref k, ref j, isLrOrder))
|
||||
{
|
||||
okButton.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBoxes[k, j].Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBox_TextChanged(object sndr, EventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
if (k >= 0) checkBoxes[j].Checked = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find the next enabled combo box, update k and i.
|
||||
/// Return true (=pastTheEndOfArray) when there is no such next combo box.
|
||||
/// </summary>
|
||||
/// <param name="comboBoxes">2-dimensional array of combo boxes</param>
|
||||
/// <param name="k">0-nased column </param>
|
||||
/// <param name="i">0-based row</param>
|
||||
/// <param name="isLrOrder">Order of progress to the next combo: true = left-right, false = top-down</param>
|
||||
/// <returns>true (=pastTheEndOfArray) when there is no such next combo box, otherwise false</returns>
|
||||
bool FindNextEnabledCombo(ComboBox[,] comboBoxes, ref int k, ref int i, bool isLrOrder)
|
||||
{
|
||||
bool pastTheEndOfArray = false;
|
||||
do
|
||||
{
|
||||
if (isLrOrder)
|
||||
{
|
||||
if (++k == comboBoxes.GetLength(0))
|
||||
{
|
||||
k = 0;
|
||||
if (++i == comboBoxes.GetLength(1))
|
||||
{
|
||||
i = 0;
|
||||
pastTheEndOfArray = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++i == comboBoxes.GetLength(1))
|
||||
{
|
||||
i = 0;
|
||||
if (++k == comboBoxes.GetLength(0))
|
||||
{
|
||||
k = 0;
|
||||
pastTheEndOfArray = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!comboBoxes[k, i].Enabled);
|
||||
|
||||
return pastTheEndOfArray;
|
||||
}
|
||||
|
||||
#region Forced close handling
|
||||
|
||||
public void StartForceCloseHandler()
|
||||
{
|
||||
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
|
||||
{
|
||||
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
|
||||
else OnForceClose(sender, args);
|
||||
};
|
||||
}
|
||||
|
||||
private void OnForceClose(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
partial class CycleBgEnForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBgEnForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
resources.ApplyResources(this.clearButton, "clearButton");
|
||||
this.clearButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.clearButton.Name = "clearButton";
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// CycleBgEnForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.Controls.Add(this.clearButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBgEnForm";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button clearButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="okButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="okButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>942, 26</value>
|
||||
</data>
|
||||
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>112, 63</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="okButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="okButton.Text" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name=">>okButton.Name" xml:space="preserve">
|
||||
<value>okButton</value>
|
||||
</data>
|
||||
<data name=">>okButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>okButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>okButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="clearButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="clearButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="clearButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="clearButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>795, 26</value>
|
||||
</data>
|
||||
<data name="clearButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>112, 63</value>
|
||||
</data>
|
||||
<data name="clearButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="clearButton.Text" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name=">>clearButton.Name" xml:space="preserve">
|
||||
<value>clearButton</value>
|
||||
</data>
|
||||
<data name=">>clearButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>clearButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>clearButton.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1094, 561</value>
|
||||
</data>
|
||||
<data name="$this.MaximumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>10000, 10000</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Batch data</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>CycleBgEnForm</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,20 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
|
||||
{
|
||||
public EntryForm()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,305 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg myCfg;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
/// </summary>
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
|
||||
|
||||
double[] wmStartState;
|
||||
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
|
||||
|
||||
double[] wmEndState;
|
||||
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
|
||||
|
||||
string[] wmStartStateStr;
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
|
||||
|
||||
Common.Unit volumeUnit;
|
||||
double refVolume;
|
||||
double errLimLo;
|
||||
double errLimHi;
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
ShowFormAtCycleBeginning,
|
||||
ShowFormAtCycleEnd,
|
||||
EnterTestStartStates,
|
||||
EnterTestEndStates,
|
||||
}
|
||||
|
||||
CurrentOp currentOp;
|
||||
|
||||
|
||||
public EntryFormNoStartEnd() { }
|
||||
|
||||
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as EntryFormCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
disabled = new bool[TBF.Data.WMsCount];
|
||||
wmStartState = new double[TBF.Data.WMsCount];
|
||||
wmStartStateStr = new string[TBF.Data.WMsCount];
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||
volumeUnit = (TBF.Rig.Sequences.ProcessData.BenchInfo != null) ? TBF.Rig.Sequences.ProcessData.BenchInfo.VolumeUnit : Common.Unit.l;
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleEndFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
this.regReaders = regReaders;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
this.regReaders = regReaders;
|
||||
this.refVolume = refVolume;
|
||||
this.errLimLo = errLimLo;
|
||||
this.errLimHi = errLimHi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp = false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
|
||||
///
|
||||
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
DEItem.ClearItems();
|
||||
for (int i = 0; i < myCfg.GetBgItemsCount(); i++)
|
||||
{
|
||||
if (myCfg.BgItemContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddItem(myCfg.BgItemContent[i], myCfg.BgItemCaption[i], myCfg.BgItemAction[i], myCfg.BgItemWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
DEItem.ClearColumns();
|
||||
for (int i = 0; i < myCfg.GetBgColumnsCount(); i++)
|
||||
{
|
||||
if (myCfg.BgColumnContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddColumn(myCfg.BgColumnContent[i], myCfg.BgColumnCaption[i], myCfg.BgColumnAction[i], myCfg.BgColumnWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg = new CycleBgEnForm(waterMeters, TBF.Data.LineSize, myCfg.BgTitle, myCfg.BgSize, myCfg.BgIsLrOrder, myCfg.BgFormCloseKeys,
|
||||
DEItem.GetItems(), DEItem.GetColumns(), false);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenEndDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
DEItem.ClearItems();
|
||||
for (int i = 0; i < myCfg.GetEnItemsCount(); i++)
|
||||
{
|
||||
if (myCfg.EnItemContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddItem(myCfg.EnItemContent[i], myCfg.EnItemCaption[i], myCfg.EnItemAction[i], myCfg.EnItemWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
DEItem.ClearColumns();
|
||||
for (int i = 0; i < myCfg.GetEnColumnsCount(); i++)
|
||||
{
|
||||
if (myCfg.EnColumnContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddColumn(myCfg.EnColumnContent[i], myCfg.EnColumnCaption[i], myCfg.EnColumnAction[i], myCfg.EnColumnWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg = new CycleBgEnForm(waterMeters, TBF.Data.LineSize, myCfg.EnTitle, myCfg.EnSize, myCfg.EnIsLrOrder, myCfg.EnFormCloseKeys,
|
||||
DEItem.GetItems(), DEItem.GetColumns(), true);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
DEItem.ClearColumns();
|
||||
for (int i = 0; i < myCfg.GetTestColumnsCount(); i++)
|
||||
{
|
||||
if (myCfg.TestColumnContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddColumn(myCfg.TestColumnContent[i], myCfg.TestColumnCaption[i], myCfg.TestColumnAction[i], myCfg.TestColumnWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg = new TestStartEndForm(waterMeters, myRef.regReaders, TBF.Data.LineSize, myCfg.TestTitle, myCfg.TestSize,
|
||||
myCfg.TestStartBoxAlwaysEn, myCfg.TestIsLrOrder, myCfg.TestFormCloseKeys, DEItem.GetColumns(),
|
||||
volumeUnit);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
DEItem.ClearColumns();
|
||||
for (int i = 0; i < myCfg.GetTestColumnsCount(); i++)
|
||||
{
|
||||
if (myCfg.TestColumnContent[i] != Ct.None)
|
||||
{
|
||||
DEItem.AddColumn(myCfg.TestColumnContent[i], myCfg.TestColumnCaption[i], myCfg.TestColumnAction[i], myCfg.TestColumnWidth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg = new TestStartEndForm(waterMeters, myRef.regReaders, TBF.Data.LineSize, myCfg.TestTitle, myCfg.TestSize,
|
||||
myCfg.TestStartBoxAlwaysEn, myCfg.TestIsLrOrder, myCfg.TestFormCloseKeys, DEItem.GetColumns(),
|
||||
volumeUnit, wmStartStateStr, refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
resultSaved = false;
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.ShowFormAtCycleBeginning:
|
||||
if (myCfg.BgShowForm)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
|
||||
}
|
||||
break;
|
||||
case CurrentOp.ShowFormAtCycleEnd:
|
||||
if (myCfg.EnShowForm)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
|
||||
}
|
||||
break;
|
||||
case CurrentOp.EnterTestStartStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
|
||||
break;
|
||||
case CurrentOp.EnterTestEndStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsPrinted</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
|
||||
{
|
||||
return Event.ModelessFormIsOpen;
|
||||
}
|
||||
|
||||
if (!resultSaved) /// This is to save the result only once
|
||||
{
|
||||
if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
|
||||
{
|
||||
/// Fixed start test - start
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
volumeUnit = dlg.VolumeUnit;
|
||||
for (int i = 0; i < waterMeters.Count; i++)
|
||||
{
|
||||
if (!((i < waterMeters.Count && waterMeters[i].Disabled) || (i < regReaders.Length && regReaders[i] == null)))
|
||||
{
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
|
||||
{
|
||||
/// Fixed start test - end
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
volumeUnit = dlg.VolumeUnit;
|
||||
for (int i = 0; i < waterMeters.Count; i++)
|
||||
{
|
||||
if (!((i < waterMeters.Count && waterMeters[i].Disabled) || (i < regReaders.Length && regReaders[i] == null)))
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultSaved = true;
|
||||
modelessDlg = null;
|
||||
}
|
||||
|
||||
return Event.ModelessFormClosed; /// Form closed
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (modelessDlg is IHasCompleted)
|
||||
{
|
||||
UiBridge.Bridge.OnCloseModelessForm(this, null);
|
||||
modelessDlg = null;
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this, GetType().Namespace.Substring(8)); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public class FactoryNoStartEnd : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8) + "-NoStartEnd"; } }
|
||||
|
||||
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryFormNoStartEnd(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this, GetType().Namespace.Substring(8) + "-NoStartEnd"); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,600 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Results.Entities;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
/// Arguments
|
||||
public readonly IList<WaterMeter> waterMeters;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly int lineSize;
|
||||
readonly Sz sz;
|
||||
readonly bool isStartBoxAlwaysEn;
|
||||
readonly bool isLrOrder; /// true = controls obtain focus after ENTER key in left-right order, false = top-down order
|
||||
readonly IList<DEItem> colItems;
|
||||
readonly string formCloseKeys;
|
||||
public readonly string[] WMStartStateStr;
|
||||
readonly double refVolume;
|
||||
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
|
||||
/// Derived from arguments in the constructor
|
||||
readonly bool isEnd;
|
||||
readonly WaterMeter firstValidWM;
|
||||
readonly int wmsCount;
|
||||
readonly int linesCount;
|
||||
readonly bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
/// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
public double[] WMEndState;
|
||||
public Unit VolumeUnit;
|
||||
int startStateColumn;
|
||||
int endStateColumn;
|
||||
|
||||
/// Size and layout related values
|
||||
readonly int meterHeight;
|
||||
readonly int meterWidth;
|
||||
readonly int margin;
|
||||
readonly int spacing;
|
||||
readonly int hdrHeight;
|
||||
readonly int labelWid;
|
||||
readonly int checkBoxWid;
|
||||
|
||||
/// UI elements
|
||||
readonly Label[] labels; /// Labels for water meter numbers
|
||||
readonly TextBox[,] textBoxes; /// Text boxes for values in columns
|
||||
readonly Label[] exclamations;
|
||||
|
||||
readonly LocalSettings ls;
|
||||
|
||||
bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor for common functionality
|
||||
/// </summary>
|
||||
public TestStartEndForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Water meters</param>
|
||||
/// <param name="regReaders">Array of register readers</param>
|
||||
/// <param name="lineSize">Number of water meters in one (test bencch) line</param>
|
||||
/// <param name="title">Form title</param>
|
||||
/// <param name="sz">Font size</param>
|
||||
/// <param name="isLrOrder">true = controls obtain focus in left-right order, forls = top-down order</param>
|
||||
/// <param name="formCloseKeys">String containing keys to close this form</param>
|
||||
/// <param name="colItems">Water meter items displayed in columns (in the matrix in the main part of the form)</param>
|
||||
/// <param name="initialVolumeUnit">Volume unit preset initially</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(IList<WaterMeter> waterMeters, IRegReader[] regReaders, int lineSize, string title, Sz sz,
|
||||
bool isStartBoxAlwaysEn, bool isLrOrder, string formCloseKeys, IList<DEItem> colItems,
|
||||
Unit initialVolumeUnit, string[] wmStartStateStr = null,
|
||||
double refVolume = 0, double errLimLo = 0, double errLimHi = 0)
|
||||
: this()
|
||||
{
|
||||
this.waterMeters = waterMeters;
|
||||
this.regReaders = regReaders;
|
||||
this.lineSize = lineSize;
|
||||
this.Text = !string.IsNullOrEmpty(title) ? title : string.Empty;
|
||||
this.sz = sz;
|
||||
this.isStartBoxAlwaysEn = isStartBoxAlwaysEn;
|
||||
this.isLrOrder = isLrOrder;
|
||||
this.formCloseKeys = !string.IsNullOrEmpty(formCloseKeys) ? formCloseKeys : string.Empty;
|
||||
this.colItems = colItems;
|
||||
this.VolumeUnit = initialVolumeUnit;
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
if (waterMeters == null || regReaders == null ||
|
||||
(wmStartStateStr != null && wmStartStateStr.Length != waterMeters.Count))
|
||||
{
|
||||
throw new Exception("Invalid argument");
|
||||
}
|
||||
|
||||
ls = Program.LocalSettings;
|
||||
|
||||
/// Readonly variables derived from arguments
|
||||
isEnd = (wmStartStateStr != null);
|
||||
wmsCount = waterMeters.Count;
|
||||
if (WMStartStateStr == null) WMStartStateStr = new string[wmsCount];
|
||||
fixedErrorLimits = (errLimHi > errLimLo);
|
||||
linesCount = (wmsCount + Math.Max(1, lineSize) - 1) / Math.Max(1, lineSize);
|
||||
firstValidWM = waterMeters.FirstOrDefault(x => (x != null && !x.Disabled));
|
||||
WMStartState = new double[wmsCount];
|
||||
WMEndState = new double[wmsCount];
|
||||
///
|
||||
unitComboBox.Text = VolumeUnit.ToDescription();
|
||||
labels = new Label[wmsCount];
|
||||
textBoxes = new TextBox[colItems.Count, wmsCount];
|
||||
exclamations = new Label[wmsCount];
|
||||
|
||||
/// Layout related readonly variables derived from argument 'sz'
|
||||
Font font;
|
||||
Font exclamationFont;
|
||||
switch (sz)
|
||||
{
|
||||
case Sz.S:
|
||||
font = new Font("Verdana", 12, FontStyle.Regular);
|
||||
//exclamationFont = new Font("Verdana", 24F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(238)));
|
||||
exclamationFont = new Font("Verdana", 18, FontStyle.Bold);
|
||||
meterHeight = 26; /// Height of a ComboBox control
|
||||
margin = 20;
|
||||
spacing = 8;
|
||||
hdrHeight = 160;
|
||||
labelWid = 31;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
|
||||
default:
|
||||
case Sz.M:
|
||||
font = new Font("Verdana", 14, FontStyle.Regular);
|
||||
exclamationFont = new Font("Verdana", 20, FontStyle.Bold);
|
||||
meterHeight = 31; /// Height of a ComboBox control
|
||||
margin = 25;
|
||||
spacing = 10;
|
||||
hdrHeight = 160;
|
||||
labelWid = 34;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
|
||||
case Sz.L:
|
||||
font = new Font("Verdana", 18, FontStyle.Regular);
|
||||
exclamationFont = new Font("Verdana", 24, FontStyle.Bold);
|
||||
meterHeight = 37; /// Height of a ComboBox control
|
||||
margin = 30;
|
||||
spacing = 12;
|
||||
hdrHeight = 160;
|
||||
labelWid = 40;
|
||||
checkBoxWid = 23;
|
||||
break;
|
||||
}
|
||||
meterWidth = labelWid + checkBoxWid + spacing;
|
||||
foreach (var ci in colItems) { meterWidth += ci.Width + spacing; }
|
||||
|
||||
int tabIndex = 1;
|
||||
|
||||
///
|
||||
/// Table
|
||||
///
|
||||
int columnsTop = hdrHeight;
|
||||
for (int j = 0; j < linesCount; j++)
|
||||
{
|
||||
/// Captions
|
||||
int capX = margin + j * (meterWidth + margin / 2) + labelWid + spacing;
|
||||
int capY = columnsTop - meterHeight;
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
int labelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(colItems[k].Caption, font).Width);
|
||||
var label = new Label
|
||||
{
|
||||
Text = colItems[k].Caption,
|
||||
Location = new Point(capX, capY),
|
||||
Size = new Size(labelWidth + spacing, meterHeight),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
capX += colItems[k].Width + spacing;
|
||||
}
|
||||
|
||||
/// Water meters
|
||||
for (int i = 0; i < lineSize; i++)
|
||||
{
|
||||
int wmPos0 = i + lineSize * j;
|
||||
if (wmPos0 > wmsCount) continue;
|
||||
|
||||
int left = margin + j * (meterWidth + margin / 2);
|
||||
int top = columnsTop + i * (meterHeight + spacing);
|
||||
|
||||
var label = new Label
|
||||
{
|
||||
Text = (wmPos0 + 1).ToString(),
|
||||
Location = new Point(left, top),
|
||||
Size = new Size(labelWid, meterHeight),
|
||||
Font = font,
|
||||
TextAlign = ContentAlignment.MiddleLeft,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
left += labelWid + spacing / 2;
|
||||
labels[wmPos0] = label;
|
||||
this.Controls.Add(label);
|
||||
|
||||
/// Columns
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
DEItem ci = colItems[k];
|
||||
var textBox = new TextBox
|
||||
{
|
||||
Name = string.Format("{0}~{1}", k, wmPos0),
|
||||
Location = new Point(left, top),
|
||||
Size = new Size(ci.Width, meterHeight),
|
||||
Enabled = (ci.Action != Ac.LoadReadOnly && !waterMeters[wmPos0].Disabled),
|
||||
Font = font,
|
||||
TabIndex = tabIndex++,
|
||||
Parent = this,
|
||||
};
|
||||
|
||||
textBox.TextChanged += new System.EventHandler(textBox_TextChanged);
|
||||
textBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(textBox_KeyPress);
|
||||
textBox.MouseClick += new System.Windows.Forms.MouseEventHandler(textBox_MouseClick);
|
||||
|
||||
left += ci.Width + spacing;
|
||||
textBoxes[k, wmPos0] = textBox;
|
||||
this.Controls.Add(textBox);
|
||||
}
|
||||
|
||||
var exclamation = new Label
|
||||
{
|
||||
AutoSize = true,
|
||||
Font = exclamationFont,
|
||||
ForeColor = System.Drawing.Color.Red,
|
||||
Location = new Point(left, top),
|
||||
Parent = this,
|
||||
TabIndex = tabIndex++,
|
||||
Text = "!",
|
||||
Visible = false,
|
||||
};
|
||||
exclamations[wmPos0] = exclamation;
|
||||
this.Controls.Add(exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Adjust window size
|
||||
///
|
||||
Rectangle screenRectangle = this.RectangleToScreen(this.ClientRectangle);
|
||||
int titleBarHeight = screenRectangle.Top - this.Top;
|
||||
Size = new Size(Math.Max(meterWidth * linesCount + margin * (linesCount + 1), 1300),
|
||||
titleBarHeight + columnsTop + lineSize * (meterHeight + spacing) + margin);
|
||||
|
||||
Localize();
|
||||
InitializeBoxes();
|
||||
|
||||
/// Set focus to the first enabled ComboBox
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize combo boxes state defined by related 'Action'.
|
||||
/// Clear check boxes.
|
||||
/// </summary>
|
||||
void InitializeBoxes()
|
||||
{
|
||||
isHandlersEnabled = false;
|
||||
|
||||
/// Table
|
||||
startStateColumn = -1;
|
||||
endStateColumn = -1;
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
if (colItems[k].Content == Ct.StartState)
|
||||
{
|
||||
startStateColumn = k;
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
textBoxes[k, i].Text = (!isEnd || waterMeters[i] == null
|
||||
|| waterMeters[i].Disabled
|
||||
|| i >= regReaders.Length
|
||||
|| regReaders[i] == null
|
||||
|| string.IsNullOrEmpty(WMStartStateStr[i])) ? string.Empty : WMStartStateStr[i];
|
||||
|
||||
textBoxes[k, i].Enabled = (isStartBoxAlwaysEn || !isEnd) && waterMeters[i] != null && !waterMeters[i].Disabled
|
||||
&& i < regReaders.Length && regReaders[i] != null;
|
||||
}
|
||||
}
|
||||
else if (colItems[k].Content == Ct.EndState)
|
||||
{
|
||||
endStateColumn = k;
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
textBoxes[k, i].Text = string.Empty;
|
||||
textBoxes[k, i].Enabled = isEnd && waterMeters[i] != null && !waterMeters[i].Disabled
|
||||
&& i < regReaders.Length && regReaders[i] != null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (colItems[k].Action)
|
||||
{
|
||||
default:
|
||||
case Ac.Clear:
|
||||
case Ac.HistoryLast:
|
||||
for (int i = 0; i < wmsCount; i++) textBoxes[k, i].Text = string.Empty;
|
||||
break;
|
||||
|
||||
case Ac.Load:
|
||||
case Ac.LoadReadOnly:
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
textBoxes[k, i].Text = DEUtils.GetContent(colItems[k].Content, waterMeters[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isEnd && isStartBoxAlwaysEn)
|
||||
{
|
||||
int k = 0;
|
||||
int j = 0;
|
||||
if (!FindNextEnabledTextBox(textBoxes, ref k, ref j, isLrOrder, true))
|
||||
{
|
||||
ActiveControl = textBoxes[k, j];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
isHandlersEnabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||
/// are updated by this function.
|
||||
/// </summary>
|
||||
void UpdateWMsFromBoxes()
|
||||
{
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
if (colItems[k].Content == Ct.StartState)
|
||||
{
|
||||
/// Water meter start state
|
||||
double startVol;
|
||||
if (textBoxes[k, i].Enabled && Utils.TryParseUDouble(textBoxes[k, i].Text, out startVol))
|
||||
{
|
||||
WMStartStateStr[i] = textBoxes[k, i].Text;
|
||||
WMStartState[i] = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
}
|
||||
}
|
||||
else if (colItems[k].Content == Ct.EndState)
|
||||
{
|
||||
/// Water meter end state
|
||||
double endVol;
|
||||
if (textBoxes[k, i].Enabled && Utils.TryParseUDouble(textBoxes[k, i].Text, out endVol))
|
||||
{
|
||||
WMEndState[i] = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Other value - store values to a water meter structure
|
||||
DEUtils.PutContent(colItems[k].Content, waterMeters[i], textBoxes[k, i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
UpdateWMsFromBoxes();
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void unitComboBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
unitComboBox_SelectedIndexChanged(sender, e);
|
||||
}
|
||||
|
||||
private void unitComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var newUnit = Units.FromDescription(unitComboBox.Text);
|
||||
|
||||
if (Units.IsVolume(newUnit))
|
||||
{
|
||||
VolumeUnit = newUnit;
|
||||
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
/// Update exclamation marks
|
||||
if (isEnd && startStateColumn >= 0 && endStateColumn >= 0)
|
||||
{
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
double startVol, endVol;
|
||||
|
||||
if (Utils.TryParseUDouble(textBoxes[startStateColumn, i].Text, out startVol) &&
|
||||
Utils.TryParseUDouble(textBoxes[endStateColumn, i].Text, out endVol))
|
||||
{
|
||||
double startState = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
double endState = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
|
||||
exclamations[i].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
else
|
||||
{
|
||||
exclamations[i].Visible = !string.IsNullOrEmpty(textBoxes[endStateColumn, i].Text);
|
||||
}
|
||||
}
|
||||
|
||||
largeTextBox.Text = string.Empty;
|
||||
largeExclamationLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void textBox_KeyPress(object sndr, KeyPressEventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as TextBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
/// Close the form if any 'form close key' was pressed
|
||||
if (!string.IsNullOrEmpty(formCloseKeys))
|
||||
{
|
||||
/// Close the form if any 'close form key' was pressed
|
||||
for (int ix = 0; ix < formCloseKeys.Length; ix++)
|
||||
{
|
||||
if (e.KeyChar == formCloseKeys[ix])
|
||||
{
|
||||
okButton_Click(sndr, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Change focus
|
||||
if (FindNextEnabledTextBox(textBoxes, ref k, ref j, isLrOrder))
|
||||
{
|
||||
okButton.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
textBoxes[k, j].Focus();
|
||||
largeTextBox.Text = string.Format("{0}: {1}", j + 1, textBoxes[k, j].Text);
|
||||
largeExclamationLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle mouse clicks so that the large text box and the large exclamation mark are updated
|
||||
private void textBox_MouseClick(object sndr, MouseEventArgs e)
|
||||
{
|
||||
textBox_TextChanged(sndr, e);
|
||||
}
|
||||
|
||||
private void textBox_TextChanged(object sndr, EventArgs e)
|
||||
{
|
||||
if (!isHandlersEnabled) return;
|
||||
|
||||
string[] kj = (sndr as TextBox).Name.Split(new char[] { '~' });
|
||||
int k = int.Parse(kj[0]);
|
||||
int j = int.Parse(kj[1]);
|
||||
|
||||
largeTextBox.Text = string.Format("{0}: {1}", j + 1, textBoxes[k, j].Text);
|
||||
|
||||
if (isEnd && (k == startStateColumn || k == endStateColumn))
|
||||
{
|
||||
double startVol, endVol;
|
||||
|
||||
if (startStateColumn >= 0 && Utils.TryParseUDouble(textBoxes[startStateColumn, j].Text, out startVol) &&
|
||||
endStateColumn >= 0 && Utils.TryParseUDouble(textBoxes[endStateColumn, j].Text, out endVol))
|
||||
{
|
||||
double startState = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
double endState = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
|
||||
largeExclamationLabel.Visible =
|
||||
exclamations[j].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
else
|
||||
{
|
||||
largeExclamationLabel.Visible =
|
||||
exclamations[j].Visible = !string.IsNullOrEmpty(textBoxes[endStateColumn, j].Text);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
largeExclamationLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Find the next enabled combo box, update k and i.
|
||||
/// Return true (=pastTheEndOfArray) when there is no such next combo box.
|
||||
/// </summary>
|
||||
/// <param name="textBoxes">2-dimensional array of combo boxes</param>
|
||||
/// <param name="k">0-nased column </param>
|
||||
/// <param name="i">0-based row</param>
|
||||
/// <param name="isLrOrder">Order of progress to the next combo: true = left-right, false = top-down</param>
|
||||
/// <returns>true (=pastTheEndOfArray) when there is no such next combo box, otherwise false</returns>
|
||||
bool FindNextEnabledTextBox(TextBox[,] textBoxes, ref int k, ref int i, bool isLrOrder, bool skipStartColumn = false)
|
||||
{
|
||||
bool pastTheEndOfArray = false;
|
||||
do
|
||||
{
|
||||
if (isLrOrder)
|
||||
{
|
||||
if (++k == textBoxes.GetLength(0))
|
||||
{
|
||||
k = 0;
|
||||
if (++i == textBoxes.GetLength(1))
|
||||
{
|
||||
i = 0;
|
||||
pastTheEndOfArray = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++i == textBoxes.GetLength(1))
|
||||
{
|
||||
i = 0;
|
||||
if (++k == textBoxes.GetLength(0))
|
||||
{
|
||||
k = 0;
|
||||
pastTheEndOfArray = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!textBoxes[k, i].Enabled || (skipStartColumn && k == startStateColumn));
|
||||
|
||||
return pastTheEndOfArray;
|
||||
}
|
||||
|
||||
#region Forced close handling
|
||||
|
||||
public void StartForceCloseHandler()
|
||||
{
|
||||
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
|
||||
{
|
||||
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
|
||||
else OnForceClose(sender, args);
|
||||
};
|
||||
}
|
||||
|
||||
void OnForceClose(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.DataEntry.Uni
|
||||
{
|
||||
partial class TestStartEndForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.largeTextBox = new System.Windows.Forms.TextBox();
|
||||
this.largeExclamationLabel = new System.Windows.Forms.Label();
|
||||
this.unitComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Location = new System.Drawing.Point(1120, 29);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(123, 63);
|
||||
this.okButton.TabIndex = 100;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// largeTextBox
|
||||
//
|
||||
this.largeTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.largeTextBox.Location = new System.Drawing.Point(35, 29);
|
||||
this.largeTextBox.Name = "largeTextBox";
|
||||
this.largeTextBox.Size = new System.Drawing.Size(849, 80);
|
||||
this.largeTextBox.TabIndex = 101;
|
||||
//
|
||||
// largeExclamationLabel
|
||||
//
|
||||
this.largeExclamationLabel.AutoSize = true;
|
||||
this.largeExclamationLabel.Font = new System.Drawing.Font("Verdana", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.largeExclamationLabel.ForeColor = System.Drawing.Color.Red;
|
||||
this.largeExclamationLabel.Location = new System.Drawing.Point(890, 28);
|
||||
this.largeExclamationLabel.Name = "largeExclamationLabel";
|
||||
this.largeExclamationLabel.Size = new System.Drawing.Size(59, 78);
|
||||
this.largeExclamationLabel.TabIndex = 102;
|
||||
this.largeExclamationLabel.Text = "!";
|
||||
this.largeExclamationLabel.Visible = false;
|
||||
//
|
||||
// unitComboBox
|
||||
//
|
||||
this.unitComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.unitComboBox.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.unitComboBox.FormattingEnabled = true;
|
||||
this.unitComboBox.Location = new System.Drawing.Point(962, 46);
|
||||
this.unitComboBox.Name = "unitComboBox";
|
||||
this.unitComboBox.Size = new System.Drawing.Size(123, 31);
|
||||
this.unitComboBox.TabIndex = 103;
|
||||
this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged);
|
||||
this.unitComboBox.TextChanged += new System.EventHandler(this.unitComboBox_TextChanged);
|
||||
//
|
||||
// TestStartEndForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.ClientSize = new System.Drawing.Size(1284, 676);
|
||||
this.Controls.Add(this.unitComboBox);
|
||||
this.Controls.Add(this.largeExclamationLabel);
|
||||
this.Controls.Add(this.largeTextBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "TestStartEndForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "End States";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.TextBox largeTextBox;
|
||||
private System.Windows.Forms.Label largeExclamationLabel;
|
||||
private System.Windows.Forms.ComboBox unitComboBox;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -193,7 +193,7 @@ namespace TBF.Rig.DataEntry.iPerl
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (orderComboBox.Text.Length > 8 ||
|
||||
if (orderComboBox.Text.Length > 10 ||
|
||||
(cfg.Orders != Orders.Arbitrary && !orderComboBox.Items.Contains(orderComboBox.Text)))
|
||||
{
|
||||
MessageBox.Show(Strings.Invalid_order_number, Strings.Error, MessageBoxButtons.OK,
|
||||
|
||||
@@ -120,11 +120,11 @@ namespace TBF.Rig.Elde
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
#endif
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
#elif CEVAK_200 || DN100 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || SENTEC
|
||||
#elif CEVAK_200 || DN100 || FUZHOU_150 || IZRAEL_200 || SENTEC
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 };
|
||||
#elif BERLIN || GELSENWASSER || GENESIS || PETERSBURG_200 || PUCHONG_200 || RUM_MOB || SLM_150
|
||||
#elif BERLIN || FUZHOU_300 || GELSENWASSER || GENESIS || PETERSBURG_200 || PUCHONG_200 || RUM_MOB || SLM_150
|
||||
public uint[,] RegValveCalib = new uint[16, 2] { {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500},
|
||||
{100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500} };
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace TBF.Rig.Elde
|
||||
public UInt128 RRoute { get { return ctrlBrdComponent.rRoute; } }
|
||||
#endif
|
||||
|
||||
#if ALZIR_25 || BADGER_STREDNA_TRAT || BAHRAIN_50 || CEVAK_200 || DEWA_300 || FEWA_50 || FUZHOU_100 || FILIPINY_50 || GELSENWASSER || GENESIS || HONGKONG_50 || IZRAEL_25 || IZRAEL_50 || JUZNA_AFRIKA_50 || KEMPNO_50 || KRAKOW_50 || LUXEMBURG_40 || MILWAUKEE || PUCHONG_200 || ROMA_200 || SENTEC || TURA_IPERL_NEW || WARSAW_50 || ZAMBIA || ZODINO
|
||||
#if ALZIR_25 || BADGER_STREDNA_TRAT || BAHRAIN_50 || CEVAK_200 || DEWA_300 || FEWA_50 || FUZHOU_100 || FUZHOU_300 || FILIPINY_50 || GELSENWASSER || GENESIS || HONGKONG_50 || IZRAEL_25 || IZRAEL_50 || JUZNA_AFRIKA_50 || KEMPNO_50 || KRAKOW_50 || LUXEMBURG_40 || MILWAUKEE || PUCHONG_200 || ROMA_200 || SENTEC || TURA_IPERL_NEW || WARSAW_50 || ZAMBIA || ZODINO
|
||||
public uint DivTime(int id) { return ctrlBrdComponent.divTime[id]; }
|
||||
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ namespace TBF.Rig.Elde
|
||||
}
|
||||
public float DivSamples(int time, int divIx0)
|
||||
{
|
||||
#if FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || MUNICH
|
||||
#if FUZHOU_50 || FUZHOU_150 || IZRAEL_200 || MUNICH
|
||||
return ctrlBrdComponent.DIVSamples[time, 0];
|
||||
#else
|
||||
return ctrlBrdComponent.DIVSamples[time, divIx0];
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace TBF.Rig.Elde.CoverTest
|
||||
{
|
||||
if (!Users.CurrentUser.IsMemberOf(bypassLevel))
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(bypassLevel, this)).ShowDialog() != DialogResult.OK)
|
||||
if ((new Users.Forms.LoginDlg(TBF.DB.UserSessionFactories, bypassLevel, this)).ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,6 +9,7 @@ using Dirichlet.Numerics;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Calendar;
|
||||
|
||||
namespace TBF.Rig.Elde.Diverter
|
||||
{
|
||||
@@ -91,8 +92,10 @@ namespace TBF.Rig.Elde.Diverter
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Unable to set {0} ADC levels: RegValveCalib array size={1}, diverter AdcNr={2}",
|
||||
Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
|
||||
string message = string.Format("Cannot save calibration: RegValveCalib[] size={1}, ADC#={2}",
|
||||
Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
|
||||
log.Error(message);
|
||||
throw new Exception(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,35 +153,51 @@ namespace TBF.Rig.Elde.Diverter
|
||||
///
|
||||
/// Calendar support
|
||||
///
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
public List<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = diverterCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
var calEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
DateTime calibDue = diverterCfg.CalibValidDate;
|
||||
if (calibDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
/// Five weekly notifications
|
||||
foreach (var days in new int[] { -35, -28, -21, -14 })
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
if (calibDue.Date.AddDays(days + 6) >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Notification,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
|
||||
/// Five daily warnings
|
||||
foreach (var days in new int[] { -7, -6, -5, -4, -3, -2, -1 })
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
if (calibDue.Date.AddDays(days) >= DateTime.Now.Date)
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Warning,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
|
||||
/// Calibration due date
|
||||
if (calibDue.Date >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationDueDateEvent(calibDue.Date,
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
|
||||
return calEvents;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,6 +7,7 @@ using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Calendar;
|
||||
|
||||
namespace TBF.Rig.Elde.FlowMeter
|
||||
{
|
||||
@@ -68,7 +69,7 @@ namespace TBF.Rig.Elde.FlowMeter
|
||||
{
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (RangeEnabled(r) && flowMeterCfg.GetCalibValidDate(r) != DateTime.MinValue
|
||||
if (RangeEnabled(r) && flowMeterCfg.GetCalibValidDate(r) > DateTime.MinValue
|
||||
&& flowMeterCfg.GetCalibValidDate(r).Date < DateTime.Now.Date)
|
||||
{
|
||||
throw new Exception(string.Format("{0}/r{1}: {2}", Name, r, Strings.Calibration_certificate_validity_expired));
|
||||
@@ -86,35 +87,51 @@ namespace TBF.Rig.Elde.FlowMeter
|
||||
///
|
||||
/// Calendar support
|
||||
///
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
public List<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = flowMeterCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
var calEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
DateTime calibDue = flowMeterCfg.CalibValidDate;
|
||||
if (calibDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
/// Five weekly notifications
|
||||
foreach (var days in new int[] { -35, -28, -21, -14 })
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
if (calibDue.Date.AddDays(days + 6) >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Notification,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
|
||||
/// Five daily warnings
|
||||
foreach (var days in new int[] { -7, -6, -5, -4, -3, -2, -1 })
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
if (calibDue.Date.AddDays(days) >= DateTime.Now.Date)
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calEvents.Add(new CalibrationReminderEvent(Config.CalendarEvent.AutoAction.Warning,
|
||||
calibDue.Date.AddDays(days),
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
|
||||
/// Calibration due date
|
||||
if (calibDue.Date >= DateTime.Now.Date)
|
||||
{
|
||||
calEvents.Add(new CalibrationDueDateEvent(calibDue.Date,
|
||||
Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
|
||||
return calEvents;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user