Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc4f280abd |
@@ -1,2 +0,0 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto
|
||||
@@ -1,21 +1,15 @@
|
||||
Config/bin/
|
||||
Config/obj/
|
||||
Decrypt/bin/
|
||||
Decrypt/obj/
|
||||
DeviceTest/bin/
|
||||
DeviceTest/obj/
|
||||
Dirichlet.Numerics/bin
|
||||
Dirichlet.Numerics/obj
|
||||
Encrypt/bin/
|
||||
Encrypt/obj/
|
||||
GemCard/bin
|
||||
GemCard/obj
|
||||
GraphLib/bin
|
||||
GraphLib/obj
|
||||
TracingDB/bin
|
||||
TracingDB/obj
|
||||
RestClient/bin
|
||||
RestClient/obj
|
||||
Results/bin/
|
||||
Results/obj/
|
||||
ResultsBrowser/bin/
|
||||
@@ -31,6 +25,5 @@ Users/obj/
|
||||
UserManagement/bin/
|
||||
UserManagement/obj/
|
||||
Doc/
|
||||
.vs/
|
||||
*.suo
|
||||
*.bak
|
||||
|
||||
+10
-13
@@ -10,30 +10,27 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Config</RootNamespace>
|
||||
<AssemblyName>Config</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TORINO_50;LANG_IT</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;TORINO_50;LANG_IT</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
@@ -86,15 +83,15 @@
|
||||
<Compile Include="Entities\MetersPath.cs" />
|
||||
<Compile Include="Entities\OutputPath.cs" />
|
||||
<Compile Include="Entities\Procedure.cs" />
|
||||
<Compile Include="Entities\Profile.cs" />
|
||||
<Compile Include="Entities\PTest.cs" />
|
||||
<Compile Include="Entities\ProcedureHistory.cs" />
|
||||
<Compile Include="Entities\Test.cs" />
|
||||
<Compile Include="Entities\TransitionSequence.cs" />
|
||||
<Compile Include="Entities\TransitionStep.cs" />
|
||||
<Compile Include="Entities\Uncertainty.cs" />
|
||||
<Compile Include="Entities\User.cs" />
|
||||
<Compile Include="Entities\VirtualBenchSequence.cs" />
|
||||
<Compile Include="Entities\VirtualBenchStep.cs" />
|
||||
<Compile Include="Entities\Watermeter.cs" />
|
||||
<Compile Include="Entities\WMType.cs" />
|
||||
<Compile Include="FluentCommon.cs" />
|
||||
<Compile Include="Formulas.cs" />
|
||||
<Compile Include="Mappings\BenchPathMap.cs" />
|
||||
@@ -108,13 +105,14 @@
|
||||
<Compile Include="Mappings\MetersPathMap.cs" />
|
||||
<Compile Include="Mappings\OutputPathMap.cs" />
|
||||
<Compile Include="Mappings\ProcedureMap.cs" />
|
||||
<Compile Include="Mappings\ProfileMap.cs" />
|
||||
<Compile Include="Mappings\PTestMap.cs" />
|
||||
<Compile Include="Mappings\TestMap.cs" />
|
||||
<Compile Include="Mappings\TransitionSequenceMap.cs" />
|
||||
<Compile Include="Mappings\TransitionStepMap.cs" />
|
||||
<Compile Include="Mappings\UncertaintyMap.cs" />
|
||||
<Compile Include="Mappings\UserMap.cs" />
|
||||
<Compile Include="Mappings\VirtualBenchSequenceMap.cs" />
|
||||
<Compile Include="Mappings\VirtualBenchStepMap.cs" />
|
||||
<Compile Include="Mappings\WatermeterMap.cs" />
|
||||
<Compile Include="Mappings\WMTypeMap.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\Strings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -127,7 +125,6 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\Strings.cs.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.de.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.fr.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.it.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.pl.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.resx">
|
||||
|
||||
+6
-22
@@ -10,8 +10,8 @@ namespace Config
|
||||
|
||||
#if MUNICH
|
||||
public const int WMsCount = 3;
|
||||
public const int LineSize = 3;
|
||||
public const int CompoundWMsCount = 3;
|
||||
public const int LineSize = 1;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
|
||||
@@ -20,24 +20,12 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif PUCHONG_200
|
||||
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || PUCHONG_200 || GENESIS || SLM_150 || PETERSBURG_200
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 3;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif DEWA_300 || ROMA_200
|
||||
public const int WMsCount = 10;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif DUBAJ_50
|
||||
public const int WMsCount = 10;
|
||||
public const int LineSize = 5;
|
||||
@@ -62,7 +50,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 1;
|
||||
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || ALZIR_25
|
||||
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50
|
||||
public const int WMsCount = 20;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 1;
|
||||
@@ -74,7 +62,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif TURA_IPERL || TURA_IPERL_NEW
|
||||
#elif TURA_IPERL
|
||||
public const int WMsCount = 40;
|
||||
public const int LineSize = 20;
|
||||
public const int CompoundWMsCount = 1;
|
||||
@@ -110,9 +98,5 @@ namespace Config
|
||||
/// Database related: This object reference is set after a successful user login
|
||||
///
|
||||
public static DatabaseSettings CurrentBench;
|
||||
|
||||
public static double RealDensity = 0; /// true water density [kg/m3]
|
||||
public static double AtTemperature = 0; /// measured at temperature [°C]
|
||||
public static double Buoyancy = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
@@ -18,7 +19,6 @@ namespace Config.Entities
|
||||
public virtual LogLevel Logging { get; set; }
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual IList<MeasurementCorrection> Corrections { get; set; }
|
||||
public virtual IList<Uncertainty> Uncertainties { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Config.Entities
|
||||
Name = string.Empty;
|
||||
ClassName = string.Empty;
|
||||
Corrections = new List<MeasurementCorrection>();
|
||||
Uncertainties = new List<Uncertainty>();
|
||||
}
|
||||
|
||||
public static Component CreateFromCfg(string name, string className, string parentName, int itemNr,
|
||||
|
||||
+16
-206
@@ -83,23 +83,6 @@ namespace Config.Entities
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ProfileType
|
||||
{
|
||||
Q3R,
|
||||
QnClassColdWater,
|
||||
QnClassHotWater,
|
||||
QpQi,
|
||||
Manual,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ErrorLimitType
|
||||
{
|
||||
Manual,
|
||||
QpClass,
|
||||
Count,
|
||||
}
|
||||
|
||||
/// <summary> Kind of meters for the procedure / test </summary>
|
||||
public enum MetersKind
|
||||
{
|
||||
@@ -107,10 +90,6 @@ namespace Config.Entities
|
||||
[Description("Wasserzähler")] Single,
|
||||
[Description("Verbundwasserzähler")] Combined,
|
||||
[Description("Wärmezähler")] HeatMeter,
|
||||
#elif LANG_FR
|
||||
[Description("Compteurs eau")] Single,
|
||||
[Description("Mètres composés")] Combined,
|
||||
[Description("Thermomètres")] HeatMeter,
|
||||
#elif LANG_CS
|
||||
[Description("Vodoměry")] Single,
|
||||
[Description("Kombinované vodoměry")] Combined,
|
||||
@@ -146,9 +125,6 @@ namespace Config.Entities
|
||||
#elif LANG_IT
|
||||
[Description("freddo")] ColdWater,
|
||||
[Description("caldo")] HotWater,
|
||||
#elif LANG_FR
|
||||
[Description("eau froide")] ColdWater,
|
||||
[Description("eau chaude")] HotWater,
|
||||
#else
|
||||
[Description("cold")] ColdWater,
|
||||
[Description("hot")] HotWater,
|
||||
@@ -264,11 +240,6 @@ namespace Config.Entities
|
||||
[Description("immer")] Always = 1,
|
||||
[Description("Bildschirm")] OnScreen = 2,
|
||||
[Description("intern")] Internal = 3,
|
||||
#elif LANG_FR
|
||||
[Description("jamais")] Never = 0,
|
||||
[Description("toujours")] Always = 1,
|
||||
[Description("À l'écran")] OnScreen = 2,
|
||||
[Description("interne")] Internal = 3,
|
||||
#elif LANG_CS
|
||||
/// czech
|
||||
[Description("nikdy")] Never = 0,
|
||||
@@ -310,10 +281,6 @@ namespace Config.Entities
|
||||
[Description("Waage")] Scale,
|
||||
[Description("Spanne")] Spread,
|
||||
[Description("Standardabw.")] StdDev,
|
||||
#elif LANG_FR
|
||||
[Description("Balance")] Scale,
|
||||
[Description("Envergure")] Spread,
|
||||
[Description("Déviation std.")] StdDev,
|
||||
#elif LANG_CS
|
||||
/// cesky
|
||||
[Description("váhou")] Scale,
|
||||
@@ -324,16 +291,22 @@ namespace Config.Entities
|
||||
[Description("Spread")] Spread,
|
||||
[Description("Std.dev.")] StdDev,
|
||||
#endif
|
||||
Count
|
||||
Count
|
||||
}
|
||||
|
||||
public enum TestProfile
|
||||
public enum TestRedType
|
||||
{
|
||||
UserDefined,
|
||||
UserDefinedHeatMeter,
|
||||
Protected, /// The first protected one
|
||||
ProtectedHeatMeter,
|
||||
}
|
||||
Fix,
|
||||
/// etc.
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum FQC1
|
||||
{
|
||||
FQC1,
|
||||
FQP1,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum Progress
|
||||
{
|
||||
@@ -372,14 +345,6 @@ namespace Config.Entities
|
||||
[Description("Prüfpunktergebnisse")] TestResult,
|
||||
[Description("Wasserzelledaten")] MeterData,
|
||||
[Description("Wasserzelleergebnisse")] MeterResult,
|
||||
#elif LANG_FR
|
||||
[Description("Autres")] Other,
|
||||
[Description("Données de banc")] BenchData,
|
||||
[Description("Résultats du banc")] BenchResult,
|
||||
[Description("Données de test")] TestData,
|
||||
[Description("Résultats de test")] TestResult,
|
||||
[Description("Données du compteur d'eau")] MeterData,
|
||||
[Description("Résultats du compteur d'eau")] MeterResult,
|
||||
#else
|
||||
[Description("Other")] Other,
|
||||
[Description("Bench data")] BenchData,
|
||||
@@ -389,7 +354,7 @@ namespace Config.Entities
|
||||
[Description("Meter data")] MeterData,
|
||||
[Description("Meter result")] MeterResult,
|
||||
#endif
|
||||
Count,
|
||||
Count,
|
||||
}
|
||||
|
||||
/// <summary> Possible modes of operation of components and devices. </summary>
|
||||
@@ -406,17 +371,6 @@ namespace Config.Entities
|
||||
[Description("Reply")] Reply,
|
||||
[Description("Simuliert")] Simulate, /// Test bench simulation, this mode does not require any hardware
|
||||
[Description("Geerbt")] Inherit,
|
||||
#elif LANG_FR
|
||||
[Description("Détection automatique: Éteindre")] DetectedOff = -2,
|
||||
[Description("Détection automatique: Allumé")] DetectedOn = -1,
|
||||
[Description("Ordinaire")] Normal = 0,
|
||||
[Description("Détection automatique")] AutoDetect,
|
||||
[Description("Erreur d'exécution")] FailureDuringOperation,
|
||||
[Description("Éteindre")] Off,
|
||||
[Description("Record")] Record,
|
||||
[Description("Répondre")] Reply,
|
||||
[Description("Simuler")] Simulate,
|
||||
[Description("Hériter")] Inherit,
|
||||
#else
|
||||
[Description("Detected off")] DetectedOff = -2,
|
||||
[Description("Detected on")] DetectedOn = -1,
|
||||
@@ -429,7 +383,7 @@ namespace Config.Entities
|
||||
[Description("Simulate")] Simulate, /// Test bench simulation, this mode does not require any hardware
|
||||
[Description("Inherit")] Inherit,
|
||||
#endif
|
||||
Count,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum LogLevel
|
||||
@@ -476,11 +430,6 @@ namespace Config.Entities
|
||||
[Description("zentriert")] Center,
|
||||
[Description("rechts")] Right,
|
||||
[Description("angepasst")] Justified,
|
||||
#elif LANG_FR
|
||||
[Description("gauche")] Left,
|
||||
[Description("centré")] Center,
|
||||
[Description("droit")] Right,
|
||||
[Description("justifié")] Justified,
|
||||
#else
|
||||
[Description("Left")] Left,
|
||||
[Description("Center")] Center,
|
||||
@@ -530,10 +479,6 @@ namespace Config.Entities
|
||||
[Description("aus")] Off,
|
||||
[Description("info")] Info,
|
||||
[Description("ein")] On,
|
||||
#elif LANG_FR
|
||||
[Description("éteindre")] Off,
|
||||
[Description("info")] Info,
|
||||
[Description("allumé")] On,
|
||||
#elif LANG_CS
|
||||
[Description("vypnuto")] Off,
|
||||
[Description("info")] Info,
|
||||
@@ -551,141 +496,6 @@ namespace Config.Entities
|
||||
[Description("info")] Info,
|
||||
[Description("on")] On,
|
||||
#endif
|
||||
Count
|
||||
Count
|
||||
}
|
||||
|
||||
|
||||
public enum ErrorFlagShift
|
||||
{
|
||||
E1 = 0,
|
||||
E2,
|
||||
E3,
|
||||
E4,
|
||||
E5,
|
||||
E6,
|
||||
E7,
|
||||
E8,
|
||||
E9,
|
||||
E10,
|
||||
E11,
|
||||
E12,
|
||||
E13,
|
||||
E14,
|
||||
E15,
|
||||
E16,
|
||||
E17,
|
||||
E18,
|
||||
E19,
|
||||
E20,
|
||||
E21,
|
||||
E22,
|
||||
E23,
|
||||
E24,
|
||||
E25,
|
||||
E26,
|
||||
E27,
|
||||
E28,
|
||||
E29,
|
||||
E30,
|
||||
E31,
|
||||
E32,
|
||||
E33,
|
||||
E34,
|
||||
E35,
|
||||
E36,
|
||||
E37,
|
||||
E38,
|
||||
E39,
|
||||
E40,
|
||||
E41,
|
||||
E42,
|
||||
E43,
|
||||
E44,
|
||||
E45,
|
||||
E46,
|
||||
E47,
|
||||
E48,
|
||||
E49,
|
||||
E50,
|
||||
E51,
|
||||
E52,
|
||||
E53,
|
||||
E54,
|
||||
E55,
|
||||
E56,
|
||||
E57,
|
||||
E58,
|
||||
E59,
|
||||
E60,
|
||||
E61,
|
||||
E62,
|
||||
E63,
|
||||
}
|
||||
|
||||
public enum ErrorFlagMask : long
|
||||
{
|
||||
E1 = (1 << (int)ErrorFlagShift.E1),
|
||||
E2 = (1 << (int)ErrorFlagShift.E2),
|
||||
E3 = (1 << (int)ErrorFlagShift.E3),
|
||||
E4 = (1 << (int)ErrorFlagShift.E4),
|
||||
E5 = (1 << (int)ErrorFlagShift.E5),
|
||||
E6 = (1 << (int)ErrorFlagShift.E6),
|
||||
E7 = (1 << (int)ErrorFlagShift.E7),
|
||||
E8 = (1 << (int)ErrorFlagShift.E8),
|
||||
E9 = (1 << (int)ErrorFlagShift.E9),
|
||||
E10 = (1 << (int)ErrorFlagShift.E10),
|
||||
E11 = (1 << (int)ErrorFlagShift.E11),
|
||||
E12 = (1 << (int)ErrorFlagShift.E12),
|
||||
E13 = (1 << (int)ErrorFlagShift.E13),
|
||||
E14 = (1 << (int)ErrorFlagShift.E14),
|
||||
E15 = (1 << (int)ErrorFlagShift.E15),
|
||||
E16 = (1 << (int)ErrorFlagShift.E16),
|
||||
E17 = (1 << (int)ErrorFlagShift.E17),
|
||||
E18 = (1 << (int)ErrorFlagShift.E18),
|
||||
E19 = (1 << (int)ErrorFlagShift.E19),
|
||||
E20 = (1 << (int)ErrorFlagShift.E20),
|
||||
E21 = (1 << (int)ErrorFlagShift.E21),
|
||||
E22 = (1 << (int)ErrorFlagShift.E22),
|
||||
E23 = (1 << (int)ErrorFlagShift.E23),
|
||||
E24 = (1 << (int)ErrorFlagShift.E24),
|
||||
E25 = (1 << (int)ErrorFlagShift.E25),
|
||||
E26 = (1 << (int)ErrorFlagShift.E26),
|
||||
E27 = (1 << (int)ErrorFlagShift.E27),
|
||||
E28 = (1 << (int)ErrorFlagShift.E28),
|
||||
E29 = (1 << (int)ErrorFlagShift.E29),
|
||||
E30 = (1 << (int)ErrorFlagShift.E30),
|
||||
E31 = (1 << (int)ErrorFlagShift.E31),
|
||||
E32 = (1 << (int)ErrorFlagShift.E32),
|
||||
E33 = (1 << (int)ErrorFlagShift.E33),
|
||||
E34 = (1 << (int)ErrorFlagShift.E34),
|
||||
E35 = (1 << (int)ErrorFlagShift.E35),
|
||||
E36 = (1 << (int)ErrorFlagShift.E36),
|
||||
E37 = (1 << (int)ErrorFlagShift.E37),
|
||||
E38 = (1 << (int)ErrorFlagShift.E38),
|
||||
E39 = (1 << (int)ErrorFlagShift.E39),
|
||||
E40 = (1 << (int)ErrorFlagShift.E40),
|
||||
E41 = (1 << (int)ErrorFlagShift.E41),
|
||||
E42 = (1 << (int)ErrorFlagShift.E42),
|
||||
E43 = (1 << (int)ErrorFlagShift.E43),
|
||||
E44 = (1 << (int)ErrorFlagShift.E44),
|
||||
E45 = (1 << (int)ErrorFlagShift.E45),
|
||||
E46 = (1 << (int)ErrorFlagShift.E46),
|
||||
E47 = (1 << (int)ErrorFlagShift.E47),
|
||||
E48 = (1 << (int)ErrorFlagShift.E48),
|
||||
E49 = (1 << (int)ErrorFlagShift.E49),
|
||||
E50 = (1 << (int)ErrorFlagShift.E50),
|
||||
E51 = (1 << (int)ErrorFlagShift.E51),
|
||||
E52 = (1 << (int)ErrorFlagShift.E52),
|
||||
E53 = (1 << (int)ErrorFlagShift.E53),
|
||||
E54 = (1 << (int)ErrorFlagShift.E54),
|
||||
E55 = (1 << (int)ErrorFlagShift.E55),
|
||||
E56 = (1 << (int)ErrorFlagShift.E56),
|
||||
E57 = (1 << (int)ErrorFlagShift.E57),
|
||||
E58 = (1 << (int)ErrorFlagShift.E58),
|
||||
E59 = (1 << (int)ErrorFlagShift.E59),
|
||||
E60 = (1 << (int)ErrorFlagShift.E60),
|
||||
E61 = (1 << (int)ErrorFlagShift.E61),
|
||||
E62 = (1 << (int)ErrorFlagShift.E62),
|
||||
E63 = (1 << (int)ErrorFlagShift.E63),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class Group
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual Users.Entities.GID GID { get; set; }
|
||||
public virtual long AccessFlags { get; set; } /// Bitfield of access flags: bit0 .. bit62
|
||||
public virtual IList<User> Users { get; set; } /// Group can be a member of a list of users
|
||||
public virtual int Gid { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
|
||||
public Group()
|
||||
{
|
||||
Users = new List<User>();
|
||||
}
|
||||
|
||||
public Group(Users.Entities.GID gid)
|
||||
: this()
|
||||
{
|
||||
GID = gid;
|
||||
public Group(int gid, string name)
|
||||
{
|
||||
Gid = gid;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,6 @@ namespace Config.Entities
|
||||
Count
|
||||
}
|
||||
|
||||
public enum Counting
|
||||
{
|
||||
Arbitrary,
|
||||
Positive,
|
||||
Negative,
|
||||
Count
|
||||
}
|
||||
|
||||
public enum OptoHeadState
|
||||
{
|
||||
Disabled,
|
||||
|
||||
@@ -1,337 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
|
||||
/// </summary>
|
||||
public class PTest : IHasName, IHasItemNr
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s /// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
|
||||
public virtual double CoefQfrom { get; set; } /// Water flow low limit in [m3/h]
|
||||
public virtual double CoefQto { get; set; } /// Water flow high limit in [m3/h]
|
||||
public virtual double ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
|
||||
public virtual double ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
|
||||
public virtual double TempLimLo { get; set; } /// Lower limit for the controlled temperature
|
||||
public virtual double TempLimHi { get; set; } /// Upper limit for the controlled temperature
|
||||
public virtual double PressLimLo { get; set; } /// [bar] min. water pressure
|
||||
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 sbyte E1 { get; set; } ///
|
||||
public virtual sbyte E2 { get; set; } ///
|
||||
public virtual sbyte E3 { get; set; } ///
|
||||
public virtual sbyte E4 { get; set; } ///
|
||||
public virtual sbyte E5 { get; set; } ///
|
||||
public virtual sbyte E6 { get; set; } ///
|
||||
public virtual sbyte E7 { get; set; } ///
|
||||
public virtual sbyte E8 { get; set; } ///
|
||||
public virtual sbyte E9 { get; set; } /// 0=off, 1=info, 2=evaluate
|
||||
public virtual sbyte E10 { get; set; } ///
|
||||
public virtual sbyte E11 { get; set; } ///
|
||||
public virtual sbyte E12 { get; set; } ///
|
||||
public virtual sbyte E13 { get; set; } ///
|
||||
public virtual sbyte E14 { get; set; } ///
|
||||
public virtual sbyte E15 { get; set; } ///
|
||||
public virtual sbyte E16 { get; set; } ///
|
||||
public virtual sbyte E21 { get; set; } ///
|
||||
|
||||
public virtual double Delta_Q_pct { get; set; } /// [%] max deviation from the mean flow
|
||||
public virtual double Delta_T { get; set; } /// [°C] max. T_up or T_down deviation from the mean temperature
|
||||
public virtual double Delta_Tup_Tdn { get; set; } /// [°C] max. difference abs(T_up - T_down)
|
||||
public virtual double TestTime_min { get; set; } /// [s]
|
||||
public virtual double TestTime_max { get; set; } /// [s]
|
||||
public virtual double AmbTemp_min { get; set; } /// [°C] min. ambient temperature
|
||||
public virtual double AmbTemp_max { get; set; } /// [°C] max. ambient temperature
|
||||
|
||||
public virtual double Coef_E9 { get; set; } /// Coefficient used in E9, default 0.025
|
||||
public virtual double Coef_E10 { get; set; } /// Coefficient used in E10, default 0.04
|
||||
public virtual double Coef_E11 { get; set; } /// Coefficient used in E11, default 0.1
|
||||
public virtual double Coef_E12 { get; set; } /// Coefficient used in E12, default 1
|
||||
public virtual double Offset_E9 { get; set; } /// [s] default 0 (no offset)
|
||||
public virtual double Offset_E12 { get; set; } /// [s] default 0 (no offset)
|
||||
|
||||
public virtual Profile Profile { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public PTest()
|
||||
{
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
Part = 0;
|
||||
CoefQfrom = 1.0;
|
||||
CoefQto = 1.1;
|
||||
ErrLimLo = -2.0; /// [%]
|
||||
ErrLimHi = 2.0; /// [%]
|
||||
TempLimLo = 15.0; /// [°C]
|
||||
TempLimHi = 25.0; /// [°C]
|
||||
PressLimLo = 0; /// [bar]
|
||||
PressLimHi = 16.0; /// [bar]
|
||||
Publish = (sbyte)Config.Entities.Publish.Always;
|
||||
Evaluate = true;
|
||||
|
||||
E1 = 1;
|
||||
E2 = 1;
|
||||
E3 = 1;
|
||||
E4 = 1;
|
||||
E5 = 1;
|
||||
E6 = 1;
|
||||
E7 = 1;
|
||||
E8 = 1;
|
||||
E9 = 1;
|
||||
E10 = 1;
|
||||
E11 = 1;
|
||||
E12 = 1;
|
||||
E13 = 1;
|
||||
E14 = 1;
|
||||
E15 = 1;
|
||||
E16 = 1;
|
||||
E21 = 1;
|
||||
|
||||
Delta_Q_pct = 5.0; /// [%]
|
||||
Delta_T = 10.0; /// [°C]
|
||||
Delta_Tup_Tdn = 10.0; /// [°C]
|
||||
TestTime_min = 0; /// [s]
|
||||
TestTime_max = 99999; /// [s]
|
||||
AmbTemp_min = 5.0; /// [°C]
|
||||
AmbTemp_max = 95.0; /// [°C]
|
||||
|
||||
Coef_E9 = 0.025;
|
||||
Coef_E10 = 0.04;
|
||||
Coef_E11 = 0.1;
|
||||
Coef_E12 = 1.0;
|
||||
Offset_E9 = 0; /// [s]
|
||||
Offset_E12 = 0; /// [s]
|
||||
}
|
||||
|
||||
public PTest(string name, int itemNr, Profile profile)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
Profile = profile;
|
||||
}
|
||||
|
||||
// Makes a new copy of this object (not just a reference)
|
||||
public virtual PTest Clone()
|
||||
{
|
||||
PTest result = new PTest(Name, ItemNr, Profile);
|
||||
|
||||
result.Part = Part;
|
||||
result.CoefQfrom = CoefQfrom;
|
||||
result.CoefQto = CoefQto;
|
||||
result.ErrLimLo = ErrLimLo;
|
||||
result.ErrLimHi = ErrLimHi;
|
||||
result.TempLimLo = TempLimLo;
|
||||
result.TempLimHi = TempLimHi;
|
||||
result.PressLimLo = PressLimLo;
|
||||
result.PressLimHi = PressLimHi;
|
||||
result.Publish = Publish;
|
||||
result.Evaluate = Evaluate;
|
||||
|
||||
result.E1 = E1;
|
||||
result.E2 = E2;
|
||||
result.E3 = E3;
|
||||
result.E4 = E4;
|
||||
result.E5 = E5;
|
||||
result.E6 = E6;
|
||||
result.E7 = E7;
|
||||
result.E8 = E8;
|
||||
result.E9 = E9;
|
||||
result.E10 = E10;
|
||||
result.E11 = E11;
|
||||
result.E12 = E12;
|
||||
result.E13 = E13;
|
||||
result.E14 = E14;
|
||||
result.E15 = E15;
|
||||
result.E16 = E16;
|
||||
result.E21 = E21;
|
||||
|
||||
result.Delta_Q_pct = Delta_Q_pct;
|
||||
result.Delta_T = Delta_T;
|
||||
result.Delta_Tup_Tdn = Delta_Tup_Tdn;
|
||||
result.TestTime_min = TestTime_min;
|
||||
result.TestTime_max = TestTime_max;
|
||||
result.AmbTemp_min = AmbTemp_min;
|
||||
result.AmbTemp_max = AmbTemp_max;
|
||||
|
||||
result.Coef_E9 = Coef_E9;
|
||||
result.Coef_E10 = Coef_E10;
|
||||
result.Coef_E11 = Coef_E11;
|
||||
result.Coef_E12 = Coef_E12;
|
||||
result.Offset_E9 = Offset_E9;
|
||||
result.Offset_E12 = Offset_E12;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(Part);
|
||||
output.WriteLine(CoefQfrom.ToString(ci));
|
||||
output.WriteLine(CoefQto.ToString(ci));
|
||||
output.WriteLine(ErrLimLo.ToString(ci));
|
||||
output.WriteLine(ErrLimHi.ToString(ci));
|
||||
output.WriteLine(TempLimLo.ToString(ci));
|
||||
output.WriteLine(TempLimHi.ToString(ci));
|
||||
output.WriteLine(PressLimLo.ToString(ci));
|
||||
output.WriteLine(PressLimHi.ToString(ci));
|
||||
output.WriteLine(Publish.ToString());
|
||||
output.WriteLine(Evaluate.ToString());
|
||||
|
||||
output.WriteLine(E1.ToString());
|
||||
output.WriteLine(E2.ToString());
|
||||
output.WriteLine(E3.ToString());
|
||||
output.WriteLine(E4.ToString());
|
||||
output.WriteLine(E5.ToString());
|
||||
output.WriteLine(E6.ToString());
|
||||
output.WriteLine(E7.ToString());
|
||||
output.WriteLine(E8.ToString());
|
||||
output.WriteLine(E9.ToString());
|
||||
output.WriteLine(E10.ToString());
|
||||
output.WriteLine(E11.ToString());
|
||||
output.WriteLine(E12.ToString());
|
||||
output.WriteLine(E13.ToString());
|
||||
output.WriteLine(E14.ToString());
|
||||
output.WriteLine(E15.ToString());
|
||||
output.WriteLine(E16.ToString());
|
||||
output.WriteLine(E21.ToString());
|
||||
|
||||
output.WriteLine(Delta_Q_pct.ToString(ci));
|
||||
output.WriteLine(Delta_T.ToString(ci));
|
||||
output.WriteLine(Delta_Tup_Tdn.ToString(ci));
|
||||
output.WriteLine(TestTime_min.ToString(ci));
|
||||
output.WriteLine(TestTime_max.ToString(ci));
|
||||
output.WriteLine(AmbTemp_min.ToString(ci));
|
||||
output.WriteLine(AmbTemp_max.ToString(ci));
|
||||
|
||||
output.WriteLine(Coef_E9.ToString(ci));
|
||||
output.WriteLine(Coef_E10.ToString(ci));
|
||||
output.WriteLine(Coef_E11.ToString(ci));
|
||||
output.WriteLine(Coef_E12.ToString(ci));
|
||||
output.WriteLine(Offset_E9.ToString(ci));
|
||||
output.WriteLine(Offset_E12.ToString(ci));
|
||||
}
|
||||
|
||||
public static PTest Import(StreamReader input, Profile newProfile)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
if (string.IsNullOrEmpty(firstLine))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
PTest tst = new PTest();
|
||||
|
||||
tst.Name = firstLine;
|
||||
tst.Part = int.Parse(input.ReadLine());
|
||||
tst.CoefQfrom = double.Parse(input.ReadLine(), ci);
|
||||
tst.CoefQto = double.Parse(input.ReadLine(), ci);
|
||||
tst.ErrLimLo = double.Parse(input.ReadLine(), ci);
|
||||
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.Evaluate = bool.Parse(input.ReadLine());
|
||||
|
||||
/// TODO (E1 .. E21)
|
||||
|
||||
tst.Delta_Q_pct = double.Parse(input.ReadLine(), ci);
|
||||
tst.Delta_T = double.Parse(input.ReadLine(), ci);
|
||||
tst.Delta_Tup_Tdn = double.Parse(input.ReadLine(), ci);
|
||||
tst.TestTime_min = double.Parse(input.ReadLine(), ci);
|
||||
tst.TestTime_max = double.Parse(input.ReadLine(), ci);
|
||||
tst.AmbTemp_min = double.Parse(input.ReadLine(), ci);
|
||||
tst.AmbTemp_max = double.Parse(input.ReadLine(), ci);
|
||||
|
||||
tst.Coef_E9 = double.Parse(input.ReadLine(), ci);
|
||||
tst.Coef_E10 = double.Parse(input.ReadLine(), ci);
|
||||
tst.Coef_E11 = double.Parse(input.ReadLine(), ci);
|
||||
tst.Coef_E12 = double.Parse(input.ReadLine(), ci);
|
||||
tst.Offset_E9 = double.Parse(input.ReadLine(), ci);
|
||||
tst.Offset_E12 = double.Parse(input.ReadLine(), ci);
|
||||
|
||||
tst.Profile = newProfile;
|
||||
return tst;
|
||||
}
|
||||
|
||||
public virtual string Compare(StreamReader inp)
|
||||
{
|
||||
System.Text.StringBuilder diff = new System.Text.StringBuilder();
|
||||
string fmt = string.Format("Test {0} : ", Name) + "{0} = {1}\r\n (in the file {2})\r\n";
|
||||
string ln;
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
|
||||
string firstLine = inp.ReadLine();
|
||||
if (string.IsNullOrEmpty(firstLine)) return string.Format("Test {0} is missing in the file\r\n", Name);
|
||||
|
||||
if (Name != firstLine) { diff.AppendFormat(fmt, "Name", Name, firstLine); };
|
||||
ln = inp.ReadLine(); if (ln != Part.ToString()) { diff.AppendFormat(fmt, "Part", Part.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != CoefQfrom.ToString(ci)) { diff.AppendFormat(fmt, "CoefQfrom", CoefQfrom.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != CoefQto.ToString(ci)) { diff.AppendFormat(fmt, "CoefQto", CoefQto.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != ErrLimLo.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimLo", ErrLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != ErrLimHi.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimHi", ErrLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != PressLimLo.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_min", PressLimLo.ToString(ci), ln); };
|
||||
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 != E1.ToString()) { diff.AppendFormat(fmt, "E1", E1.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E2.ToString()) { diff.AppendFormat(fmt, "E2", E2.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E3.ToString()) { diff.AppendFormat(fmt, "E3", E3.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E4.ToString()) { diff.AppendFormat(fmt, "E4", E4.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E5.ToString()) { diff.AppendFormat(fmt, "E5", E5.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E6.ToString()) { diff.AppendFormat(fmt, "E6", E6.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E7.ToString()) { diff.AppendFormat(fmt, "E7", E7.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E8.ToString()) { diff.AppendFormat(fmt, "E8", E8.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E9.ToString()) { diff.AppendFormat(fmt, "E9", E9.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E10.ToString()) { diff.AppendFormat(fmt, "E10", E10.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E11.ToString()) { diff.AppendFormat(fmt, "E11", E11.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E12.ToString()) { diff.AppendFormat(fmt, "E12", E12.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E13.ToString()) { diff.AppendFormat(fmt, "E13", E13.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E14.ToString()) { diff.AppendFormat(fmt, "E14", E14.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E15.ToString()) { diff.AppendFormat(fmt, "E15", E15.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E16.ToString()) { diff.AppendFormat(fmt, "E16", E16.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E21.ToString()) { diff.AppendFormat(fmt, "E21", E21.ToString(), ln); };
|
||||
|
||||
ln = inp.ReadLine(); if (ln != Delta_Q_pct.ToString(ci)) { diff.AppendFormat(fmt, "Delta_Q_pct", Delta_Q_pct.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Delta_T.ToString(ci)) { diff.AppendFormat(fmt, "Delta_T", Delta_T.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Delta_Tup_Tdn.ToString(ci)) { diff.AppendFormat(fmt, "Delta_Tup_Tdn", Delta_Tup_Tdn.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TestTime_min.ToString(ci)) { diff.AppendFormat(fmt, "TestTime_min", TestTime_min.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TestTime_max.ToString(ci)) { diff.AppendFormat(fmt, "TestTime_max", TestTime_max.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != AmbTemp_min.ToString(ci)) { diff.AppendFormat(fmt, "AmbTemp_min", AmbTemp_min.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != AmbTemp_max.ToString(ci)) { diff.AppendFormat(fmt, "AmbTemp_max", AmbTemp_max.ToString(ci), ln); };
|
||||
|
||||
ln = inp.ReadLine(); if (ln != Coef_E9.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E9", Coef_E9.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Coef_E10.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E10", Coef_E10.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Coef_E11.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E11", Coef_E11.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Coef_E12.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E12", Coef_E12.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Offset_E9.ToString(ci)) { diff.AppendFormat(fmt, "Offset_E9", Offset_E9.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Offset_E12.ToString(ci)) { diff.AppendFormat(fmt, "Offset_E12", Offset_E12.ToString(ci), ln); };
|
||||
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,10 +86,12 @@ namespace Config.Entities
|
||||
result.LastChgUser = LastChgUser;
|
||||
result.LastChgTime = LastChgTime;
|
||||
result.LongDescription = LongDescription;
|
||||
|
||||
result.ProcedureState = ProcedureState;
|
||||
result.Revision = Revision;
|
||||
result.PredecessorId = Id;
|
||||
result.ObtainedByCopy = ObtainedByCopy;
|
||||
|
||||
result.MetersKind = MetersKind;
|
||||
result.Watermeters = Watermeters;
|
||||
result.Protected = Protected;
|
||||
@@ -100,8 +102,6 @@ namespace Config.Entities
|
||||
result.ResultsWriter = ResultsWriter;
|
||||
result.TransitionStart = TransitionStart;
|
||||
result.TransitionEnd = TransitionEnd;
|
||||
result.AltProcName = AltProcName;
|
||||
result.AltProcPeriod = AltProcPeriod;
|
||||
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); }
|
||||
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
|
||||
@@ -234,42 +234,6 @@ namespace Config.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Processes the selection done by the bench control panel in the main sequence.
|
||||
/// </summary>
|
||||
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
|
||||
/// <returns>The selected test or null</returns>
|
||||
public virtual Test GetTest(string expandedTestName, out int testIx, out int repetNr)
|
||||
{
|
||||
for (int ix = 0; ix < Tests.Count; ix++)
|
||||
{
|
||||
Test test = Tests[ix];
|
||||
if (test.Name.Equals(expandedTestName))
|
||||
{
|
||||
/// Name is not expanded => Repeats==1
|
||||
testIx = ix;
|
||||
repetNr = 1;
|
||||
return test;
|
||||
}
|
||||
|
||||
for (int r = 1; r <= test.Repeats; r++)
|
||||
{
|
||||
if (test.GetExpandedTestName(r).Equals(expandedTestName))
|
||||
{
|
||||
testIx = ix;
|
||||
repetNr = r;
|
||||
return test;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
testIx = 0;
|
||||
repetNr = 1;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}, rev.{1}", Name, Revision);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ProcedureHistory
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual Procedure Current { get; set; }
|
||||
public virtual IList<Procedure> OldProcedures { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public ProcedureHistory()
|
||||
{
|
||||
Current = new Procedure();
|
||||
OldProcedures = new List<Procedure>();
|
||||
}
|
||||
|
||||
public virtual ProcedureHistory Clone()
|
||||
{
|
||||
ProcedureHistory result = new ProcedureHistory();
|
||||
result.Current = Current.Clone();
|
||||
foreach (Procedure p in OldProcedures) result.OldProcedures.Add(p.Clone());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores one test procedure, supports revisions and history log
|
||||
/// </summary>
|
||||
public class Profile : IHasName, IHasItemNr
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string Description { get; set; } /// Short description
|
||||
public virtual string CreationUser { get; set; } /// Name of the user who has created or changed this procedure
|
||||
public virtual DateTime CreationTime { get; set; } /// Date and time of the creation or change
|
||||
public virtual string LastChgUser { get; set; } /// Name of the user who has created or changed this procedure
|
||||
public virtual DateTime LastChgTime { get; set; } /// Date and time of the creation or change
|
||||
public virtual ProfileType ProfileType { get; set; }
|
||||
public virtual ErrorLimitType ErrorLimitType { get; set; }
|
||||
|
||||
public virtual IList<PTest> Tests { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public Profile()
|
||||
{
|
||||
Tests = new List<PTest>();
|
||||
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
|
||||
CreationTime = DateTime.Now;
|
||||
LastChgUser = CreationUser;
|
||||
LastChgTime = CreationTime;
|
||||
Description = string.Empty;
|
||||
}
|
||||
|
||||
public Profile(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public virtual Profile Clone()
|
||||
{
|
||||
Profile result = new Profile();
|
||||
|
||||
result.ItemNr = ItemNr;
|
||||
result.Name = Name;
|
||||
result.Description = Description;
|
||||
result.CreationUser = CreationUser;
|
||||
result.CreationTime = CreationTime;
|
||||
result.LastChgUser = LastChgUser;
|
||||
result.LastChgTime = LastChgTime;
|
||||
result.ProfileType = ProfileType;
|
||||
result.ErrorLimitType = ErrorLimitType;
|
||||
|
||||
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(Description);
|
||||
output.WriteLine(CreationUser);
|
||||
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(LastChgUser);
|
||||
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
foreach (var test in Tests) { test.Export(output); }
|
||||
output.WriteLine();
|
||||
|
||||
output.Close();
|
||||
}
|
||||
|
||||
public static Profile Import(StreamReader input)
|
||||
{
|
||||
Profile result = new Profile();
|
||||
|
||||
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.Name = input.ReadLine();
|
||||
result.Description = input.ReadLine();
|
||||
result.CreationUser = input.ReadLine();
|
||||
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.LastChgUser = input.ReadLine();
|
||||
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
string line = input.ReadLine();
|
||||
|
||||
while (true)
|
||||
{
|
||||
PTest tst = PTest.Import(input, result);
|
||||
if (tst == null)
|
||||
break;
|
||||
else
|
||||
result.Tests.Add(tst);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual string Compare(StreamReader inp)
|
||||
{
|
||||
System.Text.StringBuilder diff = new System.Text.StringBuilder();
|
||||
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
|
||||
string ln;
|
||||
|
||||
ln = inp.ReadLine(); /// skip ItemNr
|
||||
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
|
||||
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
|
||||
ln = inp.ReadLine(); /// skip CreationUser
|
||||
ln = inp.ReadLine(); /// skip CreationTime
|
||||
ln = inp.ReadLine(); /// skip LastChgUser
|
||||
ln = inp.ReadLine(); /// skip LastChgTime
|
||||
|
||||
//foreach (var test in Tests)
|
||||
//{
|
||||
// string testDiff = test.Compare(inp);
|
||||
// if (testDiff.Contains(
|
||||
//}
|
||||
|
||||
//bool extraTestsInFile = true;
|
||||
//while (Test.Import(inp, null) != null) { extraTestsInFile = true; }
|
||||
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
-75
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -18,21 +18,19 @@ namespace Config.Entities
|
||||
public virtual string Name { get; set; }
|
||||
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s
|
||||
/// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
|
||||
public virtual 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 sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
|
||||
public virtual bool DoEvaluate { get; set; }
|
||||
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 TstTime { 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
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0) or 1=class1, 2=class2, 3=class3
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0) or -Qn in m3/h
|
||||
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
|
||||
public virtual int Repeats { get; set; }
|
||||
public virtual bool DoDraining { get; set; }
|
||||
public virtual bool DoDrainingAfter { get; set; }
|
||||
public virtual bool DoZeroing { get; set; }
|
||||
public virtual bool DoControlWaterTemp { get; set; }
|
||||
public virtual float TempLimLo { get; set; } /// Lower limit for the controlled temperature
|
||||
public virtual float TempLimHi { get; set; } /// Upper limit for the controlled temperature
|
||||
@@ -45,7 +43,7 @@ namespace Config.Entities
|
||||
public virtual int TimePump2StartV { get; set; } /// Delay time from the start of the pump to opening the start valve in [s]
|
||||
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
|
||||
public virtual double TolerRed { get; set; } /// = Filter
|
||||
public virtual string RedType { get; set; }
|
||||
public virtual TestRedType RedType { get; set; }
|
||||
public virtual string FeedingPath { get; set; }
|
||||
public virtual string BenchPath { get; set; }
|
||||
public virtual string OutputPath { get; set; }
|
||||
@@ -55,11 +53,9 @@ namespace Config.Entities
|
||||
#endif
|
||||
public virtual string RelTransBefore { get; set; }
|
||||
public virtual string RelTransBetween { get; set; }
|
||||
public virtual string RelTransAfter { get; set; }
|
||||
public virtual string TransitionAfter { get; set; }
|
||||
|
||||
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
|
||||
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
|
||||
|
||||
public virtual IList<ComponentTest> MoreParams { get; set; }
|
||||
|
||||
public virtual Procedure Procedure { get; set; }
|
||||
@@ -73,13 +69,11 @@ namespace Config.Entities
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
Part = 0;
|
||||
Profile = TestProfile.UserDefined;
|
||||
Publish = (sbyte)Config.Entities.Publish.Always;
|
||||
Publish = (sbyte)Config.Entities.Publish.Always;
|
||||
DoEvaluate = true;
|
||||
Repeats = 1;
|
||||
DoDraining = false;
|
||||
DoDrainingAfter = false;
|
||||
DoZeroing = false;
|
||||
DoControlWaterTemp = false;
|
||||
TempLimLo = 15.0f;
|
||||
TempLimHi = 25.0f;
|
||||
@@ -97,6 +91,7 @@ namespace Config.Entities
|
||||
TolerRed = 0; /// = Filter parameter
|
||||
RelTransBefore = string.Empty;
|
||||
RelTransBetween = string.Empty;
|
||||
RelTransAfter = string.Empty;
|
||||
TransitionAfter = string.Empty;
|
||||
}
|
||||
|
||||
@@ -114,10 +109,8 @@ namespace Config.Entities
|
||||
Test result = new Test(Name, ItemNr, Procedure);
|
||||
|
||||
result.Part = Part;
|
||||
result.Profile = Profile;
|
||||
result.Publish = Publish;
|
||||
result.Publish = Publish;
|
||||
result.DoEvaluate = DoEvaluate;
|
||||
result.Qtg = Qtg;
|
||||
result.Qfrom = Qfrom;
|
||||
result.Qto = Qto;
|
||||
result.Volume = Volume;
|
||||
@@ -128,7 +121,7 @@ namespace Config.Entities
|
||||
result.Uncertainty = Uncertainty;
|
||||
result.Repeats = Repeats;
|
||||
result.DoDraining = DoDraining;
|
||||
result.DoDrainingAfter = DoDrainingAfter;
|
||||
result.DoZeroing = DoZeroing;
|
||||
result.DoControlWaterTemp = DoControlWaterTemp;
|
||||
result.TempLimLo = TempLimLo;
|
||||
result.TempLimHi = TempLimHi;
|
||||
@@ -151,6 +144,7 @@ namespace Config.Entities
|
||||
#endif
|
||||
result.RelTransBefore = RelTransBefore;
|
||||
result.RelTransBetween = RelTransBetween;
|
||||
result.RelTransAfter = RelTransAfter;
|
||||
result.TransitionAfter = TransitionAfter;
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
|
||||
|
||||
@@ -165,7 +159,6 @@ namespace Config.Entities
|
||||
output.WriteLine(Part.ToString(ci));
|
||||
output.WriteLine(Publish.ToString(ci));
|
||||
output.WriteLine(DoEvaluate.ToString());
|
||||
output.WriteLine(Qtg.ToString(ci));
|
||||
output.WriteLine(Qfrom.ToString(ci));
|
||||
output.WriteLine(Qto.ToString(ci));
|
||||
output.WriteLine(Volume.ToString(ci));
|
||||
@@ -176,7 +169,7 @@ namespace Config.Entities
|
||||
output.WriteLine(Uncertainty.ToString(ci));
|
||||
output.WriteLine(Repeats.ToString(ci));
|
||||
output.WriteLine(DoDraining.ToString());
|
||||
output.WriteLine(DoDrainingAfter.ToString());
|
||||
output.WriteLine(DoZeroing.ToString());
|
||||
output.WriteLine(DoControlWaterTemp.ToString());
|
||||
output.WriteLine(TempLimLo.ToString(ci));
|
||||
output.WriteLine(TempLimHi.ToString(ci));
|
||||
@@ -194,7 +187,7 @@ namespace Config.Entities
|
||||
output.WriteLine(MetersPath);
|
||||
output.WriteLine(RelTransBefore);
|
||||
output.WriteLine(RelTransBetween);
|
||||
output.WriteLine(Profile);
|
||||
output.WriteLine(RelTransAfter);
|
||||
output.WriteLine(TransitionAfter);
|
||||
|
||||
foreach (var prms in MoreParams) { prms.Export(output); }
|
||||
@@ -216,8 +209,7 @@ 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.Qfrom = float.Parse(input.ReadLine(), ci);
|
||||
tst.Qto = float.Parse(input.ReadLine(), ci);
|
||||
tst.Volume = float.Parse(input.ReadLine(), ci);
|
||||
tst.TstTime = float.Parse(input.ReadLine(), ci);
|
||||
@@ -227,7 +219,7 @@ namespace Config.Entities
|
||||
tst.Uncertainty = float.Parse(input.ReadLine(), ci);
|
||||
tst.Repeats = int.Parse(input.ReadLine(), ci);
|
||||
tst.DoDraining = bool.Parse(input.ReadLine());
|
||||
tst.DoDrainingAfter = bool.Parse(input.ReadLine());
|
||||
tst.DoZeroing = bool.Parse(input.ReadLine());
|
||||
tst.DoControlWaterTemp = bool.Parse(input.ReadLine());
|
||||
tst.TempLimLo = float.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimHi = float.Parse(input.ReadLine(), ci);
|
||||
@@ -245,10 +237,7 @@ namespace Config.Entities
|
||||
tst.MetersPath = input.ReadLine();
|
||||
tst.RelTransBefore = input.ReadLine();
|
||||
tst.RelTransBetween = input.ReadLine();
|
||||
string line = input.ReadLine();
|
||||
tst.Profile = line.Equals(TestProfile.ProtectedHeatMeter.ToString()) ? TestProfile.ProtectedHeatMeter
|
||||
: line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
|
||||
: line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
|
||||
tst.RelTransAfter = input.ReadLine();
|
||||
tst.TransitionAfter = input.ReadLine();
|
||||
|
||||
while (true)
|
||||
@@ -278,7 +267,6 @@ namespace Config.Entities
|
||||
ln = inp.ReadLine(); if (ln != Part.ToString(ci)) { diff.AppendFormat(fmt, "Part", Part.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Publish.ToString(ci)) { diff.AppendFormat(fmt, "Publish", Publish.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != DoEvaluate.ToString(ci)) { diff.AppendFormat(fmt, "Evaluate", DoEvaluate.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Qtg.ToString(ci)) { diff.AppendFormat(fmt, "Qtg", Qtg.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Qfrom.ToString(ci)) { diff.AppendFormat(fmt, "Qfrom", Qfrom.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Qto.ToString(ci)) { diff.AppendFormat(fmt, "Qto", Qto.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Volume.ToString(ci)) { diff.AppendFormat(fmt, "Volume", Volume.ToString(ci), ln); };
|
||||
@@ -289,7 +277,7 @@ namespace Config.Entities
|
||||
ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != DoZeroing.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoZeroing.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
|
||||
@@ -307,7 +295,7 @@ namespace Config.Entities
|
||||
ln = inp.ReadLine(); if (ln != MetersPath) { diff.AppendFormat(fmt, "MetersPath", MetersPath, ln); };
|
||||
ln = inp.ReadLine(); if (ln != RelTransBefore) { diff.AppendFormat(fmt, "RelTransBefore", RelTransBefore, ln); };
|
||||
ln = inp.ReadLine(); if (ln != RelTransBetween) { diff.AppendFormat(fmt, "RelTransBetween", RelTransBetween, ln); };
|
||||
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
|
||||
ln = inp.ReadLine(); if (ln != RelTransAfter) { diff.AppendFormat(fmt, "RelTransAfter", RelTransAfter, ln); };
|
||||
ln = inp.ReadLine(); if (ln != TransitionAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransitionAfter, ln); };
|
||||
|
||||
return diff.ToString();
|
||||
@@ -322,77 +310,50 @@ namespace Config.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return test title for a this test and a given repetition number
|
||||
/// </summary>
|
||||
/// <param name="repetitonNr">1 .. Nr. repetitions</param>
|
||||
/// <returns>Test title (string)</returns>
|
||||
public virtual string GetExpandedTestName(int repetitionNr)
|
||||
{
|
||||
if (Repeats == 1)
|
||||
{
|
||||
if (Part == 0)
|
||||
{
|
||||
/// Single test
|
||||
return Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// A part of a single test
|
||||
return string.Format("{0} ({1})", Name, Part);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// More test repetitions
|
||||
return string.Format("{0} ({1}/{2})", Name, repetitionNr, Repeats);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual double GetErrLimLo(double volumeCTV, double testTime)
|
||||
public virtual float GetErrLimLo(float flow)
|
||||
{
|
||||
if (ErrLimLo <= ErrLimHi)
|
||||
{
|
||||
return ErrLimLo; /// Error limit of a water meter
|
||||
return ErrLimLo; /// Error limit of a water meter
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Metrological class and nominal flow of a heat meter
|
||||
int metrClass = (int)Math.Round(ErrLimLo);
|
||||
double Qp = Math.Abs(ErrLimHi);
|
||||
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided
|
||||
float Qp = Math.Abs(ErrLimHi);
|
||||
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
|
||||
|
||||
/// Calculate the error limit of a heat meter
|
||||
switch (metrClass)
|
||||
{
|
||||
default:
|
||||
case 1: return -Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
|
||||
case 2: return -Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
|
||||
case 3: return -Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
|
||||
case 1: return -Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
|
||||
case 2: return -Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
|
||||
case 3: return -Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual double GetErrLimHi(double volumeCTV, double testTime)
|
||||
public virtual float GetErrLimHi(float flow)
|
||||
{
|
||||
if (ErrLimLo <= ErrLimHi)
|
||||
{
|
||||
return ErrLimHi; /// Error limit of a water meter
|
||||
return ErrLimHi; /// Error limit of a water meter
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Metrological class and nominal flow of a heat meter
|
||||
int metrClass = (int)Math.Round(ErrLimLo);
|
||||
double Qp = Math.Abs(ErrLimHi);
|
||||
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided
|
||||
float Qp = Math.Abs(ErrLimHi);
|
||||
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
|
||||
|
||||
/// Calculate the error limit of a heat meter
|
||||
switch (metrClass)
|
||||
{
|
||||
default:
|
||||
case 1: return +Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
|
||||
case 2: return +Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
|
||||
case 3: return +Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
|
||||
case 1: return +Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
|
||||
case 2: return +Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
|
||||
case 3: return +Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@@ -40,56 +37,5 @@ namespace Config.Entities
|
||||
foreach (var step in TransitionSteps) { result.TransitionSteps.Add(step.Clone()); }
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(Description);
|
||||
|
||||
foreach (var step in TransitionSteps) { step.Export(output); }
|
||||
output.WriteLine();
|
||||
|
||||
output.Close();
|
||||
}
|
||||
|
||||
public static TransitionSequence Import(StreamReader input)
|
||||
{
|
||||
TransitionSequence result = new TransitionSequence();
|
||||
|
||||
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.Name = input.ReadLine();
|
||||
result.Description = input.ReadLine();
|
||||
|
||||
while (true)
|
||||
{
|
||||
TransitionStep step = TransitionStep.Import(input, result);
|
||||
if (step == null)
|
||||
break;
|
||||
else
|
||||
result.TransitionSteps.Add(step);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual string Compare(StreamReader inp)
|
||||
{
|
||||
System.Text.StringBuilder diff = new System.Text.StringBuilder();
|
||||
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
|
||||
string ln;
|
||||
|
||||
ln = inp.ReadLine(); /// skip ItemNr
|
||||
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
|
||||
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
|
||||
|
||||
//foreach (var step in TransitionSteps)
|
||||
//{
|
||||
// string testDiff = step.Compare(inp);
|
||||
// if (testDiff.Contains(
|
||||
//}
|
||||
|
||||
return diff.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015, 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@@ -63,64 +61,5 @@ namespace Config.Entities
|
||||
result += indent + "PumpsWithFMPct = " + PumpWithFMPcts + Environment.NewLine;
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
|
||||
output.WriteLine(ItemNr.ToString(ci));
|
||||
output.WriteLine(Duration.ToString(ci));
|
||||
output.WriteLine(Message);
|
||||
output.WriteLine(EndCondition);
|
||||
output.WriteLine(ValvesOpen);
|
||||
output.WriteLine(ValvesClose);
|
||||
output.WriteLine(RegulValvesPct);
|
||||
output.WriteLine(PumpWithFMPcts);
|
||||
}
|
||||
|
||||
public static TransitionStep Import(StreamReader input, TransitionSequence newSequence)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
if (string.IsNullOrEmpty(firstLine))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
int itemNr = int.Parse(firstLine, ci);
|
||||
TransitionStep tst = new TransitionStep(itemNr, newSequence);
|
||||
|
||||
tst.Duration = int.Parse(input.ReadLine(), ci);
|
||||
tst.Message = input.ReadLine();
|
||||
tst.EndCondition = input.ReadLine();
|
||||
tst.ValvesOpen = input.ReadLine();
|
||||
tst.ValvesClose = input.ReadLine();
|
||||
tst.RegulValvesPct = input.ReadLine();
|
||||
tst.PumpWithFMPcts = input.ReadLine();
|
||||
|
||||
return tst;
|
||||
}
|
||||
|
||||
public virtual string Compare(StreamReader inp)
|
||||
{
|
||||
System.Text.StringBuilder diff = new System.Text.StringBuilder();
|
||||
string fmt = string.Format("Step {0} : ", ItemNr) + "{0} = {1}\r\n (in the file {2})\r\n";
|
||||
string ln;
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
|
||||
string firstLine = inp.ReadLine();
|
||||
if (string.IsNullOrEmpty(firstLine)) return string.Format("TransitionStep {0} is missing in the compared file\r\n", ItemNr);
|
||||
|
||||
if (ItemNr.ToString() != firstLine) { diff.AppendFormat(fmt, "ItemNr", ItemNr, firstLine); };
|
||||
ln = inp.ReadLine(); if (ln != Duration.ToString(ci)) { diff.AppendFormat(fmt, "Duration", Duration.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Message) { diff.AppendFormat(fmt, "Message", Message, ln); };
|
||||
ln = inp.ReadLine(); if (ln != EndCondition) { diff.AppendFormat(fmt, "EndCondition", EndCondition, ln); };
|
||||
ln = inp.ReadLine(); if (ln != ValvesOpen) { diff.AppendFormat(fmt, "ValvesOpen", ValvesOpen, ln); };
|
||||
ln = inp.ReadLine(); if (ln != ValvesClose) { diff.AppendFormat(fmt, "ValvesClose", ValvesClose, ln); };
|
||||
ln = inp.ReadLine(); if (ln != RegulValvesPct) { diff.AppendFormat(fmt, "RegulValvesPct", RegulValvesPct, ln); };
|
||||
ln = inp.ReadLine(); if (ln != PumpWithFMPcts) { diff.AppendFormat(fmt, "PumpWithFMPcts", PumpWithFMPcts, ln); };
|
||||
|
||||
return diff.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class Uncertainty
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual float Measurement { get; set; }
|
||||
public virtual float MainUncertainty { get; set; }
|
||||
public virtual float Resolution { get; set; }
|
||||
public virtual float DriftPerYr { get; set; }
|
||||
public virtual float Conditions { get; set; }
|
||||
public virtual float UncertaintyOfCorrection { get; set; }
|
||||
|
||||
public Uncertainty() { }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,12 +11,8 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string UserName { get; set; } /// = name, alias, abbreviation
|
||||
public virtual string FullName { get; set; } /// = description
|
||||
public virtual string Tag { get; set; }
|
||||
public virtual int Number { get; set; }
|
||||
public virtual int Number { get; set; }
|
||||
public virtual string Password { get; set; }
|
||||
public virtual string Password2 { get; set; }
|
||||
public virtual string Password3 { get; set; }
|
||||
public virtual string Password4 { get; set; }
|
||||
public virtual DateTime LastPwChange { get; set; }
|
||||
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@@ -36,24 +35,5 @@ namespace Config.Entities
|
||||
foreach (var step in VirtualBenchSteps) { result.VirtualBenchSteps.Add(step.Clone()); }
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
/// TODO
|
||||
}
|
||||
|
||||
public static VirtualBenchSequence Import(StreamReader input)
|
||||
{
|
||||
VirtualBenchSequence result = new VirtualBenchSequence();
|
||||
/// TODO
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual string Compare(StreamReader inp)
|
||||
{
|
||||
System.Text.StringBuilder diff = new System.Text.StringBuilder();
|
||||
/// TODO
|
||||
return diff.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
/// This class holds the watermeter type specific data
|
||||
/// that have all watermaters of the same type in common
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class WMType
|
||||
{
|
||||
// mapped
|
||||
public virtual int Id { get; protected set; } /// primary key
|
||||
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
|
||||
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
|
||||
public virtual string CreateDescription { get; set; } /// Description\
|
||||
|
||||
public virtual string Name { get; set; } /// type name
|
||||
public virtual float PulseRate { get; set; } /// Pulses per Liter
|
||||
|
||||
// not yet mapped
|
||||
public virtual int IdentNr { get; protected set; } /// identification number of watermeter tzpe
|
||||
public virtual int Diameter { get; set; } /// nominal diameter
|
||||
public virtual int Pressure { get; set; } /// nominal pressure
|
||||
public virtual int Length { get; set; } /// construction length
|
||||
public virtual int Temperatur { get; set; } /// nominal temperature in C
|
||||
public virtual float NominalFlow { get; set; } /// nominal flow Qn
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public WMType()
|
||||
{
|
||||
}
|
||||
|
||||
public static WMType DefaultWMType()
|
||||
{
|
||||
WMType procedure = new WMType()
|
||||
{
|
||||
CreateTime = DateTime.Now,
|
||||
CreateUserName = Users.GlobalData.CurrentUser.UserName,
|
||||
CreateDescription = "A default water meter created.",
|
||||
Name = "Watermeter",
|
||||
PulseRate = 1000,
|
||||
};
|
||||
return procedure;
|
||||
}
|
||||
|
||||
public virtual WMType Clone()
|
||||
{
|
||||
WMType result = new WMType();
|
||||
|
||||
result.CreateTime = CreateTime;
|
||||
result.CreateUserName = CreateUserName;
|
||||
result.CreateDescription = CreateDescription;
|
||||
result.Name = Name;
|
||||
result.PulseRate = PulseRate;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = "";
|
||||
result += "WMTpe: " + Environment.NewLine;
|
||||
result += " Name = " + Name + Environment.NewLine;
|
||||
result += " Created by = " + CreateUserName + Environment.NewLine;
|
||||
result += " Created on = " + CreateTime.ToString() + Environment.NewLine;
|
||||
result += " Description = " + CreateDescription + Environment.NewLine;
|
||||
result += " Pulse rate = " + PulseRate.ToString() + Environment.NewLine;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using NHibernate;
|
||||
using FluentNHibernate;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class Watermeter
|
||||
{
|
||||
public virtual int Id { get; protected set; } /// primary key
|
||||
|
||||
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
|
||||
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
|
||||
public virtual string CreateDescription { get; set; } /// Description
|
||||
|
||||
/// mapped
|
||||
public virtual string Serial { get; set; } /// serial number
|
||||
public virtual WMType WMType { get; set; } /// type of watermeter
|
||||
///
|
||||
|
||||
/// <summary>
|
||||
/// Load a watermeter from the database
|
||||
/// </summary>
|
||||
public static Watermeter LoadBySerialnr(string SerialNr)
|
||||
{
|
||||
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(Users.Entities.DBKind.Results)
|
||||
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
|
||||
.SetParameter("SerialNrParameter", SerialNr)
|
||||
.List<Watermeter>();
|
||||
if (ListOfWatermeters.Count > 0) return ListOfWatermeters.ElementAt(0);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
-28
@@ -145,8 +145,17 @@ namespace Config
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
///
|
||||
/// Create user 'admin'
|
||||
/// Prepare all groups
|
||||
///
|
||||
var testers = new Config.Entities.Group((int)Users.Grp.GID.Testers, Strings.Tester);
|
||||
var testingSpecialists = new Config.Entities.Group((int)Users.Grp.GID.TestingSpecialists, Strings.Testing_Specialist);
|
||||
var headOfLab = new Config.Entities.Group((int)Users.Grp.GID.HeadOfLab, Strings.Head_of_Lab);
|
||||
var maintenanceSpecialists = new Config.Entities.Group((int)Users.Grp.GID.MaintenanceSpecialists, Strings.Maintenance_Specialist);
|
||||
var metrologists = new Config.Entities.Group((int)Users.Grp.GID.Metrologists, Strings.Metrologist);
|
||||
var calibrationSpecialists = new Config.Entities.Group((int)Users.Grp.GID.CalibrationSpecialists, Strings.Calibration_Specialist);
|
||||
var administrators = new Config.Entities.Group((int)Users.Grp.GID.Administrators, Strings.Administrator);
|
||||
|
||||
/// Create the user 'admin' add his groups
|
||||
var admin = new Config.Entities.User
|
||||
{
|
||||
UserName = Data.AdminUsername,
|
||||
@@ -154,35 +163,20 @@ namespace Config
|
||||
LastPwChange = DateTime.Now
|
||||
};
|
||||
admin.SetPassword(Data.AdminPassword);
|
||||
admin.AddGroup(testers);
|
||||
admin.AddGroup(testingSpecialists);
|
||||
admin.AddGroup(headOfLab);
|
||||
admin.AddGroup(maintenanceSpecialists);
|
||||
admin.AddGroup(metrologists);
|
||||
admin.AddGroup(calibrationSpecialists);
|
||||
admin.AddGroup(administrators);
|
||||
|
||||
///
|
||||
/// Prepare all groups, add some of them to admin
|
||||
///
|
||||
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
|
||||
{
|
||||
Config.Entities.Group group = new Config.Entities.Group(gid);
|
||||
switch (gid)
|
||||
{
|
||||
case Users.Entities.GID.Testers:
|
||||
case Users.Entities.GID.TestingSpecialists:
|
||||
case Users.Entities.GID.HeadOfLab:
|
||||
case Users.Entities.GID.MaintenanceSpecialists:
|
||||
case Users.Entities.GID.Metrologists:
|
||||
case Users.Entities.GID.CalibrationSpecialists:
|
||||
case Users.Entities.GID.Administrators:
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
case Users.Entities.GID.TraceabilityManagement:
|
||||
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_END
|
||||
case Users.Entities.GID.MetrologicalAuthority:
|
||||
case Users.Entities.GID.WaterMeterAuthority:
|
||||
#endif
|
||||
admin.AddGroup(group);
|
||||
session.SaveOrUpdate(group); /// Save this group
|
||||
break;
|
||||
}
|
||||
}
|
||||
session.SaveOrUpdate(admin);
|
||||
|
||||
///// Create the control board component
|
||||
//var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
|
||||
//session.SaveOrUpdate(cmpnt);
|
||||
|
||||
session.SaveOrUpdate(admin); /// Save user 'admin'
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
+50
-68
@@ -11,23 +11,14 @@ namespace Config
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Formulas));
|
||||
|
||||
|
||||
///
|
||||
/// Wrappers
|
||||
/// Tables to calculate specific enthalpy
|
||||
///
|
||||
public static double RealDensity() { return Data.RealDensity; }
|
||||
public static double AtTemperature() { return Data.AtTemperature; }
|
||||
public static double Buoyancy() { return Data.Buoyancy; }
|
||||
|
||||
|
||||
/// Private tables with coeficients to calculate specific enthalpy
|
||||
static readonly int[] Ii;
|
||||
static readonly int[] Ji;
|
||||
static readonly double[] ni;
|
||||
|
||||
/// Private table with coeficients to calculate temperature of a platinum thermometer
|
||||
static readonly double[] Di;
|
||||
private static readonly int[] Ii;
|
||||
private static readonly int[] Ji;
|
||||
private static readonly double[] ni;
|
||||
|
||||
private static readonly double[] Di;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
@@ -162,9 +153,9 @@ namespace Config
|
||||
/// </summary>
|
||||
/// <param name="t">Temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double WaterDensityFromTemp(double t)
|
||||
public static double WaterDensityFromTemp(double t, double realDensity, double atTemperature)
|
||||
{
|
||||
return DistilledWaterDensityFromTemp(t) + DensityCorrection(RealDensity(), AtTemperature());
|
||||
return DistilledWaterDensityFromTemp(t) + DensityCorrection(realDensity, atTemperature);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -172,7 +163,7 @@ namespace Config
|
||||
/// </summary>
|
||||
/// <param name="t">Temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double WaterDensityFromTempPress(double temp, double pressure)
|
||||
public static double WaterDensityFromTempPress(double temp, double pressure, double realDensity, double atTemperature)
|
||||
{
|
||||
double x0 = 5.08821E-10;
|
||||
double x1 = 1.2639418;
|
||||
@@ -182,7 +173,7 @@ namespace Config
|
||||
double theta = temp / 100.0;
|
||||
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
|
||||
|
||||
return WaterDensityFromTemp(temp) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure));
|
||||
return WaterDensityFromTemp(temp, realDensity, atTemperature) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure));
|
||||
}
|
||||
|
||||
|
||||
@@ -230,60 +221,45 @@ namespace Config
|
||||
return error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates corrected value form a list of corrections by interpolation.
|
||||
/// It is assumed that values in the list 'corrections' are sorted.
|
||||
/// </summary>
|
||||
/// <param name="rawMeasurement">Raw uncorrected value</param>
|
||||
/// <param name="corrections">Sorted (value, correction) pairs</param>
|
||||
/// <returns>Corrected value</returns>
|
||||
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
|
||||
{
|
||||
if (corrections == null || corrections.Count == 0) return rawValue;
|
||||
|
||||
/// <summary>
|
||||
/// Calculates corrected value from a list of corrections by interpolation.
|
||||
/// It is assumed that values in the list 'corrections' are sorted.
|
||||
/// </summary>
|
||||
/// <param name="rawMeasurement">Raw uncorrected value</param>
|
||||
/// <param name="corrections">Sorted (value, correction) pairs</param>
|
||||
/// <returns>Corrected value</returns>
|
||||
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
|
||||
{
|
||||
return rawValue + GetCorrection(rawValue, corrections);
|
||||
}
|
||||
if (rawValue < corrections[0].Measurement)
|
||||
{
|
||||
return rawValue + corrections[0].Correction;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a correction from a list of corrections by interpolation.
|
||||
/// It is assumed that values in the list 'corrections' are sorted.
|
||||
/// </summary>
|
||||
/// <param name="rawMeasurement">Raw uncorrected value</param>
|
||||
/// <param name="corrections">Sorted (value, correction) pairs</param>
|
||||
/// <returns>Corrected value</returns>
|
||||
public static double GetCorrection(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
|
||||
{
|
||||
if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction
|
||||
int count = corrections.Count;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
if (rawValue < corrections[i].Measurement)
|
||||
{
|
||||
double d1 = rawValue - corrections[i-1].Measurement;
|
||||
double d2 = corrections[i].Measurement - rawValue;
|
||||
|
||||
if (rawValue < corrections[0].Measurement)
|
||||
{
|
||||
/// rawValue is below the lowest value in the correction table
|
||||
return corrections[0].Correction;
|
||||
}
|
||||
double corr;
|
||||
if (d1 + d2 <= float.Epsilon)
|
||||
{
|
||||
corr = (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
corr = (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
|
||||
}
|
||||
return rawValue + corr;
|
||||
}
|
||||
}
|
||||
|
||||
int count = corrections.Count;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
if (rawValue < corrections[i].Measurement)
|
||||
{
|
||||
double d1 = rawValue - corrections[i - 1].Measurement;
|
||||
double d2 = corrections[i].Measurement - rawValue;
|
||||
|
||||
if (d1 + d2 <= float.Epsilon)
|
||||
{
|
||||
/// Neigboring values in the corection table are close to each other -> calculate the average
|
||||
return (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Interpolate the correction from neigboring values in the corection table
|
||||
return (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// rawValue is above the highest value in the correction table
|
||||
return corrections[count - 1].Correction;
|
||||
}
|
||||
return rawValue + corrections[count - 1].Correction;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -403,5 +379,11 @@ namespace Config
|
||||
|
||||
return (-(R0 * A) + Math.Sqrt(R0 * R0 * A * A - 4 * R0 * B * (R0 - R))) / (2 * R0 * B);
|
||||
}
|
||||
|
||||
|
||||
public static double Buoyancy()
|
||||
{
|
||||
return 1.00103;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
@@ -23,9 +23,6 @@ namespace Config.Mappings
|
||||
HasMany(x => x.Corrections)
|
||||
.OrderBy("Measurement")
|
||||
.Cascade.All();
|
||||
HasMany(x => x.Uncertainties)
|
||||
.OrderBy("Measurement")
|
||||
.Cascade.All();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -7,18 +7,11 @@ namespace Config.Mappings
|
||||
{
|
||||
class GroupMap : ClassMap<Entities.Group>
|
||||
{
|
||||
/// <seealso>
|
||||
/// https://stackoverflow.com/questions/9108083/fluent-nhibernate-many-to-many-mapping-way/9125059
|
||||
/// </seealso>
|
||||
public GroupMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.GID).Column("Name");
|
||||
Map(x => x.AccessFlags);
|
||||
HasManyToMany(x => x.Users)
|
||||
.Cascade.SaveUpdate()
|
||||
.Inverse()
|
||||
.Table("UsersGroups");
|
||||
Map(x => x.Gid);
|
||||
Map(x => x.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class PTestMap : ClassMap<PTest>
|
||||
{
|
||||
public PTestMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Part);
|
||||
Map(x => x.CoefQfrom);
|
||||
Map(x => x.CoefQto);
|
||||
Map(x => x.ErrLimLo);
|
||||
Map(x => x.ErrLimHi);
|
||||
Map(x => x.TempLimLo);
|
||||
Map(x => x.TempLimHi);
|
||||
Map(x => x.PressLimLo);
|
||||
Map(x => x.PressLimHi);
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.Evaluate);
|
||||
Map(x => x.E1);
|
||||
Map(x => x.E2);
|
||||
Map(x => x.E3);
|
||||
Map(x => x.E4);
|
||||
Map(x => x.E5);
|
||||
Map(x => x.E6);
|
||||
Map(x => x.E7);
|
||||
Map(x => x.E8);
|
||||
Map(x => x.E9);
|
||||
Map(x => x.E10);
|
||||
Map(x => x.E11);
|
||||
Map(x => x.E12);
|
||||
Map(x => x.E13);
|
||||
Map(x => x.E14);
|
||||
Map(x => x.E15);
|
||||
Map(x => x.E16);
|
||||
Map(x => x.E21);
|
||||
Map(x => x.Delta_Q_pct);
|
||||
Map(x => x.Delta_T);
|
||||
Map(x => x.Delta_Tup_Tdn);
|
||||
Map(x => x.TestTime_min);
|
||||
Map(x => x.TestTime_max);
|
||||
Map(x => x.AmbTemp_min);
|
||||
Map(x => x.AmbTemp_max);
|
||||
Map(x => x.Coef_E9);
|
||||
Map(x => x.Coef_E10);
|
||||
Map(x => x.Coef_E11);
|
||||
Map(x => x.Coef_E12);
|
||||
Map(x => x.Offset_E9);
|
||||
Map(x => x.Offset_E12);
|
||||
References(x => x.Profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class ProfileMap : ClassMap<Profile>
|
||||
{
|
||||
public ProfileMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Description);
|
||||
Map(x => x.CreationUser);
|
||||
Map(x => x.CreationTime);
|
||||
Map(x => x.LastChgUser);
|
||||
Map(x => x.LastChgTime);
|
||||
Map(x => x.ProfileType);
|
||||
Map(x => x.ErrorLimitType);
|
||||
HasMany(x => x.Tests)
|
||||
.OrderBy("ItemNr")
|
||||
.Cascade.All();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,21 +14,17 @@ namespace Config.Mappings
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Part);
|
||||
Map(x => x.Profile);
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.DoEvaluate)
|
||||
.Column("Evaluate");
|
||||
#if TEST_PROFILES
|
||||
Map(x => x.Qtg);
|
||||
#endif
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qto);
|
||||
Map(x => x.Volume);
|
||||
Map(x => x.TstTime);
|
||||
Map(x => x.Repeats);
|
||||
Map(x => x.DoDraining)
|
||||
.Column("Emptying");
|
||||
Map(x => x.DoDrainingAfter)
|
||||
Map(x => x.DoZeroing)
|
||||
.Column("Zeroing");
|
||||
Map(x => x.DoControlWaterTemp);
|
||||
Map(x => x.TempLimLo);
|
||||
@@ -49,7 +45,7 @@ namespace Config.Mappings
|
||||
Map(x => x.Uncertainty);
|
||||
Map(x => x.TolerRed)
|
||||
.Column("TolerRed"); /// ???
|
||||
Map(x => x.RedType);
|
||||
Map(x => x.RedType); /// ???
|
||||
Map(x => x.FeedingPath);
|
||||
Map(x => x.BenchPath);
|
||||
Map(x => x.OutputPath);
|
||||
@@ -57,14 +53,11 @@ namespace Config.Mappings
|
||||
#if HEAT_METERS
|
||||
Map(x => x.HeatMetersPath);
|
||||
#endif
|
||||
Map(x => x.RelTransBefore)
|
||||
.Column("RelTransBefore");
|
||||
Map(x => x.RelTransBetween)
|
||||
.Column("RelTransBetween");
|
||||
Map(x => x.TransitionAfter)
|
||||
.Column("TransitionAfter");
|
||||
|
||||
HasMany(x => x.MoreParams)
|
||||
Map(x => x.RelTransBefore);
|
||||
Map(x => x.RelTransBetween);
|
||||
Map(x => x.RelTransAfter);
|
||||
Map(x => x.TransitionAfter);
|
||||
HasMany(x => x.MoreParams)
|
||||
.Cascade.All();
|
||||
References(x => x.Procedure);
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class UncertaintyMap : ClassMap<Uncertainty>
|
||||
{
|
||||
public UncertaintyMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.Measurement);
|
||||
Map(x => x.MainUncertainty);
|
||||
Map(x => x.Resolution);
|
||||
Map(x => x.DriftPerYr);
|
||||
Map(x => x.Conditions);
|
||||
Map(x => x.UncertaintyOfCorrection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -12,16 +12,11 @@ namespace Config.Mappings
|
||||
Id(x => x.Id);
|
||||
Map(x => x.UserName).Column("Name");
|
||||
Map(x => x.Number);
|
||||
Map(x => x.Tag);
|
||||
Map(x => x.Password);
|
||||
Map(x => x.Password2);
|
||||
Map(x => x.Password3);
|
||||
Map(x => x.Password4);
|
||||
Map(x => x.FullName).Column("Description");
|
||||
Map(x => x.LastPwChange);
|
||||
HasManyToMany(x => x.Groups)
|
||||
.Cascade.SaveUpdate()
|
||||
.Table("UsersGroups");
|
||||
HasMany(x => x.Groups)
|
||||
.Cascade.All();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class VirtualBenchSequenceMap : ClassMap<VirtualBenchSequence>
|
||||
{
|
||||
public VirtualBenchSequenceMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Description);
|
||||
HasMany(x => x.VirtualBenchSteps)
|
||||
.OrderBy("ItemNr")
|
||||
.Cascade.All();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class VirtualBenchStepMap : ClassMap<VirtualBenchStep>
|
||||
{
|
||||
public VirtualBenchStepMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Duration);
|
||||
|
||||
References(x => x.VirtualBenchSequence);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class WMTypeMap : ClassMap<Entities.WMType>
|
||||
{
|
||||
public WMTypeMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.CreateTime);
|
||||
Map(x => x.CreateUserName);
|
||||
Map(x => x.CreateDescription);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.PulseRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class WatermeterMap : ClassMap<Entities.Watermeter>
|
||||
{
|
||||
public WatermeterMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.Serial);
|
||||
// HasOne(x => x.WMType)
|
||||
// .Cascade.All();
|
||||
References(x => x.WMType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.25.1400.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1400.0")]
|
||||
[assembly: AssemblyVersion("2.18.1110.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1110.0")]
|
||||
|
||||
@@ -117,6 +117,27 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Administrator" xml:space="preserve">
|
||||
<value>Administrator</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>Kalibriertechniker</value>
|
||||
</data>
|
||||
<data name="Head_of_Lab" xml:space="preserve">
|
||||
<value>Laborleiter</value>
|
||||
</data>
|
||||
<data name="Maintenance_Specialist" xml:space="preserve">
|
||||
<value>Wartungstechniker</value>
|
||||
</data>
|
||||
<data name="Metrologist" xml:space="preserve">
|
||||
<value>Messtechniker</value>
|
||||
</data>
|
||||
<data name="Tester" xml:space="preserve">
|
||||
<value>Prüfer</value>
|
||||
</data>
|
||||
<data name="Testing_Specialist" xml:space="preserve">
|
||||
<value>Prüftechniker</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>NiO</value>
|
||||
</data>
|
||||
|
||||
@@ -117,6 +117,27 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Administrator" xml:space="preserve">
|
||||
<value>Amministratore</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>esperto in calibrazione</value>
|
||||
</data>
|
||||
<data name="Head_of_Lab" xml:space="preserve">
|
||||
<value>capo di laboratorio</value>
|
||||
</data>
|
||||
<data name="Maintenance_Specialist" xml:space="preserve">
|
||||
<value>esperto di manutenzione</value>
|
||||
</data>
|
||||
<data name="Metrologist" xml:space="preserve">
|
||||
<value>metrologo</value>
|
||||
</data>
|
||||
<data name="Tester" xml:space="preserve">
|
||||
<value>tester</value>
|
||||
</data>
|
||||
<data name="Testing_Specialist" xml:space="preserve">
|
||||
<value>esperto di prove </value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>NOK</value>
|
||||
</data>
|
||||
|
||||
@@ -117,6 +117,27 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Administrator" xml:space="preserve">
|
||||
<value>Administrator</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>Specjalista ds. kalibracji</value>
|
||||
</data>
|
||||
<data name="Head_of_Lab" xml:space="preserve">
|
||||
<value>Kierownik Laboratorium</value>
|
||||
</data>
|
||||
<data name="Maintenance_Specialist" xml:space="preserve">
|
||||
<value>Konserwator</value>
|
||||
</data>
|
||||
<data name="Metrologist" xml:space="preserve">
|
||||
<value>Metrolog</value>
|
||||
</data>
|
||||
<data name="Tester" xml:space="preserve">
|
||||
<value>Pracownik przeprowadzający testy</value>
|
||||
</data>
|
||||
<data name="Testing_Specialist" xml:space="preserve">
|
||||
<value>Specjalista ds. testów</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Niepowodzenie</value>
|
||||
</data>
|
||||
|
||||
@@ -117,6 +117,27 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Administrator" xml:space="preserve">
|
||||
<value>Administrator</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>Calibration Specialist</value>
|
||||
</data>
|
||||
<data name="Head_of_Lab" xml:space="preserve">
|
||||
<value>Head of Lab</value>
|
||||
</data>
|
||||
<data name="Maintenance_Specialist" xml:space="preserve">
|
||||
<value>Maintenance Specialist</value>
|
||||
</data>
|
||||
<data name="Metrologist" xml:space="preserve">
|
||||
<value>Metrologist</value>
|
||||
</data>
|
||||
<data name="Tester" xml:space="preserve">
|
||||
<value>Tester</value>
|
||||
</data>
|
||||
<data name="Testing_Specialist" xml:space="preserve">
|
||||
<value>Testing Specialist</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>NOK</value>
|
||||
</data>
|
||||
|
||||
@@ -117,6 +117,27 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Administrator" xml:space="preserve">
|
||||
<value>Администратор</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>Специалист по калибровке</value>
|
||||
</data>
|
||||
<data name="Head_of_Lab" xml:space="preserve">
|
||||
<value>Руководитель лаборатории</value>
|
||||
</data>
|
||||
<data name="Maintenance_Specialist" xml:space="preserve">
|
||||
<value>Специалист по техобслуживанию</value>
|
||||
</data>
|
||||
<data name="Metrologist" xml:space="preserve">
|
||||
<value>Метролог</value>
|
||||
</data>
|
||||
<data name="Tester" xml:space="preserve">
|
||||
<value>Контролер</value>
|
||||
</data>
|
||||
<data name="Testing_Specialist" xml:space="preserve">
|
||||
<value>Специалист по тестированию</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>NOK</value>
|
||||
</data>
|
||||
|
||||
+124
-125
@@ -1,129 +1,128 @@
|
||||
<?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.
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Error" xml:space="preserve">
|
||||
<value>错误 Error</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>NOK</value>
|
||||
</data>
|
||||
<data name="Passed" xml:space="preserve">
|
||||
<value>好</value>
|
||||
</data>
|
||||
Version 1.3
|
||||
|
||||
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">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Administrator" xml:space="preserve">
|
||||
<value>管理员</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>校准专员</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>NOK</value>
|
||||
</data>
|
||||
<data name="Head_of_Lab" xml:space="preserve">
|
||||
<value>实验室负责人</value>
|
||||
</data>
|
||||
<data name="Maintenance_Specialist" xml:space="preserve">
|
||||
<value>维护专员</value>
|
||||
</data>
|
||||
<data name="Metrologist" xml:space="preserve">
|
||||
<value>计量者</value>
|
||||
</data>
|
||||
<data name="Passed" xml:space="preserve">
|
||||
<value>好</value>
|
||||
</data>
|
||||
<data name="Tester" xml:space="preserve">
|
||||
<value>测试仪</value>
|
||||
</data>
|
||||
<data name="Testing_Specialist" xml:space="preserve">
|
||||
<value>测试专员</value>
|
||||
</data>
|
||||
</root>
|
||||
-170
@@ -82,175 +82,5 @@ namespace Config
|
||||
else return "F5";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a DB server from a MySQL connection string.
|
||||
/// </summary>
|
||||
public static string GetDBServer(string connectionString)
|
||||
{
|
||||
return GetFromConnectionString(connectionString, new string[] { "SERVER=" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a DB name from a MySQL connection string.
|
||||
/// </summary>
|
||||
public static string GetDBName(string connectionString)
|
||||
{
|
||||
return GetFromConnectionString(connectionString, new string[] { "DATABASE=" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a username from a MySQL connection string
|
||||
/// </summary>
|
||||
public static string GetDBUser(string connectionString)
|
||||
{
|
||||
return GetFromConnectionString(connectionString, new string[] { "USER=", "UID=" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a password from a MySQL connection string
|
||||
/// </summary>
|
||||
public static string GetDBPassword(string connectionString)
|
||||
{
|
||||
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=", "PWD=" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return an element of a MySQL connection string
|
||||
/// (a host, a database, a user name or a password).
|
||||
/// Return an empty string on any error.
|
||||
/// </summary>
|
||||
public static string GetFromConnectionString(string connectionString, string[] patterns)
|
||||
{
|
||||
foreach (var pattern in patterns)
|
||||
{
|
||||
int startIx = connectionString.IndexOf(pattern);
|
||||
if (startIx >= 0)
|
||||
{
|
||||
/// pattern found, extract the subsequent element
|
||||
startIx += pattern.Length;
|
||||
int endIx = connectionString.IndexOf(';', startIx);
|
||||
return (endIx > 0) ? connectionString.Substring(startIx, endIx - startIx) : string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// pattern NOT found
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get either Q1 or Qmin flow for a given Qn and metrological class
|
||||
/// </summary>
|
||||
/// <param name="Qn">Nominal flow in m3/h</param>
|
||||
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
|
||||
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
|
||||
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
|
||||
/// <returns>Q1 or Qmin flow in m3/h</returns>
|
||||
public static double GetQ1Qmin(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
|
||||
|
||||
int metroClassRatio;
|
||||
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
|
||||
{
|
||||
return Qn / (double)metroClassRatio;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (medium == Entities.Medium.HotWater)
|
||||
{
|
||||
switch (metroClass)
|
||||
{
|
||||
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
|
||||
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.04 * Qn);
|
||||
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.02 * Qn);
|
||||
case "D": return (Qn < 15) ? (0.01 * Qn) : Qdflt;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (metroClass)
|
||||
{
|
||||
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
|
||||
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.03 * Qn);
|
||||
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.006 * Qn);
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Qdflt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get either Q2 or Qt flow for a given Qn and metrological class
|
||||
/// </summary>
|
||||
/// <param name="Qn">Nominal flow in m3/h</param>
|
||||
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
|
||||
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
|
||||
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
|
||||
/// <returns>Q2 or Qt flow in m3/h</returns>
|
||||
public static double GetQ2Qt(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
|
||||
|
||||
int metroClassRatio;
|
||||
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
|
||||
{
|
||||
return 1.6 * Qn / (double)metroClassRatio;
|
||||
}
|
||||
|
||||
if (medium == Entities.Medium.HotWater)
|
||||
{
|
||||
switch (metroClass)
|
||||
{
|
||||
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.2 * Qn);
|
||||
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.15 * Qn);
|
||||
case "C": return (Qn < 15) ? (0.06 * Qn) : (0.1 * Qn);
|
||||
case "D": return (Qn < 15) ? (0.015 * Qn) : Qdflt;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (metroClass)
|
||||
{
|
||||
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.3 * Qn);
|
||||
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.2 * Qn);
|
||||
case "C": return (Qn < 15) ? (0.015 * Qn) : (0.015 * Qn);
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
return Qdflt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get either Q4 or Qmax flow for a given Qn and metrological class
|
||||
/// </summary>
|
||||
/// <param name="Qn">Nominal flow in m3/h</param>
|
||||
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
|
||||
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
|
||||
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
|
||||
/// <returns>Q4 or Qmax flow in m3/h</returns>
|
||||
public static double GetQ4Qmax(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
|
||||
|
||||
switch (metroClass[0])
|
||||
{
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
return 2 * Qn;
|
||||
case 'R':
|
||||
return 1.25 * Qn;
|
||||
default:
|
||||
return Qdflt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D476ABBE-A455-4476-8A8D-3F6151217B51}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Decrypt</RootNamespace>
|
||||
<AssemblyName>Decrypt</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Decrypt.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<StartArguments>config.xml</StartArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<StartArguments>config.xml</StartArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Decrypt
|
||||
{
|
||||
/// <summary>
|
||||
/// See also:
|
||||
/// https://www.fluxbytes.com/csharp/encrypt-and-decrypt-files-in-c/
|
||||
/// </summary>
|
||||
class Program
|
||||
{
|
||||
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
|
||||
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if ((args.Length < 1) || !File.Exists(args[0]))
|
||||
{
|
||||
Console.WriteLine("Usage: Decode <file>");
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
|
||||
string fileName = args[0];
|
||||
string intermediateFile = fileName + ".plain"; /// Intermediate file, output of cryptography decoding
|
||||
string backupFile = fileName + ".bak";
|
||||
|
||||
try
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(fileName))
|
||||
{
|
||||
if (reader.ReadLine().StartsWith("<?xml version="))
|
||||
{
|
||||
Console.WriteLine(string.Format("File {0} is not encrypted.", fileName));
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool successful = false;
|
||||
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
|
||||
{
|
||||
using (FileStream fsCrypt = new FileStream(fileName, FileMode.Open))
|
||||
{
|
||||
using (FileStream fsOut = new FileStream(intermediateFile, FileMode.Create))
|
||||
{
|
||||
using (ICryptoTransform decryptor = aes.CreateDecryptor(key, IV))
|
||||
{
|
||||
using (CryptoStream cs = new CryptoStream(fsCrypt, decryptor, CryptoStreamMode.Read))
|
||||
{
|
||||
int data;
|
||||
while ((data = cs.ReadByte()) != -1)
|
||||
{
|
||||
if (data != 0) fsOut.WriteByte((byte)data);
|
||||
}
|
||||
successful = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (successful)
|
||||
{
|
||||
/// File decryption successfuly completed => rotate files
|
||||
if (File.Exists(backupFile)) File.Delete(backupFile);
|
||||
File.Move(fileName, backupFile);
|
||||
File.Move(intermediateFile, fileName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Failed(fileName, intermediateFile, "");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Failed(fileName, intermediateFile, e.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void Failed(string fileName, string toBeDeleted, string message)
|
||||
{
|
||||
if (File.Exists(toBeDeleted))
|
||||
{
|
||||
File.Delete(toBeDeleted);
|
||||
}
|
||||
Console.WriteLine(string.Format("Decryption of file {0} failed: {1}", fileName, message));
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Decrypt")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Decrypt")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("c17ec788-0e12-4f9c-aadf-ea4e83a9f373")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DeviceTest</RootNamespace>
|
||||
<AssemblyName>DeviceTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,7 +24,6 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -34,7 +33,6 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>DeviceTest.Program</StartupObject>
|
||||
|
||||
+13
-54
@@ -7,6 +7,7 @@ using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
|
||||
@@ -26,11 +27,11 @@ namespace DeviceTest
|
||||
IComponentCfg component2Cfg;
|
||||
IComponentCfg component3Cfg;
|
||||
|
||||
static IList<IDevice> tbfDevices;
|
||||
static IList<IComponent> tbfComponents;
|
||||
static IComponent tbfComponent1forOp;
|
||||
static IComponent tbfComponent2forOp;
|
||||
static IComponent tbfComponent3forOp;
|
||||
static IList<TBF.BenchControl.Generic.IDevice> tbfDevices;
|
||||
static IList<TBF.BenchControl.Generic.IComponent> tbfComponents;
|
||||
static TBF.BenchControl.Generic.IComponent tbfComponent1forOp;
|
||||
static TBF.BenchControl.Generic.IComponent tbfComponent2forOp;
|
||||
static TBF.BenchControl.Generic.IComponent tbfComponent3forOp;
|
||||
|
||||
static Thread workerThread;
|
||||
static bool workerThreadRunning;
|
||||
@@ -275,14 +276,7 @@ namespace DeviceTest
|
||||
radioButton3.Text = "SelectTank 3";
|
||||
radioButton4.Text = "SelectTank -";
|
||||
}
|
||||
else if (className == "Modbus.QuidoRS")
|
||||
{
|
||||
radioButton1.Text = "Close relay 1";
|
||||
radioButton2.Text = "Close relay 2";
|
||||
radioButton3.Text = "Close relay 3";
|
||||
radioButton4.Text = "Open all relays";
|
||||
}
|
||||
else radioButton1.Text = "spare";
|
||||
else radioButton1.Text = "spare";
|
||||
}
|
||||
///
|
||||
void UpdateOperations2(string className)
|
||||
@@ -302,14 +296,7 @@ namespace DeviceTest
|
||||
radioButton23.Text = "SelectTank 3";
|
||||
radioButton24.Text = "SelectTank -";
|
||||
}
|
||||
else if (className == "Modbus.QuidoRS")
|
||||
{
|
||||
radioButton21.Text = "Close relay 1";
|
||||
radioButton22.Text = "Close relay 2";
|
||||
radioButton23.Text = "Close relay 3";
|
||||
radioButton24.Text = "Open all relays";
|
||||
}
|
||||
else radioButton21.Text = "spare";
|
||||
else radioButton21.Text = "spare";
|
||||
}
|
||||
///
|
||||
void UpdateOperations3(string className)
|
||||
@@ -329,14 +316,7 @@ namespace DeviceTest
|
||||
radioButton33.Text = "SelectTank 3";
|
||||
radioButton34.Text = "SelectTank -";
|
||||
}
|
||||
else if (className == "Modbus.QuidoRS")
|
||||
{
|
||||
radioButton31.Text = "Close relay 1";
|
||||
radioButton32.Text = "Close relay 2";
|
||||
radioButton33.Text = "Close relay 3";
|
||||
radioButton34.Text = "Open all relays";
|
||||
}
|
||||
else radioButton31.Text = "spare";
|
||||
else radioButton31.Text = "spare";
|
||||
}
|
||||
|
||||
|
||||
@@ -425,7 +405,7 @@ namespace DeviceTest
|
||||
cfgControl.Config = parentCfg;
|
||||
cfgControl.Config.ItemNr = 0;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
|
||||
cfgForm.TbfComponents = new List<Config.Entities.Component>();
|
||||
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
@@ -454,7 +434,7 @@ namespace DeviceTest
|
||||
cfgControl.Config = component1Cfg;
|
||||
cfgControl.Config.ItemNr = 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
|
||||
///
|
||||
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
|
||||
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
|
||||
@@ -488,7 +468,7 @@ namespace DeviceTest
|
||||
cfgControl.Config = component2Cfg;
|
||||
cfgControl.Config.ItemNr = 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
|
||||
///
|
||||
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
|
||||
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
|
||||
@@ -523,7 +503,7 @@ namespace DeviceTest
|
||||
cfgControl.Config = component3Cfg;
|
||||
cfgControl.Config.ItemNr = 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
|
||||
///
|
||||
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
|
||||
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
|
||||
@@ -692,13 +672,6 @@ namespace DeviceTest
|
||||
//operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
|
||||
//operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
operation1 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
|
||||
operation2 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
|
||||
operation3 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
|
||||
operation4 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
|
||||
}
|
||||
|
||||
|
||||
if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
|
||||
@@ -731,13 +704,6 @@ namespace DeviceTest
|
||||
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
|
||||
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
operation21 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
|
||||
operation22 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
|
||||
operation23 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
|
||||
operation24 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
|
||||
}
|
||||
|
||||
|
||||
if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
|
||||
@@ -770,13 +736,6 @@ namespace DeviceTest
|
||||
//operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
|
||||
//operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
|
||||
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
|
||||
operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
|
||||
}
|
||||
|
||||
|
||||
int time = 0;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ namespace DeviceTest.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -10,10 +10,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Dirichlet.Numerics</RootNamespace>
|
||||
<AssemblyName>Dirichlet.Numerics</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -23,7 +22,6 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -32,7 +30,6 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@@ -51,4 +48,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{DA9B09F3-A99D-4883-A954-537560453674}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Encrypt</RootNamespace>
|
||||
<AssemblyName>Encrypt</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Encrypt.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,93 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Encrypt
|
||||
{
|
||||
/// <summary>
|
||||
/// See also:
|
||||
/// https://www.fluxbytes.com/csharp/encrypt-and-decrypt-files-in-c/
|
||||
/// </summary>
|
||||
class Program
|
||||
{
|
||||
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
|
||||
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if ((args.Length < 1) || !File.Exists(args[0]))
|
||||
{
|
||||
Console.WriteLine("Usage: Encode <file>");
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
|
||||
string fileName = args[0];
|
||||
string intermediateFile = fileName + ".encrypted"; /// Intermediate file, output of cryptography encoding
|
||||
string backupFile = fileName + ".bak";
|
||||
|
||||
try
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(fileName))
|
||||
{
|
||||
if (!reader.ReadLine().StartsWith("<?xml version="))
|
||||
{
|
||||
Console.WriteLine(string.Format("File {0} is already encrypted.", fileName));
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool successful = false;
|
||||
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
|
||||
{
|
||||
using (FileStream fsCrypt = new FileStream(intermediateFile, FileMode.Create))
|
||||
{
|
||||
using (ICryptoTransform encryptor = aes.CreateEncryptor(key, IV))
|
||||
{
|
||||
using (CryptoStream cs = new CryptoStream(fsCrypt, encryptor, CryptoStreamMode.Write))
|
||||
{
|
||||
using (FileStream fsIn = new FileStream(fileName, FileMode.Open))
|
||||
{
|
||||
int data;
|
||||
while ((data = fsIn.ReadByte()) != -1) cs.WriteByte((byte)data);
|
||||
successful = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (successful)
|
||||
{
|
||||
/// File encryption successfuly completed => rotate files
|
||||
if (File.Exists(backupFile)) File.Delete(backupFile);
|
||||
File.Move(fileName, backupFile);
|
||||
File.Move(intermediateFile, fileName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Failed(fileName, intermediateFile);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Failed(fileName, intermediateFile);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void Failed(string fileName, string toBeDeleted)
|
||||
{
|
||||
if (File.Exists(toBeDeleted))
|
||||
{
|
||||
File.Delete(toBeDeleted);
|
||||
}
|
||||
Console.WriteLine(string.Format("Encryption of file {0} failed.", fileName));
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Encrypt")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Encrypt")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0f602531-6f1f-416e-af4d-9242855715a8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
@@ -28,7 +28,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
@@ -66,7 +66,6 @@
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
@@ -88,7 +87,6 @@
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -101,7 +99,6 @@
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
@@ -113,7 +110,6 @@
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ClassLibrary1</RootNamespace>
|
||||
<AssemblyName>GraphLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -26,7 +25,6 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -35,7 +33,6 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
||||
+12
-12
@@ -1,10 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18408
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace ClassLibrary1.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
@@ -33,7 +33,7 @@ namespace ClassLibrary1.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
@@ -47,8 +47,8 @@ namespace ClassLibrary1.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RestClient
|
||||
{
|
||||
public class BaseClient
|
||||
{
|
||||
private string _token;
|
||||
|
||||
private string _baseUrl;
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
private readonly HttpClient client;
|
||||
private AuthenticationHeaderValue _authValue;
|
||||
|
||||
public BaseClient(string baseUrl)
|
||||
{
|
||||
this._baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public void SetToken(string token)
|
||||
{
|
||||
_authValue = new AuthenticationHeaderValue("Bearer", token);
|
||||
}
|
||||
|
||||
protected Uri GetUrl(string relativeUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new Uri(_baseUrl + relativeUrl);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Trace.TraceError("Invalid url " + relativeUrl);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task<TResult> GetResultAsync<TResult>(string relativeUrl)
|
||||
{
|
||||
ErrorMessage = String.Empty;
|
||||
Uri url = null;
|
||||
try
|
||||
{
|
||||
url = new Uri(_baseUrl + relativeUrl);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Trace.TraceError("Invalid url " + relativeUrl);
|
||||
return default(TResult);
|
||||
}
|
||||
using (var client = GetClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await client.GetAsync(url).ConfigureAwait(false);
|
||||
var parsedResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
if (result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<TResult>(parsedResult);
|
||||
}
|
||||
if (result.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
{
|
||||
//Create not an error message, because communication is okay, only the meter is not available in database.
|
||||
return default(TResult);
|
||||
}
|
||||
try
|
||||
{
|
||||
string Messages = await result.Content.ReadAsStringAsync();
|
||||
var errors = JsonConvert.DeserializeObject<Dictionary<string, object>>(Messages);
|
||||
string ServiceError = String.Empty;
|
||||
if (errors != null)
|
||||
{
|
||||
ServiceError = errors["Message"].ToString();
|
||||
}
|
||||
ErrorMessage = string.Format("Error message: {0}", ServiceError);
|
||||
}
|
||||
catch
|
||||
{
|
||||
result.EnsureSuccessStatusCode();
|
||||
}
|
||||
return default(TResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ex.Message;
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
Message += ". " + ex.InnerException.Message;
|
||||
}
|
||||
Trace.TraceError(Message);
|
||||
ErrorMessage = Message;
|
||||
return default(TResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Post method.
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="relativeUrl"></param>
|
||||
/// <param name="Position"></param>
|
||||
/// /// <param name="withBaseUrl"></param>
|
||||
/// <returns>The new resource</returns>
|
||||
protected async Task<string> PostWithReturnDataAsync<TResult>(string relativeUrl, bool withBaseUrl, TResult Position)
|
||||
{
|
||||
string data = string.Empty;
|
||||
ErrorMessage = String.Empty;
|
||||
Uri url = null;
|
||||
try
|
||||
{
|
||||
if (withBaseUrl)
|
||||
{
|
||||
url = new Uri(_baseUrl + relativeUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
url = new Uri(relativeUrl);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Trace.TraceError("Invalid url " + url);
|
||||
ErrorMessage = ex.Message;
|
||||
return data;
|
||||
}
|
||||
using (var client = GetClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(Position);
|
||||
HttpContent content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
|
||||
HttpResponseMessage response = await client.PostAsync(url.ToString(), content).ConfigureAwait(false);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
data = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
return data;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (response.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
ErrorMessage = String.Format("Status code: {0}. Url: {1}", response.StatusCode, url);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errorMessageService = string.Empty;
|
||||
string message = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
errorMessageService = response.ReasonPhrase;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var errors = JsonConvert.DeserializeObject<Dictionary<string, object>>(message);
|
||||
errorMessageService = errors["Message"].ToString();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
errorMessageService = message;
|
||||
}
|
||||
}
|
||||
ErrorMessage = String.Format("Status code: {0}. Error message: {1}", response.StatusCode, errorMessageService);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Trace.TraceError(ex.Message);
|
||||
ErrorMessage = ex.Message;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected HttpClient GetClient()
|
||||
{
|
||||
HttpClientHandler handler = new HttpClientHandler();
|
||||
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
|
||||
HttpClient client = new HttpClient(handler);
|
||||
client.DefaultRequestHeaders.Accept.Clear();
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
client.DefaultRequestHeaders.Authorization = _authValue;
|
||||
return client;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using RestClient.Models;
|
||||
|
||||
namespace RestClient
|
||||
{
|
||||
public class GetQ2PreCorrectionClient : BaseClient
|
||||
{
|
||||
public GetQ2PreCorrectionClient(string baseUrl)
|
||||
: base(baseUrl)
|
||||
{ }
|
||||
|
||||
public async Task GetToken(string name, string password, string urlLogin)
|
||||
{
|
||||
LoginUser user = new LoginUser { Name = name, Password = password };
|
||||
var response = await PostWithReturnDataAsync(urlLogin, false, user).ConfigureAwait(false);
|
||||
var tmp = JsonConvert.DeserializeObject<CustomJwt>(response);
|
||||
if (tmp != null)
|
||||
{
|
||||
SetToken(tmp.access_token);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(string.Format("No token loaded: {0}", ErrorMessage));
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Q2PreCorrection> GetQ2Correction(string relativeUrl)
|
||||
{
|
||||
ErrorMessage = String.Empty;
|
||||
Uri url = GetUrl(relativeUrl);
|
||||
if (url == null) return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
|
||||
|
||||
using (var client = GetClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await client.GetAsync(url).ConfigureAwait(false);
|
||||
string jsonResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
if (result.IsSuccessStatusCode)
|
||||
{
|
||||
Q2PreCorrection retVal = new Q2PreCorrection();
|
||||
|
||||
string pattern = "\"areDataCalculated\":";
|
||||
int position = jsonResult.IndexOf(pattern) + pattern.Length;
|
||||
int length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
|
||||
retVal.AreDataCalculated = bool.Parse(jsonResult.Substring(position, length));
|
||||
|
||||
pattern = "\"right\":";
|
||||
position = jsonResult.IndexOf(pattern) + pattern.Length;
|
||||
length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
|
||||
retVal.CorrLR = int.Parse(jsonResult.Substring(position, length));
|
||||
|
||||
pattern = "\"left\":";
|
||||
position = jsonResult.IndexOf(pattern) + pattern.Length;
|
||||
length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
|
||||
retVal.CorrRL = int.Parse(jsonResult.Substring(position, length));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ex.Message;
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
Message += ". " + ex.InnerException.Message;
|
||||
}
|
||||
Trace.TraceError(Message);
|
||||
ErrorMessage = Message;
|
||||
return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RestClient.Models
|
||||
{
|
||||
public class CustomJwt
|
||||
{
|
||||
public string access_token { get; set; }
|
||||
public string token_type { get; set; }
|
||||
public int expires_in { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RestClient.Models
|
||||
{
|
||||
public class LoginUser
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("RestClient")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RestClient")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("46e3b0e1-209f-4550-b0dd-d7e2c039b3ce")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace RestClient
|
||||
{
|
||||
public class Q2PreCorrection
|
||||
{
|
||||
public bool AreDataCalculated;
|
||||
public int CorrLR;
|
||||
public int CorrRL;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RestClient</RootNamespace>
|
||||
<AssemblyName>RestClient</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BaseClient.cs" />
|
||||
<Compile Include="GetQ2PreCorrectionClient.cs" />
|
||||
<Compile Include="Models\CustomJwt.cs" />
|
||||
<Compile Include="Models\LoginUser.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Q2PreCorrection.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
||||
</packages>
|
||||
+7
-13
@@ -130,19 +130,13 @@ namespace Results
|
||||
|
||||
public static BatchResults FromBatch(Batch batch)
|
||||
{
|
||||
if (batch.WaterMeters == null || batch.WaterMeters.Count == 0) return null;
|
||||
int wmCount = batch.WaterMeters.Count;
|
||||
if (wmCount == 0) return null;
|
||||
|
||||
int wmPosMax = 0;
|
||||
foreach (var wm in batch.WaterMeters) if (wm.WMPosition > wmPosMax) wmPosMax = wm.WMPosition;
|
||||
|
||||
BatchResults batchResults = new BatchResults(wmPosMax);
|
||||
BatchResults batchResults = new BatchResults(wmCount);
|
||||
batchResults.Batch = batch;
|
||||
batchResults.WaterMeters = new WaterMeter[wmPosMax];
|
||||
for (int i = 0; i < batch.WaterMeters.Count; i++)
|
||||
{
|
||||
WaterMeter wm = batch.WaterMeters[i];
|
||||
batchResults.WaterMeters[wm.WMPosition - 1] = wm;
|
||||
}
|
||||
batchResults.WaterMeters = new WaterMeter[wmCount];
|
||||
for (int i = 0; i < wmCount; i++) batchResults.WaterMeters[i] = batch.WaterMeters[i];
|
||||
|
||||
return batchResults;
|
||||
}
|
||||
@@ -170,11 +164,11 @@ namespace Results
|
||||
{
|
||||
for (int i = 0; i < WMPositionsCount; i++)
|
||||
{
|
||||
if ((WaterMeters[i] != null) && !WaterMeters[i].Disabled)
|
||||
if (WaterMeters[i] != null)
|
||||
{
|
||||
foreach (var mtr in WaterMeters[i].MeterTestRslts)
|
||||
{
|
||||
if (!mtr.TestDone) return false;
|
||||
if (!mtr.TestDone) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,17 +29,7 @@ namespace Results.Entities
|
||||
public virtual float DensityCorr { get; set; } /// Density correction in [kg/m3]
|
||||
public virtual float Custom2 { get; set; }
|
||||
public virtual float Custom3 { get; set; }
|
||||
public virtual int Counter1 { get; set; }
|
||||
public virtual int Counter2 { get; set; }
|
||||
public virtual int Counter3 { get; set; }
|
||||
public virtual int Counter4 { get; set; }
|
||||
public virtual int Counter5 { get; set; }
|
||||
public virtual int Counter6 { get; set; }
|
||||
public virtual int Counter7 { get; set; }
|
||||
public virtual int Counter8 { get; set; }
|
||||
public virtual int Counter9 { get; set; }
|
||||
public virtual int Counter10 { get; set; }
|
||||
public virtual DateTime StartTime { get; set; }
|
||||
public virtual DateTime StartTime { get; set; }
|
||||
public virtual DateTime EndTime { get; set; }
|
||||
public virtual bool Dirty { get; set; }
|
||||
public virtual bool RsltsSent { get; set; }
|
||||
@@ -48,7 +38,7 @@ namespace Results.Entities
|
||||
public virtual IList<WaterMeter> WaterMeters { get; set; }
|
||||
public virtual IList<TestRslt> TestRslts { get; set; }
|
||||
public virtual bool Compound { get; set; } /// Not mapped to DB now
|
||||
public virtual bool HeatMeter { get; set; } /// Not mapped to DB now ///
|
||||
public virtual bool HeatMeter { get; set; } /// Not mapped to DB now
|
||||
|
||||
public Batch()
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Results.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
|
||||
public virtual byte CompoundMeterId { get; set; } /// 0=single, 1=compound/main, 2=compound/aux., 3=compound/overal, 4=heat meter volume, 5=heat meter energy
|
||||
public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depend on localization and customer
|
||||
public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
|
||||
|
||||
public virtual double PulsesMeter { get; set; } /// # of water meter or heat meter pulses
|
||||
public virtual double PulsesMaster { get; set; } /// # of reference flowmeter pulses (gated by this water meter pulses)
|
||||
@@ -25,8 +25,6 @@ namespace Results.Entities
|
||||
|
||||
/// Main result
|
||||
public virtual double Error { get; set; } /// [%]
|
||||
public virtual long ErrorIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28 (error flags)
|
||||
public virtual long InfoIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28 (info flags)
|
||||
public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB
|
||||
public virtual bool TestDone { get; set; } /// true = test was completed
|
||||
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
|
||||
@@ -51,15 +49,14 @@ namespace Results.Entities
|
||||
public virtual TestData TestData() { return TestRslt.TestData; }
|
||||
///
|
||||
public virtual int Repeats() { return TestData().Repeats; }
|
||||
public virtual double Qtg() { return TestData().Qtg; } /// [m3/h]
|
||||
public virtual double Qfrom() { return TestData().Qfrom; } /// [m3/h]
|
||||
public virtual double Qfrom() { return TestData().Qfrom; } /// [m3/h]
|
||||
public virtual double Qto() { return TestData().Qto; } /// [m3/h]
|
||||
public virtual double TargetVolume() { return TestData().TargetVolume; } /// [l]
|
||||
public virtual double TargetTime() { return TestData().TargetTime; } /// [s]
|
||||
public virtual string Method() { return TestData().Method; }
|
||||
public virtual double ErrLimLo() { return TestData().ErrLimLo; } /// [%]
|
||||
public virtual double ErrLimHi() { return TestData().ErrLimHi; } /// [%]
|
||||
public virtual double Uncertainty() { return TestData().ErrLimMargin; } /// [%]
|
||||
public virtual double Uncertainty() { return TestData().Uncertainty; } /// [%]
|
||||
|
||||
public virtual string ProcedureName() { return WaterMeter.Batch.ProcedureName; }
|
||||
public virtual int BatchNr() { return WaterMeter.Batch.BatchNr; }
|
||||
@@ -130,13 +127,9 @@ namespace Results.Entities
|
||||
TimestampEnd = src.TimestampEnd;
|
||||
TestTime = src.TestTime;
|
||||
Error = src.Error;
|
||||
ErrorIndicators = src.ErrorIndicators;
|
||||
KorrErrQ = src.KorrErrQ;
|
||||
TestDone = src.TestDone;
|
||||
Passed = src.Passed;
|
||||
#if ORACLE_DB
|
||||
LastError = src.LastError;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -15,15 +15,14 @@ namespace Results.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual int Repeats { get; set; }
|
||||
public virtual double Qtg { get; set; } /// [m3/h] flow range low limit
|
||||
public virtual double Qfrom { get; set; } /// [m3/h] flow range low limit
|
||||
public virtual double Qfrom { get; set; } /// [m3/h] flow range low limit
|
||||
public virtual double Qto { get; set; } /// [m3/h] flow range high limit
|
||||
public virtual double TargetVolume { get; set; } /// [l] target test volume
|
||||
public virtual double TargetTime { get; set; } /// [s] target test time
|
||||
public virtual string Method { get; set; }
|
||||
public virtual double ErrLimLo { get; set; } /// [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
|
||||
public virtual double ErrLimHi { get; set; } /// [%] usually > 0, in case of heat meters: -Qn in m3/h
|
||||
public virtual double ErrLimMargin { get; set; } /// [%] makes error limits tighter: 0 <= ErrLimMargin <= abs(ErrLimXx)
|
||||
public virtual double ErrLimLo { get; set; } /// [%] (usually < 0)
|
||||
public virtual double ErrLimHi { get; set; } /// [%] (usually > 0)
|
||||
public virtual double Uncertainty { get; set; } /// [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
|
||||
public virtual bool DoControlWaterTemp { get; set; }
|
||||
public virtual float TempLimLo { get; set; }
|
||||
public virtual float TempLimHi { get; set; }
|
||||
@@ -42,15 +41,14 @@ namespace Results.Entities
|
||||
{
|
||||
Name = test.Name;
|
||||
Repeats = test.Repeats;
|
||||
Qtg = (double)test.Qtg;
|
||||
Qfrom = (double)test.Qfrom;
|
||||
Qfrom = (double)test.Qfrom;
|
||||
Qto = (double)test.Qto;
|
||||
TargetVolume = (double)test.Volume;
|
||||
TargetTime = (double)test.TstTime;
|
||||
Method = test.Method;
|
||||
ErrLimLo = (double)test.ErrLimLo;
|
||||
ErrLimHi = (double)test.ErrLimHi;
|
||||
ErrLimMargin = (double)test.Uncertainty;
|
||||
Uncertainty = (double)test.Uncertainty;
|
||||
DoControlWaterTemp = test.DoControlWaterTemp;
|
||||
TempLimLo = test.TempLimLo;
|
||||
TempLimHi = test.TempLimHi;
|
||||
@@ -68,15 +66,14 @@ namespace Results.Entities
|
||||
{
|
||||
if (!Name.Equals(td.Name)) return false;
|
||||
if (Repeats != td.Repeats) return false;
|
||||
if (Qtg != td.Qtg) return false;
|
||||
if (Qfrom != td.Qfrom) return false;
|
||||
if (Qfrom != td.Qfrom) return false;
|
||||
if (Qto != td.Qto) return false;
|
||||
if (TargetVolume != td.TargetVolume) return false;
|
||||
if (TargetTime != td.TargetTime) return false;
|
||||
if (!Method.Equals(td.Method)) return false;
|
||||
if (ErrLimLo != td.ErrLimLo) return false;
|
||||
if (ErrLimHi != td.ErrLimHi) return false;
|
||||
if (ErrLimMargin != td.ErrLimMargin) return false;
|
||||
if (Uncertainty != td.Uncertainty) return false;
|
||||
if (DoControlWaterTemp != td.DoControlWaterTemp) return false;
|
||||
if (DoControlWaterTemp)
|
||||
{
|
||||
|
||||
@@ -15,24 +15,22 @@ namespace Results.Entities
|
||||
public virtual TestData TestData { get; set; }
|
||||
public virtual Components Components { get; set; }
|
||||
public virtual int Part { get; set; }
|
||||
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
|
||||
public virtual string MethodClass { get; set; } /// Not mapped to DB, does not depend on localization and customer
|
||||
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
|
||||
public virtual string MethodClass { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
|
||||
|
||||
/// Main results
|
||||
public virtual bool TestDone { get; set; }
|
||||
public virtual string Remark { get; set; }
|
||||
public virtual DateTime StartTime { get; set; } /// Date and time of the test start
|
||||
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Flow set time in seconds
|
||||
public virtual int TimeBtwnMassMsrmnts { get; set; } /// [s] Time between two mass measurements in seconds (if applicable)
|
||||
public virtual double TestTime { get; set; } /// [s] Test time in seconds
|
||||
public virtual double TestTimeCorrection { get; set; } /// [s] Correction of the test time due to diverter (0 for methods w/o diverter or when there is no correction table)
|
||||
public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank
|
||||
public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB)
|
||||
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected.
|
||||
public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table.
|
||||
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
|
||||
/// When mass measurement is not available, corrected by a correction table.
|
||||
public virtual DateTime StartTime { get; set; } /// Date and time of the test start
|
||||
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank
|
||||
public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB)
|
||||
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected.
|
||||
public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table.
|
||||
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
|
||||
/// When mass measurement is not available, corrected by a correction table.
|
||||
public virtual double MassStartRaw { get; set; } /// [kg]
|
||||
public virtual double MassStart { get; set; } /// [kg]
|
||||
public virtual double MassEndRaw { get; set; } /// [kg]
|
||||
@@ -56,9 +54,9 @@ namespace Results.Entities
|
||||
public virtual float DivEnd90 { get; set; } /// [s] Diverter switch time when test starts at level 90 (e.g. 90%) (not mapped to DB)
|
||||
public virtual float DivEnd50 { get; set; } /// [s] Diverter switch time when test starts at level 50 (e.g. 50%) (not mapped to DB)
|
||||
public virtual float DivEnd10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB)
|
||||
|
||||
public virtual long ErrorFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc.
|
||||
public virtual long InfoFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc.
|
||||
|
||||
public virtual int ErrorFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc.
|
||||
public virtual sbyte ErrorFlagsMd { get; set; } /// 0=off, 1=info, 2=on (evaluated in MeterTestRslt.Passed)
|
||||
|
||||
/// Main results of heat meters
|
||||
public virtual double RefEnergy { get; set; } /// [J] Joul
|
||||
@@ -115,12 +113,6 @@ namespace Results.Entities
|
||||
public virtual float FlowMin { get; set; } /// [m3/h]
|
||||
public virtual float FlowMax { get; set; } /// [m3/h]
|
||||
|
||||
public virtual float Uncertnt { get; set; } /// [%] Relative error uncertainty
|
||||
public virtual float UncertntScale { get; set; } /// [%] Contribution to uncertainty from scale
|
||||
public virtual float UncertntDensity { get; set; } /// [%] Contribution to uncertainty from density
|
||||
public virtual float UncertntTemp { get; set; } /// [%] Contribution to uncertainty from temperature
|
||||
public virtual float UncertntPressure { get; set; } /// [%] Contribution to uncertainty from pressure
|
||||
|
||||
public virtual float Custom1 { get; set; } /// [°C] T ref hi mean
|
||||
public virtual float Custom2 { get; set; } /// [°C] T ref hi start
|
||||
public virtual float Custom3 { get; set; } /// [°C] T ref hi end
|
||||
@@ -131,7 +123,7 @@ namespace Results.Entities
|
||||
public virtual float Custom8 { get; set; } /// [°C] T ref lo end
|
||||
public virtual float Custom9 { get; set; } /// [°C] T ref lo min
|
||||
public virtual float Custom10 { get; set; } /// [°C] T ref lo max
|
||||
|
||||
|
||||
/// Wrappers
|
||||
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
|
||||
public virtual int Repeats() { return TestData.Repeats; }
|
||||
@@ -140,25 +132,10 @@ namespace Results.Entities
|
||||
public virtual double TargetVolume() { return TestData.TargetVolume; }
|
||||
public virtual double TargetTime() { return TestData.TargetTime; }
|
||||
public virtual string Method() { return TestData.Method; }
|
||||
public virtual string RefFlowmeter() { return (Components != null) ? Components.Flowmeter : string.Empty; }
|
||||
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection") || MethodClass.Contains("DiverterTest") || MethodClass.Contains("ManualEntry")) : true; }
|
||||
public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest") || TestData.Method.ToLower().Contains("pmax")) : true; }
|
||||
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection")) : true; }
|
||||
public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")) : true; }
|
||||
public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; }
|
||||
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; }
|
||||
|
||||
public virtual string MethodElde()
|
||||
{
|
||||
if (MethodClass == null) return string.Empty;
|
||||
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollection.")) return "MS";
|
||||
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollectionProlonged.")) return "MS";
|
||||
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollectionComparative.")) return "MS";
|
||||
else if (MethodClass.Contains("TestMethods.FlyingStart.")) return "VS";
|
||||
else if (MethodClass.Contains("TestMethods.FixedStartMassCollection.")) return "MP";
|
||||
else if (MethodClass.Contains("TestMethods.FixedStartTankCollection.")) return "VP";
|
||||
else if (MethodClass.Contains("TestMethods.FixedStart.")) return "VP";
|
||||
else return string.Empty;
|
||||
}
|
||||
public virtual bool IsDiverter() { return (MethodClass != null) ? (MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) : true; }
|
||||
|
||||
public virtual double ErrLimLo()
|
||||
{
|
||||
@@ -171,7 +148,7 @@ namespace Results.Entities
|
||||
/// Metrological class and nominal flow of a heat meter
|
||||
int metrClass = (int)Math.Round(TestData.ErrLimLo);
|
||||
double Qp = Math.Abs(TestData.ErrLimHi);
|
||||
double Q = (TestTime == 0) ? 1 : Math.Max(3.6 * VolumeCTV / TestTime, 0.00001); /// Div. by zero avoided
|
||||
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
|
||||
|
||||
/// Calculate the error limit of a heat meter
|
||||
switch (metrClass)
|
||||
@@ -195,7 +172,7 @@ namespace Results.Entities
|
||||
/// Metrological class and nominal flow of a heat meter
|
||||
int metrClass = (int)Math.Round(TestData.ErrLimLo);
|
||||
double Qp = Math.Abs(TestData.ErrLimHi);
|
||||
double Q = (TestTime == 0) ? 1 : Math.Max(3.6 * VolumeCTV / TestTime, 0.00001); /// Div. by zero avoided
|
||||
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
|
||||
|
||||
/// Calculate the error limit of a heat meter
|
||||
switch (metrClass)
|
||||
@@ -208,7 +185,7 @@ namespace Results.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public virtual double ErrLimMargin() { return TestData.ErrLimMargin; }
|
||||
public virtual double Uncertainty() { return TestData.Uncertainty; }
|
||||
public virtual float TempLimLo() { return TestData.TempLimLo; }
|
||||
public virtual float TempLimHi() { return TestData.TempLimHi; }
|
||||
public virtual bool Evaluate() { return TestData.Evaluate; }
|
||||
@@ -241,13 +218,10 @@ namespace Results.Entities
|
||||
StartTime = src.StartTime;
|
||||
EndTime = src.EndTime;
|
||||
FlowSetTime = src.FlowSetTime;
|
||||
TimeBtwnMassMsrmnts = src.TimeBtwnMassMsrmnts;
|
||||
TestTime = src.TestTime;
|
||||
PulsesMaster = src.PulsesMaster;
|
||||
TotalPulsesMstr = src.TotalPulsesMstr;
|
||||
ConstMasterRaw = src.ConstMasterRaw;
|
||||
ConstMasterCorr = src.ConstMasterCorr;
|
||||
ConstMaster = src.ConstMaster;
|
||||
ConstMaster = src.ConstMaster;
|
||||
MassStartRaw = src.MassStartRaw;
|
||||
MassStart = src.MassStart;
|
||||
MassEndRaw = src.MassEndRaw;
|
||||
@@ -262,15 +236,9 @@ namespace Results.Entities
|
||||
VolumeMaster = src.VolumeMaster;
|
||||
ErrorMaster = src.ErrorMaster;
|
||||
DiverterStart = src.DiverterStart;
|
||||
DivStart10 = src.DivStart10;
|
||||
DivStart50 = src.DivStart50;
|
||||
DivStart90 = src.DivStart90;
|
||||
DiverterEnd = src.DiverterEnd;
|
||||
DivEnd10 = src.DivEnd10;
|
||||
DivEnd50 = src.DivEnd50;
|
||||
DivEnd90 = src.DivEnd90;
|
||||
ErrorFlags = src.ErrorFlags;
|
||||
InfoFlags = src.InfoFlags;
|
||||
ErrorFlagsMd = src.ErrorFlagsMd;
|
||||
RefEnergy = src.RefEnergy;
|
||||
AmbTempMean = src.AmbTempMean;
|
||||
AmbTempStart = src.AmbTempStart;
|
||||
@@ -334,6 +302,12 @@ namespace Results.Entities
|
||||
Custom10 = src.Custom10;
|
||||
}
|
||||
|
||||
/// <summary> Wrapper </summary>
|
||||
public virtual Config.Entities.ErrorFlagsMode ErrorFlagsMode()
|
||||
{
|
||||
return (Config.Entities.ErrorFlagsMode)ErrorFlagsMd;
|
||||
}
|
||||
|
||||
/// <summary> Wrapper </summary>
|
||||
public virtual string ErrorFlagsStr()
|
||||
{
|
||||
@@ -364,11 +338,11 @@ namespace Results.Entities
|
||||
|
||||
public virtual string ToString(int i)
|
||||
{
|
||||
return string.Format("TestRslt: Part={0} RepetitionNr={1} TestDone={2} Remark={3} StartTime={4} EndTime={5} FlowSetTime={6} TestTime={7} PulsesMaster={8} ConstMaster={9} MassStartRaw={10} MassStart={11} MassEndRaw={12} MassEnd={13} DensityIn={14} DensityOut={15} DensityDiv={16} Buoyancy={17} FlowMass={18} FlowVolume={19} VolumeCTV={20} VolumeMaster={21} ErrorMaster={22} DiverterStart={85} DiverterEnd={86} ErrorFlags={23} InfoFlags={24} AmbTempMean={25} AmbTempStart={26} AmbTempEnd={27} AmbTempMin={28} AmbTempMax={29} AmbPressMean={30} AmbPressStart={31} AmbPressEnd={32} AmbPressMin={33} AmbPressMax={34} AmbHumiMean={35} AmbHumiStart={36} AmbHumiEnd={37} AmbHumiMin={38} AmbHumiMax={39} PressUpMean={40} PressUpStart={41} PressUpEnd={42} PressUpMin={43} PressUpMax={44} PressDownMean={45} PressDownStart={46} PressDownEnd={47} PressDownMin={48} PressDownMax={49} PressDeltaMean={50} PressDeltaStart={51} PressDeltaEnd={52} PressDeltaMin={53} PressDeltaMax={54} TempUpMean={55} TempUpStart={56} TempUpEnd={57} TempUpMin={58} TempUpMax={59} TempDownMean={60} TempDownStart={61} TempDownEnd={62} TempDownMin={63} TempDownMax={64} TempDivMean={65} TempDivStart={66} TempDivEnd={67} TempDivMin={68} TempDivMax={69} FlowMean={70} FlowStart={71} FlowEnd={72} FlowMin={73} FlowMax={74} Custom1={75} Custom2={76} Custom3={77} Custom4={78} Custom5={79} Custom6={80} Custom7={81} Custom8={82} Custom9={83} Custom10={84}",
|
||||
return string.Format("TestRslt: Part={0} RepetitionNr={1} TestDone={2} Remark={3} StartTime={4} EndTime={5} FlowSetTime={6} TestTime={7} PulsesMaster={8} ConstMaster={9} MassStartRaw={10} MassStart={11} MassEndRaw={12} MassEnd={13} DensityIn={14} DensityOut={15} DensityDiv={16} Buoyancy={17} FlowMass={18} FlowVolume={19} VolumeCTV={20} VolumeMaster={21} ErrorMaster={22} DiverterStart={85} DiverterEnd={86} ErrorFlags={23} ErrorFlagsMd={24} AmbTempMean={25} AmbTempStart={26} AmbTempEnd={27} AmbTempMin={28} AmbTempMax={29} AmbPressMean={30} AmbPressStart={31} AmbPressEnd={32} AmbPressMin={33} AmbPressMax={34} AmbHumiMean={35} AmbHumiStart={36} AmbHumiEnd={37} AmbHumiMin={38} AmbHumiMax={39} PressUpMean={40} PressUpStart={41} PressUpEnd={42} PressUpMin={43} PressUpMax={44} PressDownMean={45} PressDownStart={46} PressDownEnd={47} PressDownMin={48} PressDownMax={49} PressDeltaMean={50} PressDeltaStart={51} PressDeltaEnd={52} PressDeltaMin={53} PressDeltaMax={54} TempUpMean={55} TempUpStart={56} TempUpEnd={57} TempUpMin={58} TempUpMax={59} TempDownMean={60} TempDownStart={61} TempDownEnd={62} TempDownMin={63} TempDownMax={64} TempDivMean={65} TempDivStart={66} TempDivEnd={67} TempDivMin={68} TempDivMax={69} FlowMean={70} FlowStart={71} FlowEnd={72} FlowMin={73} FlowMax={74} Custom1={75} Custom2={76} Custom3={77} Custom4={78} Custom5={79} Custom6={80} Custom7={81} Custom8={82} Custom9={83} Custom10={84}",
|
||||
Part, RepetitionNr, TestDone, Remark, StartTime, EndTime, FlowSetTime, TestTime,
|
||||
PulsesMaster, ConstMaster, MassStartRaw, MassStart, MassEndRaw, MassEnd,
|
||||
DensityIn, DensityLine, DensityDiv, Buoyancy, FlowMass, FlowVolume,
|
||||
VolumeCTV, VolumeMaster, ErrorMaster, ErrorFlags, InfoFlags,
|
||||
VolumeCTV, VolumeMaster, ErrorMaster, ErrorFlags, ErrorFlagsMd,
|
||||
AmbTempMean, AmbTempStart, AmbTempEnd, AmbTempMin, AmbTempMax,
|
||||
AmbPressMean, AmbPressStart, AmbPressEnd, AmbPressMin, AmbPressMax,
|
||||
AmbHumiMean, AmbHumiStart, AmbHumiEnd, AmbHumiMin, AmbHumiMax,
|
||||
|
||||
+34
-180
@@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
@@ -42,8 +41,8 @@ namespace Results.Entities
|
||||
public class WaterMeter
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string SerialNr { get; set; } /// S/N _or_ S/N of the main meter of a compound meter _or_ PCB Number of an iPerl water meter
|
||||
public virtual string SerialNrAux { get; set; } /// S/N of the aux. meter of a compound meter _or_ a complete assigned S/N of an iPerl water meter
|
||||
public virtual string SerialNr { get; set; } /// Main s/n for compound meters, PCB Number for iPerl water meter
|
||||
public virtual string SerialNrAux { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
|
||||
public virtual string PurchaseOrder { get; set; }
|
||||
public virtual int YearOfProduction { get; set; }
|
||||
public virtual int WMPosition { get; set; }
|
||||
@@ -51,19 +50,21 @@ namespace Results.Entities
|
||||
public virtual string EndStateAux { get; set; } /// End state of the auxiliary water meter
|
||||
public virtual double QRise { get; set; } /// [m3/h] detected Q_rise of a composed meter or 'sensitivity' of a single meter
|
||||
public virtual double QFall { get; set; } /// [m3/h] detected Q_fall of a composed meter
|
||||
public virtual long ErrorFlags { get; set; } /// bitfield : bit14=E15, bit15=E16
|
||||
public virtual long InfoFlags { get; set; } /// bitfield : bit14=E15, bit15=E16
|
||||
public virtual int ErrorFlags { get; set; } /// bitfield : bit14=E15, bit15=E16
|
||||
public virtual bool Passed { get; set; }
|
||||
public virtual int ResultCode { get; set; }
|
||||
public virtual string ArchivePath { get; set; }
|
||||
public virtual string Remark { get; set; }
|
||||
|
||||
#if IPERL
|
||||
public virtual int SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
|
||||
public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test
|
||||
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double OrigCalibFactorLNA{ get; set; } /// Original iPerl LNA calibration factor used during the test
|
||||
public virtual double CalibFactorLNA { get; set; } /// iPerl LNA calibration factor used during the test
|
||||
public virtual double Q2ErrWOCorrection { get; set; }
|
||||
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
public virtual double Q2Correction { get; set; } /// !!! obsolete
|
||||
public virtual int Q2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
|
||||
@@ -72,36 +73,11 @@ namespace Results.Entities
|
||||
public virtual int Hz2Correction { get; set; } /// iPerl Q2 correction used during the test
|
||||
public virtual string FWVersion { get; set; }
|
||||
#endif
|
||||
#if TURA_SPECIAL
|
||||
/// <summary>
|
||||
/// Data from a production test bench (in case of tests on iPerl special)
|
||||
/// </summary>
|
||||
public virtual int AssignedSerialNr { get; set; }
|
||||
public virtual string CompleteSerialNr { get; set; }
|
||||
public virtual string RadioAddress { get; set; }
|
||||
public virtual int PaletteNr { get; set; }
|
||||
public virtual int UmkartonNr { get; set; }
|
||||
public virtual string ProdTestBench { get; set; }
|
||||
public virtual int ProdWMPosition { get; set; }
|
||||
public virtual string ProdUserName { get; set; }
|
||||
public virtual string ProdPurchaseOrder { get; set; }
|
||||
public virtual bool ProdPassed { get; set; }
|
||||
public virtual int ProdResultCode { get; set; }
|
||||
public virtual int ProdQ2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int ProdQ2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
#endif
|
||||
#if ORACLE_DB
|
||||
public virtual int Pruefindex { get; set; } /// >= 1 ... pruefindex
|
||||
public virtual int HydrPruefung { get; set; }
|
||||
public virtual int WMTypeRevision { get; set; } /// Not mapped to DB !!!
|
||||
public virtual object RawTestInfos { get; set; } /// IList<SensusTestInfo> fetched from Oracle at the beginning of the cycle, not mapped to DB !!!
|
||||
public virtual object CompleteTestInfos { get; set; } /// SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!!
|
||||
public virtual int Pruefindex { get; set; } /// Not mapped to DB !!! 0=unknown (saving to Oracle failed), >=1 ... pruefindex
|
||||
public virtual int HydrPruefung { get; set; } /// 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)
|
||||
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
|
||||
|
||||
public virtual WaterMeterData WaterMeterData { get; set; }
|
||||
public virtual WaterMeterData WaterMeterData { get; set; }
|
||||
public virtual Batch Batch { get; set; }
|
||||
public virtual IList<MeterTestRslt> MeterTestRslts { get; set; }
|
||||
|
||||
@@ -137,19 +113,23 @@ namespace Results.Entities
|
||||
public virtual MeterTestRslt LastMeterTestRslts() { return lastMeterTestRslts; }
|
||||
|
||||
|
||||
public virtual long ErrorFlagsFromTests()
|
||||
public virtual int ErrorFlagsFromTests(out ErrorFlagsMode errorFlagsMode)
|
||||
{
|
||||
long errorFlags = 0;
|
||||
int errorFlags = 0;
|
||||
ErrorFlagsMode eFlagsMode = 0; /// = ErrorFlagsMode.Off;
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (mtr.Evaluate() && mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags;
|
||||
if ((int)mtr.TestRslt.ErrorFlagsMode() > (int)eFlagsMode) eFlagsMode = mtr.TestRslt.ErrorFlagsMode();
|
||||
}
|
||||
errorFlagsMode = eFlagsMode; /// Maximum from all tests (=ErrorFlagsMode.On if at least one test is ErrorFlagsMode.On)
|
||||
return errorFlags;
|
||||
}
|
||||
|
||||
public virtual long ErrorFlagsFromTestsAndWM()
|
||||
public virtual int ErrorFlagsFromTestsAndWM(out ErrorFlagsMode errorFlagsMode)
|
||||
{
|
||||
return ErrorFlagsFromTests() | ErrorFlags;
|
||||
int eFlagsFromTests = ErrorFlagsFromTests(out errorFlagsMode) | ErrorFlags;
|
||||
return (errorFlagsMode != ErrorFlagsMode.Off) ? (eFlagsFromTests | ErrorFlags) : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -158,7 +138,8 @@ namespace Results.Entities
|
||||
/// <returns>ErrorFlags string</returns>
|
||||
public virtual string ErrorFlagsStr()
|
||||
{
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM());
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
#if LANG_PL
|
||||
return string.IsNullOrEmpty(eFlags) ? "brak" : eFlags;
|
||||
#else
|
||||
@@ -168,7 +149,8 @@ namespace Results.Entities
|
||||
|
||||
public virtual string PassedOrErrorFlagsStr()
|
||||
{
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM());
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr(null)) : eFlags;
|
||||
}
|
||||
|
||||
@@ -188,14 +170,19 @@ namespace Results.Entities
|
||||
}
|
||||
}
|
||||
|
||||
errFlgsStr.Append(Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM()));
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
errFlgsStr.Append(Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode)));
|
||||
|
||||
return errFlgsStr.ToString();
|
||||
}
|
||||
|
||||
public virtual bool PassedFromTests()
|
||||
{
|
||||
bool passed = (ErrorFlagsFromTestsAndWM() == 0);
|
||||
ErrorFlagsMode eFlagsMode;
|
||||
int eFlags = ErrorFlagsFromTestsAndWM(out eFlagsMode);
|
||||
|
||||
bool passed = true;
|
||||
if (eFlagsMode == ErrorFlagsMode.On && eFlags != 0) passed = false;
|
||||
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
@@ -275,12 +262,7 @@ namespace Results.Entities
|
||||
{
|
||||
return mtr;
|
||||
}
|
||||
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
|
||||
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy)
|
||||
{
|
||||
return mtr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -342,17 +324,6 @@ namespace Results.Entities
|
||||
public WaterMeter()
|
||||
{
|
||||
MeterTestRslts = new List<MeterTestRslt>();
|
||||
#if ORACLE_DB
|
||||
Pruefindex = 1;
|
||||
HydrPruefung = 0;
|
||||
WMTypeRevision = 0;
|
||||
RawTestInfos = null;
|
||||
CompleteTestInfos = null;
|
||||
#endif
|
||||
ProcessId = 0;
|
||||
SessionId = 0;
|
||||
ErrorFlags = 0;
|
||||
LastRecordIsNok = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -375,11 +346,12 @@ namespace Results.Entities
|
||||
ArchivePath = src.ArchivePath;
|
||||
Remark = src.Remark;
|
||||
#if IPERL
|
||||
SerialNrEx = src.SerialNrEx;
|
||||
OrigCalibFactor = src.OrigCalibFactor;
|
||||
CalibFactor = src.CalibFactor;
|
||||
OrigCalibFactorLNA = src.OrigCalibFactorLNA;
|
||||
CalibFactorLNA = src.CalibFactorLNA;
|
||||
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
|
||||
Q2CorrectionDone = src.Q2CorrectionDone;
|
||||
Q2Correction = src.Q2Correction;
|
||||
Q2CorrRL = src.Q2CorrRL;
|
||||
Q2CorrLR = src.Q2CorrLR;
|
||||
Q2CorrFlowRight = src.Q2CorrFlowRight;
|
||||
@@ -388,32 +360,10 @@ namespace Results.Entities
|
||||
Hz2Correction = src.Hz2Correction;
|
||||
FWVersion = src.FWVersion;
|
||||
#endif
|
||||
#if TURA_SPECIAL
|
||||
AssignedSerialNr = src.AssignedSerialNr;
|
||||
CompleteSerialNr = src.CompleteSerialNr;
|
||||
RadioAddress = src.RadioAddress;
|
||||
PaletteNr = src.PaletteNr;
|
||||
UmkartonNr = src.UmkartonNr;
|
||||
ProdTestBench = src.ProdTestBench;
|
||||
ProdWMPosition = src.ProdWMPosition;
|
||||
ProdUserName = src.ProdUserName;
|
||||
ProdPurchaseOrder = src.ProdPurchaseOrder;
|
||||
ProdPassed = src.ProdPassed;
|
||||
ProdResultCode = src.ProdResultCode;
|
||||
ProdQ2CorrRL = src.ProdQ2CorrRL;
|
||||
ProdQ2CorrLR = src.ProdQ2CorrLR;
|
||||
#endif
|
||||
#if ORACLE_DB
|
||||
Pruefindex = src.Pruefindex;
|
||||
Pruefindex = src.Pruefindex;
|
||||
HydrPruefung = src.HydrPruefung;
|
||||
WMTypeRevision = src.WMTypeRevision;
|
||||
RawTestInfos = src.RawTestInfos;
|
||||
CompleteTestInfos = src.CompleteTestInfos;
|
||||
#endif
|
||||
ProcessId = src.ProcessId;
|
||||
SessionId = src.SessionId;
|
||||
LastRecordIsNok = src.LastRecordIsNok;
|
||||
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (Config.Entities.CompoundMeterId)mtr.CompoundMeterId);
|
||||
@@ -429,7 +379,7 @@ namespace Results.Entities
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(80);
|
||||
#if IPERL
|
||||
sb.AppendFormat("PCB:{0} S/N:{1} ", SerialNr, SerialNrAux);
|
||||
sb.AppendFormat("PCB:{0} S/N:{1} ", SerialNr, SerialNrEx);
|
||||
#else
|
||||
sb.AppendFormat("S/N:{0} ", SerialNr);
|
||||
#endif
|
||||
@@ -438,101 +388,5 @@ namespace Results.Entities
|
||||
sb.AppendFormat(" test start: {0} {1} batch={2}", StartTime().ToShortDateString(), StartTime().ToShortTimeString(), BatchNr());
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get decorated test names for a specified watermeter
|
||||
/// </summary>
|
||||
/// <param name="wMtr">Watermeter results entity</param>
|
||||
/// <returns>A list of strings</returns>
|
||||
public virtual IList<string> GetAllDecoratedTestNames()
|
||||
{
|
||||
IList<string> testNames = new List<string>();
|
||||
|
||||
if (MeterTestRslts != null)
|
||||
{
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound || mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy)
|
||||
&& mtr.TestDone
|
||||
&& (mtr.Publish() != Config.Entities.Publish.Never)
|
||||
&& (mtr.Publish() != Config.Entities.Publish.Internal))
|
||||
{
|
||||
testNames.Add(mtr.Name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return testNames;
|
||||
}
|
||||
|
||||
|
||||
static readonly System.Drawing.Color NotCompletedColor = System.Drawing.Color.White;
|
||||
static readonly System.Drawing.Color OkColor = System.Drawing.Color.LightGreen;
|
||||
static readonly System.Drawing.Color NokColor = System.Drawing.Color.LightPink;
|
||||
static readonly System.Drawing.Color RejectColor = System.Drawing.Color.Magenta;
|
||||
static readonly System.Drawing.Color ProductionErrorColor = System.Drawing.Color.RoyalBlue;
|
||||
static readonly System.Drawing.Color WrongDirectionColor = System.Drawing.Color.Gold;
|
||||
static readonly System.Drawing.Color WrongQ2FactorsColor = System.Drawing.Color.Red;
|
||||
|
||||
/// <summary>
|
||||
/// Get color for highlighting results and an apporpriate text message.
|
||||
/// </summary>
|
||||
/// <param name="wMtr">Water meter results entity</param>
|
||||
/// <param name="message">Appropriate message</param>
|
||||
/// <returns>Color for results</returns>
|
||||
public virtual System.Drawing.Color GetColorOfResults(bool maxRepeatsExceeded, out string message)
|
||||
{
|
||||
bool wmtrCompleted = CompletedFromTests();
|
||||
bool wmtrPassed = PassedFromTests();
|
||||
|
||||
if ((ErrorFlags & (int)ErrorFlagMask.E28) != 0)
|
||||
{
|
||||
message = Strings.Previous_step_is_missing_or_NOK;
|
||||
return ProductionErrorColor;
|
||||
}
|
||||
else if ((ErrorFlags & (int)ErrorFlagMask.E27) != 0)
|
||||
{
|
||||
message = Strings.Wrong_iPerl_counting_direction;
|
||||
return WrongDirectionColor;
|
||||
}
|
||||
else if ((ErrorFlags & (int)ErrorFlagMask.E26) != 0)
|
||||
{
|
||||
message = Strings.Invalid_Q2_correction_factors;
|
||||
return WrongQ2FactorsColor;
|
||||
}
|
||||
else if (wmtrPassed)
|
||||
{
|
||||
/// Water meter passed (therefore is was also completed)
|
||||
message = Strings.Passed;
|
||||
return OkColor;
|
||||
}
|
||||
else if (wmtrCompleted)
|
||||
{
|
||||
/// Water meter was completed but did not pass => Failed
|
||||
if (maxRepeatsExceeded)
|
||||
{
|
||||
message = Strings.Test_repetition_count_exceeded_upper_limit;
|
||||
return RejectColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
message = Strings.Failed;
|
||||
return NokColor;
|
||||
}
|
||||
}
|
||||
else if (Disabled)
|
||||
{
|
||||
/// Water meter was not completed yet => did not pass, did not fail
|
||||
message = Strings.This_position_is_disabled;
|
||||
return NotCompletedColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Water meter was not completed yet => did not pass, did not fail
|
||||
message = Strings.Test_in_progress;
|
||||
return NotCompletedColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Results.Entities
|
||||
|
||||
#if ORACLE_DB
|
||||
public virtual int WMTypeId { get; set; }
|
||||
public virtual int WMTypeRev { get; set; }
|
||||
#endif
|
||||
|
||||
public WaterMeterData()
|
||||
@@ -110,6 +111,7 @@ namespace Results.Entities
|
||||
|
||||
#if ORACLE_DB
|
||||
if (WMTypeId != wmd.WMTypeId) return false;
|
||||
if (WMTypeRev != wmd.WMTypeRev) return false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
+268
-219
@@ -1,11 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
using NHibernate;
|
||||
using TracingDB.Entities;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
@@ -13,33 +16,42 @@ namespace Results.Forms
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg));
|
||||
|
||||
DateTime lastRedraw;
|
||||
DateTime lastSizeChange;
|
||||
bool loaded;
|
||||
|
||||
///
|
||||
/// Public members
|
||||
///
|
||||
public Results.BatchResults Results;
|
||||
public IList<Results.WMeterRsltItemSpec> Items;
|
||||
public MetersArrangement MetersArrangement;
|
||||
public TestsArrangement TestsArrangement;
|
||||
public int NrMetersInOneGroup;
|
||||
public bool ShowDisabledPositions;
|
||||
public int MinWidth;
|
||||
public int MinHeight;
|
||||
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_SingleWM;
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_CombinedWM;
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_HeatM;
|
||||
public int[] RsltsClmnWidths { set { rsltsClmnWidths = value; } }
|
||||
|
||||
public int PopupResultsLeft;
|
||||
public int PopupResultsTop;
|
||||
public int PopupResultsWidth;
|
||||
public int PopupResultsHeight;
|
||||
public int[] RsltsClmnWidths;
|
||||
|
||||
public Results.BatchResults Results { set { Display(value); } }
|
||||
|
||||
///
|
||||
/// Private members
|
||||
///
|
||||
IOneWMResultsCtrl[] wmRsltsCtrl; /// An array of controls with water meter results.
|
||||
IOneWMResultsCtrl firstEnabledControl;
|
||||
DateTime lastRedraw;
|
||||
DateTime lastSizeChange;
|
||||
int metersInOneGroup;
|
||||
int nrGroups;
|
||||
Results.BatchResults results;
|
||||
MetersKind metersKind;
|
||||
|
||||
ListView firstListView;
|
||||
public int[] rsltsClmnWidths;
|
||||
int rsltsClmnCount { get { return (rsltsClmnWidths != null) ? rsltsClmnWidths.Length : 0; } }
|
||||
|
||||
int lvWidth;
|
||||
int lvHeight;
|
||||
|
||||
|
||||
Timer timer;
|
||||
|
||||
@@ -47,226 +59,291 @@ namespace Results.Forms
|
||||
public BatchResultsDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = Strings.Results;
|
||||
|
||||
firstEnabledControl = null;
|
||||
lastSizeChange = DateTime.Now;
|
||||
nrGroups = 1;
|
||||
metersInOneGroup = 1;
|
||||
|
||||
/// Create a timer with one second interval.
|
||||
// Create a timer with a ten second interval.
|
||||
timer = new Timer();
|
||||
timer.Interval = 1000; /// ms
|
||||
timer.Interval = 500; /// ms
|
||||
timer.Tick += new EventHandler(OnTimer);
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private void BatchResultsDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (PopupResultsLeft != 0) Left = PopupResultsLeft;
|
||||
if (PopupResultsTop != 0) Top = PopupResultsTop;
|
||||
if (PopupResultsWidth != 0) Width = PopupResultsWidth;
|
||||
if (PopupResultsLeft != 0) Left = PopupResultsLeft;
|
||||
if (PopupResultsTop != 0) Top = PopupResultsTop;
|
||||
if (PopupResultsWidth != 0) Width = PopupResultsWidth;
|
||||
if (PopupResultsHeight != 0) Height = PopupResultsHeight;
|
||||
|
||||
CreateControlsAndFillPanel(Results);
|
||||
UpdateColumnWidths(RsltsClmnWidths);
|
||||
UpdateResults(Results);
|
||||
loaded = true;
|
||||
if (results != null) Redraw();
|
||||
}
|
||||
|
||||
public void Display(Results.BatchResults results)
|
||||
{
|
||||
this.results = results;
|
||||
if (loaded) Redraw();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Handle double-click inside a water meter results control
|
||||
///
|
||||
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
IList<Results.WMeterRsltItemSpec> GetRsltItems(MetersKind metersKind)
|
||||
{
|
||||
if (Results.WaterMeters != null && args.WMPosition > 0)
|
||||
IList<Results.WMeterRsltItemSpec> srcItems;
|
||||
switch (metersKind)
|
||||
{
|
||||
foreach (var wm in Results.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && (wm.WMPosition == args.WMPosition))
|
||||
{
|
||||
ShowMoreWMResults(wm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
default:
|
||||
case MetersKind.Single: srcItems = RsltItems_Screen_SingleWM; break;
|
||||
case MetersKind.Combined: srcItems = RsltItems_Screen_CombinedWM; break;
|
||||
case MetersKind.HeatMeter: srcItems = RsltItems_Screen_HeatM; break;
|
||||
}
|
||||
|
||||
MessageBox.Show(Strings.No_water_meter);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void UpdateColumnWidths(int[] columnWidths)
|
||||
{
|
||||
foreach (var ctrl in wmRsltsCtrl) ctrl.Update(columnWidths);
|
||||
}
|
||||
|
||||
void UpdateScrollpositions(int scrollStart)
|
||||
{
|
||||
/// TODO
|
||||
IList<Results.WMeterRsltItemSpec> copiedItems = new List<Results.WMeterRsltItemSpec>();
|
||||
foreach (var it in srcItems) copiedItems.Add(it.Clone());
|
||||
return copiedItems;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Re-draw the results. Apply new settings if they changed.
|
||||
/// </summary>
|
||||
void CreateControlsAndFillPanel(Results.BatchResults results)
|
||||
public void Redraw()
|
||||
{
|
||||
if ((results == null) || (results.WMPositionsCount == 0))
|
||||
{
|
||||
/// There are no water meters at all
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
wmRsltsCtrl = new OneWMResultsRowsCtrl[0];
|
||||
firstEnabledControl = null;
|
||||
return;
|
||||
}
|
||||
|
||||
///
|
||||
/// Determine water meter positions count
|
||||
///
|
||||
int displayedControlsCount = 0;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
|
||||
{
|
||||
displayedControlsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Calculate geometry
|
||||
///
|
||||
metersInOneGroup = Math.Max(1, Math.Min(displayedControlsCount, NrMetersInOneGroup));
|
||||
nrGroups = Math.Max(1, (displayedControlsCount + metersInOneGroup - 1) / metersInOneGroup);
|
||||
|
||||
int oneWidth;
|
||||
int oneHeight;
|
||||
///
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
///
|
||||
/// Create controls and fill the FlowLayoutPanel
|
||||
///
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
flowLayoutPanel.WrapContents = true;
|
||||
flowLayoutPanel.AutoScroll = true;
|
||||
|
||||
wmRsltsCtrl = new IOneWMResultsCtrl[displayedControlsCount];
|
||||
int ix = 0;
|
||||
firstEnabledControl = null;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
|
||||
{
|
||||
/// Create one water meter position / control
|
||||
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
|
||||
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
|
||||
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
|
||||
wmRsltsCtrl[ix].Width = oneWidth;
|
||||
wmRsltsCtrl[ix].Height = oneHeight;
|
||||
|
||||
if ((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
if ((firstEnabledControl == null) && (results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
firstEnabledControl = wmRsltsCtrl[ix];
|
||||
}
|
||||
|
||||
//wmRsltsCtrl[ix].Update(results.WaterMeters[i].WMPosition);
|
||||
wmRsltsCtrl[ix].Update(Items);
|
||||
wmRsltsCtrl[ix].WMResultsClickedHandler += delegate(object s, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), s, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDoubleClick(s, args);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
|
||||
ix++;
|
||||
}
|
||||
}
|
||||
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
|
||||
lastRedraw = DateTime.Now;
|
||||
}
|
||||
|
||||
this.SuspendLayout();
|
||||
|
||||
|
||||
void UpdateResults(Results.BatchResults results)
|
||||
{
|
||||
if ((results != null) && (results.WaterMeters != null))
|
||||
try
|
||||
{
|
||||
int ctrlIx = 0;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
/// Determine how many water meters were enabled for result evaluation and printing
|
||||
int enabledWMsCount = 0;
|
||||
for (int i = 0; i < results.WMPositionsCount; i++)
|
||||
{
|
||||
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.WaterMeters[i]);
|
||||
enabledWMsCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int metersInOneGroup = Math.Max(1, Math.Min(enabledWMsCount, NrMetersInOneGroup));
|
||||
int nrGroups = Math.Max(1, (enabledWMsCount + metersInOneGroup - 1) / metersInOneGroup);
|
||||
|
||||
void ShowMoreWMResults(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
new Results.Forms.MoreWMResultsDlg(wm, null).ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
using (ISession session = TracingDB.DB.SessionFactory.OpenSession())
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
IList<ReferenceRecord> refRecords = session.QueryOver<ReferenceRecord>()
|
||||
.Where(x => (x.Code == wm.SerialNr))
|
||||
.OrderBy(x => x.TimeStamp).Desc
|
||||
.List();
|
||||
for (int i = 0; i < refRecords.Count; i++)
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
lvWidth = flowLayoutPanel.Width / metersInOneGroup - 6;
|
||||
lvHeight = flowLayoutPanel.Height / nrGroups - 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
lvWidth = flowLayoutPanel.Width / nrGroups - 6;
|
||||
lvHeight = flowLayoutPanel.Height / metersInOneGroup - 6;
|
||||
}
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
flowLayoutPanel.WrapContents = true;
|
||||
flowLayoutPanel.AutoScroll = true;
|
||||
|
||||
bool first = true;
|
||||
for (int i = 0; i < results.WMPositionsCount; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
ReferenceRecord refR = refRecords[i];
|
||||
if ((refR.Records != null) && (refR.Records.Count > 0))
|
||||
ListView lview = (TestsArrangement == TestsArrangement.Rows)
|
||||
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
|
||||
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
|
||||
if (lview != null)
|
||||
{
|
||||
/// Reference record has additional records/parts (i.e. it is PCB assembly workflow step)
|
||||
///
|
||||
foreach (var rec in refR.Records)
|
||||
flowLayoutPanel.Controls.Add(lview);
|
||||
if (first)
|
||||
{
|
||||
if (rec.Part.OraDBType.ToLower().Contains("flowtube"))
|
||||
{
|
||||
/// rec.Part is a flowtube
|
||||
///
|
||||
IList<ReferenceRecord> flowtubeRRs = session.QueryOver<ReferenceRecord>()
|
||||
.Where(x => (x.Code == rec.Code))
|
||||
.OrderBy(x => x.TimeStamp).Desc
|
||||
.List();
|
||||
foreach (var rr in flowtubeRRs) refRecords.Add(rr);
|
||||
}
|
||||
firstListView = lview;
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Results.Forms.MoreWMResultsDlg(wm, refRecords).ShowDialog();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.FatalFormat("Redrawing results failed : {0}", e.Message);
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
|
||||
}
|
||||
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
|
||||
}
|
||||
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an empty ListView control with appropriate parameters.
|
||||
/// </summary>
|
||||
/// <returns>ListView control</returns>
|
||||
ListView GetListView()
|
||||
{
|
||||
ListView lview = new ListView();
|
||||
lview.AllowColumnReorder = false;
|
||||
lview.Dock = System.Windows.Forms.DockStyle.None;
|
||||
lview.FullRowSelect = true;
|
||||
lview.GridLines = true;
|
||||
lview.Location = new System.Drawing.Point(0, 0);
|
||||
lview.Size = new System.Drawing.Size(lvWidth, lvHeight);
|
||||
lview.TabIndex = 0;
|
||||
lview.UseCompatibleStateImageBehavior = false;
|
||||
lview.View = System.Windows.Forms.View.Details;
|
||||
return lview;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get decorated test names for a specified watermeter
|
||||
/// </summary>
|
||||
/// <param name="wMtr">Watermeter results entity</param>
|
||||
/// <returns>A list of strings</returns>
|
||||
IList<string> GetAllDecoratedTestNames(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
IList<string> testNames = new List<string>();
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr.IsPilotRslt() && mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never)
|
||||
&& (mtr.Publish() != Config.Entities.Publish.Internal))
|
||||
{
|
||||
testNames.Add(mtr.Name());
|
||||
}
|
||||
}
|
||||
|
||||
return testNames;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a ListView control filled with results of the meter 'mtr'
|
||||
/// </summary>
|
||||
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
|
||||
/// <returns>ListView object</returns>
|
||||
ListView GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
|
||||
{
|
||||
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
|
||||
|
||||
ListView lview = GetListView();
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
|
||||
int col = 1;
|
||||
foreach (var item in items)
|
||||
{
|
||||
lview.Columns.Add(item.Caption, (rsltsClmnCount > col) ? rsltsClmnWidths[col] : 70);
|
||||
col++;
|
||||
}
|
||||
|
||||
|
||||
IList<string> testNames = GetAllDecoratedTestNames(wMtr);
|
||||
int ix = 0;
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
|
||||
&& mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(testNames[ix++]);
|
||||
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string str = items[i].Print(wMtr, mtr.Name());
|
||||
|
||||
/// Extract and use color information
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
lview.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
return lview;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a ListView control filled with results of the meter 'mtr'
|
||||
/// </summary>
|
||||
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
|
||||
/// <returns>ListView object</returns>
|
||||
ListView GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
|
||||
{
|
||||
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
|
||||
|
||||
ListView lview = GetListView();
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
|
||||
int i = 1;
|
||||
foreach (var str in GetAllDecoratedTestNames(wMtr))
|
||||
{
|
||||
lview.Columns.Add(str, (rsltsClmnCount > i) ? rsltsClmnWidths[i] : 70);
|
||||
i++;
|
||||
}
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Caption);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lview.Items.Add(lvi);
|
||||
}
|
||||
|
||||
return lview;
|
||||
}
|
||||
|
||||
private void BatchResultsDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
@@ -276,7 +353,6 @@ namespace Results.Forms
|
||||
PopupResultsHeight = Height;
|
||||
}
|
||||
|
||||
|
||||
private void flowLayoutPanel_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
lastSizeChange = DateTime.Now;
|
||||
@@ -286,40 +362,13 @@ namespace Results.Forms
|
||||
{
|
||||
if (DateTime.Compare(lastSizeChange, lastRedraw) > 0)
|
||||
{
|
||||
/// The last size change was more recent then the last redraw
|
||||
/// The last size change was later then the last redraw
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
if (DateTime.Compare(lastSizeChange + new TimeSpan(0, 0, 1), now) < 0)
|
||||
{
|
||||
/// More then 1 second since the last panel size change
|
||||
|
||||
/// Calculate geometry
|
||||
int oneWidth;
|
||||
int oneHeight;
|
||||
///
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
/// Update size of controls
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
///
|
||||
foreach (var oneCtrl in wmRsltsCtrl)
|
||||
{
|
||||
oneCtrl.Width = oneWidth;
|
||||
oneCtrl.Height = oneHeight;
|
||||
}
|
||||
///
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
/// More then 1s since the last size change
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public interface IOneWMResultsCtrl
|
||||
{
|
||||
event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
|
||||
bool Disabled { get; } /// true when water meter position is disabled
|
||||
int WMPosition { get; } /// 1-based WM position
|
||||
int Width { get; set; } /// Control width
|
||||
int Height { get; set; } /// Control height
|
||||
ListView.ColumnHeaderCollection Columns { get; } /// Embedded ListView control columns
|
||||
|
||||
void Update(int[] columnWidths);
|
||||
void Update(IList<Results.WMeterRsltItemSpec> items);
|
||||
void Update(Results.Entities.WaterMeter wMtr);
|
||||
}
|
||||
}
|
||||
-258
@@ -1,258 +0,0 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class ManualEntryConfigCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.availableTabControl = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.availableByQuantityTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.availableByCategoryTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
|
||||
this.downButton = new System.Windows.Forms.Button();
|
||||
this.upButton = new System.Windows.Forms.Button();
|
||||
this.selectedResultsListViewEx = new Results.Forms.ListViewEx();
|
||||
this.removeAllButton = new System.Windows.Forms.Button();
|
||||
this.removeButton = new System.Windows.Forms.Button();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.selectedItemsLabel = new System.Windows.Forms.Label();
|
||||
this.availableItemsLabel = new System.Windows.Forms.Label();
|
||||
this.availableTabControl.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// availableTabControl
|
||||
//
|
||||
this.availableTabControl.Controls.Add(this.tabPage1);
|
||||
this.availableTabControl.Controls.Add(this.tabPage2);
|
||||
this.availableTabControl.Controls.Add(this.tabPage3);
|
||||
this.availableTabControl.Enabled = false;
|
||||
this.availableTabControl.Location = new System.Drawing.Point(9, 33);
|
||||
this.availableTabControl.Name = "availableTabControl";
|
||||
this.availableTabControl.SelectedIndex = 0;
|
||||
this.availableTabControl.Size = new System.Drawing.Size(206, 453);
|
||||
this.availableTabControl.TabIndex = 59;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.availableByQuantityTreeView);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(198, 427);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "A...Z";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableByQuantityTreeView
|
||||
//
|
||||
this.availableByQuantityTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableByQuantityTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.availableByQuantityTreeView.Name = "availableByQuantityTreeView";
|
||||
this.availableByQuantityTreeView.Size = new System.Drawing.Size(192, 421);
|
||||
this.availableByQuantityTreeView.TabIndex = 0;
|
||||
this.availableByQuantityTreeView.DoubleClick += new System.EventHandler(this.availableByQuantityTreeView_DoubleClick);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.availableByCategoryTreeView);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(198, 427);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "by quantity";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableByCategoryTreeView
|
||||
//
|
||||
this.availableByCategoryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableByCategoryTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.availableByCategoryTreeView.Name = "availableByCategoryTreeView";
|
||||
this.availableByCategoryTreeView.Size = new System.Drawing.Size(192, 421);
|
||||
this.availableByCategoryTreeView.TabIndex = 0;
|
||||
this.availableByCategoryTreeView.DoubleClick += new System.EventHandler(this.availableByCategoryTreeView_DoubleClick);
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.availableAlphabeticTreeView);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Size = new System.Drawing.Size(198, 427);
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "by category";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableAlphabeticTreeView
|
||||
//
|
||||
this.availableAlphabeticTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableAlphabeticTreeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.availableAlphabeticTreeView.Name = "availableAlphabeticTreeView";
|
||||
this.availableAlphabeticTreeView.Size = new System.Drawing.Size(198, 427);
|
||||
this.availableAlphabeticTreeView.TabIndex = 0;
|
||||
this.availableAlphabeticTreeView.DoubleClick += new System.EventHandler(this.availableAlphabeticTreeView_DoubleClick);
|
||||
//
|
||||
// downButton
|
||||
//
|
||||
this.downButton.Enabled = false;
|
||||
this.downButton.Location = new System.Drawing.Point(221, 351);
|
||||
this.downButton.Name = "downButton";
|
||||
this.downButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.downButton.TabIndex = 58;
|
||||
this.downButton.Text = "Down";
|
||||
this.downButton.UseVisualStyleBackColor = true;
|
||||
this.downButton.Click += new System.EventHandler(this.downButton_Click);
|
||||
//
|
||||
// upButton
|
||||
//
|
||||
this.upButton.Enabled = false;
|
||||
this.upButton.Location = new System.Drawing.Point(221, 315);
|
||||
this.upButton.Name = "upButton";
|
||||
this.upButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.upButton.TabIndex = 57;
|
||||
this.upButton.Text = "Up";
|
||||
this.upButton.UseVisualStyleBackColor = true;
|
||||
this.upButton.Click += new System.EventHandler(this.upButton_Click);
|
||||
//
|
||||
// selectedResultsListViewEx
|
||||
//
|
||||
this.selectedResultsListViewEx.AllowColumnReorder = true;
|
||||
this.selectedResultsListViewEx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectedResultsListViewEx.DoubleClickActivation = false;
|
||||
this.selectedResultsListViewEx.Enabled = false;
|
||||
this.selectedResultsListViewEx.FullRowSelect = true;
|
||||
this.selectedResultsListViewEx.GridLines = true;
|
||||
this.selectedResultsListViewEx.Location = new System.Drawing.Point(322, 33);
|
||||
this.selectedResultsListViewEx.Name = "selectedResultsListViewEx";
|
||||
this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 453);
|
||||
this.selectedResultsListViewEx.TabIndex = 56;
|
||||
this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.selectedResultsListViewEx.DoubleClick += new System.EventHandler(this.selectedResultsListViewEx_DoubleClick);
|
||||
//
|
||||
// removeAllButton
|
||||
//
|
||||
this.removeAllButton.Enabled = false;
|
||||
this.removeAllButton.Location = new System.Drawing.Point(221, 223);
|
||||
this.removeAllButton.Name = "removeAllButton";
|
||||
this.removeAllButton.Size = new System.Drawing.Size(94, 30);
|
||||
this.removeAllButton.TabIndex = 55;
|
||||
this.removeAllButton.Text = "<< R&emove all";
|
||||
this.removeAllButton.UseVisualStyleBackColor = true;
|
||||
this.removeAllButton.Visible = false;
|
||||
this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click);
|
||||
//
|
||||
// removeButton
|
||||
//
|
||||
this.removeButton.Enabled = false;
|
||||
this.removeButton.Location = new System.Drawing.Point(221, 188);
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.removeButton.TabIndex = 54;
|
||||
this.removeButton.Text = "< &Remove";
|
||||
this.removeButton.UseVisualStyleBackColor = true;
|
||||
this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.Enabled = false;
|
||||
this.addButton.Location = new System.Drawing.Point(221, 153);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.addButton.TabIndex = 53;
|
||||
this.addButton.Text = "&Add >";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addButton_Click);
|
||||
//
|
||||
// selectedItemsLabel
|
||||
//
|
||||
this.selectedItemsLabel.AutoSize = true;
|
||||
this.selectedItemsLabel.Location = new System.Drawing.Point(321, 11);
|
||||
this.selectedItemsLabel.Name = "selectedItemsLabel";
|
||||
this.selectedItemsLabel.Size = new System.Drawing.Size(79, 13);
|
||||
this.selectedItemsLabel.TabIndex = 52;
|
||||
this.selectedItemsLabel.Text = "Selected items:";
|
||||
//
|
||||
// availableItemsLabel
|
||||
//
|
||||
this.availableItemsLabel.AutoSize = true;
|
||||
this.availableItemsLabel.Location = new System.Drawing.Point(11, 11);
|
||||
this.availableItemsLabel.Name = "availableItemsLabel";
|
||||
this.availableItemsLabel.Size = new System.Drawing.Size(80, 13);
|
||||
this.availableItemsLabel.TabIndex = 51;
|
||||
this.availableItemsLabel.Text = "Available items:";
|
||||
//
|
||||
// ManualEntryConfigCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.availableTabControl);
|
||||
this.Controls.Add(this.downButton);
|
||||
this.Controls.Add(this.upButton);
|
||||
this.Controls.Add(this.selectedResultsListViewEx);
|
||||
this.Controls.Add(this.removeAllButton);
|
||||
this.Controls.Add(this.removeButton);
|
||||
this.Controls.Add(this.addButton);
|
||||
this.Controls.Add(this.selectedItemsLabel);
|
||||
this.Controls.Add(this.availableItemsLabel);
|
||||
this.Name = "ManualEntryConfigCtrl";
|
||||
this.Size = new System.Drawing.Size(925, 496);
|
||||
this.Load += new System.EventHandler(this.ManualEntryConfigCtrl_Load);
|
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ManualEntryConfigCtrl_KeyPress);
|
||||
this.availableTabControl.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl availableTabControl;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TreeView availableByQuantityTreeView;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.TreeView availableByCategoryTreeView;
|
||||
private System.Windows.Forms.TabPage tabPage3;
|
||||
private System.Windows.Forms.TreeView availableAlphabeticTreeView;
|
||||
private System.Windows.Forms.Button downButton;
|
||||
private System.Windows.Forms.Button upButton;
|
||||
private ListViewEx selectedResultsListViewEx;
|
||||
private System.Windows.Forms.Button removeAllButton;
|
||||
private System.Windows.Forms.Button removeButton;
|
||||
private System.Windows.Forms.Button addButton;
|
||||
private System.Windows.Forms.Label selectedItemsLabel;
|
||||
private System.Windows.Forms.Label availableItemsLabel;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,450 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class ManualEntryConfigCtrl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// ListViewEx columns
|
||||
/// </summary>
|
||||
enum Column
|
||||
{
|
||||
Item,
|
||||
Caption,
|
||||
Units,
|
||||
Count,
|
||||
}
|
||||
|
||||
Control[] editors; /// all editors except of units
|
||||
ComboBox unitsCB; /// units combo box
|
||||
|
||||
public IList<ManualEntryItemSpec> SelectedItems;
|
||||
public bool Unlocked
|
||||
{
|
||||
set
|
||||
{
|
||||
availableTabControl.Enabled = value;
|
||||
selectedResultsListViewEx.Enabled = value;
|
||||
addButton.Enabled = value;
|
||||
removeButton.Enabled = value;
|
||||
removeAllButton.Enabled = value;
|
||||
upButton.Enabled = value;
|
||||
downButton.Enabled = value;
|
||||
unlocked = value;
|
||||
}
|
||||
get { return unlocked; }
|
||||
}
|
||||
bool unlocked;
|
||||
|
||||
|
||||
public ManualEntryConfigCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Configuration;
|
||||
availableItemsLabel.Text = Strings.Available_items;
|
||||
availableTabControl.TabPages[0].Text = Strings.Quantity;
|
||||
availableTabControl.TabPages[1].Text = Strings.Category;
|
||||
availableTabControl.TabPages[2].Text = "A...Z";
|
||||
|
||||
selectedItemsLabel.Text = Strings.Selected_items;
|
||||
|
||||
addButton.Text = Strings.Add;
|
||||
removeButton.Text = Strings.Remove;
|
||||
removeAllButton.Text = Strings.Remove_all;
|
||||
upButton.Text = Strings.UpBtnText;
|
||||
downButton.Text = Strings.DownBtnText;
|
||||
}
|
||||
|
||||
private void ManualEntryConfigCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
/// Add columns to ListViewEx
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Item, Width = 120 });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Caption });
|
||||
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Units });
|
||||
|
||||
/// Create controls used by ListViewEx to edit items
|
||||
unitsCB = new ComboBox();
|
||||
|
||||
ComboBox alignmentCB = new ComboBox();
|
||||
for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
|
||||
{
|
||||
alignmentCB.Items.Add(a.ToDescription());
|
||||
}
|
||||
|
||||
editors = new Control[]
|
||||
{
|
||||
null,
|
||||
new TextBox(), /// caption
|
||||
unitsCB,
|
||||
};
|
||||
foreach (var edi in editors)
|
||||
{
|
||||
if (edi != null)
|
||||
{
|
||||
edi.Visible = false;
|
||||
Controls.Add(edi);
|
||||
}
|
||||
}
|
||||
|
||||
selectedResultsListViewEx.SubItemClicked += new SubItemEventHandler(selectedResultsListViewEx_SubItemClicked);
|
||||
selectedResultsListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(selectedResultsListViewEx_SubItemEndEditing);
|
||||
|
||||
availableByQuantityTreeView.ShowNodeToolTips = true;
|
||||
availableByCategoryTreeView.ShowNodeToolTips = true;
|
||||
availableAlphabeticTreeView.ShowNodeToolTips = true;
|
||||
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
}
|
||||
|
||||
void selectedResultsListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
if (e.SubItem == (int)Column.Units)
|
||||
{
|
||||
Config.Quantity quantity = (e.Item.Tag as ManualEntryItemSpec).Quantity;
|
||||
unitsCB.Items.Clear();
|
||||
unitsCB.Items.Add(Config.Unit.None.ToDescription()); /// "---"
|
||||
for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++)
|
||||
{
|
||||
if (Config.Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
|
||||
}
|
||||
selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem);
|
||||
}
|
||||
else if ((e.SubItem > 0) && (e.SubItem < (int)Column.Count))
|
||||
{
|
||||
selectedResultsListViewEx.StartEditing(editors[e.SubItem], e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
void selectedResultsListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
|
||||
{
|
||||
ListViewItem lvi = e.Item;
|
||||
ManualEntryItemSpec item = lvi.Tag as ManualEntryItemSpec;
|
||||
|
||||
switch ((Column)e.SubItem)
|
||||
{
|
||||
case Column.Caption: item.Caption = e.DisplayText; return;
|
||||
case Column.Units:
|
||||
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
|
||||
{
|
||||
if (u.ToDescription().Equals(unitsCB.Text))
|
||||
{
|
||||
item.Units = u;
|
||||
return; /// OK
|
||||
}
|
||||
}
|
||||
break; /// Error
|
||||
|
||||
default:
|
||||
return; /// OK
|
||||
}
|
||||
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Redraw available items (right hand side)
|
||||
/// </summary>
|
||||
void RedrawAvailable()
|
||||
{
|
||||
RedrawByQuantity(availableByQuantityTreeView);
|
||||
RedrawByCategory(availableByCategoryTreeView);
|
||||
RedrawInAlphabeticOrder(availableAlphabeticTreeView);
|
||||
}
|
||||
|
||||
|
||||
void RedrawInAlphabeticOrder(TreeView treeView)
|
||||
{
|
||||
treeView.Nodes.Clear();
|
||||
|
||||
IList<ManualEntryItemSpec> alphabeticlList = ManualEntryItemSpec.AllItems.OrderBy(x => x.Name).ToList();
|
||||
///
|
||||
foreach (var item in alphabeticlList)
|
||||
{
|
||||
TreeNode node = new TreeNode(item.Name);
|
||||
node.Tag = item;
|
||||
node.ToolTipText = item.ToolTipText;
|
||||
treeView.Nodes.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RedrawByQuantity(TreeView treeView)
|
||||
{
|
||||
treeView.Nodes.Clear();
|
||||
|
||||
IList<Config.Quantity> quantities = new List<Config.Quantity>();
|
||||
for (Config.Quantity q = 0; q < Config.Quantity.Count; q++) quantities.Add(q);
|
||||
|
||||
IList<Config.Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
|
||||
|
||||
foreach (var q in sortedQuantities)
|
||||
{
|
||||
int n = 0;
|
||||
foreach (var ri in ManualEntryItemSpec.AllItems)
|
||||
{
|
||||
if (ri.Quantity == q) n++;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
TreeNode[] array = new TreeNode[n];
|
||||
int i = 0;
|
||||
foreach (var ri in ManualEntryItemSpec.AllItems)
|
||||
{
|
||||
if (ri.Quantity == q)
|
||||
{
|
||||
TreeNode node = new TreeNode(ri.Name);
|
||||
node.Tag = ri;
|
||||
node.ToolTipText = ri.ToolTipText;
|
||||
array[i++] = node;
|
||||
}
|
||||
}
|
||||
|
||||
treeView.Nodes.Add(new TreeNode(q.ToDescription(), array));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RedrawByCategory(TreeView treeView)
|
||||
{
|
||||
treeView.Nodes.Clear();
|
||||
|
||||
IList<ItemCategory> categories = new List<ItemCategory>();
|
||||
for (ItemCategory c = 0; c < ItemCategory.Count; c++) categories.Add(c);
|
||||
|
||||
IList<ItemCategory> sortedCategories = categories.OrderBy(x => x.ToDescription()).ToList();
|
||||
|
||||
foreach (var c in sortedCategories)
|
||||
{
|
||||
int n = 0;
|
||||
foreach (var ri in ManualEntryItemSpec.AllItems)
|
||||
{
|
||||
if (ri.Category == c) n++;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
TreeNode[] array = new TreeNode[n];
|
||||
int i = 0;
|
||||
foreach (var ri in ManualEntryItemSpec.AllItems)
|
||||
{
|
||||
if (ri.Category == c)
|
||||
{
|
||||
TreeNode node = new TreeNode(ri.Name);
|
||||
node.Tag = ri;
|
||||
node.ToolTipText = ri.ToolTipText;
|
||||
array[i++] = node;
|
||||
}
|
||||
}
|
||||
|
||||
treeView.Nodes.Add(new TreeNode(c.ToDescription(), array));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Redraw selected items (right hand side)
|
||||
/// </summary>
|
||||
void RedrawSelected()
|
||||
{
|
||||
selectedResultsListViewEx.Items.Clear();
|
||||
|
||||
if (SelectedItems == null) return;
|
||||
|
||||
foreach (var item in SelectedItems)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Name); /// Item
|
||||
lvi.Tag = item;
|
||||
lvi.SubItems.Add(item.Caption); /// Header
|
||||
lvi.SubItems.Add(item.Units.ToDescription()); /// Units
|
||||
selectedResultsListViewEx.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSelectedFromView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
switch (availableTabControl.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
availableByQuantityTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
case 1:
|
||||
availableByCategoryTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
case 2:
|
||||
availableAlphabeticTreeView_DoubleClick(this, null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void availableByQuantityTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableByQuantityTreeView.SelectedNode != null &&
|
||||
availableByQuantityTreeView.SelectedNode.Tag is ManualEntryItemSpec)
|
||||
{
|
||||
AddItem(availableByQuantityTreeView.SelectedNode.Tag as ManualEntryItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
private void availableByCategoryTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableByCategoryTreeView.SelectedNode != null &&
|
||||
availableByCategoryTreeView.SelectedNode.Tag is ManualEntryItemSpec)
|
||||
{
|
||||
AddItem(availableByCategoryTreeView.SelectedNode.Tag as ManualEntryItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
private void availableAlphabeticTreeView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (availableAlphabeticTreeView.SelectedNode != null &&
|
||||
availableAlphabeticTreeView.SelectedNode.Tag is ManualEntryItemSpec)
|
||||
{
|
||||
AddItem(availableAlphabeticTreeView.SelectedNode.Tag as ManualEntryItemSpec);
|
||||
}
|
||||
}
|
||||
|
||||
void AddItem(ManualEntryItemSpec item)
|
||||
{
|
||||
ManualEntryItemSpec newItem = item.Clone();
|
||||
newItem.Caption = newItem.Name;
|
||||
SelectedItems.Add(newItem);
|
||||
RedrawSelected();
|
||||
|
||||
/// Select the last item
|
||||
selectedResultsListViewEx.Focus();
|
||||
selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
|
||||
selectedResultsListViewEx.Items[SelectedItems.Count - 1].EnsureVisible();
|
||||
}
|
||||
|
||||
|
||||
private void selectedResultsListViewEx_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
/// Double click works when just one item is selected
|
||||
|
||||
if (selectedResultsListViewEx.SelectedIndices.Count == 1)
|
||||
{
|
||||
SelectedItems.RemoveAt(selectedResultsListViewEx.SelectedIndices[0]);
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
}
|
||||
}
|
||||
|
||||
void removeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
/// Remove from the list (the last selected item first so that the indexes are not affected)
|
||||
|
||||
for (int i = selectedResultsListViewEx.SelectedIndices.Count - 1; i >= 0; i--)
|
||||
{
|
||||
SelectedItems.RemoveAt(selectedResultsListViewEx.SelectedIndices[i]);
|
||||
}
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
}
|
||||
|
||||
void removeAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
/// Remove all items from 'Selected' list
|
||||
|
||||
SelectedItems.Clear();
|
||||
RedrawAvailable();
|
||||
RedrawSelected();
|
||||
}
|
||||
|
||||
//void okButton_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// DialogResult = DialogResult.OK;
|
||||
// Close();
|
||||
//}
|
||||
|
||||
private void ManualEntryConfigCtrl_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void upButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (selectedResultsListViewEx.SelectedIndices.Count != 1) return;
|
||||
|
||||
int selIdx = selectedResultsListViewEx.SelectedIndices[0];
|
||||
if (selIdx == 0)
|
||||
{
|
||||
/// Cannot move up
|
||||
selectedResultsListViewEx.Focus();
|
||||
selectedResultsListViewEx.Items[0].Selected = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ManualEntryItemSpec tmp = SelectedItems[selIdx - 1];
|
||||
SelectedItems[selIdx - 1] = SelectedItems[selIdx];
|
||||
SelectedItems[selIdx] = tmp;
|
||||
|
||||
RedrawSelected();
|
||||
|
||||
selectedResultsListViewEx.Focus();
|
||||
selectedResultsListViewEx.Items[selIdx - 1].Selected = true;
|
||||
selectedResultsListViewEx.Items[selIdx - 1].EnsureVisible();
|
||||
}
|
||||
|
||||
private void downButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (selectedResultsListViewEx.SelectedIndices.Count != 1) return;
|
||||
|
||||
int selIdx = selectedResultsListViewEx.SelectedIndices[0];
|
||||
if (selIdx == SelectedItems.Count - 1)
|
||||
{
|
||||
/// Cannot move down
|
||||
selectedResultsListViewEx.Focus();
|
||||
selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ManualEntryItemSpec tmp = SelectedItems[selIdx + 1];
|
||||
SelectedItems[selIdx + 1] = SelectedItems[selIdx];
|
||||
SelectedItems[selIdx] = tmp;
|
||||
|
||||
RedrawSelected();
|
||||
|
||||
selectedResultsListViewEx.Focus();
|
||||
selectedResultsListViewEx.Items[selIdx + 1].Selected = true;
|
||||
selectedResultsListViewEx.Items[selIdx + 1].EnsureVisible();
|
||||
}
|
||||
|
||||
//private void cancelButton_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// DialogResult = DialogResult.Cancel;
|
||||
// Close();
|
||||
//}
|
||||
|
||||
private void availableByCategoryTreeView_NodeMouseHover2(object sender, TreeNodeMouseHoverEventArgs e)
|
||||
{
|
||||
ToolTip toolTip = new ToolTip();
|
||||
toolTip.SetToolTip(this, e.Node.ToolTipText);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Results;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class ManualEntryConfigDlg : Form
|
||||
{
|
||||
public IList<ManualEntryItemSpec> SelectedItems
|
||||
{
|
||||
set { manualEntryConfigCtrl.SelectedItems = value; }
|
||||
get { return manualEntryConfigCtrl.SelectedItems; }
|
||||
}
|
||||
|
||||
|
||||
public ManualEntryConfigDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
manualEntryConfigCtrl.Unlocked = true;
|
||||
}
|
||||
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Configuration;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
cancelButton.Text = Strings.CancelBtnText;
|
||||
}
|
||||
|
||||
void ManualEntryConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
}
|
||||
|
||||
void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ManualEntryConfigDlg_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class ManualEntryConfigDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.manualEntryConfigCtrl = new Results.Forms.ManualEntryConfigCtrl();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(939, 29);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(105, 42);
|
||||
this.okButton.TabIndex = 4;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(939, 82);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(105, 42);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// manualEntryConfigCtrl
|
||||
//
|
||||
this.manualEntryConfigCtrl.Location = new System.Drawing.Point(-1, 1);
|
||||
this.manualEntryConfigCtrl.Name = "manualEntryConfigCtrl";
|
||||
this.manualEntryConfigCtrl.Size = new System.Drawing.Size(925, 496);
|
||||
this.manualEntryConfigCtrl.TabIndex = 6;
|
||||
this.manualEntryConfigCtrl.Unlocked = false;
|
||||
//
|
||||
// ManualEntryConfigDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1066, 498);
|
||||
this.Controls.Add(this.manualEntryConfigCtrl);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Name = "ManualEntryConfigDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "ManualEntryConfig";
|
||||
this.Load += new System.EventHandler(this.ManualEntryConfig_Load);
|
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ManualEntryConfigDlg_KeyPress);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private ManualEntryConfigCtrl manualEntryConfigCtrl;
|
||||
}
|
||||
}
|
||||
-164
@@ -1,164 +0,0 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class MoreWMResultsDlg
|
||||
{
|
||||
/// <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.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.graphsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.productionTracingTabPage = new System.Windows.Forms.TabPage();
|
||||
this.productionTracingSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.messageLabel = new System.Windows.Forms.Label();
|
||||
this.tracingResultsListView = new System.Windows.Forms.ListView();
|
||||
this.allResultsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.productionTracingTabPage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).BeginInit();
|
||||
this.productionTracingSplitContainer.Panel1.SuspendLayout();
|
||||
this.productionTracingSplitContainer.Panel2.SuspendLayout();
|
||||
this.productionTracingSplitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
this.tabControl1.Controls.Add(this.allResultsTabPage);
|
||||
this.tabControl1.Controls.Add(this.graphsTabPage);
|
||||
this.tabControl1.Controls.Add(this.productionTracingTabPage);
|
||||
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(1195, 448);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// graphsTabPage
|
||||
//
|
||||
this.graphsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.graphsTabPage.Name = "graphsTabPage";
|
||||
this.graphsTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.graphsTabPage.Size = new System.Drawing.Size(1187, 422);
|
||||
this.graphsTabPage.TabIndex = 1;
|
||||
this.graphsTabPage.Text = "Graphs";
|
||||
this.graphsTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// productionTracingTabPage
|
||||
//
|
||||
this.productionTracingTabPage.Controls.Add(this.productionTracingSplitContainer);
|
||||
this.productionTracingTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.productionTracingTabPage.Name = "productionTracingTabPage";
|
||||
this.productionTracingTabPage.Size = new System.Drawing.Size(1187, 422);
|
||||
this.productionTracingTabPage.TabIndex = 2;
|
||||
this.productionTracingTabPage.Text = "Production tracing";
|
||||
this.productionTracingTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// productionTracingSplitContainer
|
||||
//
|
||||
this.productionTracingSplitContainer.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.productionTracingSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.productionTracingSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.productionTracingSplitContainer.IsSplitterFixed = true;
|
||||
this.productionTracingSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.productionTracingSplitContainer.Name = "productionTracingSplitContainer";
|
||||
this.productionTracingSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// productionTracingSplitContainer.Panel1
|
||||
//
|
||||
this.productionTracingSplitContainer.Panel1.Controls.Add(this.messageLabel);
|
||||
this.productionTracingSplitContainer.Panel1MinSize = 55;
|
||||
//
|
||||
// productionTracingSplitContainer.Panel2
|
||||
//
|
||||
this.productionTracingSplitContainer.Panel2.Controls.Add(this.tracingResultsListView);
|
||||
this.productionTracingSplitContainer.Panel2MinSize = 60;
|
||||
this.productionTracingSplitContainer.Size = new System.Drawing.Size(1187, 422);
|
||||
this.productionTracingSplitContainer.SplitterDistance = 55;
|
||||
this.productionTracingSplitContainer.SplitterWidth = 1;
|
||||
this.productionTracingSplitContainer.TabIndex = 0;
|
||||
//
|
||||
// messageLabel
|
||||
//
|
||||
this.messageLabel.AutoSize = true;
|
||||
this.messageLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.messageLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.messageLabel.Name = "messageLabel";
|
||||
this.messageLabel.Size = new System.Drawing.Size(152, 37);
|
||||
this.messageLabel.TabIndex = 1;
|
||||
this.messageLabel.Text = "Message";
|
||||
//
|
||||
// tracingResultsListView
|
||||
//
|
||||
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tracingResultsListView.GridLines = true;
|
||||
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
|
||||
this.tracingResultsListView.Name = "tracingResultsListView";
|
||||
this.tracingResultsListView.Size = new System.Drawing.Size(1187, 366);
|
||||
this.tracingResultsListView.TabIndex = 0;
|
||||
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
|
||||
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// allResultsTabPage
|
||||
//
|
||||
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.allResultsTabPage.Name = "allResultsTabPage";
|
||||
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
|
||||
this.allResultsTabPage.TabIndex = 0;
|
||||
this.allResultsTabPage.Text = "All results";
|
||||
this.allResultsTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// MoreWMResultsDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1195, 448);
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Name = "MoreWMResultsDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Water meter results";
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.productionTracingTabPage.ResumeLayout(false);
|
||||
this.productionTracingSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.productionTracingSplitContainer.Panel1.PerformLayout();
|
||||
this.productionTracingSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).EndInit();
|
||||
this.productionTracingSplitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private OneWMResultsRowsCtrl oneWMResultsCtrl;
|
||||
private System.Windows.Forms.TabPage graphsTabPage;
|
||||
private System.Windows.Forms.TabPage productionTracingTabPage;
|
||||
private System.Windows.Forms.SplitContainer productionTracingSplitContainer;
|
||||
private System.Windows.Forms.Label messageLabel;
|
||||
private System.Windows.Forms.ListView tracingResultsListView;
|
||||
private System.Windows.Forms.TabPage allResultsTabPage;
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using TracingDB.Entities;
|
||||
using Results.Resources;
|
||||
using Config.Entities;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class MoreWMResultsDlg : Form
|
||||
{
|
||||
public MoreWMResultsDlg(Results.Entities.WaterMeter wm, IList<ReferenceRecord> refRecords)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Localize();
|
||||
|
||||
ShowAllResults(wm);
|
||||
ShowChart(wm);
|
||||
|
||||
if (refRecords == null)
|
||||
{
|
||||
tabControl1.SelectTab(1);
|
||||
tabControl1.TabPages.RemoveAt(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
tabControl1.SelectTab(2);
|
||||
ShowTracingResults(wm, refRecords);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Display all results for this water meter in the 1st tab page
|
||||
/// </summary>
|
||||
/// <param name="wMtr">Water meter entity</param>
|
||||
void ShowAllResults(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
// string message;
|
||||
// Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
|
||||
//#if ORACLE_DB
|
||||
// oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
//#else
|
||||
// oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
//#endif
|
||||
|
||||
// IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
|
||||
|
||||
// // Header
|
||||
// oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
|
||||
// int i = 1;
|
||||
// foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
// {
|
||||
// oneWMResultsCtrl.Columns.Add(str, 100);
|
||||
// i++;
|
||||
// }
|
||||
|
||||
// foreach (var item in items)
|
||||
// {
|
||||
// ListViewItem lvi = new ListViewItem(item.Name);
|
||||
|
||||
// foreach (var mtr in wMtr.MeterTestRslts)
|
||||
// {
|
||||
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
// mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
// {
|
||||
// string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
// string[] texts = str.Split(new char[] { '|' });
|
||||
// if (texts.Length == 1)
|
||||
// {
|
||||
// lvi.SubItems.Add(str);
|
||||
// }
|
||||
// else if (texts.Length == 2)
|
||||
// {
|
||||
// Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
// lvi.UseItemStyleForSubItems = false;
|
||||
// lvi.SubItems.Add(texts[0]);
|
||||
// lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// lvi.SubItems.Add(string.Empty);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// oneWMResultsCtrl.Items.Add(lvi);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Display tracing results in the 3rd tab page
|
||||
/// </summary>
|
||||
/// <param name="wm">Water meter entity</param>
|
||||
/// <param name="refRecords">ReferenceRecord-s from tracing DB</param>
|
||||
void ShowTracingResults(Results.Entities.WaterMeter wm, IList<ReferenceRecord> refRecords)
|
||||
{
|
||||
tracingResultsListView.Columns.Add(Strings.Date_and_time, 110);
|
||||
tracingResultsListView.Columns.Add(Strings.Step, 100);
|
||||
tracingResultsListView.Columns.Add(Strings.Workplace, 100);
|
||||
tracingResultsListView.Columns.Add(Strings.Name, 100);
|
||||
tracingResultsListView.Columns.Add(Strings.Result, 70);
|
||||
tracingResultsListView.Columns.Add(Strings.Part, 90);
|
||||
tracingResultsListView.Columns.Add(Strings.Code, 150);
|
||||
tracingResultsListView.Columns.Add(Strings.Workflow, 450);
|
||||
|
||||
if (refRecords == null || refRecords.Count == 0)
|
||||
{
|
||||
messageLabel.Text = "V sledovaní výroby nie sú žiadne záznamy";
|
||||
}
|
||||
else
|
||||
{
|
||||
Process proc = refRecords[0].Process;
|
||||
bool[] isMissing = new bool[proc.Worksteps.Count];
|
||||
for (int i = 0; i < isMissing.Length; i++) isMissing[i] = true;
|
||||
|
||||
foreach (var rr in refRecords)
|
||||
{
|
||||
tracingResultsListView.Items.Add(new ListViewItem(new string[]
|
||||
{
|
||||
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
|
||||
rr.Workstep.Name,
|
||||
rr.Workplace,
|
||||
rr.UserName,
|
||||
rr.Result == 0 ? "OK" : "NOK",
|
||||
rr.Workstep.ReferencePart.Name,
|
||||
rr.Code,
|
||||
rr.Process.Name,
|
||||
}));
|
||||
|
||||
for (int i = 0; i < isMissing.Length; i++)
|
||||
{
|
||||
if (proc.Worksteps[i] == rr.Workstep) isMissing[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
string missingWorkplace = null;
|
||||
for (int i = 0; i < isMissing.Length; i++)
|
||||
{
|
||||
if (isMissing[i])
|
||||
{
|
||||
if (missingWorkplace == null)
|
||||
{
|
||||
missingWorkplace = proc.Worksteps[i].Name;
|
||||
messageLabel.Text = string.Format("Chýba záznam z pracoviska {0}", missingWorkplace);
|
||||
}
|
||||
else
|
||||
{
|
||||
messageLabel.Text = string.Format("Chýba záznam z pracoviska {0} aj z nasledujúcich pracovísk", missingWorkplace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (missingWorkplace == null)
|
||||
{
|
||||
messageLabel.Text = "Všetko je OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class OneWMResultsColumnsCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tBox = new System.Windows.Forms.TextBox();
|
||||
this.lView = new System.Windows.Forms.ListView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.tBox);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lView);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
|
||||
this.splitContainer1.SplitterDistance = 25;
|
||||
this.splitContainer1.SplitterWidth = 1;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// tBox
|
||||
//
|
||||
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.tBox.Name = "tBox";
|
||||
this.tBox.Size = new System.Drawing.Size(352, 20);
|
||||
this.tBox.TabIndex = 0;
|
||||
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
|
||||
//
|
||||
// lView
|
||||
//
|
||||
this.lView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lView.FullRowSelect = true;
|
||||
this.lView.GridLines = true;
|
||||
this.lView.Location = new System.Drawing.Point(0, 0);
|
||||
this.lView.Name = "lView";
|
||||
this.lView.Size = new System.Drawing.Size(352, 292);
|
||||
this.lView.TabIndex = 0;
|
||||
this.lView.UseCompatibleStateImageBehavior = false;
|
||||
this.lView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// OneWMResultsCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "OneWMResultsCtrl";
|
||||
this.Size = new System.Drawing.Size(352, 318);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.TextBox tBox;
|
||||
private System.Windows.Forms.ListView lView;
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class OneWMResultsColumnsCtrl : UserControl, IOneWMResultsCtrl
|
||||
{
|
||||
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
///
|
||||
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool disabled;
|
||||
int wmPosition; /// 1-based water meter position
|
||||
string caption;
|
||||
Color bkColor;
|
||||
int[] columnWidths;
|
||||
IList<Results.WMeterRsltItemSpec> items;
|
||||
|
||||
|
||||
public bool Disabled { get { return disabled; } } /// Read only
|
||||
public int WMPosition { get { return wmPosition; } } /// Read only
|
||||
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
|
||||
|
||||
|
||||
public OneWMResultsColumnsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
disabled = false;
|
||||
wmPosition = 0;
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
items = new List<Results.WMeterRsltItemSpec>();
|
||||
columnWidths = new int[0];
|
||||
}
|
||||
|
||||
public void Update(int[] columnWidths)
|
||||
{
|
||||
this.columnWidths = columnWidths;
|
||||
|
||||
/// Always update ListView column widths
|
||||
int col = 0;
|
||||
foreach (ColumnHeader column in lView.Columns)
|
||||
{
|
||||
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(IList<Results.WMeterRsltItemSpec> items)
|
||||
{
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public void Update(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
if (wMtr == null || wMtr.Disabled)
|
||||
{
|
||||
/// Water meter position is disabled
|
||||
this.disabled = true;
|
||||
lView.Items.Clear();
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
string message = string.Empty;
|
||||
Update(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
/// Header
|
||||
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
|
||||
int col = 1;
|
||||
foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
{
|
||||
lView.Columns.Add(str, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
|
||||
col++;
|
||||
}
|
||||
|
||||
lView.Items.Clear();
|
||||
if (items == null || items.Count == 0) return;
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Caption);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lView.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Private
|
||||
///
|
||||
|
||||
void Update(int wmPosition)
|
||||
{
|
||||
this.wmPosition = wmPosition;
|
||||
if (lView.Columns.Count > 0)
|
||||
{
|
||||
lView.Columns[0].Text = wmPosition.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void Update(Color backColor)
|
||||
{
|
||||
if (this.bkColor != backColor)
|
||||
{
|
||||
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class OneWMResultsRowsCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tBox = new System.Windows.Forms.TextBox();
|
||||
this.lView = new System.Windows.Forms.ListView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.tBox);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lView);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
|
||||
this.splitContainer1.SplitterDistance = 25;
|
||||
this.splitContainer1.SplitterWidth = 1;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// tBox
|
||||
//
|
||||
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.tBox.Name = "tBox";
|
||||
this.tBox.Size = new System.Drawing.Size(352, 20);
|
||||
this.tBox.TabIndex = 0;
|
||||
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
|
||||
//
|
||||
// lView
|
||||
//
|
||||
this.lView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lView.FullRowSelect = true;
|
||||
this.lView.GridLines = true;
|
||||
this.lView.Location = new System.Drawing.Point(0, 0);
|
||||
this.lView.Name = "lView";
|
||||
this.lView.Size = new System.Drawing.Size(352, 292);
|
||||
this.lView.TabIndex = 0;
|
||||
this.lView.UseCompatibleStateImageBehavior = false;
|
||||
this.lView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// OneWMResultsCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "OneWMResultsCtrl";
|
||||
this.Size = new System.Drawing.Size(352, 318);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.TextBox tBox;
|
||||
private System.Windows.Forms.ListView lView;
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class OneWMResultsRowsCtrl : UserControl, IOneWMResultsCtrl
|
||||
{
|
||||
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
///
|
||||
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool disabled;
|
||||
int wmPosition; /// 1-based water meter position
|
||||
string caption;
|
||||
Color bkColor;
|
||||
int[] columnWidths;
|
||||
IList<Results.WMeterRsltItemSpec> items;
|
||||
|
||||
|
||||
public bool Disabled { get { return disabled; } } /// Read only
|
||||
public int WMPosition { get { return wmPosition; } } /// Read only
|
||||
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
|
||||
|
||||
|
||||
public OneWMResultsRowsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
disabled = false;
|
||||
wmPosition = 0;
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
items = new List<Results.WMeterRsltItemSpec>();
|
||||
columnWidths = new int[0];
|
||||
}
|
||||
|
||||
public void Update(int[] columnWidths)
|
||||
{
|
||||
this.columnWidths = columnWidths;
|
||||
|
||||
/// Always update ListView column widths
|
||||
int col = 0;
|
||||
foreach (ColumnHeader column in lView.Columns)
|
||||
{
|
||||
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(IList<Results.WMeterRsltItemSpec> items)
|
||||
{
|
||||
this.items = items;
|
||||
|
||||
/// Always draw ListView header
|
||||
lView.Columns.Clear();
|
||||
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
|
||||
|
||||
if (items == null || items.Count == 0) return;
|
||||
int col = 1;
|
||||
foreach (var item in items)
|
||||
{
|
||||
lView.Columns.Add(item.Caption, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
if (wMtr == null || wMtr.Disabled)
|
||||
{
|
||||
/// Water meter position is disabled
|
||||
this.disabled = true;
|
||||
lView.Items.Clear();
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
string message = string.Empty;
|
||||
Update(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
Update(wMtr.WMPosition);
|
||||
|
||||
/// Update test results
|
||||
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
|
||||
int ix = 0;
|
||||
lView.Items.Clear();
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
|
||||
&& mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(testNames[ix++]);
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string str = items[i].Print(wMtr, mtr.Name());
|
||||
|
||||
/// Extract and use color information
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lView.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Private
|
||||
///
|
||||
|
||||
void Update(int wmPosition)
|
||||
{
|
||||
this.wmPosition = wmPosition;
|
||||
if (lView.Columns.Count > 0)
|
||||
{
|
||||
lView.Columns[0].Text = wmPosition.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void Update(Color backColor)
|
||||
{
|
||||
if (this.bkColor != backColor)
|
||||
{
|
||||
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class TracingResultsDlg
|
||||
{
|
||||
/// <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.tracingResultsListView = new System.Windows.Forms.ListView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tracingResultsListView
|
||||
//
|
||||
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tracingResultsListView.GridLines = true;
|
||||
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
|
||||
this.tracingResultsListView.Name = "tracingResultsListView";
|
||||
this.tracingResultsListView.Size = new System.Drawing.Size(1228, 178);
|
||||
this.tracingResultsListView.TabIndex = 0;
|
||||
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
|
||||
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// TracingResultsDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1228, 178);
|
||||
this.Controls.Add(this.tracingResultsListView);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "TracingResultsDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "TracingResultsDlg";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListView tracingResultsListView;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using TracingDB.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class TracingResultsDlg : Form
|
||||
{
|
||||
public TracingResultsDlg(IList<ReferenceRecord> rRecords)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Text = Strings.Production_tracing_results;
|
||||
|
||||
tracingResultsListView.Columns.Add(Strings.Date_and_time, 110);
|
||||
tracingResultsListView.Columns.Add(Strings.Step, 100);
|
||||
tracingResultsListView.Columns.Add(Strings.Workplace, 100);
|
||||
tracingResultsListView.Columns.Add(Strings.Name, 100);
|
||||
tracingResultsListView.Columns.Add(Strings.Result, 70);
|
||||
tracingResultsListView.Columns.Add(Strings.Part, 90);
|
||||
tracingResultsListView.Columns.Add(Strings.Code, 150);
|
||||
tracingResultsListView.Columns.Add(Strings.Workflow, 450);
|
||||
|
||||
foreach (var rr in rRecords)
|
||||
{
|
||||
tracingResultsListView.Items.Add(new ListViewItem(new string[] {
|
||||
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
|
||||
rr.Workstep.Name,
|
||||
rr.Workplace,
|
||||
rr.UserName,
|
||||
rr.Result == 0 ? "OK" : "NOK",
|
||||
rr.Workstep.ReferencePart.Name,
|
||||
rr.Code,
|
||||
rr.Process.Name,
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,14 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public class WaterMeterEventArgs : EventArgs
|
||||
{
|
||||
public int WMPosition;
|
||||
|
||||
public WaterMeterEventArgs(int wmPosition) { WMPosition = wmPosition; }
|
||||
}
|
||||
}
|
||||
+71
-118
@@ -91,85 +91,85 @@ namespace Results
|
||||
T_Lo_start, /// 81
|
||||
T_Lo_end, /// 82
|
||||
T_Lo_avg, /// 83
|
||||
P_delta_mean, /// 84
|
||||
P_delta_start, /// 85
|
||||
P_delta_end, /// 86
|
||||
Meter_type, /// 87 Single, Compound or HeatMeter
|
||||
Volume_main, /// 88
|
||||
Volume_aux, /// 89
|
||||
Start_volume, /// 90
|
||||
Start_volume_main, /// 91
|
||||
Start_volume_aux, /// 92
|
||||
End_volume, /// 93
|
||||
End_volume_main, /// 94
|
||||
End_volume_aux, /// 95
|
||||
Error_main, /// 96
|
||||
Error_aux, /// 97
|
||||
Serial_Nr_main, /// 98
|
||||
Serial_Nr_aux, /// 99
|
||||
End_state_main, /// 100
|
||||
End_state_aux, /// 101
|
||||
Q_rise, /// 102
|
||||
Q_fall, /// 103
|
||||
P_delta_mean, /// 84
|
||||
P_delta_start, /// 85
|
||||
P_delta_end, /// 86
|
||||
Meter_type, /// 87 Single, Compound or HeatMeter
|
||||
Volume_main, /// 88
|
||||
Volume_aux, /// 89
|
||||
Start_volume, /// 90
|
||||
Start_volume_main, /// 91
|
||||
Start_volume_aux, /// 92
|
||||
End_volume, /// 93
|
||||
End_volume_main, /// 94
|
||||
End_volume_aux, /// 95
|
||||
Error_main, /// 96
|
||||
Error_aux, /// 97
|
||||
Serial_Nr_main, /// 98
|
||||
Serial_Nr_aux, /// 99
|
||||
End_state_main, /// 100
|
||||
End_state_aux, /// 101
|
||||
Q_rise, /// 102
|
||||
Q_fall, /// 103
|
||||
|
||||
/// iPerl
|
||||
/// iPerl
|
||||
OrigCalibFactor, /// 104
|
||||
CalibFactor, /// 105
|
||||
Q2ErrWOCorrection, /// 106
|
||||
Q2CorrectionDone, /// 107
|
||||
CalibFactor, /// 105
|
||||
Q2ErrWOCorrection, /// 106
|
||||
Q2CorrectionDone, /// 107
|
||||
Q2CorrRFlow, /// 108
|
||||
Q2CorrLFlow, /// 109
|
||||
Q2CorrFlowRight, /// 110
|
||||
|
||||
Q_ref_mean, /// 111
|
||||
T_up_start, /// 112
|
||||
T_up_end, /// 113
|
||||
T_up_avg, /// 114
|
||||
T_down_start, /// 115
|
||||
T_down_end, /// 116
|
||||
T_down_avg, /// 117
|
||||
T_div_start, /// 118
|
||||
T_div_end, /// 119
|
||||
T_div_avg, /// 120
|
||||
P_up_avg, /// 121
|
||||
P_down_avg, /// 122
|
||||
P_delta_avg, /// 123
|
||||
|
||||
TestDone, /// 124
|
||||
TestPassed, /// 125
|
||||
Q_ref_mean, /// 111
|
||||
T_up_start, /// 112
|
||||
T_up_end, /// 113
|
||||
T_up_avg, /// 114
|
||||
T_down_start, /// 115
|
||||
T_down_end, /// 116
|
||||
T_down_avg, /// 117
|
||||
T_div_start, /// 118
|
||||
T_div_end, /// 119
|
||||
T_div_avg, /// 120
|
||||
P_up_avg, /// 121
|
||||
P_down_avg, /// 122
|
||||
P_delta_avg, /// 123
|
||||
|
||||
TestDone, /// 124
|
||||
TestPassed, /// 125
|
||||
|
||||
/// iPerl
|
||||
FW_Version, /// 126
|
||||
|
||||
Mass_start_raw, /// 127
|
||||
Mass_start, /// 128
|
||||
Mass_end_raw, /// 129
|
||||
Mass_end, /// 130
|
||||
Mass, /// 131
|
||||
Buoyancy, /// 132
|
||||
Density_correction, /// 133
|
||||
Mass_start_raw, /// 127
|
||||
Mass_start, /// 128
|
||||
Mass_end_raw, /// 129
|
||||
Mass_end, /// 130
|
||||
Mass, /// 131
|
||||
Buoyancy, /// 132
|
||||
Density_correction, /// 133
|
||||
|
||||
ErrorFlags, /// 134
|
||||
E1, /// 135
|
||||
E2, /// 136
|
||||
E3, /// 137
|
||||
E4, /// 138
|
||||
E5, /// 139
|
||||
E6, /// 140
|
||||
E7, /// 141
|
||||
E8, /// 142
|
||||
E9, /// 143
|
||||
E10, /// 144
|
||||
E11, /// 145
|
||||
E12, /// 146
|
||||
E13, /// 147
|
||||
E14, /// 148
|
||||
E15, /// 149
|
||||
E16, /// 150
|
||||
ErrorFlags, /// 134
|
||||
E1, /// 135
|
||||
E2, /// 136
|
||||
E3, /// 137
|
||||
E4, /// 138
|
||||
E5, /// 139
|
||||
E6, /// 140
|
||||
E7, /// 141
|
||||
E8, /// 142
|
||||
E9, /// 143
|
||||
E10, /// 144
|
||||
E11, /// 145
|
||||
E12, /// 146
|
||||
E13, /// 147
|
||||
E14, /// 148
|
||||
E15, /// 149
|
||||
E16, /// 150
|
||||
|
||||
Table_row_nr, /// 151
|
||||
Table_column_nr, /// 152
|
||||
WMRemark, /// 153
|
||||
Table_row_nr, /// 151
|
||||
Table_column_nr, /// 152
|
||||
WMRemark, /// 153
|
||||
|
||||
User_description, /// 154
|
||||
Legalizator, /// 155
|
||||
@@ -181,7 +181,7 @@ namespace Results
|
||||
Diverter_start_time, /// 159
|
||||
Diverter_end_time, /// 160
|
||||
Q_sensitivity, /// 161
|
||||
|
||||
|
||||
Q_ref_min, /// 162
|
||||
Q_ref_max, /// 163
|
||||
Q_ref_start, /// 164
|
||||
@@ -210,7 +210,7 @@ namespace Results
|
||||
Rho_Wa_calc, /// 183
|
||||
|
||||
Formatted_WM_ID, /// 184, Formated WM ID string:
|
||||
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
|
||||
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
|
||||
E21, /// 185
|
||||
|
||||
T_line_mean, /// 186
|
||||
@@ -262,7 +262,7 @@ namespace Results
|
||||
Bench_address5, /// 227 'Address 5' from IBenchInfo
|
||||
|
||||
Max_test_index, /// 228 MaxPruefindex % 100
|
||||
VolumeCTV, /// 229
|
||||
VolumeCTV, /// 229
|
||||
|
||||
/// iPerl
|
||||
LastError, /// 230 For iPerl previous test result (test with Proefindex-1)
|
||||
@@ -270,54 +270,7 @@ namespace Results
|
||||
CalibFactorLNA, /// 232
|
||||
|
||||
WM_remark, /// 233
|
||||
|
||||
/// iPerl special
|
||||
Prod_AssignedSerialNr, /// 234
|
||||
Prod_CompleteSerialNr, /// 235
|
||||
Prod_RadioAddress, /// 236
|
||||
Prod_PaletteNr, /// 237
|
||||
Prod_UmkartonNr, /// 238
|
||||
Prod_TestBench, /// 239
|
||||
Prod_WMPosition, /// 240
|
||||
Prod_UserName, /// 241
|
||||
Prod_PurchaseOrder, /// 242
|
||||
Prod_Passed, /// 243
|
||||
Prod_ResultCode, /// 244
|
||||
Prod_Q2CorrRL, /// 245
|
||||
Prod_Q2CorrLR, /// 246
|
||||
|
||||
TestPartStr, /// 247
|
||||
|
||||
Error_heat_mtr_vol, /// 248
|
||||
Energy_start, /// 249
|
||||
Energy_end, /// 250
|
||||
|
||||
OraWMTypeID, /// 251
|
||||
OraWMTypeRev, /// 252
|
||||
|
||||
E25, /// 253
|
||||
E26, /// 254
|
||||
E27, /// 255
|
||||
E28, /// 256
|
||||
|
||||
RefFlowmeter, /// 257
|
||||
Test_Method_Elde, /// 258
|
||||
|
||||
Counter1, /// 259 counterIdx0 = 0
|
||||
Counter2, /// 260 counterIdx0 = 1
|
||||
Counter3, /// 261 counterIdx0 = 2
|
||||
Counter4, /// 262 counterIdx0 = 3
|
||||
Counter5, /// 263 counterIdx0 = 4
|
||||
Counter6, /// 264 counterIdx0 = 5
|
||||
Counter7, /// 265 counterIdx0 = 6
|
||||
Counter8, /// 266 counterIdx0 = 7
|
||||
Counter9, /// 267 counterIdx0 = 8
|
||||
Counter10, /// 268 counterIdx0 = 9
|
||||
|
||||
ConstMasterCorr, /// 269
|
||||
TimeBtwnMassMsrmnts, /// 270
|
||||
TestTimeCorrection, /// 271
|
||||
|
||||
|
||||
Count,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,252 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using Results.Entities;
|
||||
using Results.Resources;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Results
|
||||
{
|
||||
public class ManualEntryItemSpec
|
||||
{
|
||||
///
|
||||
/// Public fields
|
||||
///
|
||||
public readonly int Uid;
|
||||
public readonly string Name; /// Name-s of all items must be unique
|
||||
public readonly string ToolTipText; /// Tool-Tip Text
|
||||
public readonly Quantity Quantity; /// Quantity
|
||||
public readonly ItemCategory Category; ///
|
||||
public string Caption; /// Specifies item description to be printed as a caption (in the header, etc.)
|
||||
public Config.Unit Units; /// Specifies units for the output
|
||||
|
||||
|
||||
public ManualEntryItemSpec Clone()
|
||||
{
|
||||
ManualEntryItemSpec item = new ManualEntryItemSpec((ItemID)Uid, Name, ToolTipText, Quantity, Category, updateDlgt);
|
||||
item.Caption = Caption;
|
||||
item.Units = Units;
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate bool UpdateDlgt(string str, MeterTestRslt meterTestRslt);
|
||||
|
||||
private readonly UpdateDlgt updateDlgt;
|
||||
|
||||
public bool Update(string str, MeterTestRslt meterTestRslt)
|
||||
{
|
||||
return (updateDlgt != null) ? updateDlgt(str, meterTestRslt) : true;
|
||||
}
|
||||
|
||||
public static bool ParseBool(string str, out bool success)
|
||||
{
|
||||
bool b;
|
||||
success = bool.TryParse(str, out b);
|
||||
return b;
|
||||
}
|
||||
|
||||
public static int ParseInt(string str, out bool success)
|
||||
{
|
||||
int i;
|
||||
success = int.TryParse(str, out i);
|
||||
return i;
|
||||
}
|
||||
|
||||
public static float ParseFloat(string str, out bool success)
|
||||
{
|
||||
float f;
|
||||
success = float.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out f) ||
|
||||
float.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out f);
|
||||
return f;
|
||||
}
|
||||
|
||||
public static double ParseDouble(string str, out bool success)
|
||||
{
|
||||
double d;
|
||||
success = double.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out d) ||
|
||||
double.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Public constructor
|
||||
///
|
||||
public ManualEntryItemSpec(ItemID itemId, string name, string toolTipText, Quantity quantity, ItemCategory category, UpdateDlgt updateDlgt)
|
||||
{
|
||||
Uid = (int)itemId;
|
||||
Name = name;
|
||||
ToolTipText = toolTipText;
|
||||
Quantity = quantity;
|
||||
Category = category;
|
||||
this.updateDlgt = updateDlgt;
|
||||
}
|
||||
|
||||
|
||||
/// Static list of all available items
|
||||
public static readonly IList<ManualEntryItemSpec> AllItems;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the <see cref="ManualEntryItemSpec"/> class.
|
||||
/// </summary>
|
||||
/// Static constructor that initializes the list of all items
|
||||
static ManualEntryItemSpec()
|
||||
{
|
||||
AllItems = new List<ManualEntryItemSpec>();
|
||||
|
||||
AllItems.Add(new ManualEntryItemSpec(ItemID.P_PMax_test_mean,
|
||||
string.Format("{0} PMax mean", Strings.VName_Press),
|
||||
"PMax test pressure",
|
||||
Quantity.Pressure,
|
||||
ItemCategory.TestResult,
|
||||
(str, mtr) => { bool r;
|
||||
mtr.TestRslt.PressUpMean = mtr.TestRslt.PressDownMean = ParseFloat(str, out r);
|
||||
return r; }));
|
||||
AllItems.Add(new ManualEntryItemSpec(ItemID.T_line_mean,
|
||||
string.Format("{0} LN ME", Strings.VName_Temp),
|
||||
Strings.Tooltip_T_ln_me,
|
||||
Quantity.Temperature,
|
||||
ItemCategory.TestResult,
|
||||
(str, mtr) => { bool r;
|
||||
mtr.TestRslt.TempUpMean = mtr.TestRslt.TempDownMean = ParseFloat(str, out r);
|
||||
return r; }));
|
||||
AllItems.Add(new ManualEntryItemSpec(ItemID.Test_time,
|
||||
Strings.T_s,
|
||||
"Test time",
|
||||
Quantity.Time,
|
||||
ItemCategory.MeterResult,
|
||||
(str, mtr) => { bool r;
|
||||
mtr.TestTime = ParseDouble(str, out r);
|
||||
return r; }));
|
||||
AllItems.Add(new ManualEntryItemSpec(ItemID.PMax_test_time,
|
||||
"Pressure test time",
|
||||
"Pressure test time",
|
||||
Quantity.Time,
|
||||
ItemCategory.MeterResult,
|
||||
(str, mtr) => { bool r;
|
||||
mtr.TestTime = ParseDouble(str, out r);
|
||||
return r; }));
|
||||
AllItems.Add(new ManualEntryItemSpec(ItemID.TestPassed,
|
||||
Strings.Test_passed,
|
||||
"Passed",
|
||||
Quantity.Boolean,
|
||||
ItemCategory.MeterResult,
|
||||
(str, mtr) => { bool r;
|
||||
mtr.Passed = ParseBool(str, out r);
|
||||
return r; }));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of 'Output item specifications' to a string array
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <returns></returns>
|
||||
public static string[] ToStrArray(IList<ManualEntryItemSpec> items)
|
||||
{
|
||||
int count = (items != null) ? items.Count : 0;
|
||||
string[] result = new string[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (items[i].Caption == null) items[i].Caption = string.Empty;
|
||||
|
||||
result[i] = string.Format("{0}~{1}~{2}",
|
||||
items[i].Uid,
|
||||
items[i].Caption.Replace("~", "\n"),
|
||||
items[i].Units);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a string array to a list of 'Output item specifications'
|
||||
/// </summary>
|
||||
/// <param name="strArray"></param>
|
||||
/// <returns></returns>
|
||||
public static IList<ManualEntryItemSpec> FromStrArray(string[] strArray)
|
||||
{
|
||||
IList<ManualEntryItemSpec> result = new List<ManualEntryItemSpec>();
|
||||
|
||||
if (strArray != null)
|
||||
{
|
||||
for (int i = 0; i < strArray.Length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
ManualEntryItemSpec item;
|
||||
string[] field = strArray[i].Split(new char[] { '~' });
|
||||
|
||||
if (!strArray[i].Contains("~"))
|
||||
{
|
||||
item = GetItem(0);
|
||||
item.Caption = "Prs.Err.";
|
||||
result.Add(item);
|
||||
}
|
||||
else if ((item = GetItem(int.Parse(field[0]))) != null)
|
||||
{
|
||||
///
|
||||
/// Load the new style results item specification
|
||||
///
|
||||
item.Caption = field[1].Replace("\n", "~");
|
||||
item.Units = 0;
|
||||
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
|
||||
{
|
||||
if (u.ToString().Equals(field[2])) { item.Units = u; break; }
|
||||
}
|
||||
result.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
/// Create an item with parse error information
|
||||
///
|
||||
ManualEntryItemSpec item2 = GetItem(0);
|
||||
item2.Caption = "Prs.Err.";
|
||||
result.Add(item2);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
ManualEntryItemSpec item = GetItem(0);
|
||||
item.Caption = "Prs.Err.";
|
||||
result.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static ManualEntryItemSpec GetItem(int uid)
|
||||
{
|
||||
foreach (var item in AllItems)
|
||||
{
|
||||
if (item.Uid == uid) return item.Clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static ManualEntryItemSpec GetItem(ItemID itemId)
|
||||
{
|
||||
return GetItem((int)itemId);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Caption))
|
||||
return Caption;
|
||||
else
|
||||
return ((ItemID)Uid).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -26,16 +26,6 @@ namespace Results.Mappings
|
||||
.Column("Custom1"); ;
|
||||
Map(x => x.Custom2);
|
||||
Map(x => x.Custom3);
|
||||
Map(x => x.Counter1);
|
||||
Map(x => x.Counter2);
|
||||
Map(x => x.Counter3);
|
||||
Map(x => x.Counter4);
|
||||
Map(x => x.Counter5);
|
||||
Map(x => x.Counter6);
|
||||
Map(x => x.Counter7);
|
||||
Map(x => x.Counter8);
|
||||
Map(x => x.Counter9);
|
||||
Map(x => x.Counter10);
|
||||
Map(x => x.StartTime);
|
||||
Map(x => x.EndTime);
|
||||
Map(x => x.Dirty);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -12,7 +12,6 @@ namespace Results.Mappings
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.CompoundMeterId);
|
||||
Map(x => x.RegReaderType);
|
||||
Map(x => x.PulsesMeter);
|
||||
Map(x => x.PulsesMaster);
|
||||
Map(x => x.PulsesPerLiter);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -12,10 +12,7 @@ namespace Results.Mappings
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.Name);
|
||||
#if TEST_PROFILES
|
||||
Map(x => x.Qtg);
|
||||
#endif
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qto);
|
||||
Map(x => x.TargetVolume);
|
||||
Map(x => x.TargetTime);
|
||||
@@ -23,7 +20,7 @@ namespace Results.Mappings
|
||||
Map(x => x.Method);
|
||||
Map(x => x.ErrLimLo);
|
||||
Map(x => x.ErrLimHi);
|
||||
Map(x => x.ErrLimMargin).Column("Uncertainty");
|
||||
Map(x => x.Uncertainty);
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.Evaluate);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -16,7 +16,6 @@ namespace Results.Mappings
|
||||
References<Components>(x => x.Components);
|
||||
Map(x => x.Part);
|
||||
Map(x => x.RepetitionNr);
|
||||
Map(x => x.MethodClass);
|
||||
|
||||
Map(x => x.TestDone);
|
||||
Map(x => x.Remark)
|
||||
@@ -25,13 +24,9 @@ namespace Results.Mappings
|
||||
Map(x => x.StartTime);
|
||||
Map(x => x.EndTime);
|
||||
Map(x => x.FlowSetTime);
|
||||
Map(x => x.TimeBtwnMassMsrmnts);
|
||||
Map(x => x.TestTime);
|
||||
Map(x => x.TestTimeCorrection);
|
||||
Map(x => x.PulsesMaster);
|
||||
Map(x => x.ConstMasterRaw);
|
||||
Map(x => x.ConstMasterCorr);
|
||||
Map(x => x.ConstMaster);
|
||||
Map(x => x.ConstMaster);
|
||||
Map(x => x.MassStartRaw);
|
||||
Map(x => x.MassStart);
|
||||
Map(x => x.MassEndRaw);
|
||||
@@ -48,7 +43,7 @@ namespace Results.Mappings
|
||||
Map(x => x.DiverterStart);
|
||||
Map(x => x.DiverterEnd);
|
||||
Map(x => x.ErrorFlags);
|
||||
Map(x => x.InfoFlags);
|
||||
Map(x => x.ErrorFlagsMd);
|
||||
#if HEAT_METERS
|
||||
Map(x => x.RefEnergy);
|
||||
#endif
|
||||
@@ -103,12 +98,6 @@ namespace Results.Mappings
|
||||
Map(x => x.FlowMin);
|
||||
Map(x => x.FlowMax);
|
||||
|
||||
Map(x => x.Uncertnt);
|
||||
Map(x => x.UncertntScale);
|
||||
Map(x => x.UncertntDensity);
|
||||
Map(x => x.UncertntTemp);
|
||||
Map(x => x.UncertntPressure);
|
||||
|
||||
Map(x => x.Custom1);
|
||||
Map(x => x.Custom2);
|
||||
Map(x => x.Custom3);
|
||||
|
||||
@@ -42,8 +42,6 @@ namespace Results.Mappings
|
||||
Map(x => x.MetrologicalClassAux);
|
||||
Map(x => x.ApprovalInfoAux);
|
||||
|
||||
Map(x => x.Medium);
|
||||
|
||||
Map(x => x.Text1);
|
||||
Map(x => x.Text2);
|
||||
Map(x => x.Text3);
|
||||
@@ -56,6 +54,7 @@ namespace Results.Mappings
|
||||
#endif
|
||||
#if ORACLE_DB
|
||||
Map(x => x.WMTypeId);
|
||||
Map(x => x.WMTypeRev);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,42 +21,29 @@ namespace Results.Mappings
|
||||
Map(x => x.QRise);
|
||||
Map(x => x.QFall);
|
||||
Map(x => x.ErrorFlags);
|
||||
Map(x => x.InfoFlags);
|
||||
Map(x => x.Passed);
|
||||
Map(x => x.Passed);
|
||||
Map(x => x.ResultCode);
|
||||
Map(x => x.ArchivePath);
|
||||
Map(x => x.Remark)
|
||||
.CustomType("StringClob")
|
||||
.CustomSqlType("varchar(2000)");
|
||||
#if IPERL
|
||||
Map(x => x.SerialNrEx);
|
||||
Map(x => x.OrigCalibFactor);
|
||||
Map(x => x.CalibFactor);
|
||||
Map(x => x.OrigCalibFactorLNA);
|
||||
Map(x => x.CalibFactorLNA);
|
||||
Map(x => x.Q2ErrWOCorrection);
|
||||
Map(x => x.Q2CorrRL);
|
||||
Map(x => x.Q2CorrLR);
|
||||
Map(x => x.Q2CorrectionDone);
|
||||
Map(x => x.Q2Correction);
|
||||
Map(x => x.Q2CorrRL).Column("Q2CorrRFlow");
|
||||
Map(x => x.Q2CorrLR).Column("Q2CorrLFlow");
|
||||
Map(x => x.Q2CorrFlowRight);
|
||||
Map(x => x.Diff2Hz8Hz);
|
||||
Map(x => x.Hz2CorrectionDone);
|
||||
Map(x => x.Hz2Correction);
|
||||
Map(x => x.FWVersion);
|
||||
#endif
|
||||
#if TURA_SPECIAL
|
||||
Map(x => x.AssignedSerialNr);
|
||||
Map(x => x.CompleteSerialNr);
|
||||
Map(x => x.RadioAddress);
|
||||
Map(x => x.PaletteNr);
|
||||
Map(x => x.UmkartonNr);
|
||||
Map(x => x.ProdTestBench);
|
||||
Map(x => x.ProdWMPosition);
|
||||
Map(x => x.ProdUserName);
|
||||
Map(x => x.ProdPurchaseOrder);
|
||||
Map(x => x.ProdPassed);
|
||||
Map(x => x.ProdResultCode);
|
||||
Map(x => x.ProdQ2CorrRL);
|
||||
Map(x => x.ProdQ2CorrLR);
|
||||
#endif
|
||||
#if ORACLE_DB
|
||||
Map(x => x.Pruefindex);
|
||||
Map(x => x.HydrPruefung);
|
||||
|
||||
@@ -152,12 +152,6 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
}
|
||||
}
|
||||
|
||||
if ((cfg.GraphHgh != 0) && (cfg.GraphWid != 0))
|
||||
{
|
||||
Rectangle pos = new Rectangle(cfg.GraphLeft, cfg.GraphTop, cfg.GraphWid, cfg.GraphHgh);
|
||||
WMChart.GetChart(wm, true).Printing.PrintPaint(e.Graphics, pos);
|
||||
}
|
||||
|
||||
float tableTop = cfg.TopMargin;
|
||||
|
||||
if (pageNr == 1)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
///
|
||||
|
||||
namespace Results.Output.Printers.OnePerMeter
|
||||
@@ -45,14 +45,10 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
public string[] BelowItems3;
|
||||
public string Footer;
|
||||
public bool TestsAreRows;
|
||||
public int GraphLeft;
|
||||
public int GraphTop;
|
||||
public int GraphWid;
|
||||
public int GraphHgh;
|
||||
public string ImgFullPathName;
|
||||
public int ImgLeft;
|
||||
public int ImgTop;
|
||||
public int ImgWid;
|
||||
public int ImgHgh;
|
||||
public string ImgFullPathName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Results.Output
|
||||
namespace Results.Output.Printers
|
||||
{
|
||||
public enum TableLines
|
||||
{
|
||||
@@ -94,7 +94,7 @@ namespace Results.Output
|
||||
else
|
||||
{
|
||||
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
|
||||
SizeF size = Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
|
||||
SizeF size = PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
|
||||
if (size.Width > columnWidth[colIx]) columnWidth[colIx] = size.Width;
|
||||
if (size.Height > rowHeight[rowIx]) rowHeight[rowIx] = size.Height;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ namespace Results.Output
|
||||
{
|
||||
/// In not a separator line
|
||||
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
|
||||
SizeF size = Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
|
||||
SizeF size = PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
|
||||
if ((Style.ColumnWidths != null) && (Style.ColumnWidths.Length > colIx))
|
||||
{
|
||||
size.Width = Style.ColumnWidths[colIx]; /// Override measurement if column width is defined
|
||||
@@ -244,14 +244,14 @@ namespace Results.Output
|
||||
for (int colIndex = 0; colIndex < tblColumnsCount; colIndex++)
|
||||
{
|
||||
bool isHeader = (colIndex < Style.LeftHeadersCount) || (rowIndex < Style.TopHeadersCount);
|
||||
Printers.PrintersCommon.PrintAt(e, oneTableRow[colIndex],
|
||||
isHeader ? Style.HeaderFont : Style.Font,
|
||||
columnPos[colIndex],
|
||||
rowPos[rowIndex],
|
||||
columnWidth[colIndex],
|
||||
rowHeight[rowIndex],
|
||||
horizAlignment[colIndex],
|
||||
vertAlignment[colIndex]);
|
||||
PrintersCommon.PrintAt(e, oneTableRow[colIndex],
|
||||
isHeader ? Style.HeaderFont : Style.Font,
|
||||
columnPos[colIndex],
|
||||
rowPos[rowIndex],
|
||||
columnWidth[colIndex],
|
||||
rowHeight[rowIndex],
|
||||
horizAlignment[colIndex],
|
||||
vertAlignment[colIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user