Compare commits
187
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdb1c1f233 | ||
|
|
5f0c56b19f | ||
|
|
714780d0b6 | ||
|
|
d852e390b3 | ||
|
|
bb2087c002 | ||
|
|
15ac3608c4 | ||
|
|
e4e8c97cfd | ||
|
|
3ef8674caf | ||
|
|
58a2be10aa | ||
|
|
bcae594b3f | ||
|
|
763acec379 | ||
|
|
12bd4e80dd | ||
|
|
4f456e0c40 | ||
|
|
c6ef378bc9 | ||
|
|
9689080387 | ||
|
|
6ecddf07f6 | ||
|
|
89ecf478ba | ||
|
|
d9e7efa15a | ||
|
|
6e6edde77f | ||
|
|
b2c944f9b1 | ||
|
|
852ffd0602 | ||
|
|
a06fe00440 | ||
|
|
8c1c5ed4f0 | ||
|
|
123187aa8a | ||
|
|
644c26355c | ||
|
|
432b288c34 | ||
|
|
f6cec9d769 | ||
|
|
29ece2f91c | ||
|
|
e3aa3f6721 | ||
|
|
b1ccdcb5c1 | ||
|
|
a541ac4945 | ||
|
|
38cbcb6430 | ||
|
|
c593ed903e | ||
|
|
d488f62648 | ||
|
|
aefbcdb2a0 | ||
|
|
c1bdb53a4d | ||
|
|
38dc09af7f | ||
|
|
d83b497fa0 | ||
|
|
5b31a94b74 | ||
|
|
ee1afaa78b | ||
|
|
910d5d58dc | ||
|
|
6dfba78dbf | ||
|
|
cd98f30ad2 | ||
|
|
893b7af55a | ||
|
|
3bb8cb2ab7 | ||
|
|
22b1fbca90 | ||
|
|
ddcfa71273 | ||
|
|
8d123d306f | ||
|
|
a380a68855 | ||
|
|
39d0a73e39 | ||
|
|
a01f99fa7e | ||
|
|
8a0411bd92 | ||
|
|
8cd4f12de3 | ||
|
|
4a528dafb8 | ||
|
|
b3a9302f53 | ||
|
|
575b17a919 | ||
|
|
41433329da | ||
|
|
e52f9ea9e7 | ||
|
|
1892f9de9f | ||
|
|
db0c850d70 | ||
|
|
060aba08a9 | ||
|
|
5ac7572a3d | ||
|
|
c9e2742745 | ||
|
|
5a77c5f660 | ||
|
|
1301db3af4 | ||
|
|
2cd877fb17 | ||
|
|
9dc3759f99 | ||
|
|
66f1bfa14b | ||
|
|
d7c262c87a | ||
|
|
02da6ae134 | ||
|
|
3336454719 | ||
|
|
5967db86a1 | ||
|
|
2acd67707e | ||
|
|
70f38e9352 | ||
|
|
687e843e5f | ||
|
|
43eaa61007 | ||
|
|
518d87afe1 | ||
|
|
f2676993b1 | ||
|
|
786485f566 | ||
|
|
e3df943946 | ||
|
|
bdd2f5f89d | ||
|
|
6318ce7700 | ||
|
|
5e9f9e7425 | ||
|
|
7ca07d78c6 | ||
|
|
69a51908c2 | ||
|
|
656ef27a3b | ||
|
|
72754ebe10 | ||
|
|
d7e6a69ca9 | ||
|
|
2985338d7e | ||
|
|
120c1cc39d | ||
|
|
f203c56e8b | ||
|
|
b3dc49e8b7 | ||
|
|
8c796eaeee | ||
|
|
c45f8298ac | ||
|
|
4a35215be9 | ||
|
|
62cd81b5f7 | ||
|
|
7afb780d5b | ||
|
|
cdb8304287 | ||
|
|
ebda3f5127 | ||
|
|
06c46785f6 | ||
|
|
e230ce02bf | ||
|
|
2a0fbca1e0 | ||
|
|
2845cf20f5 | ||
|
|
e9440411bc | ||
|
|
d041cd1d20 | ||
|
|
264830a36b | ||
|
|
558f000198 | ||
|
|
cb4833664c | ||
|
|
d5cb6ca71b | ||
|
|
7827fa4e5b | ||
|
|
d1944753b3 | ||
|
|
c6007d3b6a | ||
|
|
91a4ca3760 | ||
|
|
36e0c177c7 | ||
|
|
e13b553ab5 | ||
|
|
2799522a22 | ||
|
|
3e86aa99cb | ||
|
|
ebbc0528c6 | ||
|
|
1d8156e4d7 | ||
|
|
fcf4f6bdcf | ||
|
|
08aed03cef | ||
|
|
da01b1fe61 | ||
|
|
d4399c23ca | ||
|
|
31fc49485a | ||
|
|
217ceffa67 | ||
|
|
6b10e67c17 | ||
|
|
76b9f64029 | ||
|
|
cabee1f06e | ||
|
|
421474b990 | ||
|
|
6a7e1e5052 | ||
|
|
f24cd89928 | ||
|
|
2b8f5ebec3 | ||
|
|
f3dabcbcc1 | ||
|
|
d390705df8 | ||
|
|
f75138eced | ||
|
|
46b17fddc8 | ||
|
|
5d00bcf456 | ||
|
|
db8598579d | ||
|
|
be1344034e | ||
|
|
a0c3ffd01a | ||
|
|
4faf6b5d69 | ||
|
|
2e04076b30 | ||
|
|
20762b7fde | ||
|
|
440199b3bc | ||
|
|
3647740d4a | ||
|
|
b8d9e1aa12 | ||
|
|
3ebeb4a0dc | ||
|
|
33963ec8cf | ||
|
|
fa6b99b980 | ||
|
|
22c652ad24 | ||
|
|
c376e67eab | ||
|
|
e349d6811d | ||
|
|
7b134f7ba5 | ||
|
|
7f46e64a0d | ||
|
|
ed4afff0b2 | ||
|
|
713fd9d0ae | ||
|
|
5db53ca6e3 | ||
|
|
752bfd98b1 | ||
|
|
e302cb9335 | ||
|
|
a6aa6739ad | ||
|
|
ee044e3dd7 | ||
|
|
68a038d321 | ||
|
|
a0cf76112d | ||
|
|
5f5ac87f42 | ||
|
|
f85fbd0b55 | ||
|
|
90cfda893c | ||
|
|
1bf987a6cd | ||
|
|
4166bf8d87 | ||
|
|
bf376b4ff0 | ||
|
|
7e28381df5 | ||
|
|
289e06ce65 | ||
|
|
faeb940134 | ||
|
|
343c04061e | ||
|
|
6440a8950c | ||
|
|
e569a80ec2 | ||
|
|
40a43e46b4 | ||
|
|
7c1b713780 | ||
|
|
52c5679c00 | ||
|
|
5997a494bd | ||
|
|
3665f4d5d0 | ||
|
|
f2da177517 | ||
|
|
6ecae88518 | ||
|
|
769bb5a9bc | ||
|
|
083cfd0efd | ||
|
|
064de08d4b | ||
|
|
f924e72088 | ||
|
|
81e6feded3 |
+10
-4
@@ -1,7 +1,13 @@
|
||||
TestBenchFramework/bin/
|
||||
TestBenchFramework/obj/
|
||||
Config/bin/
|
||||
Config/obj/
|
||||
Results/bin/
|
||||
Results/obj/
|
||||
ResultsBrowser/bin/
|
||||
ResultsBrowser/obj/
|
||||
TBFSetup/
|
||||
TestBenchFramework/bin/
|
||||
TestBenchFramework/obj/
|
||||
TBFSetup/Debug/
|
||||
TBFSetup/Release/
|
||||
Doc/
|
||||
*.suo
|
||||
*.suo
|
||||
*.bak
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
<?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)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Config</RootNamespace>
|
||||
<AssemblyName>Config</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</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>TRACE;DEBUG;IPERLST</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;IPERLST</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
<HintPath>..\packages\FluentNHibernate.1.3.0.733\lib\FluentNHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Iesi.Collections">
|
||||
<HintPath>..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.6.6.5\lib\net20\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.3.3.3.4001\lib\Net35\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SQLite">
|
||||
<HintPath>..\packages\System.Data.SQLite.1.0.90.0\lib\net40\System.Data.SQLite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.SQLite.Linq">
|
||||
<HintPath>..\packages\System.Data.SQLite.1.0.90.0\lib\net40\System.Data.SQLite.Linq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<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="Data.cs" />
|
||||
<Compile Include="DatabaseSettings.cs" />
|
||||
<Compile Include="DatabaseSettingsDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DatabaseSettingsDlg.designer.cs">
|
||||
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DBSettings.cs" />
|
||||
<Compile Include="Entities\BenchPath.cs" />
|
||||
<Compile Include="Entities\Component.cs" />
|
||||
<Compile Include="Entities\ComponentProcedure.cs" />
|
||||
<Compile Include="Entities\ComponentTest.cs" />
|
||||
<Compile Include="Entities\Enums.cs" />
|
||||
<Compile Include="Entities\FeedingPath.cs" />
|
||||
<Compile Include="Entities\Group.cs" />
|
||||
<Compile Include="Entities\IHasItemNr.cs" />
|
||||
<Compile Include="Entities\IHasValves.cs" />
|
||||
<Compile Include="Entities\MeasurementCorrection.cs" />
|
||||
<Compile Include="Entities\MetersPath.cs" />
|
||||
<Compile Include="Entities\MeterTestResult.cs" />
|
||||
<Compile Include="Entities\OutputPath.cs" />
|
||||
<Compile Include="Entities\Procedure.cs" />
|
||||
<Compile Include="Entities\ProcedureHistory.cs" />
|
||||
<Compile Include="Entities\Test.cs" />
|
||||
<Compile Include="Entities\TestResult.cs" />
|
||||
<Compile Include="Entities\TransitionSequence.cs" />
|
||||
<Compile Include="Entities\TransitionStep.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="Grp.cs" />
|
||||
<Compile Include="Mappings\BenchPathMap.cs" />
|
||||
<Compile Include="Mappings\ComponentMap.cs" />
|
||||
<Compile Include="Mappings\ComponentProcedureMap.cs" />
|
||||
<Compile Include="Mappings\ComponentTestMap.cs" />
|
||||
<Compile Include="Mappings\FeedingPathMap.cs" />
|
||||
<Compile Include="Mappings\GroupMap.cs" />
|
||||
<Compile Include="Mappings\MeasurementCorrectionMap.cs" />
|
||||
<Compile Include="Mappings\MetersPathMap.cs" />
|
||||
<Compile Include="Mappings\MeterTestResultMap.cs" />
|
||||
<Compile Include="Mappings\OutputPathMap.cs" />
|
||||
<Compile Include="Mappings\ProcedureMap.cs" />
|
||||
<Compile Include="Mappings\TestMap.cs" />
|
||||
<Compile Include="Mappings\TestResultMap.cs" />
|
||||
<Compile Include="Mappings\TransitionSequenceMap.cs" />
|
||||
<Compile Include="Mappings\TransitionStepMap.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" />
|
||||
<Compile Include="ResultItemSpec.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="DatabaseSettingsDlg.resx">
|
||||
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Strings.resx">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</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>
|
||||
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF
|
||||
namespace Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Database settings required to make a connection
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
public const string AdminUsername = "admin";
|
||||
public const string AdminPassword = "staratura";
|
||||
public const string SQLiteDbFName = "SQLite.db";
|
||||
|
||||
#if MUNICH
|
||||
public const int WMsCount = 3;
|
||||
public const int LineSize = 1;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#elif DN100 || BADGER_VELKA_TRAT
|
||||
public const int WMsCount = 3;
|
||||
public const int LineSize = 3;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#elif FUZHOU300 || FUZHOU150 || PT200IL
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 3;
|
||||
#elif TORINO50 || BADGER_MALA_TRAT
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#elif TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40
|
||||
public const int WMsCount = 20;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#elif IPERLST
|
||||
public const int WMsCount = 40;
|
||||
public const int LineSize = 20;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Database related: This object reference is set after a successful user login
|
||||
///
|
||||
public static DatabaseSettings CurrentBench;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace TBF
|
||||
namespace Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Test bench database settings, contains bench name and settings od several databases
|
||||
Generated
+1
-22
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF
|
||||
namespace Config
|
||||
{
|
||||
partial class DatabaseSettingsDlg
|
||||
{
|
||||
@@ -69,7 +69,6 @@ namespace TBF
|
||||
// okButton
|
||||
//
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
@@ -78,7 +77,6 @@ namespace TBF
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.cancelButton, "cancelButton");
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
@@ -87,7 +85,6 @@ namespace TBF
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// benchNameTextBox
|
||||
@@ -103,7 +100,6 @@ namespace TBF
|
||||
// connectionStringLabel
|
||||
//
|
||||
resources.ApplyResources(this.connectionStringLabel, "connectionStringLabel");
|
||||
this.connectionStringLabel.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.connectionStringLabel.Name = "connectionStringLabel";
|
||||
//
|
||||
// benchConnectionStringTextBox
|
||||
@@ -129,37 +125,31 @@ namespace TBF
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
resources.ApplyResources(this.label5, "label5");
|
||||
this.label5.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label5.Name = "label5";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
resources.ApplyResources(this.label6, "label6");
|
||||
this.label6.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label6.Name = "label6";
|
||||
//
|
||||
// testConnUsersBtn
|
||||
//
|
||||
this.testConnUsersBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnUsersBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnUsersBtn, "testConnUsersBtn");
|
||||
this.testConnUsersBtn.Name = "testConnUsersBtn";
|
||||
this.testConnUsersBtn.UseVisualStyleBackColor = true;
|
||||
@@ -168,7 +158,6 @@ namespace TBF
|
||||
// createUsersDbBtn
|
||||
//
|
||||
this.createUsersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createUsersDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createUsersDbBtn, "createUsersDbBtn");
|
||||
this.createUsersDbBtn.Name = "createUsersDbBtn";
|
||||
this.createUsersDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -177,14 +166,12 @@ namespace TBF
|
||||
// realBenchCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.realBenchCheckBox, "realBenchCheckBox");
|
||||
this.realBenchCheckBox.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.realBenchCheckBox.Name = "realBenchCheckBox";
|
||||
this.realBenchCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dbTypeLabel
|
||||
//
|
||||
resources.ApplyResources(this.dbTypeLabel, "dbTypeLabel");
|
||||
this.dbTypeLabel.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.dbTypeLabel.Name = "dbTypeLabel";
|
||||
//
|
||||
// usersDbTypeComboBox
|
||||
@@ -220,7 +207,6 @@ namespace TBF
|
||||
// testConnBenchBtn
|
||||
//
|
||||
this.testConnBenchBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnBenchBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnBenchBtn, "testConnBenchBtn");
|
||||
this.testConnBenchBtn.Name = "testConnBenchBtn";
|
||||
this.testConnBenchBtn.UseVisualStyleBackColor = true;
|
||||
@@ -229,7 +215,6 @@ namespace TBF
|
||||
// testConnProceduresBtn
|
||||
//
|
||||
this.testConnProceduresBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnProceduresBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnProceduresBtn, "testConnProceduresBtn");
|
||||
this.testConnProceduresBtn.Name = "testConnProceduresBtn";
|
||||
this.testConnProceduresBtn.UseVisualStyleBackColor = true;
|
||||
@@ -238,7 +223,6 @@ namespace TBF
|
||||
// testConnWMTypesBtn
|
||||
//
|
||||
this.testConnWMTypesBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnWMTypesBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnWMTypesBtn, "testConnWMTypesBtn");
|
||||
this.testConnWMTypesBtn.Name = "testConnWMTypesBtn";
|
||||
this.testConnWMTypesBtn.UseVisualStyleBackColor = true;
|
||||
@@ -247,7 +231,6 @@ namespace TBF
|
||||
// testConnWaterMetersBtn
|
||||
//
|
||||
this.testConnWaterMetersBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnWaterMetersBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnWaterMetersBtn, "testConnWaterMetersBtn");
|
||||
this.testConnWaterMetersBtn.Name = "testConnWaterMetersBtn";
|
||||
this.testConnWaterMetersBtn.UseVisualStyleBackColor = true;
|
||||
@@ -256,7 +239,6 @@ namespace TBF
|
||||
// createBenchDbBtn
|
||||
//
|
||||
this.createBenchDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createBenchDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createBenchDbBtn, "createBenchDbBtn");
|
||||
this.createBenchDbBtn.Name = "createBenchDbBtn";
|
||||
this.createBenchDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -265,7 +247,6 @@ namespace TBF
|
||||
// createProceduresDbBtn
|
||||
//
|
||||
this.createProceduresDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createProceduresDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createProceduresDbBtn, "createProceduresDbBtn");
|
||||
this.createProceduresDbBtn.Name = "createProceduresDbBtn";
|
||||
this.createProceduresDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -274,7 +255,6 @@ namespace TBF
|
||||
// createWMTypesDbBtn
|
||||
//
|
||||
this.createWMTypesDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createWMTypesDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createWMTypesDbBtn, "createWMTypesDbBtn");
|
||||
this.createWMTypesDbBtn.Name = "createWMTypesDbBtn";
|
||||
this.createWMTypesDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -283,7 +263,6 @@ namespace TBF
|
||||
// createWaterMetersDbBtn
|
||||
//
|
||||
this.createWaterMetersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createWaterMetersDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createWaterMetersDbBtn, "createWaterMetersDbBtn");
|
||||
this.createWaterMetersDbBtn.Name = "createWaterMetersDbBtn";
|
||||
this.createWaterMetersDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -2,15 +2,10 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using TBF.Resources;
|
||||
using Config.Resources;
|
||||
|
||||
namespace TBF
|
||||
namespace Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Dialog to process test bench name and database settings (BenchSettings)
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class BenchPath : IHasItemNr, IHasValves
|
||||
{
|
||||
@@ -26,7 +26,9 @@ namespace TBF.Entities
|
||||
|
||||
public BenchPath()
|
||||
{
|
||||
}
|
||||
ValvesOpen = string.Empty;
|
||||
ValvesClose = string.Empty;
|
||||
}
|
||||
|
||||
public BenchPath(string name, int itemNr)
|
||||
: this()
|
||||
@@ -35,33 +37,6 @@ namespace TBF.Entities
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public BenchPath(BenchControl.BenchPath path)
|
||||
: this(path.Name, path.ItemNr)
|
||||
{
|
||||
Qfrom = path.Qfrom;
|
||||
Qto = path.Qto;
|
||||
TempIn = (path.TempIn != null) ? path.TempIn.Cfg.Name : null;
|
||||
TempOut = (path.TempOut != null) ? path.TempOut.Cfg.Name : null;
|
||||
PressIn = (path.PressIn != null) ? path.PressIn.Cfg.Name : null;
|
||||
PressOut = (path.PressOut != null) ? path.PressOut.Cfg.Name : null;
|
||||
|
||||
string vOpen = string.Empty;
|
||||
foreach (var valve in path.ValvesOpen)
|
||||
{
|
||||
if (vOpen != string.Empty) vOpen += ";";
|
||||
vOpen += valve.Cfg.Name;
|
||||
}
|
||||
ValvesOpen = vOpen;
|
||||
|
||||
string vClose = string.Empty;
|
||||
foreach (var valve in path.ValvesClose)
|
||||
{
|
||||
if (vClose != string.Empty) vClose += ";";
|
||||
vClose += valve.Cfg.Name;
|
||||
}
|
||||
ValvesClose = vClose;
|
||||
}
|
||||
|
||||
public virtual BenchPath Clone(string name, int itemNr)
|
||||
{
|
||||
BenchPath result = new BenchPath(name, itemNr);
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class Component : IHasItemNr
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ComponentProcedure
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ComponentTest
|
||||
{
|
||||
@@ -4,8 +4,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public enum ProcedureState
|
||||
{
|
||||
Active,
|
||||
History,
|
||||
Template,
|
||||
Count,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Kind of meters for the procedure / test
|
||||
/// </summary>
|
||||
@@ -15,6 +23,12 @@ namespace TBF.Entities
|
||||
Combined,
|
||||
}
|
||||
|
||||
public enum Medium
|
||||
{
|
||||
ColdWater,
|
||||
HotWater,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transition step is finished when this condition is fulfilled
|
||||
/// </summary>
|
||||
@@ -49,6 +63,13 @@ namespace TBF.Entities
|
||||
Disk,
|
||||
}
|
||||
|
||||
public enum PageOrientation
|
||||
{
|
||||
Portrait,
|
||||
Landscape,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum UnitsVolume
|
||||
{
|
||||
Liter,
|
||||
@@ -62,12 +83,13 @@ namespace TBF.Entities
|
||||
{
|
||||
DetectedOff = -2,
|
||||
DetectedOn = -1,
|
||||
Normal = 0, /// Normal operation
|
||||
AutoDetect, /// The component (device) will be auto-detected
|
||||
Off, /// The component is off
|
||||
Normal = 0, /// Normal operation
|
||||
AutoDetect, /// The component (device) will be auto-detected
|
||||
FailureDuringOperation, /// Failure during operation -> disabled
|
||||
Off, /// The component is off
|
||||
Record,
|
||||
Reply,
|
||||
Simulate, /// Test bench simulation, this mode does not require any hardware
|
||||
Simulate, /// Test bench simulation, this mode does not require any hardware
|
||||
Inherit,
|
||||
Count,
|
||||
}
|
||||
@@ -83,5 +105,20 @@ namespace TBF.Entities
|
||||
All,
|
||||
Count,
|
||||
}
|
||||
|
||||
|
||||
/// Arrangement of tests
|
||||
public enum TestsArrangement
|
||||
{
|
||||
Rows,
|
||||
Columns,
|
||||
}
|
||||
|
||||
/// Arrangement of meters
|
||||
public enum MetersArrangement
|
||||
{
|
||||
Vertically,
|
||||
Horizontally,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class FeedingPath : IHasItemNr, IHasValves
|
||||
{
|
||||
@@ -23,7 +23,9 @@ namespace TBF.Entities
|
||||
|
||||
public FeedingPath()
|
||||
{
|
||||
}
|
||||
ValvesOpen = string.Empty;
|
||||
ValvesClose = string.Empty;
|
||||
}
|
||||
|
||||
public FeedingPath(string name, int itemNr)
|
||||
: this()
|
||||
@@ -32,30 +34,6 @@ namespace TBF.Entities
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public FeedingPath(BenchControl.FeedingPath path)
|
||||
: this(path.Name, path.ItemNr)
|
||||
{
|
||||
Qfrom = path.Qfrom;
|
||||
Qto = path.Qto;
|
||||
Pump = (path.Pump != null) ? path.Pump.Cfg.Name : null;
|
||||
|
||||
string vOpen = string.Empty;
|
||||
foreach (var valve in path.ValvesOpen)
|
||||
{
|
||||
if (vOpen != string.Empty) vOpen += ";";
|
||||
vOpen += valve.Cfg.Name;
|
||||
}
|
||||
ValvesOpen = vOpen;
|
||||
|
||||
string vClose = string.Empty;
|
||||
foreach (var valve in path.ValvesClose)
|
||||
{
|
||||
if (vClose != string.Empty) vClose += ";";
|
||||
vClose += valve.Cfg.Name;
|
||||
}
|
||||
ValvesClose = vClose;
|
||||
}
|
||||
|
||||
public virtual FeedingPath Clone(string name, int itemNr)
|
||||
{
|
||||
FeedingPath result = new FeedingPath(name, itemNr);
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class Group
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
interface IHasItemNr
|
||||
public interface IHasItemNr
|
||||
{
|
||||
int Id { get; }
|
||||
int ItemNr { get; set; }
|
||||
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public interface IHasValves
|
||||
{
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class MeasurementCorrection
|
||||
{
|
||||
+10
-2
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class MeterTestResult
|
||||
{
|
||||
@@ -22,7 +22,11 @@ namespace TBF.Entities
|
||||
public virtual float PulsesPerLiter { get; set; } /// Pulses per liter
|
||||
public virtual float PulsesMaster { get; set; }
|
||||
public virtual float Time { get; set; } /// sec.
|
||||
public virtual bool Passed { get; set; } /// true = test passed
|
||||
public virtual float TimeStart { get; set; } /// sec. - Not mapped to DB !!!
|
||||
public virtual float TimeEnd { get; set; } /// sec. - Not mapped to DB !!!
|
||||
public virtual int CalibFactor { get; set; } /// iPerl calibration factor used during the test - Not mapped to DB !!!
|
||||
public virtual double Q2Correction { get; set; } /// iPerl Q2 correction used during the test - Not mapped to DB !!!
|
||||
public virtual bool Passed { get; set; } /// true=test passed - Not mapped to DB !!!
|
||||
|
||||
public MeterTestResult()
|
||||
{
|
||||
@@ -51,6 +55,10 @@ namespace TBF.Entities
|
||||
result.PulsesPerLiter = PulsesPerLiter;
|
||||
result.PulsesMaster = PulsesMaster;
|
||||
result.Time = Time;
|
||||
result.TimeStart = TimeStart;
|
||||
result.TimeEnd = TimeEnd;
|
||||
result.CalibFactor = CalibFactor;
|
||||
result.Q2Correction = Q2Correction;
|
||||
result.Passed = Passed;
|
||||
|
||||
return result;
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class MetersPath : IHasItemNr
|
||||
{
|
||||
@@ -35,6 +35,28 @@ namespace TBF.Entities
|
||||
public virtual string Sensor18 { get; set; }
|
||||
public virtual string Sensor19 { get; set; }
|
||||
public virtual string Sensor20 { get; set; }
|
||||
#if IPERLST
|
||||
public virtual string Sensor21 { get; set; }
|
||||
public virtual string Sensor22 { get; set; }
|
||||
public virtual string Sensor23 { get; set; }
|
||||
public virtual string Sensor24 { get; set; }
|
||||
public virtual string Sensor25 { get; set; }
|
||||
public virtual string Sensor26 { get; set; }
|
||||
public virtual string Sensor27 { get; set; }
|
||||
public virtual string Sensor28 { get; set; }
|
||||
public virtual string Sensor29 { get; set; }
|
||||
public virtual string Sensor30 { get; set; }
|
||||
public virtual string Sensor31 { get; set; }
|
||||
public virtual string Sensor32 { get; set; }
|
||||
public virtual string Sensor33 { get; set; }
|
||||
public virtual string Sensor34 { get; set; }
|
||||
public virtual string Sensor35 { get; set; }
|
||||
public virtual string Sensor36 { get; set; }
|
||||
public virtual string Sensor37 { get; set; }
|
||||
public virtual string Sensor38 { get; set; }
|
||||
public virtual string Sensor39 { get; set; }
|
||||
public virtual string Sensor40 { get; set; }
|
||||
#endif
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
@@ -49,35 +71,6 @@ namespace TBF.Entities
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public MetersPath(BenchControl.MetersPath path)
|
||||
: this(path.Name, path.ItemNr)
|
||||
{
|
||||
Qfrom = path.Qfrom;
|
||||
Qto = path.Qto;
|
||||
Sensor1 = (path.RegisterReaders[0] != null) ? path.RegisterReaders[0].Cfg.Name : null;
|
||||
#pragma warning disable
|
||||
if (Program.WMsCount >= 2) Sensor2 = (path.RegisterReaders[1] != null) ? path.RegisterReaders[1].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 3) Sensor3 = (path.RegisterReaders[2] != null) ? path.RegisterReaders[2].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 4) Sensor4 = (path.RegisterReaders[3] != null) ? path.RegisterReaders[3].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 5) Sensor5 = (path.RegisterReaders[4] != null) ? path.RegisterReaders[4].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 6) Sensor6 = (path.RegisterReaders[5] != null) ? path.RegisterReaders[5].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 7) Sensor7 = (path.RegisterReaders[6] != null) ? path.RegisterReaders[6].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 8) Sensor8 = (path.RegisterReaders[7] != null) ? path.RegisterReaders[7].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 9) Sensor9 = (path.RegisterReaders[8] != null) ? path.RegisterReaders[8].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 10) Sensor10 = (path.RegisterReaders[9] != null) ? path.RegisterReaders[9].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 11) Sensor11 = (path.RegisterReaders[10] != null) ? path.RegisterReaders[10].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 12) Sensor12 = (path.RegisterReaders[11] != null) ? path.RegisterReaders[11].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 13) Sensor13 = (path.RegisterReaders[12] != null) ? path.RegisterReaders[12].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 14) Sensor14 = (path.RegisterReaders[13] != null) ? path.RegisterReaders[13].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 15) Sensor15 = (path.RegisterReaders[14] != null) ? path.RegisterReaders[14].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 16) Sensor16 = (path.RegisterReaders[15] != null) ? path.RegisterReaders[15].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 17) Sensor17 = (path.RegisterReaders[16] != null) ? path.RegisterReaders[16].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 18) Sensor18 = (path.RegisterReaders[17] != null) ? path.RegisterReaders[17].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 19) Sensor19 = (path.RegisterReaders[18] != null) ? path.RegisterReaders[18].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 20) Sensor20 = (path.RegisterReaders[19] != null) ? path.RegisterReaders[19].Cfg.Name : null;
|
||||
#pragma warning restore
|
||||
}
|
||||
|
||||
public virtual MetersPath Clone(string name, int itemNr)
|
||||
{
|
||||
MetersPath result = new MetersPath(name, itemNr);
|
||||
@@ -103,6 +96,28 @@ namespace TBF.Entities
|
||||
result.Sensor18 = Sensor18;
|
||||
result.Sensor19 = Sensor19;
|
||||
result.Sensor20 = Sensor20;
|
||||
#if IPERLST
|
||||
result.Sensor21 = Sensor21;
|
||||
result.Sensor22 = Sensor22;
|
||||
result.Sensor23 = Sensor23;
|
||||
result.Sensor24 = Sensor24;
|
||||
result.Sensor25 = Sensor25;
|
||||
result.Sensor26 = Sensor26;
|
||||
result.Sensor27 = Sensor27;
|
||||
result.Sensor28 = Sensor28;
|
||||
result.Sensor29 = Sensor29;
|
||||
result.Sensor30 = Sensor30;
|
||||
result.Sensor31 = Sensor31;
|
||||
result.Sensor32 = Sensor32;
|
||||
result.Sensor33 = Sensor33;
|
||||
result.Sensor34 = Sensor34;
|
||||
result.Sensor35 = Sensor35;
|
||||
result.Sensor36 = Sensor36;
|
||||
result.Sensor37 = Sensor37;
|
||||
result.Sensor38 = Sensor38;
|
||||
result.Sensor39 = Sensor39;
|
||||
result.Sensor40 = Sensor40;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -129,6 +144,28 @@ namespace TBF.Entities
|
||||
else if (i == 17) return Sensor18;
|
||||
else if (i == 18) return Sensor19;
|
||||
else if (i == 19) return Sensor20;
|
||||
#if IPERLST
|
||||
else if (i == 20) return Sensor21;
|
||||
else if (i == 21) return Sensor22;
|
||||
else if (i == 22) return Sensor23;
|
||||
else if (i == 23) return Sensor24;
|
||||
else if (i == 24) return Sensor25;
|
||||
else if (i == 25) return Sensor26;
|
||||
else if (i == 26) return Sensor27;
|
||||
else if (i == 27) return Sensor28;
|
||||
else if (i == 28) return Sensor29;
|
||||
else if (i == 29) return Sensor30;
|
||||
else if (i == 30) return Sensor31;
|
||||
else if (i == 31) return Sensor32;
|
||||
else if (i == 32) return Sensor33;
|
||||
else if (i == 33) return Sensor34;
|
||||
else if (i == 34) return Sensor35;
|
||||
else if (i == 35) return Sensor36;
|
||||
else if (i == 36) return Sensor37;
|
||||
else if (i == 37) return Sensor38;
|
||||
else if (i == 38) return Sensor39;
|
||||
else if (i == 39) return Sensor40;
|
||||
#endif
|
||||
else return null;
|
||||
}
|
||||
|
||||
@@ -155,6 +192,28 @@ namespace TBF.Entities
|
||||
else if (i == 17) Sensor18 = cmpntName;
|
||||
else if (i == 18) Sensor19 = cmpntName;
|
||||
else if (i == 19) Sensor20 = cmpntName;
|
||||
#if IPERLST
|
||||
else if (i == 20) Sensor21 = cmpntName;
|
||||
else if (i == 21) Sensor22 = cmpntName;
|
||||
else if (i == 22) Sensor23 = cmpntName;
|
||||
else if (i == 23) Sensor24 = cmpntName;
|
||||
else if (i == 24) Sensor25 = cmpntName;
|
||||
else if (i == 25) Sensor26 = cmpntName;
|
||||
else if (i == 26) Sensor27 = cmpntName;
|
||||
else if (i == 27) Sensor28 = cmpntName;
|
||||
else if (i == 28) Sensor29 = cmpntName;
|
||||
else if (i == 29) Sensor30 = cmpntName;
|
||||
else if (i == 30) Sensor31 = cmpntName;
|
||||
else if (i == 31) Sensor32 = cmpntName;
|
||||
else if (i == 32) Sensor33 = cmpntName;
|
||||
else if (i == 33) Sensor34 = cmpntName;
|
||||
else if (i == 34) Sensor35 = cmpntName;
|
||||
else if (i == 35) Sensor36 = cmpntName;
|
||||
else if (i == 36) Sensor37 = cmpntName;
|
||||
else if (i == 37) Sensor38 = cmpntName;
|
||||
else if (i == 38) Sensor39 = cmpntName;
|
||||
else if (i == 39) Sensor40 = cmpntName;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class OutputPath : IHasItemNr, IHasValves
|
||||
{
|
||||
@@ -30,6 +30,8 @@ namespace TBF.Entities
|
||||
|
||||
public OutputPath()
|
||||
{
|
||||
ValvesOpen = string.Empty;
|
||||
ValvesClose = string.Empty;
|
||||
}
|
||||
|
||||
public OutputPath(string name, int itemNr)
|
||||
@@ -39,37 +41,6 @@ namespace TBF.Entities
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public OutputPath(BenchControl.OutputPath path)
|
||||
: this(path.Name, path.ItemNr)
|
||||
{
|
||||
Qfrom = path.Qfrom;
|
||||
Qto = path.Qto;
|
||||
RegulValve = (path.RegulValve != null) ? path.RegulValve.Cfg.Name : null;
|
||||
FlowMeter = (path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : null;
|
||||
PidCoef = path.PidCoef;
|
||||
StartValve = (path.StartValve != null) ? path.StartValve.Cfg.Name : null;
|
||||
Diverter = (path.Diverter != null) ? path.Diverter.Cfg.Name : null;
|
||||
TempDiv = (path.TempDiv != null) ? path.TempDiv.Cfg.Name : null;
|
||||
Balance = (path.Balance != null) ? path.Balance.Cfg.Name : null;
|
||||
EmptyTankValve = (path.EmptyTankValve != null) ? path.EmptyTankValve.Cfg.Name : null;
|
||||
|
||||
string vOpen = string.Empty;
|
||||
foreach (var valve in path.ValvesOpen)
|
||||
{
|
||||
if (vOpen != string.Empty) vOpen += ";";
|
||||
vOpen += valve.Cfg.Name;
|
||||
}
|
||||
ValvesOpen = vOpen;
|
||||
|
||||
string vClose = string.Empty;
|
||||
foreach (var valve in path.ValvesClose)
|
||||
{
|
||||
if (vClose != string.Empty) vClose += ";";
|
||||
vClose += valve.Cfg.Name;
|
||||
}
|
||||
ValvesClose = vClose;
|
||||
}
|
||||
|
||||
public virtual OutputPath Clone(string name, int itemNr)
|
||||
{
|
||||
OutputPath result = new OutputPath(name, itemNr);
|
||||
@@ -3,9 +3,8 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores one test procedure, supports revisions and history log
|
||||
@@ -15,13 +14,20 @@ namespace TBF.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual MetersKind MetersKind { 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 string LongDescription { get; set; } /// Long description (notes)
|
||||
|
||||
public virtual ProcedureState ProcedureState { get; set; }
|
||||
public virtual int Revision { get; set; }
|
||||
public virtual int PredecessorId { get; set; }
|
||||
public virtual bool ObtainedByCopy { get; set; }
|
||||
///
|
||||
public virtual MetersKind MetersKind { get; set; }
|
||||
public virtual string Watermeters { get; set; } /// Water meter name or Id
|
||||
public virtual string ProtocolTitle { get; set; } /// Title of the printed and saved protocol
|
||||
|
||||
@@ -74,6 +80,10 @@ namespace TBF.Entities
|
||||
result.LastChgUser = LastChgUser;
|
||||
result.LastChgTime = LastChgTime;
|
||||
result.LongDescription = LongDescription;
|
||||
|
||||
result.ProcedureState = ProcedureState.Active;
|
||||
result.PredecessorId = Id;
|
||||
|
||||
result.Watermeters = Watermeters;
|
||||
result.DataEntry = DataEntry;
|
||||
result.ResultsPrinter = ResultsPrinter;
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ProcedureHistory
|
||||
{
|
||||
@@ -5,7 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
|
||||
@@ -32,6 +32,7 @@ namespace TBF.Entities
|
||||
public virtual string Method { get; set; }
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
|
||||
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
|
||||
public virtual double TolerRed { get; set; } /// = Filter
|
||||
public virtual TestRedType RedType { get; set; }
|
||||
public virtual string FeedingPath { get; set; }
|
||||
@@ -66,7 +67,8 @@ namespace TBF.Entities
|
||||
TimeStop2Mass = 5; /// [s] between the test end and the final mass measurement
|
||||
ErrLimLo = -2.0f; /// [%] lower error limit
|
||||
ErrLimHi = 2.0f; /// [%] upper error limit
|
||||
TolerRed = 0.0; /// = Filter parameter
|
||||
Uncertainty = 0;
|
||||
TolerRed = 0; /// = Filter parameter
|
||||
}
|
||||
|
||||
public Test(string name, int itemNr, Procedure procedure)
|
||||
@@ -98,7 +100,8 @@ namespace TBF.Entities
|
||||
result.Method = Method;
|
||||
result.ErrLimLo = ErrLimLo;
|
||||
result.ErrLimHi = ErrLimHi;
|
||||
result.TolerRed = TolerRed;
|
||||
result.Uncertainty = Uncertainty;
|
||||
result.TolerRed = TolerRed;
|
||||
result.RedType = RedType;
|
||||
result.FeedingPath = FeedingPath;
|
||||
result.BenchPath = BenchPath;
|
||||
@@ -0,0 +1,171 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class TestResult
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual int BatchNr { get; set; }
|
||||
public virtual string PurchaseOrder { get; set; }
|
||||
public virtual MetersKind MetersKind { get; set; }
|
||||
public virtual IList<MeterTestResult> Meters { get; set; }
|
||||
public virtual IList<MeterTestResult> CombinedMeters { get; set; }
|
||||
|
||||
/// Value copied from the procedure (Entities.Procedure)
|
||||
public virtual string ProcedureName { get; set; }
|
||||
public virtual string ProtocolTitle { get; set; }
|
||||
|
||||
/// Values copied from the test (Entities.Test)
|
||||
public virtual int TestId { get; set; } /// Test entity ID to distinguish between tests with the same name
|
||||
public virtual string TestName { get; set; }
|
||||
public virtual int Part { get; set; }
|
||||
public virtual bool DoNotEvaluate { get; set; } /// Not mapped to the database
|
||||
public virtual bool DoNotPublish { get; set; } /// Not mapped to the database
|
||||
public virtual float Qfrom { get; set; } /// [m3/h] Water flow low limit
|
||||
public virtual float Qto { get; set; } /// [m3/h] Water flow high limit
|
||||
public virtual float Volume { get; set; } /// [l] Target test volume
|
||||
public virtual float TstTime { get; set; } /// [s] Test time estimate
|
||||
public virtual int Repeats { get; set; }
|
||||
public virtual bool Emptying { get; set; }
|
||||
public virtual bool Zeroing { get; set; }
|
||||
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
|
||||
public virtual int Time2MassMsrmt { get; set; }
|
||||
public virtual string Method { get; set; }
|
||||
public virtual float ErrLimLo { get; set; } /// [%] Lower error limit (usually < 0)
|
||||
public virtual float ErrLimHi { get; set; } /// [%] Upper error limit (usually > 0)
|
||||
public virtual float Uncertainty { get; set; } /// [%] Makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
|
||||
|
||||
/// To be replaced by the virtual bench component parameters
|
||||
public virtual string FeedingPath { get; set; }
|
||||
public virtual string BenchPath { get; set; }
|
||||
public virtual string OutputPath { get; set; }
|
||||
public virtual string MetersPath { get; set; }
|
||||
|
||||
/// Results
|
||||
public virtual DateTime TimeStart { get; set; } /// Date and time of the test start
|
||||
public virtual DateTime TimeEnd { get; set; } /// Date and time of the test end
|
||||
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
|
||||
public virtual float AmbientTempAve { get; set; } /// [deg.C] Average ambient air temperature
|
||||
public virtual float AmbientPressAve { get; set; } /// Average ambient air pressure
|
||||
public virtual float AmbientHumiAve { get; set; } /// [%] Average ambient air relative humidity
|
||||
public virtual float PressInAvrg { get; set; } /// [Bar] Input water pressure (average)
|
||||
public virtual float PressInStart { get; set; } /// [Bar]
|
||||
public virtual float PressInEnd { get; set; } /// [Bar]
|
||||
public virtual float PressOutAvrg { get; set; } /// [Bar]
|
||||
public virtual float PressOutStart { get; set; } /// [Bar]
|
||||
public virtual float PressOutEnd { get; set; } /// [Bar]
|
||||
public virtual float TempInAvrg { get; set; } /// [deg.C]
|
||||
public virtual float TempInStart { get; set; } /// [deg.C]
|
||||
public virtual float TempInEnd { get; set; } /// [deg.C]
|
||||
public virtual float TempOutAvrg { get; set; } /// [deg.C]
|
||||
public virtual float TempOutStart { get; set; } /// [deg.C]
|
||||
public virtual float TempOutEnd { get; set; } /// [deg.C]
|
||||
public virtual float TempDivAvrg { get; set; } /// [deg.C]
|
||||
public virtual float TempDivStart { get; set; } /// [deg.C]
|
||||
public virtual float TempDivEnd { get; set; } /// [deg.C]
|
||||
public virtual float MassStartRaw { get; set; } /// [kg]
|
||||
public virtual float MassStart { get; set; } /// [kg]
|
||||
public virtual float MassEndRaw { get; set; } /// [kg]
|
||||
public virtual float MassEnd { get; set; } /// [kg]
|
||||
public virtual float MassDiff { get; set; } /// [kg]
|
||||
public virtual float DensityIn { get; set; } /// [kg/m3]
|
||||
public virtual float DensityOut { get; set; } /// [kg/m3]
|
||||
public virtual float DensityDiv { get; set; } /// [kg/m3]
|
||||
public virtual float Buoyancy { get; set; } ///TODO -> map
|
||||
public virtual float FlowMass { get; set; } /// [kg/h] calculated from conventional true value
|
||||
public virtual float FlowVolume { get; set; } /// [l/h] calculated from conventional true value
|
||||
public virtual float VolumeCTV { get; set; } /// [l] Volume conventional true value
|
||||
public virtual float VolumeMaster { get; set; } /// [l] Volume from the master flow meter
|
||||
public virtual float Time { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual float ErrorMaster { get; set; } /// [%]
|
||||
public virtual float PulsesMaster { get; set; }
|
||||
public virtual float ConstMaster { get; set; } /// [pls/l] Pulses per liter master flow meter
|
||||
public virtual float QRise { get; set; } /// Detected Q_rise of a composed meter
|
||||
public virtual float QFall { get; set; } /// Detected Q_fall of a composed meter
|
||||
public virtual float TimeDivStart0 { get; set; }
|
||||
public virtual float TimeDivStart1 { get; set; }
|
||||
public virtual float TimeDivStart2 { get; set; }
|
||||
public virtual float TimeDivStart3 { get; set; }
|
||||
public virtual float TimeDivStart4 { get; set; }
|
||||
public virtual float TimeDivStart5 { get; set; }
|
||||
public virtual float TimeDivEnd0 { get; set; }
|
||||
public virtual float TimeDivEnd1 { get; set; }
|
||||
public virtual float TimeDivEnd2 { get; set; }
|
||||
public virtual float TimeDivEnd3 { get; set; }
|
||||
public virtual float TimeDivEnd4 { get; set; }
|
||||
public virtual float TimeDivEnd5 { get; set; }
|
||||
|
||||
public TestResult()
|
||||
{
|
||||
Meters = new List<MeterTestResult>();
|
||||
CombinedMeters = new List<MeterTestResult>();
|
||||
}
|
||||
|
||||
public TestResult(MetersKind kind)
|
||||
: this()
|
||||
{
|
||||
MetersKind = kind;
|
||||
|
||||
if (kind == MetersKind.Single)
|
||||
{
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++) Meters.Add(new MeterTestResult(this));
|
||||
}
|
||||
else if (kind == MetersKind.Combined)
|
||||
{
|
||||
for (int i = 0; i < 2 * Config.Data.CompoundWMsCount; i++) Meters.Add(new MeterTestResult(this));
|
||||
for (int i = 0; i < Config.Data.CompoundWMsCount; i++) CombinedMeters.Add(new MeterTestResult(this));
|
||||
}
|
||||
}
|
||||
|
||||
public TestResult(Test test, int repetitionNr, MetersKind kind)
|
||||
: this(kind)
|
||||
{
|
||||
if (test.Repeats == 1)
|
||||
{
|
||||
Name = test.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
Name = string.Format("{0} ({1}/{2})", test.Name, repetitionNr, test.Repeats);
|
||||
}
|
||||
RepetitionNr = repetitionNr;
|
||||
|
||||
/// Copy test parameters from Entities.Procedure object
|
||||
ProcedureName = test.Procedure.Name;
|
||||
ProtocolTitle = test.Procedure.ProtocolTitle;
|
||||
|
||||
/// Copy test parameters from Entities.Test object
|
||||
TestId = test.Id;
|
||||
TestName = test.Name;
|
||||
Part = test.Part;
|
||||
Qfrom = test.Qfrom;
|
||||
Qto = test.Qto;
|
||||
Volume = test.Volume;
|
||||
TstTime = test.TstTime;
|
||||
Repeats = test.Repeats;
|
||||
Emptying = test.Emptying;
|
||||
Zeroing = test.Zeroing;
|
||||
PumpPower = PumpPower;
|
||||
Time2MassMsrmt = test.TimeStop2Mass;
|
||||
Method = test.Method;
|
||||
ErrLimLo = test.ErrLimLo;
|
||||
ErrLimHi = test.ErrLimHi;
|
||||
Uncertainty = test.Uncertainty;
|
||||
|
||||
FeedingPath = test.FeedingPath;
|
||||
BenchPath = test.BenchPath;
|
||||
OutputPath = test.OutputPath;
|
||||
MetersPath = test.MetersPath;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", BatchNr, ProcedureName, TestName, TimeStart.ToShortDateString(), TimeStart.ToShortTimeString());
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores one transition sequence containing a list of transition steps
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class TransitionStep : IHasItemNr, IHasValves
|
||||
{
|
||||
@@ -13,7 +13,6 @@ namespace TBF.Entities
|
||||
public virtual int Duration { get; set; } /// Duration in seconds
|
||||
public virtual string Message { get; set; } /// Message
|
||||
public virtual StepCondition EndCondition { get; set; } /// Condition when transition step is finished (next to the duration)
|
||||
public virtual string Communication { get; set; } /// String specifying type of communication with water meters
|
||||
public virtual string ValvesOpen { get; set; } /// List of valves to be opened
|
||||
public virtual string ValvesClose { get; set; } /// List of valves to be closed
|
||||
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
|
||||
@@ -42,7 +41,6 @@ namespace TBF.Entities
|
||||
result.Duration = Duration;
|
||||
result.Message = Message;
|
||||
result.EndCondition = EndCondition;
|
||||
result.Communication = Communication;
|
||||
result.ValvesOpen = ValvesOpen;
|
||||
result.ValvesClose = ValvesClose;
|
||||
result.RegulValvesPct = RegulValvesPct;
|
||||
@@ -57,7 +55,6 @@ namespace TBF.Entities
|
||||
result += indent + "Duration = " + Duration.ToString() + ", ";
|
||||
result += indent + "Message = " + Message + ", ";
|
||||
result += indent + "EndCondition = " + EndCondition.ToString() + ", ";
|
||||
result += indent + "Communication = " + Communication + ", ";
|
||||
result += indent + "ValvesOpen = " + ValvesOpen.ToString() + ", ";
|
||||
result += indent + "ValvesClose = " + ValvesClose.ToString() + ", ";
|
||||
result += indent + "RegulValvesPct = " + RegulValvesPct.ToString() + ", ";
|
||||
@@ -6,9 +6,9 @@ using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using TBF.Resources;
|
||||
using Config.Resources;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class User
|
||||
{
|
||||
@@ -123,7 +123,7 @@ namespace TBF.Entities
|
||||
/// <param name="password"></param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool Authorize(string userName, string password, TBF.Grp.GID requiredGroupMembership)
|
||||
public virtual bool Authorize(string userName, string password, Grp.GID requiredGroupMembership)
|
||||
{
|
||||
if (Entities.User.IsPowerUser(userName, password))
|
||||
{
|
||||
@@ -255,8 +255,9 @@ namespace TBF.Entities
|
||||
public static bool IsPowerUser(string userName, string password)
|
||||
{
|
||||
return (userName.Equals("milan") && password.Equals("napajedla")) ||
|
||||
(userName.Equals("igor") && password.Equals("ronko4")) ||
|
||||
(userName.Equals("janb") && password.Equals("sen345bnaj21"));
|
||||
(userName.Equals("igor") && password.Equals("ronko4")) ||
|
||||
(userName.Equals("janb") && password.Equals("sen345bnaj21")) ||
|
||||
(userName.Equals("vlado") && password.Equals("luskovica.430"));
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class VirtualBenchSequence : IHasItemNr
|
||||
{
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class VirtualBenchStep : IHasItemNr
|
||||
{
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
/// This class holds the watermeter type specific data
|
||||
/// that have all watermaters of the same type in common
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class WMType
|
||||
{
|
||||
@@ -6,11 +6,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using TBF;
|
||||
using NHibernate;
|
||||
using FluentNHibernate;
|
||||
|
||||
namespace TBF.Entities
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class Watermeter
|
||||
{
|
||||
@@ -2,14 +2,15 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using TBF.Resources;
|
||||
using Config.Resources;
|
||||
|
||||
namespace TBF
|
||||
namespace Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the content of a database
|
||||
@@ -54,20 +55,20 @@ namespace TBF
|
||||
{
|
||||
default:
|
||||
case Database.Users:
|
||||
dbType = Program.CurrentBench.UsersDBSettings.DbType;
|
||||
connectionString = Program.CurrentBench.UsersDBSettings.ConnectionString;
|
||||
dbType = Data.CurrentBench.UsersDBSettings.DbType;
|
||||
connectionString = Data.CurrentBench.UsersDBSettings.ConnectionString;
|
||||
break;
|
||||
case Database.Bench:
|
||||
dbType = Program.CurrentBench.BenchDBSettings.DbType;
|
||||
connectionString = Program.CurrentBench.BenchDBSettings.ConnectionString;
|
||||
dbType = Data.CurrentBench.BenchDBSettings.DbType;
|
||||
connectionString = Data.CurrentBench.BenchDBSettings.ConnectionString;
|
||||
break;
|
||||
case Database.Procedures:
|
||||
dbType = Program.CurrentBench.ProceduresDBSettings.DbType;
|
||||
connectionString = Program.CurrentBench.ProceduresDBSettings.ConnectionString;
|
||||
dbType = Data.CurrentBench.ProceduresDBSettings.DbType;
|
||||
connectionString = Data.CurrentBench.ProceduresDBSettings.ConnectionString;
|
||||
break;
|
||||
case Database.WaterMeters:
|
||||
dbType = Program.CurrentBench.WaterMetersDBSettings.DbType;
|
||||
connectionString = Program.CurrentBench.WaterMetersDBSettings.ConnectionString;
|
||||
dbType = Data.CurrentBench.WaterMetersDBSettings.DbType;
|
||||
connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -99,16 +100,16 @@ namespace TBF
|
||||
{
|
||||
default:
|
||||
case Database.Users:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
case Database.Bench:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
case Database.Procedures:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
case Database.WaterMeters:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -121,8 +122,10 @@ namespace TBF
|
||||
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(string.Format("Cannot open database.\r\nReason:\r\n{0}", exc.Message),
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -205,22 +208,22 @@ namespace TBF
|
||||
///
|
||||
/// Prepare all groups
|
||||
///
|
||||
var testers = new Entities.Group { Gid = (int)TBF.Grp.GID.Testers, Name = Strings.Tester };
|
||||
var testingSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.TestingSpecialists, Name = Strings.Testing_Specialist };
|
||||
var headOfLab = new Entities.Group { Gid = (int)TBF.Grp.GID.HeadOfLab, Name = Strings.Head_of_Lab };
|
||||
var maintenanceSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.MaintenanceSpecialists, Name = Strings.Maintenance_Specialist };
|
||||
var metrologists = new Entities.Group { Gid = (int)TBF.Grp.GID.Metrologists, Name = Strings.Metrologist };
|
||||
var calibrationSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.CalibrationSpecialists, Name = Strings.Calibration_Specialist };
|
||||
var administrators = new Entities.Group { Gid = (int)TBF.Grp.GID.Administrators, Name = Strings.Administrator };
|
||||
var testers = new Entities.Group { Gid = (int)Grp.GID.Testers, Name = Strings.Tester };
|
||||
var testingSpecialists = new Entities.Group { Gid = (int)Grp.GID.TestingSpecialists, Name = Strings.Testing_Specialist };
|
||||
var headOfLab = new Entities.Group { Gid = (int)Grp.GID.HeadOfLab, Name = Strings.Head_of_Lab };
|
||||
var maintenanceSpecialists = new Entities.Group { Gid = (int)Grp.GID.MaintenanceSpecialists, Name = Strings.Maintenance_Specialist };
|
||||
var metrologists = new Entities.Group { Gid = (int)Grp.GID.Metrologists, Name = Strings.Metrologist };
|
||||
var calibrationSpecialists = new Entities.Group { Gid = (int)Grp.GID.CalibrationSpecialists, Name = Strings.Calibration_Specialist };
|
||||
var administrators = new Entities.Group { Gid = (int)Grp.GID.Administrators, Name = Strings.Administrator };
|
||||
|
||||
/// Create the user 'admin' add his groups
|
||||
var admin = new Entities.User
|
||||
{
|
||||
Name = Program.AdminUsername,
|
||||
Name = Data.AdminUsername,
|
||||
Description = "Administrator",
|
||||
LastPwChange = DateTime.Now
|
||||
};
|
||||
admin.SetPassword(Program.AdminPassword);
|
||||
admin.SetPassword(Data.AdminPassword);
|
||||
admin.AddGroup(testers);
|
||||
admin.AddGroup(testingSpecialists);
|
||||
admin.AddGroup(headOfLab);
|
||||
@@ -231,9 +234,9 @@ namespace TBF
|
||||
|
||||
session.SaveOrUpdate(admin);
|
||||
|
||||
/// Create the control board component
|
||||
var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
|
||||
session.SaveOrUpdate(cmpnt);
|
||||
///// Create the control board component
|
||||
//var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
|
||||
//session.SaveOrUpdate(cmpnt);
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
@@ -5,11 +5,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
using NHibernate;
|
||||
using FluentNHibernate;
|
||||
|
||||
namespace TBF
|
||||
namespace Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum Grp.GID specifies GID-s of user groups.
|
||||
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class BenchPathMap : ClassMap<BenchPath>
|
||||
{
|
||||
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class ComponentMap : ClassMap<Component>
|
||||
{
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class ComponentProcedureMap : ClassMap<ComponentProcedure>
|
||||
{
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class ComponentTestMap : ClassMap<ComponentTest>
|
||||
{
|
||||
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class FeedingPathMap : ClassMap<FeedingPath>
|
||||
{
|
||||
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class GroupMap : ClassMap<Entities.Group>
|
||||
{
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class MeasurementCorrectionMap : ClassMap<MeasurementCorrection>
|
||||
{
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class MeterTestResultMap : ClassMap<MeterTestResult>
|
||||
{
|
||||
@@ -0,0 +1,64 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class MetersPathMap : ClassMap<MetersPath>
|
||||
{
|
||||
public MetersPathMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qto);
|
||||
Map(x => x.Sensor1);
|
||||
#pragma warning disable
|
||||
if (Config.Data.WMsCount >= 2) Map(x => x.Sensor2);
|
||||
if (Config.Data.WMsCount >= 3) Map(x => x.Sensor3);
|
||||
if (Config.Data.WMsCount >= 4) Map(x => x.Sensor4);
|
||||
if (Config.Data.WMsCount >= 5) Map(x => x.Sensor5);
|
||||
if (Config.Data.WMsCount >= 6) Map(x => x.Sensor6);
|
||||
if (Config.Data.WMsCount >= 7) Map(x => x.Sensor7);
|
||||
if (Config.Data.WMsCount >= 8) Map(x => x.Sensor8);
|
||||
if (Config.Data.WMsCount >= 9) Map(x => x.Sensor9);
|
||||
if (Config.Data.WMsCount >= 10) Map(x => x.Sensor10);
|
||||
if (Config.Data.WMsCount >= 11) Map(x => x.Sensor11);
|
||||
if (Config.Data.WMsCount >= 12) Map(x => x.Sensor12);
|
||||
if (Config.Data.WMsCount >= 13) Map(x => x.Sensor13);
|
||||
if (Config.Data.WMsCount >= 14) Map(x => x.Sensor14);
|
||||
if (Config.Data.WMsCount >= 15) Map(x => x.Sensor15);
|
||||
if (Config.Data.WMsCount >= 16) Map(x => x.Sensor16);
|
||||
if (Config.Data.WMsCount >= 17) Map(x => x.Sensor17);
|
||||
if (Config.Data.WMsCount >= 18) Map(x => x.Sensor18);
|
||||
if (Config.Data.WMsCount >= 19) Map(x => x.Sensor19);
|
||||
if (Config.Data.WMsCount >= 20) Map(x => x.Sensor20);
|
||||
#if IPERLST
|
||||
if (Config.Data.WMsCount >= 21) Map(x => x.Sensor21);
|
||||
if (Config.Data.WMsCount >= 22) Map(x => x.Sensor22);
|
||||
if (Config.Data.WMsCount >= 23) Map(x => x.Sensor23);
|
||||
if (Config.Data.WMsCount >= 24) Map(x => x.Sensor24);
|
||||
if (Config.Data.WMsCount >= 25) Map(x => x.Sensor25);
|
||||
if (Config.Data.WMsCount >= 26) Map(x => x.Sensor26);
|
||||
if (Config.Data.WMsCount >= 27) Map(x => x.Sensor27);
|
||||
if (Config.Data.WMsCount >= 28) Map(x => x.Sensor28);
|
||||
if (Config.Data.WMsCount >= 29) Map(x => x.Sensor29);
|
||||
if (Config.Data.WMsCount >= 30) Map(x => x.Sensor30);
|
||||
if (Config.Data.WMsCount >= 31) Map(x => x.Sensor31);
|
||||
if (Config.Data.WMsCount >= 32) Map(x => x.Sensor32);
|
||||
if (Config.Data.WMsCount >= 33) Map(x => x.Sensor33);
|
||||
if (Config.Data.WMsCount >= 34) Map(x => x.Sensor34);
|
||||
if (Config.Data.WMsCount >= 35) Map(x => x.Sensor35);
|
||||
if (Config.Data.WMsCount >= 36) Map(x => x.Sensor36);
|
||||
if (Config.Data.WMsCount >= 37) Map(x => x.Sensor37);
|
||||
if (Config.Data.WMsCount >= 38) Map(x => x.Sensor38);
|
||||
if (Config.Data.WMsCount >= 39) Map(x => x.Sensor39);
|
||||
if (Config.Data.WMsCount >= 40) Map(x => x.Sensor40);
|
||||
#endif
|
||||
#pragma warning restore
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class OutputPathMap : ClassMap<OutputPath>
|
||||
{
|
||||
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class ProcedureMap : ClassMap<Procedure>
|
||||
{
|
||||
@@ -13,13 +13,20 @@ namespace TBF.Mappings
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.MetersKind);
|
||||
|
||||
Map(x => x.Description);
|
||||
Map(x => x.CreationUser);
|
||||
Map(x => x.CreationTime);
|
||||
Map(x => x.LastChgUser);
|
||||
Map(x => x.LastChgTime);
|
||||
Map(x => x.LongDescription);
|
||||
|
||||
Map(x => x.ProcedureState);
|
||||
Map(x => x.Revision);
|
||||
Map(x => x.PredecessorId);
|
||||
Map(x => x.ObtainedByCopy);
|
||||
|
||||
Map(x => x.MetersKind);
|
||||
Map(x => x.Watermeters);
|
||||
Map(x => x.ProtocolTitle);
|
||||
Map(x => x.DataEntry);
|
||||
@@ -3,9 +3,9 @@
|
||||
/// Author: Milan Hanajik
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class TestMap : ClassMap<Test>
|
||||
{
|
||||
@@ -30,6 +30,7 @@ namespace TBF.Mappings
|
||||
Map(x => x.Method);
|
||||
Map(x => x.ErrLimLo);
|
||||
Map(x => x.ErrLimHi);
|
||||
Map(x => x.Uncertainty);
|
||||
Map(x => x.TolerRed); /// ???
|
||||
Map(x => x.RedType); /// ???
|
||||
Map(x => x.FeedingPath);
|
||||
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class TestResultMap : ClassMap<TestResult>
|
||||
{
|
||||
@@ -38,6 +38,7 @@ namespace TBF.Mappings
|
||||
Map(x => x.Method);
|
||||
Map(x => x.ErrLimLo);
|
||||
Map(x => x.ErrLimHi);
|
||||
Map(x => x.Uncertainty);
|
||||
|
||||
Map(x => x.FeedingPath)
|
||||
.CustomType("StringClob")
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class TransitionSequenceMap : ClassMap<TransitionSequence>
|
||||
{
|
||||
+2
-3
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class TransitionStepMap : ClassMap<TransitionStep>
|
||||
{
|
||||
@@ -15,7 +15,6 @@ namespace TBF.Mappings
|
||||
Map(x => x.Duration);
|
||||
Map(x => x.Message);
|
||||
Map(x => x.EndCondition);
|
||||
Map(x => x.Communication);
|
||||
Map(x => x.ValvesOpen)
|
||||
.CustomType("StringClob")
|
||||
.CustomSqlType("varchar(8000)");
|
||||
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class UserMap : ClassMap<Entities.User>
|
||||
{
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class VirtualBenchSequenceMap : ClassMap<VirtualBenchSequence>
|
||||
{
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using TBF.Entities;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class VirtualBenchStepMap : ClassMap<VirtualBenchStep>
|
||||
{
|
||||
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class WMTypeMap : ClassMap<Entities.WMType>
|
||||
{
|
||||
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace TBF.Mappings
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class WatermeterMap : ClassMap<Entities.Watermeter>
|
||||
{
|
||||
@@ -0,0 +1,36 @@
|
||||
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("Config")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("Config")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2015 Sensus Slovensko a.s.")]
|
||||
[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("3fc3ff67-7386-4aff-9855-bef33d5fa0d3")]
|
||||
|
||||
// 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("2.0.2.0")]
|
||||
[assembly: AssemblyFileVersion("2.0.2.0")]
|
||||
Generated
+3168
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,9 +3,10 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TBF.Resources;
|
||||
using Config.Entities;
|
||||
using Config.Resources;
|
||||
|
||||
namespace TBF.Forms
|
||||
namespace Config
|
||||
{
|
||||
public class ResultItemSpec
|
||||
{
|
||||
@@ -19,14 +20,14 @@ namespace TBF.Forms
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintDlgt(Entities.MeterTestResult meterTestResult);
|
||||
public delegate string PrintDlgt(MeterTestResult meterTestResult);
|
||||
|
||||
private readonly PrintDlgt printDlgt;
|
||||
|
||||
public bool CanPrintSingle { get { return (printDlgt != null); } }
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string Print(Entities.MeterTestResult meterTestResult)
|
||||
public string Print(MeterTestResult meterTestResult)
|
||||
{
|
||||
string str = printDlgt(meterTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
@@ -36,17 +37,17 @@ namespace TBF.Forms
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintCombinedDlgt(Entities.MeterTestResult largeMeterTestResult,
|
||||
Entities.MeterTestResult smallMeterTestResult,
|
||||
Entities.MeterTestResult combinedMeterTestResult);
|
||||
public delegate string PrintCombinedDlgt(MeterTestResult largeMeterTestResult,
|
||||
MeterTestResult smallMeterTestResult,
|
||||
MeterTestResult combinedMeterTestResult);
|
||||
private readonly PrintCombinedDlgt printCombinedDlgt;
|
||||
|
||||
public bool CanPrintCombined { get { return (printCombinedDlgt != null); } }
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string PrintCombined(Entities.MeterTestResult largeMeterTestResult,
|
||||
Entities.MeterTestResult smallMeterTestResult,
|
||||
Entities.MeterTestResult combinedMeterTestResult)
|
||||
public string PrintCombined(MeterTestResult largeMeterTestResult,
|
||||
MeterTestResult smallMeterTestResult,
|
||||
MeterTestResult combinedMeterTestResult)
|
||||
{
|
||||
string str = printCombinedDlgt(largeMeterTestResult, smallMeterTestResult, combinedMeterTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
@@ -75,17 +76,24 @@ namespace TBF.Forms
|
||||
AllItems = new List<ResultItemSpec>();
|
||||
|
||||
/// Common
|
||||
|
||||
//AllItems.Add(new ResultItemSpec("Bench ID", "Bench ID", x => x.TestResult.BenchID,
|
||||
// (x, y, z) => x.TestResult.BenchID));
|
||||
AllItems.Add(new ResultItemSpec("Test name", "Test", x => x.TestResult.TestName,
|
||||
(x, y, z) => x.TestResult.TestName));
|
||||
AllItems.Add(new ResultItemSpec("Procedure name", Strings.Procedure, x => x.TestResult.ProcedureName,
|
||||
AllItems.Add(new ResultItemSpec("Procedure name", "Procedure", x => x.TestResult.ProcedureName,
|
||||
(x, y, z) => x.TestResult.ProcedureName));
|
||||
AllItems.Add(new ResultItemSpec("Batch number", "Batch nr.", x => x.TestResult.BatchNr.ToString(),
|
||||
(x, y, z) => x.TestResult.BatchNr.ToString()));
|
||||
AllItems.Add(new ResultItemSpec("Test method", "Test method", x => x.TestResult.Method,
|
||||
(x, y, z) => x.TestResult.Method));
|
||||
AllItems.Add(new ResultItemSpec("Density", "Density", x => x.TestResult.DensityOut.ToString("F1"),
|
||||
(x, y, z) => x.TestResult.DensityOut.ToString("F1"))); /// [kg/m3]
|
||||
|
||||
/// Target values
|
||||
AllItems.Add(new ResultItemSpec("Q from", Strings.Q_from_m3h, x => x.TestResult.Qfrom.ToString("F3"),
|
||||
AllItems.Add(new ResultItemSpec("Q from", "Q from [l/h]", x => x.TestResult.Qfrom.ToString("F3"),
|
||||
(x, y, z) => x.TestResult.Qfrom.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Q to", Strings.Q_to_m3h, x => x.TestResult.Qto.ToString("F3"),
|
||||
AllItems.Add(new ResultItemSpec("Q to", "Q to [l/h]", x => x.TestResult.Qto.ToString("F3"),
|
||||
(x, y, z) => x.TestResult.Qto.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Test volume", "Test vol. [l]", x => x.TestResult.Volume.ToString("F1"),
|
||||
(x, y, z) => x.TestResult.Volume.ToString("F1")));
|
||||
@@ -93,6 +101,10 @@ namespace TBF.Forms
|
||||
(x, y, z) => x.TestResult.ErrLimLo.ToString("F1")));
|
||||
AllItems.Add(new ResultItemSpec("Error limit Hi", "Err.Lim.Hi [%]", x => x.TestResult.ErrLimHi.ToString("F1"),
|
||||
(x, y, z) => x.TestResult.ErrLimHi.ToString("F1")));
|
||||
AllItems.Add(new ResultItemSpec("Error limit sum", "Err.Lim.Sum [%]", x => (x.TestResult.ErrLimHi - x.TestResult.ErrLimLo).ToString("F1"),
|
||||
(x, y, z) => (x.TestResult.ErrLimHi - x.TestResult.ErrLimLo).ToString("F1")));
|
||||
AllItems.Add(new ResultItemSpec("Uncertainty", "Uncertainty [%]", x => x.TestResult.Uncertainty.ToString("F2"),
|
||||
(x, y, z) => x.TestResult.Uncertainty.ToString("F2")));
|
||||
|
||||
/// Test results
|
||||
AllItems.Add(new ResultItemSpec("Start time", "T start", x => x.TestResult.TimeStart.ToShortTimeString(),
|
||||
@@ -101,25 +113,25 @@ namespace TBF.Forms
|
||||
(x, y, z) => z.TestResult.TimeEnd.ToShortTimeString()));
|
||||
AllItems.Add(new ResultItemSpec("Test time", "T [s]", x => x.TestResult.Time.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.Time.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Flow", Strings.Flow_m3h, x => Utils.FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
|
||||
(x, y, z) => Utils.FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
|
||||
AllItems.Add(new ResultItemSpec("T in", Strings.T_in, x => x.TestResult.TempInAvrg.ToString("F2"),
|
||||
AllItems.Add(new ResultItemSpec("Flow", "Flow [m3/h]", x => FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
|
||||
(x, y, z) => FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
|
||||
AllItems.Add(new ResultItemSpec("T in", "T in", x => x.TestResult.TempInAvrg.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.TempInAvrg.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("T out", Strings.T_out, x => x.TestResult.TempOutAvrg.ToString("F2"),
|
||||
AllItems.Add(new ResultItemSpec("T out", "T out", x => x.TestResult.TempOutAvrg.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.TempOutAvrg.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("T div", Strings.T_div, x => x.TestResult.TempDivAvrg.ToString("F2"),
|
||||
AllItems.Add(new ResultItemSpec("T div", "T div", x => x.TestResult.TempDivAvrg.ToString("F2"),
|
||||
(x, y, z) => z.TestResult.TempDivAvrg.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("P up", Strings.P_in, x => x.TestResult.PressInAvrg.ToString("F3"),
|
||||
AllItems.Add(new ResultItemSpec("P up", "P up", x => x.TestResult.PressInAvrg.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressInAvrg.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P up start", Strings.P_in_start, x => x.TestResult.PressInStart.ToString("F3"),
|
||||
AllItems.Add(new ResultItemSpec("P up start", "P up start", x => x.TestResult.PressInStart.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressInStart.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P up end", Strings.P_in_end, x => x.TestResult.PressInEnd.ToString("F3"),
|
||||
AllItems.Add(new ResultItemSpec("P up end", "P up end", x => x.TestResult.PressInEnd.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressInEnd.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P down", Strings.P_out, x => x.TestResult.PressOutAvrg.ToString("F3"),
|
||||
AllItems.Add(new ResultItemSpec("P down", "P down", x => x.TestResult.PressOutAvrg.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressOutAvrg.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P down start", Strings.P_out_start, x => x.TestResult.PressOutStart.ToString("F3"),
|
||||
AllItems.Add(new ResultItemSpec("P down start", "P down start", x => x.TestResult.PressOutStart.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressOutStart.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("P down end", Strings.P_out_end, x => x.TestResult.PressOutEnd.ToString("F3"),
|
||||
AllItems.Add(new ResultItemSpec("P down end", "P down end", x => x.TestResult.PressOutEnd.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.PressOutEnd.ToString("F3")));
|
||||
AllItems.Add(new ResultItemSpec("Reference error", "Err.ref. [%]", x => x.TestResult.ErrorMaster.ToString("F3"),
|
||||
(x, y, z) => z.TestResult.ErrorMaster.ToString("F3")));
|
||||
@@ -148,8 +160,8 @@ namespace TBF.Forms
|
||||
AllItems.Add(new ResultItemSpec("Reference pulses", "Ref.pulses", x => x.PulsesMaster.ToString(), null));
|
||||
|
||||
/// Combined water meters only results
|
||||
AllItems.Add(new ResultItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (x.TestResult.QRise == 0) ? "-" : Utils.FloatToStr(x.TestResult.QRise, 4)));
|
||||
AllItems.Add(new ResultItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (x.TestResult.QFall == 0) ? "-" : Utils.FloatToStr(x.TestResult.QFall, 4)));
|
||||
AllItems.Add(new ResultItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (x.TestResult.QRise == 0) ? "-" : FloatToStr(x.TestResult.QRise, 4)));
|
||||
AllItems.Add(new ResultItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (x.TestResult.QFall == 0) ? "-" : FloatToStr(x.TestResult.QFall, 4)));
|
||||
AllItems.Add(new ResultItemSpec("Error large WM", "Error-L [%]", null, (x, y, z) => x.VolumeErrorPct.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Error small WM", "Error-S [%]", null, (x, y, z) => y.VolumeErrorPct.ToString("F2")));
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr large WM", "s/n", null, (x, y, z) => x.SerialNr));
|
||||
@@ -185,5 +197,45 @@ namespace TBF.Forms
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts float number to a string with the specified number of valid digits
|
||||
/// </summary>
|
||||
/// <param name="value">Float value to be converted to a string</param>
|
||||
/// <param name="validDigits">Number of valid digits: 4, 3, or 2 (otherwise a full precision number is printed)</param>
|
||||
/// <returns>String representation of the float number</returns>
|
||||
public static string FloatToStr(float value, int validDigits)
|
||||
{
|
||||
if (validDigits == 4)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return value.ToString("F0");
|
||||
else if (value >= 99.95 || value < -99.95) return value.ToString("F1");
|
||||
else if (value >= 9.995 || value < -9.995) return value.ToString("F2");
|
||||
else if (value >= 0.9995 || value < -0.9995) return value.ToString("F3");
|
||||
else if (value >= 0.09995 || value < -0.09995) return value.ToString("F4");
|
||||
else if (value >= 0.009995 || value < -0.009995) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
}
|
||||
else if (validDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return value.ToString("F0");
|
||||
else if (value >= 9.95 || value < -9.95) return value.ToString("F1");
|
||||
else if (value >= 0.995 || value < -0.995) return value.ToString("F2");
|
||||
else if (value >= 0.0995 || value < -0.0995) return value.ToString("F3");
|
||||
else if (value >= 0.00995 || value < -0.00995) return value.ToString("F4");
|
||||
else if (value >= 0.000995 || value < -0.000995) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
}
|
||||
else if (validDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return value.ToString("F0");
|
||||
else if (value >= 0.95 || value < -0.95) return value.ToString("F1");
|
||||
else if (value >= 0.095 || value < -0.095) return value.ToString("F2");
|
||||
else if (value >= 0.0095 || value < -0.0095) return value.ToString("F3");
|
||||
else if (value >= 0.00095 || value < -0.00095) return value.ToString("F4");
|
||||
else return value.ToString("F5");
|
||||
}
|
||||
else return value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Results
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
public class WaterMeterResult
|
||||
{
|
||||
/// Set only once, used as a reference in some getters
|
||||
private readonly MeterTestResult firstMeterTestResult;
|
||||
|
||||
///
|
||||
/// Hard water meter data
|
||||
///
|
||||
public string SerialNr; /// iPerl : This is PCB Number
|
||||
public int SerialNrEx; /// iPerl : This is the serial number assigned later
|
||||
public int BenchId;
|
||||
public int BatchNr { get { return firstMeterTestResult.TestResult.BatchNr; } }
|
||||
public string ProcedureName { get { return firstMeterTestResult.TestResult.ProcedureName; } }
|
||||
public DateTime TestStart;
|
||||
public DateTime TestEnd;
|
||||
public IList<MeterTestResult> MeterTestResults;
|
||||
|
||||
///
|
||||
/// Soft water meter data
|
||||
///
|
||||
public string Type;
|
||||
public string TypeApproval;
|
||||
public string MetrologicalClass;
|
||||
public string ProtocolTitle { get { return firstMeterTestResult.TestResult.ProtocolTitle; } }
|
||||
public string PurchaseOrder;
|
||||
|
||||
|
||||
public TestResult TestResult(string testName)
|
||||
{
|
||||
foreach (var tr in MeterTestResults)
|
||||
{
|
||||
if (tr.TestResult.TestName.ToLower().Equals(testName.ToLower())) return tr.TestResult;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public MeterTestResult MeterTestResult(string testName)
|
||||
{
|
||||
foreach (var tr in MeterTestResults)
|
||||
{
|
||||
if (tr.TestResult.TestName.ToLower().Equals(testName.ToLower())) return tr;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Private constructor, initializes a list, used as a base
|
||||
/// </summary>
|
||||
private WaterMeterResult()
|
||||
{
|
||||
MeterTestResults = new List<MeterTestResult>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used to construct WaterMeterResults from the first meter test result
|
||||
/// </summary>
|
||||
public WaterMeterResult(MeterTestResult meterTestResult, int benchId)
|
||||
: this()
|
||||
{
|
||||
if (meterTestResult == null) throw new Exception("meterTestResult cannot be null");
|
||||
MeterTestResults.Add(firstMeterTestResult = meterTestResult);
|
||||
|
||||
SerialNr = meterTestResult.SerialNr;
|
||||
BenchId = (benchId == 5) ? 20033 : ((benchId == 6) ? 20034 : 0);
|
||||
TestStart = meterTestResult.TestResult.TimeStart;
|
||||
TestEnd = meterTestResult.TestResult.TimeEnd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Function to append result to a list of results and update start/end dates
|
||||
/// </summary>
|
||||
public void Append(MeterTestResult meterTestResult)
|
||||
{
|
||||
MeterTestResults.Add(meterTestResult);
|
||||
if (meterTestResult.TestResult.TimeStart < TestStart) TestStart = meterTestResult.TestResult.TimeStart;
|
||||
if (meterTestResult.TestResult.TimeEnd > TestEnd) TestEnd = meterTestResult.TestResult.TimeEnd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns 'tests passed' information based on so far appended results
|
||||
/// </summary>
|
||||
public bool Passed()
|
||||
{
|
||||
bool passed = true;
|
||||
foreach (var tr in MeterTestResults)
|
||||
{
|
||||
if (tr.TestResult.DoNotEvaluate) continue;
|
||||
if (tr.VolumeErrorPct < tr.TestResult.ErrLimLo || tr.VolumeErrorPct > tr.TestResult.ErrLimHi) passed = false;
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(80);
|
||||
sb.AppendFormat("PCB:{0} s/n:{1} ", SerialNr, SerialNrEx);
|
||||
|
||||
foreach (var tr in MeterTestResults) sb.AppendFormat(" {0}:{1}%", tr.TestResult.TestName, tr.VolumeErrorPct.ToString("F1"));
|
||||
sb.AppendFormat(" test start: {0} {1} batch={2}", TestStart.ToShortDateString(), TestStart.ToShortTimeString(), BatchNr);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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("Results")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Results")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[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("5da980c4-8924-4762-9b72-91e011e08f6c")]
|
||||
|
||||
// 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("2.0.2.0")]
|
||||
[assembly: AssemblyFileVersion("2.0.2.0")]
|
||||
@@ -0,0 +1,79 @@
|
||||
<?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)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Results</RootNamespace>
|
||||
<AssemblyName>Results</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</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>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
<HintPath>..\packages\FluentNHibernate.1.3.0.733\lib\FluentNHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Iesi.Collections">
|
||||
<HintPath>..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.6.6.5\lib\net20\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.3.3.3.4001\lib\Net35\NHibernate.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.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Entities\WaterMeterResult.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Config\Config.csproj">
|
||||
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="FileWriters\" />
|
||||
<Folder Include="Mappings\" />
|
||||
<Folder Include="Printers\" />
|
||||
</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>
|
||||
Generated
-7
@@ -43,7 +43,6 @@ namespace ResultsBrowser
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
@@ -52,7 +51,6 @@ namespace ResultsBrowser
|
||||
//
|
||||
resources.ApplyResources(this.cancelButton, "cancelButton");
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
@@ -67,13 +65,11 @@ namespace ResultsBrowser
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// editButton
|
||||
//
|
||||
resources.ApplyResources(this.editButton, "editButton");
|
||||
this.editButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.editButton.Name = "editButton";
|
||||
this.editButton.UseVisualStyleBackColor = true;
|
||||
this.editButton.Click += new System.EventHandler(this.editButton_Click);
|
||||
@@ -81,7 +77,6 @@ namespace ResultsBrowser
|
||||
// addButton
|
||||
//
|
||||
resources.ApplyResources(this.addButton, "addButton");
|
||||
this.addButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addButton_Click);
|
||||
@@ -89,7 +84,6 @@ namespace ResultsBrowser
|
||||
// removeButton
|
||||
//
|
||||
resources.ApplyResources(this.removeButton, "removeButton");
|
||||
this.removeButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.UseVisualStyleBackColor = true;
|
||||
this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
|
||||
@@ -97,7 +91,6 @@ namespace ResultsBrowser
|
||||
// copyButton
|
||||
//
|
||||
resources.ApplyResources(this.copyButton, "copyButton");
|
||||
this.copyButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.copyButton.Name = "copyButton";
|
||||
this.copyButton.UseVisualStyleBackColor = true;
|
||||
this.copyButton.Click += new System.EventHandler(this.copyButton_Click);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using ResultsBrowser.Resources;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
@@ -18,8 +22,9 @@ namespace ResultsBrowser
|
||||
/// </summary>
|
||||
public BenchesDlg()
|
||||
{
|
||||
localSettings = new LocalSettings();
|
||||
localSettings.Assign(Program.LocalSettings);
|
||||
Program.LocalSettings.Save();
|
||||
localSettings = LocalSettings.Load(Program.LocalSettingsFileName);
|
||||
if (localSettings == null) throw new Exception("Cannot load local settings");
|
||||
|
||||
InitializeComponent();
|
||||
RedrawTestBenchesListBox();
|
||||
@@ -28,12 +33,12 @@ namespace ResultsBrowser
|
||||
void RedrawTestBenchesListBox()
|
||||
{
|
||||
testBenchesListBox.Items.Clear();
|
||||
if (localSettings.testBenches != null)
|
||||
if (localSettings.TestBenches != null)
|
||||
{
|
||||
int nrBenches = localSettings.testBenches.GetLength(0);
|
||||
int nrBenches = localSettings.TestBenches.GetLength(0);
|
||||
for (int i = 0; i < nrBenches; i++)
|
||||
{
|
||||
testBenchesListBox.Items.Add(localSettings.testBenches[i].BenchName);
|
||||
testBenchesListBox.Items.Add(localSettings.TestBenches[i].BenchName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,28 +50,28 @@ namespace ResultsBrowser
|
||||
/// <param name="e">Not used</param>
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DatabaseSettings bench = new DatabaseSettings();
|
||||
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench);
|
||||
Config.DatabaseSettings bench = new Config.DatabaseSettings();
|
||||
Config.DatabaseSettingsDlg dlg = new Config.DatabaseSettingsDlg(bench);
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
int nrBenches =
|
||||
(localSettings.testBenches == null) ? 0 : localSettings.testBenches.GetLength(0);
|
||||
(localSettings.TestBenches == null) ? 0 : localSettings.TestBenches.GetLength(0);
|
||||
|
||||
if (nrBenches == 0)
|
||||
{
|
||||
localSettings.testBenches = new DatabaseSettings[1];
|
||||
localSettings.testBenches[0] = bench;
|
||||
localSettings.TestBenches = new Config.DatabaseSettings[1];
|
||||
localSettings.TestBenches[0] = bench;
|
||||
}
|
||||
else
|
||||
{
|
||||
DatabaseSettings[] newTestBenches = new DatabaseSettings[nrBenches + 1];
|
||||
Config.DatabaseSettings[] newTestBenches = new Config.DatabaseSettings[nrBenches + 1];
|
||||
for (int i = 0; i < nrBenches; i++)
|
||||
{
|
||||
newTestBenches[i] = localSettings.testBenches[i];
|
||||
newTestBenches[i] = localSettings.TestBenches[i];
|
||||
}
|
||||
newTestBenches[nrBenches] = bench;
|
||||
localSettings.testBenches = newTestBenches;
|
||||
localSettings.TestBenches = newTestBenches;
|
||||
}
|
||||
|
||||
testBenchesListBox.Items.Add(bench.BenchName);
|
||||
@@ -83,23 +88,23 @@ namespace ResultsBrowser
|
||||
{
|
||||
if (testBenchesListBox.SelectedIndex >= 0)
|
||||
{
|
||||
DatabaseSettings ori = localSettings.testBenches[testBenchesListBox.SelectedIndex];
|
||||
DatabaseSettings bench = (DatabaseSettings)ori.Clone();
|
||||
Config.DatabaseSettings ori = localSettings.TestBenches[testBenchesListBox.SelectedIndex];
|
||||
Config.DatabaseSettings bench = (Config.DatabaseSettings)ori.Clone();
|
||||
|
||||
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench);
|
||||
Config.DatabaseSettingsDlg dlg = new Config.DatabaseSettingsDlg(bench);
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
int nrBenches =
|
||||
(localSettings.testBenches == null) ? 0 : localSettings.testBenches.GetLength(0);
|
||||
(localSettings.TestBenches == null) ? 0 : localSettings.TestBenches.GetLength(0);
|
||||
|
||||
DatabaseSettings[] newTestBenches = new DatabaseSettings[nrBenches + 1];
|
||||
Config.DatabaseSettings[] newTestBenches = new Config.DatabaseSettings[nrBenches + 1];
|
||||
for (int i = 0; i < nrBenches; i++)
|
||||
{
|
||||
newTestBenches[i] = localSettings.testBenches[i];
|
||||
newTestBenches[i] = localSettings.TestBenches[i];
|
||||
}
|
||||
newTestBenches[nrBenches] = bench;
|
||||
localSettings.testBenches = newTestBenches;
|
||||
localSettings.TestBenches = newTestBenches;
|
||||
|
||||
testBenchesListBox.Items.Add(bench.BenchName);
|
||||
}
|
||||
@@ -115,13 +120,13 @@ namespace ResultsBrowser
|
||||
{
|
||||
if (testBenchesListBox.SelectedIndex >= 0)
|
||||
{
|
||||
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(localSettings.testBenches[testBenchesListBox.SelectedIndex]);
|
||||
Config.DatabaseSettingsDlg dlg = new Config.DatabaseSettingsDlg(localSettings.TestBenches[testBenchesListBox.SelectedIndex]);
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
// Update the item name
|
||||
testBenchesListBox.Items[testBenchesListBox.SelectedIndex] =
|
||||
localSettings.testBenches[testBenchesListBox.SelectedIndex].BenchName;
|
||||
localSettings.TestBenches[testBenchesListBox.SelectedIndex].BenchName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,24 +142,24 @@ namespace ResultsBrowser
|
||||
if (selectedIx >= 0)
|
||||
{
|
||||
int nrBenches =
|
||||
(localSettings.testBenches == null) ? 0 : localSettings.testBenches.GetLength(0);
|
||||
(localSettings.TestBenches == null) ? 0 : localSettings.TestBenches.GetLength(0);
|
||||
|
||||
if (nrBenches == 1)
|
||||
{
|
||||
localSettings.testBenches = null;
|
||||
localSettings.TestBenches = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
DatabaseSettings[] newTestBenches = new DatabaseSettings[nrBenches - 1];
|
||||
Config.DatabaseSettings[] newTestBenches = new Config.DatabaseSettings[nrBenches - 1];
|
||||
for (int i = 0; i < selectedIx; i++)
|
||||
{
|
||||
newTestBenches[i] = localSettings.testBenches[i];
|
||||
newTestBenches[i] = localSettings.TestBenches[i];
|
||||
}
|
||||
for (int i = selectedIx + 1; i < nrBenches; i++)
|
||||
{
|
||||
newTestBenches[i - 1] = localSettings.testBenches[i];
|
||||
newTestBenches[i - 1] = localSettings.TestBenches[i];
|
||||
}
|
||||
localSettings.testBenches = newTestBenches;
|
||||
localSettings.TestBenches = newTestBenches;
|
||||
}
|
||||
|
||||
RedrawTestBenchesListBox();
|
||||
@@ -168,7 +173,8 @@ namespace ResultsBrowser
|
||||
/// <param name="e">Not used</param>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Program.LocalSettings.Assign(localSettings); // Update Program.localSettings
|
||||
localSettings.Save();
|
||||
Program.LocalSettings = LocalSettings.Load(Program.LocalSettingsFileName);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
|
||||
@@ -1,148 +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>
|
||||
<data name="okButton.Text" xml:space="preserve">
|
||||
<value>&OK</value>
|
||||
</data>
|
||||
<data name="cancelButton.Text" xml:space="preserve">
|
||||
<value>&Abbrechen</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>58, 13</value>
|
||||
</data>
|
||||
<data name="label1.Text" xml:space="preserve">
|
||||
<value>Prüfstände</value>
|
||||
</data>
|
||||
<data name="editButton.Text" xml:space="preserve">
|
||||
<value>&Bearbeiten...</value>
|
||||
</data>
|
||||
<data name="addButton.Text" xml:space="preserve">
|
||||
<value>&Neu...</value>
|
||||
</data>
|
||||
<data name="removeButton.Text" xml:space="preserve">
|
||||
<value>&Löschen</value>
|
||||
</data>
|
||||
<data name="copyButton.Text" xml:space="preserve">
|
||||
<value>&Kopieren</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Datenbank Einstellungen</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -134,8 +134,8 @@
|
||||
<data name="addButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>192, 37</value>
|
||||
</data>
|
||||
<data name="testBenchesListBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>164, 134</value>
|
||||
<data name="okButton.Text" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="addButton.Text" xml:space="preserve">
|
||||
<value>&Add</value>
|
||||
@@ -164,9 +164,6 @@
|
||||
<data name="removeButton.Text" xml:space="preserve">
|
||||
<value>&Remove</value>
|
||||
</data>
|
||||
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>344, 71</value>
|
||||
</data>
|
||||
<data name=">>cancelButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
@@ -209,8 +206,8 @@
|
||||
<data name=">>removeButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>459, 185</value>
|
||||
<data name="testBenchesListBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 37</value>
|
||||
</data>
|
||||
<data name="cancelButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>11</value>
|
||||
@@ -218,6 +215,9 @@
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name=">>copyButton.Name" xml:space="preserve">
|
||||
<value>copyButton</value>
|
||||
</data>
|
||||
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>105, 28</value>
|
||||
</data>
|
||||
@@ -255,8 +255,8 @@
|
||||
<data name="copyButton.Text" xml:space="preserve">
|
||||
<value>&Copy</value>
|
||||
</data>
|
||||
<data name="testBenchesListBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 37</value>
|
||||
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>344, 71</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
@@ -270,8 +270,11 @@
|
||||
<data name=">>addButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>copyButton.Name" xml:space="preserve">
|
||||
<value>copyButton</value>
|
||||
<data name=">>okButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>editButton.Name" xml:space="preserve">
|
||||
<value>editButton</value>
|
||||
</data>
|
||||
<data name="removeButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>105, 28</value>
|
||||
@@ -282,8 +285,8 @@
|
||||
<data name=">>editButton.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name=">>editButton.Name" xml:space="preserve">
|
||||
<value>editButton</value>
|
||||
<data name="testBenchesListBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>164, 134</value>
|
||||
</data>
|
||||
<data name=">>cancelButton.Name" xml:space="preserve">
|
||||
<value>cancelButton</value>
|
||||
@@ -303,14 +306,11 @@
|
||||
<data name=">>addButton.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="okButton.Text" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Database Settings</value>
|
||||
</data>
|
||||
<data name=">>okButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>459, 185</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
@@ -333,7 +333,4 @@
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>de</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
/// <summary>
|
||||
/// Database settings required to make a connection
|
||||
/// </summary>
|
||||
public class DBSettings : ICloneable
|
||||
{
|
||||
public DBType DbType;
|
||||
public string ConnectionString;
|
||||
|
||||
public DBSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public DBSettings(DBType dbType, string connectionString)
|
||||
{
|
||||
this.DbType = dbType;
|
||||
this.ConnectionString = connectionString;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new DBSettings(DbType, ConnectionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
public static class DataDeposit
|
||||
{
|
||||
public static IList<TestResult> ReportTestResults;
|
||||
public static IList<Results.Entities.WaterMeterResult> ReportWaterMeterResults;
|
||||
|
||||
public static IList<TestResult> QueryTestResults;
|
||||
public static IList<Results.Entities.WaterMeterResult> QueryWaterMeterResults;
|
||||
|
||||
static DataDeposit()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
ReportTestResults = new List<TestResult>();
|
||||
ReportWaterMeterResults = new List<Results.Entities.WaterMeterResult>();
|
||||
|
||||
QueryTestResults = new List<TestResult>();
|
||||
QueryWaterMeterResults = new List<Results.Entities.WaterMeterResult>();
|
||||
}
|
||||
|
||||
public static void ProcessQueryTestResults(IList<TestResult> testResults, bool resolveManually)
|
||||
{
|
||||
IList<TestResult> selectedTestResults = new List<TestResult>();
|
||||
|
||||
///
|
||||
/// Place all batch numbers into one list without duplicates
|
||||
///
|
||||
IList<int> batchNrs = new List<int>();
|
||||
foreach (var tr in testResults)
|
||||
{
|
||||
if (tr.TestName.ToLower().Contains("q") && !tr.TestName.ToLower().Contains("adj") /*&& tr.TestName.Length == 2*/)
|
||||
{
|
||||
selectedTestResults.Insert(0, tr);
|
||||
|
||||
if (!batchNrs.Contains(tr.BatchNr))
|
||||
{
|
||||
batchNrs.Add(tr.BatchNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: Optionally sort them in reverse order (they should be now sorted in this way)
|
||||
|
||||
///
|
||||
/// Iterate through all batch numbers
|
||||
///
|
||||
foreach (var batchNr in batchNrs)
|
||||
{
|
||||
IList<Results.Entities.WaterMeterResult> wmResults = new List<Results.Entities.WaterMeterResult>();
|
||||
bool waterMetersCreated = false;
|
||||
|
||||
foreach (var tr in selectedTestResults)
|
||||
{
|
||||
//if (tr.TestName.ToLower().Contains("q2"))
|
||||
{
|
||||
if (tr.BatchNr == batchNr)
|
||||
{
|
||||
if (!waterMetersCreated)
|
||||
{
|
||||
foreach (var mtr in tr.Meters) wmResults.Add(new Results.Entities.WaterMeterResult(mtr, 5));
|
||||
waterMetersCreated = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Math.Min(tr.Meters.Count, wmResults.Count); i++)
|
||||
{
|
||||
wmResults[i].Append(tr.Meters[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Exclude 'failed' water meters
|
||||
for (int i = wmResults.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (string.IsNullOrEmpty(wmResults[i].SerialNr) || !wmResults[i].Passed())
|
||||
{
|
||||
wmResults.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
int added = AddWMResultsAvoidDuplicates(wmResults, resolveManually);
|
||||
Console.WriteLine("batch={0} added={1}", batchNr, added);
|
||||
}
|
||||
|
||||
foreach (var tr in selectedTestResults) QueryTestResults.Add(tr);
|
||||
}
|
||||
|
||||
public static int AddWMResultsAvoidDuplicates(IList<Results.Entities.WaterMeterResult> wmResults, bool resolveManually)
|
||||
{
|
||||
int added = 0;
|
||||
foreach (var wmr in wmResults)
|
||||
{
|
||||
Results.Entities.WaterMeterResult foundWM = null;
|
||||
|
||||
foreach (var wm in QueryWaterMeterResults)
|
||||
{
|
||||
if (wm.SerialNr.Equals(wmr.SerialNr))
|
||||
{
|
||||
foundWM = wm;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundWM == null)
|
||||
{
|
||||
QueryWaterMeterResults.Add(wmr);
|
||||
added++;
|
||||
}
|
||||
else if (resolveManually)
|
||||
{
|
||||
if (DialogResult.Yes == MessageBox.Show(string.Format("New watermeter: {0}\r\nWatermeter in data set: {1}\r\nDou you want to replace the watermeter in the data set?", wmr, foundWM),
|
||||
"Resolve duplicity", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
|
||||
{
|
||||
QueryWaterMeterResults.Remove(foundWM);
|
||||
QueryWaterMeterResults.Add(wmr);
|
||||
added++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return added;
|
||||
}
|
||||
|
||||
public static void AddQueryToReport()
|
||||
{
|
||||
foreach (var wm in QueryWaterMeterResults) ReportWaterMeterResults.Add(wm);
|
||||
QueryWaterMeterResults.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
/// <summary>
|
||||
/// Test bench database settings, contains bench name and settings od several databases
|
||||
/// </summary>
|
||||
public class DatabaseSettings : ICloneable
|
||||
{
|
||||
// Public fields
|
||||
public string BenchName;
|
||||
public bool IsRealBench;
|
||||
public DBSettings UsersDBSettings;
|
||||
public DBSettings BenchDBSettings;
|
||||
public DBSettings ProceduresDBSettings;
|
||||
public DBSettings WMTypesDBSettings;
|
||||
public DBSettings WaterMetersDBSettings;
|
||||
|
||||
// Constructor
|
||||
public DatabaseSettings()
|
||||
{
|
||||
BenchName = String.Empty; /// Empty string to avoid null
|
||||
IsRealBench = false;
|
||||
UsersDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_users; UID=root; PASSWORD=;");
|
||||
BenchDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_bench; UID=root; PASSWORD=;");
|
||||
ProceduresDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_procedures; UID=root; PASSWORD=;");
|
||||
WMTypesDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_wmtypes; UID=root; PASSWORD=;");
|
||||
WaterMetersDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_watermeters; UID=root; PASSWORD=;");
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
DatabaseSettings result = new DatabaseSettings();
|
||||
|
||||
result.BenchName = BenchName;
|
||||
result.IsRealBench = IsRealBench;
|
||||
result.UsersDBSettings = (DBSettings)UsersDBSettings.Clone();
|
||||
result.BenchDBSettings = (DBSettings)BenchDBSettings.Clone();
|
||||
result.ProceduresDBSettings = (DBSettings)ProceduresDBSettings.Clone();
|
||||
result.WMTypesDBSettings = (DBSettings)WMTypesDBSettings.Clone();
|
||||
result.WaterMetersDBSettings = (DBSettings)WaterMetersDBSettings.Clone();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
-21
@@ -66,7 +66,6 @@ namespace ResultsBrowser
|
||||
// okButton
|
||||
//
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
@@ -75,7 +74,6 @@ namespace ResultsBrowser
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.cancelButton, "cancelButton");
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
@@ -84,7 +82,6 @@ namespace ResultsBrowser
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// benchNameTextBox
|
||||
@@ -100,7 +97,6 @@ namespace ResultsBrowser
|
||||
// connectionStringLabel
|
||||
//
|
||||
resources.ApplyResources(this.connectionStringLabel, "connectionStringLabel");
|
||||
this.connectionStringLabel.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.connectionStringLabel.Name = "connectionStringLabel";
|
||||
//
|
||||
// benchConnectionStringTextBox
|
||||
@@ -126,37 +122,31 @@ namespace ResultsBrowser
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
resources.ApplyResources(this.label5, "label5");
|
||||
this.label5.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label5.Name = "label5";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
resources.ApplyResources(this.label6, "label6");
|
||||
this.label6.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.label6.Name = "label6";
|
||||
//
|
||||
// testConnUsersBtn
|
||||
//
|
||||
this.testConnUsersBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnUsersBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnUsersBtn, "testConnUsersBtn");
|
||||
this.testConnUsersBtn.Name = "testConnUsersBtn";
|
||||
this.testConnUsersBtn.UseVisualStyleBackColor = true;
|
||||
@@ -165,7 +155,6 @@ namespace ResultsBrowser
|
||||
// createUsersDbBtn
|
||||
//
|
||||
this.createUsersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createUsersDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createUsersDbBtn, "createUsersDbBtn");
|
||||
this.createUsersDbBtn.Name = "createUsersDbBtn";
|
||||
this.createUsersDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -174,14 +163,12 @@ namespace ResultsBrowser
|
||||
// realBenchCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.realBenchCheckBox, "realBenchCheckBox");
|
||||
this.realBenchCheckBox.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.realBenchCheckBox.Name = "realBenchCheckBox";
|
||||
this.realBenchCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dbTypeLabel
|
||||
//
|
||||
resources.ApplyResources(this.dbTypeLabel, "dbTypeLabel");
|
||||
this.dbTypeLabel.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
this.dbTypeLabel.Name = "dbTypeLabel";
|
||||
//
|
||||
// usersDbTypeComboBox
|
||||
@@ -217,7 +204,6 @@ namespace ResultsBrowser
|
||||
// testConnBenchBtn
|
||||
//
|
||||
this.testConnBenchBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnBenchBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnBenchBtn, "testConnBenchBtn");
|
||||
this.testConnBenchBtn.Name = "testConnBenchBtn";
|
||||
this.testConnBenchBtn.UseVisualStyleBackColor = true;
|
||||
@@ -226,7 +212,6 @@ namespace ResultsBrowser
|
||||
// testConnProceduresBtn
|
||||
//
|
||||
this.testConnProceduresBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnProceduresBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnProceduresBtn, "testConnProceduresBtn");
|
||||
this.testConnProceduresBtn.Name = "testConnProceduresBtn";
|
||||
this.testConnProceduresBtn.UseVisualStyleBackColor = true;
|
||||
@@ -235,7 +220,6 @@ namespace ResultsBrowser
|
||||
// testConnWMTypesBtn
|
||||
//
|
||||
this.testConnWMTypesBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnWMTypesBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnWMTypesBtn, "testConnWMTypesBtn");
|
||||
this.testConnWMTypesBtn.Name = "testConnWMTypesBtn";
|
||||
this.testConnWMTypesBtn.UseVisualStyleBackColor = true;
|
||||
@@ -244,7 +228,6 @@ namespace ResultsBrowser
|
||||
// testConnWaterMetersBtn
|
||||
//
|
||||
this.testConnWaterMetersBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnWaterMetersBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.testConnWaterMetersBtn, "testConnWaterMetersBtn");
|
||||
this.testConnWaterMetersBtn.Name = "testConnWaterMetersBtn";
|
||||
this.testConnWaterMetersBtn.UseVisualStyleBackColor = true;
|
||||
@@ -253,7 +236,6 @@ namespace ResultsBrowser
|
||||
// createBenchDbBtn
|
||||
//
|
||||
this.createBenchDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createBenchDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createBenchDbBtn, "createBenchDbBtn");
|
||||
this.createBenchDbBtn.Name = "createBenchDbBtn";
|
||||
this.createBenchDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -262,7 +244,6 @@ namespace ResultsBrowser
|
||||
// createProceduresDbBtn
|
||||
//
|
||||
this.createProceduresDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createProceduresDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createProceduresDbBtn, "createProceduresDbBtn");
|
||||
this.createProceduresDbBtn.Name = "createProceduresDbBtn";
|
||||
this.createProceduresDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -271,7 +252,6 @@ namespace ResultsBrowser
|
||||
// createWMTypesDbBtn
|
||||
//
|
||||
this.createWMTypesDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createWMTypesDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createWMTypesDbBtn, "createWMTypesDbBtn");
|
||||
this.createWMTypesDbBtn.Name = "createWMTypesDbBtn";
|
||||
this.createWMTypesDbBtn.UseVisualStyleBackColor = true;
|
||||
@@ -280,7 +260,6 @@ namespace ResultsBrowser
|
||||
// createWaterMetersDbBtn
|
||||
//
|
||||
this.createWaterMetersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createWaterMetersDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
|
||||
resources.ApplyResources(this.createWaterMetersDbBtn, "createWaterMetersDbBtn");
|
||||
this.createWaterMetersDbBtn.Name = "createWaterMetersDbBtn";
|
||||
this.createWaterMetersDbBtn.UseVisualStyleBackColor = true;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -5,9 +8,9 @@ using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using TBF.Resources;
|
||||
using ResultsBrowser.Resources;
|
||||
|
||||
namespace TBF
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
/// <summary>
|
||||
/// Dialog to process test bench name and database settings (BenchSettings)
|
||||
@@ -15,13 +18,13 @@ namespace TBF
|
||||
public partial class DatabaseSettingsDlg : Form
|
||||
{
|
||||
// Reference to bench DB settins (not a local copy)
|
||||
DatabaseSettings bench;
|
||||
Config.DatabaseSettings bench;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="bench">Test bench database settings</param>
|
||||
public DatabaseSettingsDlg(DatabaseSettings bench)
|
||||
public DatabaseSettingsDlg(Config.DatabaseSettings bench)
|
||||
{
|
||||
this.bench = bench;
|
||||
|
||||
@@ -64,9 +67,9 @@ namespace TBF
|
||||
realBenchCheckBox.Checked = bench.IsRealBench;
|
||||
|
||||
/// Initialize 'Database type' combo-boxes
|
||||
for (int i = 0; i < (int)DBType.DbTypesCount; i++)
|
||||
for (int i = 0; i < (int)Config.DBType.DbTypesCount; i++)
|
||||
{
|
||||
DBType dbType = (DBType)i;
|
||||
Config.DBType dbType = (Config.DBType)i;
|
||||
usersDbTypeComboBox.Items.Add(dbType);
|
||||
benchDbTypeComboBox.Items.Add(dbType);
|
||||
proceduresDbTypeComboBox.Items.Add(dbType);
|
||||
@@ -108,11 +111,11 @@ namespace TBF
|
||||
bench.WMTypesDBSettings.ConnectionString = wmTypesConnectionStringTextBox.Text;
|
||||
bench.WaterMetersDBSettings.ConnectionString = watermetersConnectionStringTextBox.Text;
|
||||
|
||||
bench.UsersDBSettings.DbType = (DBType)usersDbTypeComboBox.SelectedIndex;
|
||||
bench.BenchDBSettings.DbType = (DBType)benchDbTypeComboBox.SelectedIndex;
|
||||
bench.ProceduresDBSettings.DbType = (DBType)proceduresDbTypeComboBox.SelectedIndex;
|
||||
bench.WMTypesDBSettings.DbType = (DBType)wmTypesDbTypeComboBox.SelectedIndex;
|
||||
bench.WaterMetersDBSettings.DbType = (DBType)watermetersDbTypeComboBox.SelectedIndex;
|
||||
bench.UsersDBSettings.DbType = (Config.DBType)usersDbTypeComboBox.SelectedIndex;
|
||||
bench.BenchDBSettings.DbType = (Config.DBType)benchDbTypeComboBox.SelectedIndex;
|
||||
bench.ProceduresDBSettings.DbType = (Config.DBType)proceduresDbTypeComboBox.SelectedIndex;
|
||||
bench.WMTypesDBSettings.DbType = (Config.DBType)wmTypesDbTypeComboBox.SelectedIndex;
|
||||
bench.WaterMetersDBSettings.DbType = (Config.DBType)watermetersDbTypeComboBox.SelectedIndex;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -155,7 +158,7 @@ namespace TBF
|
||||
try
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
FluentCommon.CreateEmptyUsersDB(bench.UsersDBSettings);
|
||||
Config.FluentCommon.CreateEmptyUsersDB(bench.UsersDBSettings);
|
||||
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
|
||||
Cursor.Current = Cursors.Default;
|
||||
DialogResult = DialogResult.None;
|
||||
@@ -177,7 +180,7 @@ namespace TBF
|
||||
try
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
FluentCommon.CreateEmptyBenchDB(bench.BenchDBSettings);
|
||||
Config.FluentCommon.CreateEmptyBenchDB(bench.BenchDBSettings);
|
||||
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
|
||||
Cursor.Current = Cursors.Default;
|
||||
DialogResult = DialogResult.None;
|
||||
@@ -199,7 +202,7 @@ namespace TBF
|
||||
try
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
FluentCommon.CreateEmptyProceduresDB(bench.ProceduresDBSettings);
|
||||
Config.FluentCommon.CreateEmptyProceduresDB(bench.ProceduresDBSettings);
|
||||
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
|
||||
Cursor.Current = Cursors.Default;
|
||||
DialogResult = DialogResult.None;
|
||||
@@ -226,7 +229,7 @@ namespace TBF
|
||||
try
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
FluentCommon.CreateEmptyWaterMetersDB(bench.WaterMetersDBSettings);
|
||||
Config.FluentCommon.CreateEmptyWaterMetersDB(bench.WaterMetersDBSettings);
|
||||
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
|
||||
Cursor.Current = Cursors.Default;
|
||||
DialogResult = DialogResult.None;
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class BenchPath : IHasItemNr, IHasValves
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual string TempIn { get; set; }
|
||||
public virtual string TempOut { get; set; }
|
||||
public virtual string PressIn { get; set; }
|
||||
public virtual string PressOut { get; set; }
|
||||
|
||||
/// Valves
|
||||
public virtual string ValvesOpen { get; set; }
|
||||
public virtual string ValvesClose { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public BenchPath()
|
||||
{
|
||||
}
|
||||
|
||||
public BenchPath(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public BenchPath(BenchControl.BenchPath path)
|
||||
: this(path.Name, path.ItemNr)
|
||||
{
|
||||
Qfrom = path.Qfrom;
|
||||
Qto = path.Qto;
|
||||
TempIn = (path.TempIn != null) ? path.TempIn.Cfg.Name : null;
|
||||
TempOut = (path.TempOut != null) ? path.TempOut.Cfg.Name : null;
|
||||
PressIn = (path.PressIn != null) ? path.PressIn.Cfg.Name : null;
|
||||
PressOut = (path.PressOut != null) ? path.PressOut.Cfg.Name : null;
|
||||
|
||||
string vOpen = string.Empty;
|
||||
foreach (var valve in path.ValvesOpen)
|
||||
{
|
||||
if (vOpen != string.Empty) vOpen += ";";
|
||||
vOpen += valve.Cfg.Name;
|
||||
}
|
||||
ValvesOpen = vOpen;
|
||||
|
||||
string vClose = string.Empty;
|
||||
foreach (var valve in path.ValvesClose)
|
||||
{
|
||||
if (vClose != string.Empty) vClose += ";";
|
||||
vClose += valve.Cfg.Name;
|
||||
}
|
||||
ValvesClose = vClose;
|
||||
}
|
||||
|
||||
public virtual BenchPath Clone(string name, int itemNr)
|
||||
{
|
||||
BenchPath result = new BenchPath(name, itemNr);
|
||||
|
||||
result.Qfrom = Qfrom;
|
||||
result.Qto = Qto;
|
||||
result.TempIn = TempIn;
|
||||
result.TempOut = TempOut;
|
||||
result.PressIn = PressIn;
|
||||
result.PressOut = PressOut;
|
||||
result.ValvesOpen = ValvesOpen;
|
||||
result.ValvesClose = ValvesClose;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class Component : IHasItemNr
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string ClassName { get; set; }
|
||||
public virtual string ParentName { get; set; }
|
||||
public virtual DebugMode Mode { get; set; }
|
||||
public virtual LogLevel Logging { get; set; }
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual IList<MeasurementCorrection> Corrections { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public Component()
|
||||
{
|
||||
Corrections = new List<MeasurementCorrection>();
|
||||
}
|
||||
|
||||
public static Component CreateFromCfg(string name, string className, string parentName, int itemNr,
|
||||
DebugMode debugLevel, LogLevel logLevel, string parameters)
|
||||
{
|
||||
Component result = new Component();
|
||||
result.ItemNr = itemNr;
|
||||
result.Name = name;
|
||||
result.ClassName = className;
|
||||
result.ParentName = parentName;
|
||||
result.Mode = debugLevel;
|
||||
result.Logging = logLevel;
|
||||
result.Parameters = parameters;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Makes a new copy of this object (not just a reference)
|
||||
public virtual Component Clone()
|
||||
{
|
||||
Component result = new Component();
|
||||
result.ItemNr = ItemNr;
|
||||
result.Name = Name;
|
||||
result.ClassName = ClassName;
|
||||
result.ParentName = ParentName;
|
||||
result.Mode = Mode;
|
||||
result.Logging = Logging;
|
||||
result.Parameters = Parameters;
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual string ToString(string indent)
|
||||
{
|
||||
string result = string.Empty;
|
||||
|
||||
result += indent + "ItemNr = " + (ItemNr + 1).ToString() + Environment.NewLine;
|
||||
result += indent + "Name = " + Name + Environment.NewLine;
|
||||
result += indent + "ClassName = " + ClassName + Environment.NewLine;
|
||||
if (ParentName != null)
|
||||
{
|
||||
result += indent + "ParentName = " + ParentName + Environment.NewLine;
|
||||
}
|
||||
result += indent + "DebugLevel = " + Mode.ToString() + Environment.NewLine;
|
||||
result += indent + "LogLevel = " + Logging.ToString() + Environment.NewLine;
|
||||
result += indent + "Parameters = " + Parameters + Environment.NewLine;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class ComponentProcedure
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string CmpntName { get; set; } /// Component name
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual Procedure Procedure { get; set; }
|
||||
|
||||
public virtual ComponentProcedure Clone()
|
||||
{
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = CmpntName;
|
||||
result.Parameters = Parameters;
|
||||
result.Procedure = Procedure;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class ComponentTest
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string CmpntName { get; set; } /// Component name
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual Test Test { get; set; }
|
||||
|
||||
public virtual ComponentTest Clone()
|
||||
{
|
||||
ComponentTest result = new ComponentTest();
|
||||
result.CmpntName = CmpntName;
|
||||
result.Parameters = Parameters;
|
||||
result.Test = Test;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Kind of meters for the procedure / test
|
||||
/// </summary>
|
||||
public enum MetersKind
|
||||
{
|
||||
Single,
|
||||
Combined,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flow set method Std/ComposedMeter
|
||||
/// </summary>
|
||||
public enum QSetMethod
|
||||
{
|
||||
Std,
|
||||
ComposedMeter,
|
||||
Count,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Procedure method FSS/SSS
|
||||
/// </summary>
|
||||
public enum TestMethod2
|
||||
{
|
||||
FSS,
|
||||
SSS,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum TestRedType
|
||||
{
|
||||
Fix,
|
||||
/// etc.
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum FQC1
|
||||
{
|
||||
FQC1,
|
||||
FQP1,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum Device
|
||||
{
|
||||
Screen,
|
||||
Printer,
|
||||
Disk,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Possible modes of operation of components and devices.
|
||||
/// </summary>
|
||||
public enum DebugMode
|
||||
{
|
||||
DetectedOff = -2,
|
||||
DetectedOn = -1,
|
||||
Normal = 0, /// Normal operation
|
||||
AutoDetect, /// The component (device) will be auto-detected
|
||||
Off, /// The component is off
|
||||
Record,
|
||||
Reply,
|
||||
Simulate, /// Test bench simulation, this mode does not require any hardware
|
||||
Inherit,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum LogLevel
|
||||
{
|
||||
Off,
|
||||
Fatal,
|
||||
Error,
|
||||
Warn,
|
||||
Info,
|
||||
Debug,
|
||||
All,
|
||||
Count,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class FeedingPath : IHasItemNr, IHasValves
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual string Pump { get; set; }
|
||||
|
||||
/// Valves
|
||||
public virtual string ValvesOpen { get; set; }
|
||||
public virtual string ValvesClose { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public FeedingPath()
|
||||
{
|
||||
}
|
||||
|
||||
public FeedingPath(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public FeedingPath(BenchControl.FeedingPath path)
|
||||
: this(path.Name, path.ItemNr)
|
||||
{
|
||||
Qfrom = path.Qfrom;
|
||||
Qto = path.Qto;
|
||||
Pump = (path.Pump != null) ? path.Pump.Cfg.Name : null;
|
||||
|
||||
string vOpen = string.Empty;
|
||||
foreach (var valve in path.ValvesOpen)
|
||||
{
|
||||
if (vOpen != string.Empty) vOpen += ";";
|
||||
vOpen += valve.Cfg.Name;
|
||||
}
|
||||
ValvesOpen = vOpen;
|
||||
|
||||
string vClose = string.Empty;
|
||||
foreach (var valve in path.ValvesClose)
|
||||
{
|
||||
if (vClose != string.Empty) vClose += ";";
|
||||
vClose += valve.Cfg.Name;
|
||||
}
|
||||
ValvesClose = vClose;
|
||||
}
|
||||
|
||||
public virtual FeedingPath Clone(string name, int itemNr)
|
||||
{
|
||||
FeedingPath result = new FeedingPath(name, itemNr);
|
||||
|
||||
result.Qfrom = Qfrom;
|
||||
result.Qto = Qto;
|
||||
result.Pump = Pump;
|
||||
result.ValvesOpen = ValvesOpen;
|
||||
result.ValvesClose = ValvesClose;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class Group
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int Gid { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
interface IHasItemNr
|
||||
{
|
||||
int Id { get; }
|
||||
int ItemNr { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public interface IHasValves
|
||||
{
|
||||
string ValvesOpen { get; set; } /// List of valves to be opened
|
||||
string ValvesClose { get; set; } /// List of valves to be closed
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class MeasurementCorrection
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual float Measurement { get; set; }
|
||||
public virtual float Correction { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class MeterTestResult
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual TestResult TestResult { get; set; } /// reference to the TestResult entity
|
||||
|
||||
public virtual string SerialNr { get; set; }
|
||||
public virtual string EndState { get; set; }
|
||||
public virtual float VolumeStart { get; set; } /// liter
|
||||
public virtual float VolumeEnd { get; set; } /// liter
|
||||
public virtual float VolumeMeter { get; set; } /// liter
|
||||
public virtual float VolumeRef { get; set; } /// liter
|
||||
public virtual float VolumeErrorPct { get; set; } /// %
|
||||
public virtual float PulsesMeter { get; set; } /// Not applicable for a combined meter
|
||||
public virtual float PulsesMaster { get; set; }
|
||||
public virtual float Time { get; set; } /// sec.
|
||||
public virtual bool Passed { get; set; } /// true = test passed
|
||||
|
||||
public MeterTestResult()
|
||||
{
|
||||
}
|
||||
|
||||
public MeterTestResult(TestResult testResult)
|
||||
: this()
|
||||
{
|
||||
TestResult = testResult;
|
||||
}
|
||||
|
||||
public virtual MeterTestResult Clone(TestResult testResult)
|
||||
{
|
||||
MeterTestResult result = new MeterTestResult(testResult);
|
||||
|
||||
result.SerialNr = SerialNr;
|
||||
result.EndState = EndState;
|
||||
result.VolumeStart = VolumeStart;
|
||||
result.VolumeEnd = VolumeEnd;
|
||||
result.VolumeMeter = VolumeMeter;
|
||||
result.VolumeRef = VolumeRef;
|
||||
result.VolumeErrorPct = VolumeErrorPct;
|
||||
result.PulsesMeter = PulsesMeter;
|
||||
result.PulsesMaster = PulsesMaster;
|
||||
result.Time = Time;
|
||||
result.Passed = Passed;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class MetersPath : IHasItemNr
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
|
||||
/// Sensors
|
||||
public virtual string Sensor1 { get; set; }
|
||||
public virtual string Sensor2 { get; set; }
|
||||
public virtual string Sensor3 { get; set; }
|
||||
public virtual string Sensor4 { get; set; }
|
||||
public virtual string Sensor5 { get; set; }
|
||||
public virtual string Sensor6 { get; set; }
|
||||
public virtual string Sensor7 { get; set; }
|
||||
public virtual string Sensor8 { get; set; }
|
||||
public virtual string Sensor9 { get; set; }
|
||||
public virtual string Sensor10 { get; set; }
|
||||
public virtual string Sensor11 { get; set; }
|
||||
public virtual string Sensor12 { get; set; }
|
||||
public virtual string Sensor13 { get; set; }
|
||||
public virtual string Sensor14 { get; set; }
|
||||
public virtual string Sensor15 { get; set; }
|
||||
public virtual string Sensor16 { get; set; }
|
||||
public virtual string Sensor17 { get; set; }
|
||||
public virtual string Sensor18 { get; set; }
|
||||
public virtual string Sensor19 { get; set; }
|
||||
public virtual string Sensor20 { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public MetersPath()
|
||||
{
|
||||
}
|
||||
|
||||
public MetersPath(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public MetersPath(BenchControl.MetersPath path)
|
||||
: this(path.Name, path.ItemNr)
|
||||
{
|
||||
Qfrom = path.Qfrom;
|
||||
Qto = path.Qto;
|
||||
Sensor1 = (path.RegisterReaders[0] != null) ? path.RegisterReaders[0].Cfg.Name : null;
|
||||
#pragma warning disable
|
||||
if (Program.WMsCount >= 2) Sensor2 = (path.RegisterReaders[1] != null) ? path.RegisterReaders[1].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 3) Sensor3 = (path.RegisterReaders[2] != null) ? path.RegisterReaders[2].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 4) Sensor4 = (path.RegisterReaders[3] != null) ? path.RegisterReaders[3].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 5) Sensor5 = (path.RegisterReaders[4] != null) ? path.RegisterReaders[4].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 6) Sensor6 = (path.RegisterReaders[5] != null) ? path.RegisterReaders[5].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 7) Sensor7 = (path.RegisterReaders[6] != null) ? path.RegisterReaders[6].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 8) Sensor8 = (path.RegisterReaders[7] != null) ? path.RegisterReaders[7].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 9) Sensor9 = (path.RegisterReaders[8] != null) ? path.RegisterReaders[8].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 10) Sensor10 = (path.RegisterReaders[9] != null) ? path.RegisterReaders[9].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 11) Sensor11 = (path.RegisterReaders[10] != null) ? path.RegisterReaders[10].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 12) Sensor12 = (path.RegisterReaders[11] != null) ? path.RegisterReaders[11].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 13) Sensor13 = (path.RegisterReaders[12] != null) ? path.RegisterReaders[12].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 14) Sensor14 = (path.RegisterReaders[13] != null) ? path.RegisterReaders[13].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 15) Sensor15 = (path.RegisterReaders[14] != null) ? path.RegisterReaders[14].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 16) Sensor16 = (path.RegisterReaders[15] != null) ? path.RegisterReaders[15].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 17) Sensor17 = (path.RegisterReaders[16] != null) ? path.RegisterReaders[16].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 18) Sensor18 = (path.RegisterReaders[17] != null) ? path.RegisterReaders[17].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 19) Sensor19 = (path.RegisterReaders[18] != null) ? path.RegisterReaders[18].Cfg.Name : null;
|
||||
if (Program.WMsCount >= 20) Sensor20 = (path.RegisterReaders[19] != null) ? path.RegisterReaders[19].Cfg.Name : null;
|
||||
#pragma warning restore
|
||||
}
|
||||
|
||||
public virtual MetersPath Clone(string name, int itemNr)
|
||||
{
|
||||
MetersPath result = new MetersPath(name, itemNr);
|
||||
result.Qfrom = Qfrom;
|
||||
result.Qto = Qto;
|
||||
result.Sensor1 = Sensor1;
|
||||
result.Sensor2 = Sensor2;
|
||||
result.Sensor3 = Sensor3;
|
||||
result.Sensor4 = Sensor4;
|
||||
result.Sensor5 = Sensor5;
|
||||
result.Sensor6 = Sensor6;
|
||||
result.Sensor7 = Sensor7;
|
||||
result.Sensor8 = Sensor8;
|
||||
result.Sensor9 = Sensor9;
|
||||
result.Sensor10 = Sensor10;
|
||||
result.Sensor11 = Sensor11;
|
||||
result.Sensor12 = Sensor12;
|
||||
result.Sensor13 = Sensor13;
|
||||
result.Sensor14 = Sensor14;
|
||||
result.Sensor15 = Sensor15;
|
||||
result.Sensor16 = Sensor16;
|
||||
result.Sensor17 = Sensor17;
|
||||
result.Sensor18 = Sensor18;
|
||||
result.Sensor19 = Sensor19;
|
||||
result.Sensor20 = Sensor20;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Returns the component name
|
||||
public virtual string GetSensor(int i)
|
||||
{
|
||||
if (i == 0) return Sensor1;
|
||||
else if (i == 1) return Sensor2;
|
||||
else if (i == 2) return Sensor3;
|
||||
else if (i == 3) return Sensor4;
|
||||
else if (i == 4) return Sensor5;
|
||||
else if (i == 5) return Sensor6;
|
||||
else if (i == 6) return Sensor7;
|
||||
else if (i == 7) return Sensor8;
|
||||
else if (i == 8) return Sensor9;
|
||||
else if (i == 9) return Sensor10;
|
||||
else if (i == 10) return Sensor11;
|
||||
else if (i == 11) return Sensor12;
|
||||
else if (i == 12) return Sensor13;
|
||||
else if (i == 13) return Sensor14;
|
||||
else if (i == 14) return Sensor15;
|
||||
else if (i == 15) return Sensor16;
|
||||
else if (i == 16) return Sensor17;
|
||||
else if (i == 17) return Sensor18;
|
||||
else if (i == 18) return Sensor19;
|
||||
else if (i == 19) return Sensor20;
|
||||
else return null;
|
||||
}
|
||||
|
||||
/// Sets the component name
|
||||
public virtual void SetSensor(int i, string cmpntName)
|
||||
{
|
||||
if (i == 0) Sensor1 = cmpntName;
|
||||
else if (i == 1) Sensor2 = cmpntName;
|
||||
else if (i == 2) Sensor3 = cmpntName;
|
||||
else if (i == 3) Sensor4 = cmpntName;
|
||||
else if (i == 4) Sensor5 = cmpntName;
|
||||
else if (i == 5) Sensor6 = cmpntName;
|
||||
else if (i == 6) Sensor7 = cmpntName;
|
||||
else if (i == 7) Sensor8 = cmpntName;
|
||||
else if (i == 8) Sensor9 = cmpntName;
|
||||
else if (i == 9) Sensor10 = cmpntName;
|
||||
else if (i == 10) Sensor11 = cmpntName;
|
||||
else if (i == 11) Sensor12 = cmpntName;
|
||||
else if (i == 12) Sensor13 = cmpntName;
|
||||
else if (i == 13) Sensor14 = cmpntName;
|
||||
else if (i == 14) Sensor15 = cmpntName;
|
||||
else if (i == 15) Sensor16 = cmpntName;
|
||||
else if (i == 16) Sensor17 = cmpntName;
|
||||
else if (i == 17) Sensor18 = cmpntName;
|
||||
else if (i == 18) Sensor19 = cmpntName;
|
||||
else if (i == 19) Sensor20 = cmpntName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class OutputPath : IHasItemNr, IHasValves
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual string RegulValve { get; set; }
|
||||
public virtual string FlowMeter { get; set; }
|
||||
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
|
||||
public virtual string StartValve { get; set; }
|
||||
public virtual string Diverter { get; set; }
|
||||
public virtual string TempDiv { get; set; }
|
||||
public virtual string Balance { get; set; }
|
||||
public virtual string EmptyTankValve { get; set; }
|
||||
|
||||
/// Valves
|
||||
public virtual string ValvesOpen { get; set; }
|
||||
public virtual string ValvesClose { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public OutputPath()
|
||||
{
|
||||
}
|
||||
|
||||
public OutputPath(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public OutputPath(BenchControl.OutputPath path)
|
||||
: this(path.Name, path.ItemNr)
|
||||
{
|
||||
Qfrom = path.Qfrom;
|
||||
Qto = path.Qto;
|
||||
RegulValve = (path.RegulValve != null) ? path.RegulValve.Cfg.Name : null;
|
||||
FlowMeter = (path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : null;
|
||||
PidCoef = path.PidCoef;
|
||||
StartValve = (path.StartValve != null) ? path.StartValve.Cfg.Name : null;
|
||||
Diverter = (path.Diverter != null) ? path.Diverter.Cfg.Name : null;
|
||||
TempDiv = (path.TempDiv != null) ? path.TempDiv.Cfg.Name : null;
|
||||
Balance = (path.Balance != null) ? path.Balance.Cfg.Name : null;
|
||||
EmptyTankValve = (path.EmptyTankValve != null) ? path.EmptyTankValve.Cfg.Name : null;
|
||||
|
||||
string vOpen = string.Empty;
|
||||
foreach (var valve in path.ValvesOpen)
|
||||
{
|
||||
if (vOpen != string.Empty) vOpen += ";";
|
||||
vOpen += valve.Cfg.Name;
|
||||
}
|
||||
ValvesOpen = vOpen;
|
||||
|
||||
string vClose = string.Empty;
|
||||
foreach (var valve in path.ValvesClose)
|
||||
{
|
||||
if (vClose != string.Empty) vClose += ";";
|
||||
vClose += valve.Cfg.Name;
|
||||
}
|
||||
ValvesClose = vClose;
|
||||
}
|
||||
|
||||
public virtual OutputPath Clone(string name, int itemNr)
|
||||
{
|
||||
OutputPath result = new OutputPath(name, itemNr);
|
||||
|
||||
result.Name = Name;
|
||||
result.Qfrom = Qfrom;
|
||||
result.Qto = Qto;
|
||||
result.RegulValve = RegulValve;
|
||||
result.FlowMeter = FlowMeter;
|
||||
result.PidCoef = PidCoef;
|
||||
result.StartValve = StartValve;
|
||||
result.Diverter = Diverter;
|
||||
result.TempDiv = TempDiv;
|
||||
result.Balance = Balance;
|
||||
result.EmptyTankValve = EmptyTankValve;
|
||||
result.ValvesOpen = ValvesOpen;
|
||||
result.ValvesClose = ValvesClose;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores one test procedure, supports revisions and history log
|
||||
/// </summary>
|
||||
public class Procedure : IHasItemNr
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual MetersKind MetersKind { 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 string LongDescription { get; set; } /// Long description (notes)
|
||||
public virtual string Watermeters { get; set; } /// Water meter name or Id
|
||||
public virtual string ProtocolTitle { get; set; } /// Title of the printed and saved protocol
|
||||
|
||||
public virtual string DataEntry { get; set; } /// Component to use for data entry
|
||||
public virtual string ResultsPrinter { get; set; } /// Component to use for printing the results
|
||||
public virtual string ResultsWriter { get; set; } /// Component to use for saving the results into the file
|
||||
public virtual string TransitionStart { get; set; }
|
||||
public virtual string TransitionEnd { get; set; }
|
||||
|
||||
public virtual IList<ComponentProcedure> MoreParams { get; set; }
|
||||
public virtual IList<Test> Tests { get; set; }
|
||||
|
||||
////public virtual string MetrologicalClass { get; set; }
|
||||
////public virtual IList<WMType> WMTypes { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public Procedure()
|
||||
{
|
||||
MoreParams = new List<ComponentProcedure>();
|
||||
Tests = new List<Test>();
|
||||
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CreationUser = (User.CurrentUser != null) ? User.CurrentUser.Name : null;
|
||||
CreationTime = DateTime.Now;
|
||||
LastChgUser = CreationUser;
|
||||
LastChgTime = CreationTime;
|
||||
MetersKind = Entities.MetersKind.Single;
|
||||
ProtocolTitle = "Watermeter test protocol";
|
||||
}
|
||||
|
||||
public Procedure(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public virtual Procedure Clone()
|
||||
{
|
||||
Procedure result = new Procedure();
|
||||
|
||||
result.Name = Name;
|
||||
result.MetersKind = MetersKind;
|
||||
result.Description = Description;
|
||||
result.CreationUser = CreationUser;
|
||||
result.CreationTime = CreationTime;
|
||||
result.LastChgUser = LastChgUser;
|
||||
result.LastChgTime = LastChgTime;
|
||||
result.LongDescription = LongDescription;
|
||||
result.Watermeters = Watermeters;
|
||||
result.DataEntry = DataEntry;
|
||||
result.ResultsPrinter = ResultsPrinter;
|
||||
result.ResultsWriter = ResultsWriter;
|
||||
result.TransitionStart = TransitionStart;
|
||||
result.TransitionEnd = TransitionEnd;
|
||||
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
|
||||
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
|
||||
|
||||
//result.MetrologicalClass = MetrologicalClass;
|
||||
//result.WMType = WMType.Clone();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.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,97 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
|
||||
/// </summary>
|
||||
public class Test : 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 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 int Repeats { get; set; }
|
||||
public virtual bool Emptying { get; set; }
|
||||
public virtual bool Zeroing { get; set; }
|
||||
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
|
||||
public virtual int Time2MassMsrmt { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
|
||||
public virtual string Method { get; set; }
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
|
||||
public virtual double TolerRed { get; set; } /// = Filter
|
||||
public virtual TestRedType RedType { get; set; }
|
||||
public virtual string FeedingPath { get; set; }
|
||||
public virtual string BenchPath { get; set; }
|
||||
public virtual string OutputPath { get; set; }
|
||||
public virtual string MetersPath { get; set; }
|
||||
public virtual string TransitionStart { get; set; }
|
||||
public virtual string TransitionEnd { get; set; }
|
||||
|
||||
public virtual IList<ComponentTest> MoreParams { get; set; }
|
||||
|
||||
public virtual Procedure Procedure { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public Test()
|
||||
{
|
||||
MoreParams = new List<ComponentTest>();
|
||||
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
Repeats = 1;
|
||||
Emptying = false;
|
||||
Zeroing = false;
|
||||
PumpPower = 60.0f; /// [%]
|
||||
Time2MassMsrmt = 5; /// [s] between the test end and the final mass measurement
|
||||
ErrLimLo = -2.0f; /// [%] lower error limit
|
||||
ErrLimHi = 2.0f; /// [%] upper error limit
|
||||
TolerRed = 5.0; /// = Filter parameter
|
||||
}
|
||||
|
||||
public Test(string name, int itemNr, Procedure procedure)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
Procedure = procedure;
|
||||
}
|
||||
|
||||
// Makes a new copy of this object (not just a reference)
|
||||
public virtual Test Clone()
|
||||
{
|
||||
Test result = new Test(Name, ItemNr, Procedure);
|
||||
|
||||
result.Part = Part;
|
||||
result.Qfrom = Qfrom;
|
||||
result.Qto = Qto;
|
||||
result.Volume = Volume;
|
||||
result.TstTime = TstTime;
|
||||
result.Repeats = Repeats;
|
||||
result.Emptying = Emptying;
|
||||
result.Zeroing = Zeroing;
|
||||
result.PumpPower = PumpPower;
|
||||
result.Time2MassMsrmt = Time2MassMsrmt;
|
||||
result.Method = Method;
|
||||
result.ErrLimLo = ErrLimLo;
|
||||
result.ErrLimHi = ErrLimHi;
|
||||
result.TolerRed = TolerRed;
|
||||
result.RedType = RedType;
|
||||
result.FeedingPath = FeedingPath;
|
||||
result.BenchPath = BenchPath;
|
||||
result.OutputPath = OutputPath;
|
||||
result.MetersPath = MetersPath;
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class TestResult
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual int BatchNr { get; set; }
|
||||
public virtual MetersKind MetersKind { get; set; }
|
||||
public virtual IList<MeterTestResult> Meters { get; set; }
|
||||
public virtual IList<MeterTestResult> CombinedMeters { get; set; }
|
||||
|
||||
/// Value copied from the procedure (Entities.Procedure)
|
||||
public virtual string ProcedureName { get; set; }
|
||||
public virtual string ProtocolTitle { get; set; }
|
||||
|
||||
/// Values copied from the test (Entities.Test)
|
||||
public virtual int TestId { get; set; } /// Test entity ID to distinguish between tests with the same name
|
||||
public virtual string TestName { get; set; }
|
||||
public virtual int Part { get; set; }
|
||||
public virtual bool DoNotEvaluate { get; set; } /// Not mapped to the database
|
||||
public virtual bool DoNotPublish { get; set; } /// Not mapped to the database
|
||||
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 int Repeats { get; set; }
|
||||
public virtual bool Emptying { get; set; }
|
||||
public virtual bool Zeroing { get; set; }
|
||||
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
|
||||
public virtual int Time2MassMsrmt { get; set; }
|
||||
public virtual string Method { get; set; }
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
|
||||
|
||||
/// To be replaced by the virtual bench component parameters
|
||||
public virtual string FeedingPath { get; set; }
|
||||
public virtual string BenchPath { get; set; }
|
||||
public virtual string OutputPath { get; set; }
|
||||
public virtual string MetersPath { get; set; }
|
||||
|
||||
/// Results
|
||||
public virtual DateTime TimeStart { get; set; } /// Date and time of the test start
|
||||
public virtual DateTime TimeEnd { get; set; } /// Date and time of the test end
|
||||
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
|
||||
public virtual float AmbientTempAve { get; set; } /// Average ambient air temperature [degC]
|
||||
public virtual float AmbientPressAve { get; set; } /// Average ambient air pressure
|
||||
public virtual float AmbientHumiAve { get; set; } /// Average ambient air relative humidity [%]
|
||||
public virtual float PressInAvrg { get; set; } /// Input water pressure (average) [Bar]
|
||||
public virtual float PressInStart { get; set; }
|
||||
public virtual float PressInEnd { get; set; }
|
||||
public virtual float PressOutAvrg { get; set; }
|
||||
public virtual float PressOutStart { get; set; }
|
||||
public virtual float PressOutEnd { get; set; }
|
||||
public virtual float TempInAvrg { get; set; }
|
||||
public virtual float TempInStart { get; set; }
|
||||
public virtual float TempInEnd { get; set; }
|
||||
public virtual float TempOutAvrg { get; set; }
|
||||
public virtual float TempOutStart { get; set; }
|
||||
public virtual float TempOutEnd { get; set; }
|
||||
public virtual float TempDivAvrg { get; set; }
|
||||
public virtual float TempDivStart { get; set; }
|
||||
public virtual float TempDivEnd { get; set; }
|
||||
public virtual float MassStartRaw { get; set; }
|
||||
public virtual float MassStart { get; set; }
|
||||
public virtual float MassEndRaw { get; set; }
|
||||
public virtual float MassEnd { get; set; }
|
||||
public virtual float MassDiff { get; set; }
|
||||
public virtual float DensityIn { get; set; }
|
||||
public virtual float DensityOut { get; set; }
|
||||
public virtual float DensityDiv { get; set; }
|
||||
public virtual float Buoyancy { get; set; } ///TODO -> map
|
||||
public virtual float FlowMass { get; set; } /// from conventional true value
|
||||
public virtual float FlowVolume { get; set; } /// from conventional true value
|
||||
public virtual float VolumeCTV { get; set; } /// volume conventional true value
|
||||
public virtual float VolumeMaster { get; set; } /// volume from the master flow meter
|
||||
public virtual float Time { get; set; } /// measurement time in seconds
|
||||
public virtual float ErrorMaster { get; set; }
|
||||
public virtual float PulsesMaster { get; set; }
|
||||
public virtual float ConstMaster { get; set; } /// Pulses per liter master flow meter
|
||||
public virtual float QRise { get; set; } /// Detected Q_rise of a composed meter
|
||||
public virtual float QFall { get; set; } /// Detected Q_fall of a composed meter
|
||||
public virtual float TimeDivStart0 { get; set; }
|
||||
public virtual float TimeDivStart1 { get; set; }
|
||||
public virtual float TimeDivStart2 { get; set; }
|
||||
public virtual float TimeDivStart3 { get; set; }
|
||||
public virtual float TimeDivStart4 { get; set; }
|
||||
public virtual float TimeDivStart5 { get; set; }
|
||||
public virtual float TimeDivEnd0 { get; set; }
|
||||
public virtual float TimeDivEnd1 { get; set; }
|
||||
public virtual float TimeDivEnd2 { get; set; }
|
||||
public virtual float TimeDivEnd3 { get; set; }
|
||||
public virtual float TimeDivEnd4 { get; set; }
|
||||
public virtual float TimeDivEnd5 { get; set; }
|
||||
|
||||
public TestResult()
|
||||
{
|
||||
Meters = new List<MeterTestResult>();
|
||||
CombinedMeters = new List<MeterTestResult>();
|
||||
}
|
||||
|
||||
public TestResult(MetersKind kind)
|
||||
: this()
|
||||
{
|
||||
MetersKind = kind;
|
||||
|
||||
if (kind == MetersKind.Single)
|
||||
{
|
||||
for (int i = 0; i < Program.WMsCount; i++) Meters.Add(new MeterTestResult(this));
|
||||
}
|
||||
else if (kind == MetersKind.Combined)
|
||||
{
|
||||
int combinedCount = Program.WMsCount / 2;
|
||||
for (int i = 0; i < 2 * combinedCount; i++) Meters.Add(new MeterTestResult(this));
|
||||
for (int i = 0; i < combinedCount; i++) CombinedMeters.Add(new MeterTestResult(this));
|
||||
}
|
||||
}
|
||||
|
||||
public TestResult(Test test, int repetitionNr, MetersKind kind)
|
||||
: this(kind)
|
||||
{
|
||||
if (test.Repeats == 1)
|
||||
{
|
||||
Name = test.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
Name = string.Format("{0} ({1}/{2})", test.Name, repetitionNr, test.Repeats);
|
||||
}
|
||||
RepetitionNr = repetitionNr;
|
||||
|
||||
/// Copy test parameters from Entities.Procedure object
|
||||
ProcedureName = test.Procedure.Name;
|
||||
ProtocolTitle = test.Procedure.ProtocolTitle;
|
||||
|
||||
/// Copy test parameters from Entities.Test object
|
||||
TestId = test.Id;
|
||||
TestName = test.Name;
|
||||
Part = test.Part;
|
||||
Qfrom = test.Qfrom;
|
||||
Qto = test.Qto;
|
||||
Volume = test.Volume;
|
||||
TstTime = test.TstTime;
|
||||
Repeats = test.Repeats;
|
||||
Emptying = test.Emptying;
|
||||
Zeroing = test.Zeroing;
|
||||
PumpPower = PumpPower;
|
||||
Time2MassMsrmt = test.Time2MassMsrmt;
|
||||
Method = test.Method;
|
||||
ErrLimLo = test.ErrLimLo;
|
||||
ErrLimHi = test.ErrLimHi;
|
||||
|
||||
FeedingPath = test.FeedingPath;
|
||||
BenchPath = test.BenchPath;
|
||||
OutputPath = test.OutputPath;
|
||||
MetersPath = test.MetersPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores one transition sequence containing a list of transition steps
|
||||
/// </summary>
|
||||
public class TransitionSequence : 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 IList<TransitionStep> TransitionSteps { get; set; }
|
||||
|
||||
public TransitionSequence()
|
||||
{
|
||||
TransitionSteps = new List<TransitionStep>();
|
||||
}
|
||||
|
||||
public TransitionSequence(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public virtual TransitionSequence Clone()
|
||||
{
|
||||
TransitionSequence result = new TransitionSequence();
|
||||
result.Name = Name;
|
||||
result.Description = Description;
|
||||
foreach (var step in TransitionSteps) { result.TransitionSteps.Add(step.Clone()); }
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class TransitionStep : IHasItemNr, IHasValves
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; } /// Order of the preparation step
|
||||
public virtual int Duration { get; set; } /// Duration in seconds
|
||||
public virtual string Message { get; set; } /// Message
|
||||
public virtual string ValvesOpen { get; set; } /// List of valves to be opened
|
||||
public virtual string ValvesClose { get; set; } /// List of valves to be closed
|
||||
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
|
||||
public virtual string PumpWithFMPcts { get; set; } /// Power of FM controlled pumps in % separated by ';'
|
||||
|
||||
public virtual TransitionSequence TransitionSequence { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public TransitionStep()
|
||||
{
|
||||
Duration = 5; /// sec.
|
||||
}
|
||||
|
||||
public TransitionStep(int itemNr, TransitionSequence sequence)
|
||||
: this()
|
||||
{
|
||||
ItemNr = itemNr;
|
||||
TransitionSequence = sequence;
|
||||
}
|
||||
|
||||
public virtual TransitionStep Clone()
|
||||
{
|
||||
TransitionStep result = new TransitionStep(ItemNr, TransitionSequence);
|
||||
result.Duration = Duration;
|
||||
result.Message = Message;
|
||||
result.ValvesOpen = ValvesOpen;
|
||||
result.ValvesClose = ValvesClose;
|
||||
result.RegulValvesPct = RegulValvesPct;
|
||||
result.PumpWithFMPcts = PumpWithFMPcts;
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual string ToString(string indent)
|
||||
{
|
||||
string result = "";
|
||||
result += indent + "ItemNr = " + ItemNr.ToString() + ", ";
|
||||
result += indent + "Duration = " + Duration.ToString() + ", ";
|
||||
result += indent + "Message = " + Message + ", ";
|
||||
result += indent + "ValvesOpen = " + ValvesOpen.ToString() + ", ";
|
||||
result += indent + "ValvesClose = " + ValvesClose.ToString() + ", ";
|
||||
result += indent + "RegulValvesPct = " + RegulValvesPct.ToString() + ", ";
|
||||
result += indent + "PumpsWithFMPct = " + RegulValvesPct.ToString() + Environment.NewLine;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string Password { get; set; }
|
||||
public virtual string Description { 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
|
||||
|
||||
private bool powerUser; /// Set to tue for built-in users, power users have full access even with empty Groups
|
||||
|
||||
public User()
|
||||
{
|
||||
this.powerUser = false;
|
||||
Groups = new List<Group>();
|
||||
}
|
||||
|
||||
public virtual void AddGroup(Group group)
|
||||
{
|
||||
Groups.Add(group);
|
||||
}
|
||||
|
||||
|
||||
public User(string name)
|
||||
{
|
||||
this.powerUser = true;
|
||||
Name = name;
|
||||
Groups = new List<Group>();
|
||||
Description = "Power user";
|
||||
}
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
///
|
||||
/// Authorized user (static)
|
||||
///
|
||||
private static User currentUser = null; /// Updated by instance methods Authorize, Unauthorize
|
||||
public static User CurrentUser
|
||||
{
|
||||
get { return currentUser; }
|
||||
set { currentUser = value; }
|
||||
}
|
||||
|
||||
private static DateTime lastAuthorization = DateTime.Now;
|
||||
public static DateTime LastAuthorization { get { return lastAuthorization; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether user is a member of a group.
|
||||
/// </summary>
|
||||
/// <param name="groupId">Group GID</param>
|
||||
/// <returns>true is user is a member of the specified group</returns>
|
||||
public virtual bool IsMemberOf(Grp.GID groupId)
|
||||
{
|
||||
if (groupId == Grp.GID.None || powerUser)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (groupId >= 0 && (int)groupId < Grp.Count)
|
||||
{
|
||||
// for all group elements in User.groups
|
||||
for (int i = 0; i < Groups.Count; ++i)
|
||||
{
|
||||
// element GID = parameter GroupId ?
|
||||
if (((Group)Groups[i]).Gid == (int)groupId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets users password. It then will be encrypted.
|
||||
/// </summary>
|
||||
/// <param name="password">Password</param>
|
||||
public virtual void SetPassword(string password)
|
||||
{
|
||||
this.Password = EncryptedPassword(password);
|
||||
LastPwChange = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
public virtual string EncryptedPassword(string password)
|
||||
{
|
||||
return getHash(password);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies users password. Used by static bool Authorisation(...)
|
||||
/// </summary>
|
||||
/// <param name="password">Password</param>
|
||||
/// <returns>true if password is correct</returns>
|
||||
public virtual bool CheckPassword(string password)
|
||||
{
|
||||
return (Password == EncryptedPassword(password));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The FIRST of TWO possible user authorization method to be used
|
||||
/// when a specific group membership is required (you can use Grp.GID.None).
|
||||
/// If the user is not authorized, the current user remains to be a current user
|
||||
/// (i.e. the access rights were not risen to a higher level).
|
||||
/// If you require different behavior, use Unauthorize() before calling Authorize().
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool Authorize(string userName, string password, TBF.Grp.GID requiredGroupMembership)
|
||||
{
|
||||
if (Entities.User.IsPowerUser(userName, password))
|
||||
{
|
||||
currentUser = this;
|
||||
lastAuthorization = DateTime.Now;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Name.ToLower() == userName.ToLower())
|
||||
{
|
||||
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
|
||||
{
|
||||
currentUser = this;
|
||||
lastAuthorization = DateTime.Now;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The SECOND of TWO possible user authorization method to be used when
|
||||
/// no specific group membership is required.
|
||||
/// If the user is not authorized, the current user remains to be a current user
|
||||
/// (i.e. the access rights were not risen to a higher level).
|
||||
/// If you require different behavior, use Unauthorize() before calling Authorize().
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="requiredGroupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool Authorize(string userName, string password)
|
||||
{
|
||||
return Authorize(userName, password, Grp.GID.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from a database.
|
||||
/// </summary>
|
||||
/// <param name="username">User name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User AuthorizeDummyUser(string username)
|
||||
{
|
||||
User user = new User();
|
||||
user.Name = username;
|
||||
currentUser = user;
|
||||
return user;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from an ARBITRARY database.
|
||||
/// </summary>
|
||||
/// <param name="username">User name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User LoadUserByName(string username, DBSettings dbSettings)
|
||||
{
|
||||
IList<User> listOfUsers = FluentCommon.CreateSessionFactory(Database.Users, dbSettings, false)
|
||||
.OpenSession()
|
||||
.CreateQuery("FROM User WHERE LOWER(Name) = :username")
|
||||
.SetParameter("username", username.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from the users database.
|
||||
/// </summary>
|
||||
/// <param name="username">User name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User LoadUserByName(string username)
|
||||
{
|
||||
IList<User> listOfUsers = FluentCommon.CreateSession(Database.Users)
|
||||
.CreateQuery("FROM User WHERE LOWER(Name) = :username")
|
||||
.SetParameter("username", username.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns an IList of all Users
|
||||
/// </summary>
|
||||
public static IList<User> GetAllUsers()
|
||||
{
|
||||
return FluentCommon.CreateSession(Database.Users)
|
||||
.CreateQuery("FROM User")
|
||||
.List<User>();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Unauthorize, abandon current users authorization.
|
||||
/// </summary>
|
||||
public static void Unauthorize()
|
||||
{
|
||||
currentUser = null;
|
||||
lastAuthorization = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getHash encrypts a string
|
||||
/// </summary>
|
||||
/// <param name="text">the string to encrypt</param>
|
||||
/// <returns></returns>
|
||||
public static string getHash(string text)
|
||||
{
|
||||
byte[] bytes = Encoding.Unicode.GetBytes(text);
|
||||
SHA512Managed hashstring = new SHA512Managed();
|
||||
byte[] hash = hashstring.ComputeHash(bytes);
|
||||
string hashString = string.Empty;
|
||||
foreach (byte x in hash)
|
||||
{
|
||||
hashString += String.Format("{0:x2}", x);
|
||||
}
|
||||
return hashString;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns 'true' when authentication data are valid for a power user.
|
||||
/// </summary>
|
||||
/// <param name="userName">User name</param>
|
||||
/// <param name="password">Password</param>
|
||||
/// <returns>true = authenticated, false = refused</returns>
|
||||
public static bool IsPowerUser(string userName, string password)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class VirtualBenchSequence : 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 IList<VirtualBenchStep> VirtualBenchSteps { get; set; }
|
||||
|
||||
public VirtualBenchSequence()
|
||||
{
|
||||
VirtualBenchSteps = new List<VirtualBenchStep>();
|
||||
}
|
||||
|
||||
public VirtualBenchSequence(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public virtual VirtualBenchSequence Clone()
|
||||
{
|
||||
VirtualBenchSequence result = new VirtualBenchSequence();
|
||||
result.Name = Name;
|
||||
result.Description = Description;
|
||||
foreach (var step in VirtualBenchSteps) { result.VirtualBenchSteps.Add(step.Clone()); }
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ResultsBrowser.Entities
|
||||
{
|
||||
public class VirtualBenchStep : IHasItemNr
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; } /// Order of the preparation step
|
||||
public virtual int Duration { get; set; } /// Duration in seconds
|
||||
///
|
||||
|
||||
public virtual VirtualBenchSequence VirtualBenchSequence { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public VirtualBenchStep()
|
||||
{
|
||||
Duration = 5; /// sec.
|
||||
}
|
||||
|
||||
public VirtualBenchStep(int itemNr, VirtualBenchSequence sequence)
|
||||
: this()
|
||||
{
|
||||
ItemNr = itemNr;
|
||||
VirtualBenchSequence = sequence;
|
||||
}
|
||||
|
||||
public virtual VirtualBenchStep Clone()
|
||||
{
|
||||
VirtualBenchStep result = new VirtualBenchStep(ItemNr, VirtualBenchSequence);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
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 ResultsBrowser.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 = User.CurrentUser.Name,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using TBF;
|
||||
using NHibernate;
|
||||
using FluentNHibernate;
|
||||
|
||||
namespace ResultsBrowser.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(Database.WaterMeters)
|
||||
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
|
||||
.SetParameter("SerialNrParameter", SerialNr)
|
||||
.List<Watermeter>();
|
||||
if (ListOfWatermeters.Count > 0) return ListOfWatermeters.ElementAt(0);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,316 +0,0 @@
|
||||
using System;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the content of a database
|
||||
/// </summary>
|
||||
public enum Database
|
||||
{
|
||||
Users,
|
||||
Bench,
|
||||
Procedures,
|
||||
WaterMeters,
|
||||
Count,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the type of a database
|
||||
/// </summary>
|
||||
public enum DBType
|
||||
{
|
||||
SQLite, /// SQLite
|
||||
MySql, /// MySQL database
|
||||
DbTypesCount,
|
||||
}
|
||||
|
||||
|
||||
public static class FluentCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Session factories for regular sessions.
|
||||
/// </summary>
|
||||
public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)Database.Count];
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <returns>A database session</returns>
|
||||
static ISessionFactory CreateSessionFactory(Database database)
|
||||
{
|
||||
DBType dbType;
|
||||
string connectionString;
|
||||
|
||||
switch (database)
|
||||
{
|
||||
default:
|
||||
case Database.Users:
|
||||
dbType = Program.CurrentBench.UsersDBSettings.DbType;
|
||||
connectionString = Program.CurrentBench.UsersDBSettings.ConnectionString;
|
||||
break;
|
||||
case Database.Bench:
|
||||
dbType = Program.CurrentBench.BenchDBSettings.DbType;
|
||||
connectionString = Program.CurrentBench.BenchDBSettings.ConnectionString;
|
||||
break;
|
||||
case Database.Procedures:
|
||||
dbType = Program.CurrentBench.ProceduresDBSettings.DbType;
|
||||
connectionString = Program.CurrentBench.ProceduresDBSettings.ConnectionString;
|
||||
break;
|
||||
case Database.WaterMeters:
|
||||
dbType = Program.CurrentBench.WaterMetersDBSettings.DbType;
|
||||
connectionString = Program.CurrentBench.WaterMetersDBSettings.ConnectionString;
|
||||
break;
|
||||
}
|
||||
|
||||
return CreateSessionFactory(database, new DBSettings(dbType, connectionString), false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <returns>A database session</returns>
|
||||
public static ISessionFactory CreateSessionFactory(Database database, DBSettings dbSettings, bool createDB)
|
||||
{
|
||||
try
|
||||
{
|
||||
FluentConfiguration cfg = Fluently.Configure();
|
||||
|
||||
switch (dbSettings.DbType)
|
||||
{
|
||||
default:
|
||||
case DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(dbSettings.ConnectionString));
|
||||
break;
|
||||
case DBType.MySql:
|
||||
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(dbSettings.ConnectionString));
|
||||
break;
|
||||
}
|
||||
|
||||
switch (database)
|
||||
{
|
||||
default:
|
||||
case Database.Users:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
|
||||
break;
|
||||
case Database.Bench:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
|
||||
break;
|
||||
case Database.Procedures:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
|
||||
break;
|
||||
case Database.WaterMeters:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
|
||||
break;
|
||||
}
|
||||
|
||||
if (createDB)
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchemaCreate).BuildSessionFactory();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void BuildSchemaDlgt(Configuration config);
|
||||
|
||||
static void BuildSchema(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration (with mapping info in)
|
||||
/// and exports a database schema from it
|
||||
new SchemaExport(config).SetOutputFile("db_schema");
|
||||
}
|
||||
|
||||
static void BuildSchemaCreate(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration (with mapping info in)
|
||||
/// and exports a database schema from it
|
||||
new SchemaExport(config).Create(true, true);
|
||||
}
|
||||
|
||||
/// Create a NHibernate session for the given database
|
||||
public static ISession CreateSession(Database database)
|
||||
{
|
||||
int ix = (int)database;
|
||||
if (ix < 0 || ix >= (int)Database.Count) return null;
|
||||
|
||||
if (SessionFactories[ix] == null) SessionFactories[ix] = CreateSessionFactory(database);
|
||||
|
||||
return SessionFactories[ix].OpenSession();
|
||||
}
|
||||
|
||||
public static void SaveToDb(Database database, object obj)
|
||||
{
|
||||
ISession session = FluentCommon.CreateSession(database);
|
||||
SaveToDb(session, obj);
|
||||
}
|
||||
|
||||
public static void SaveToDb(ISession session, object obj)
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
session.SaveOrUpdate(obj);
|
||||
try { transaction.Commit(); }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteFromDb(Database database, object obj)
|
||||
{
|
||||
ISession session = FluentCommon.CreateSession(database);
|
||||
SaveToDb(session, obj);
|
||||
}
|
||||
|
||||
public static void DeleteFromDb(ISession session, object obj)
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
session.Delete(obj);
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty users database.
|
||||
/// Database contains only the user 'admin' and the control board component 'CB'.
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyUsersDB(DBSettings dbSettings)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Database.Users, dbSettings, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
using (var session = sessionFactory.OpenSession())
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
///
|
||||
/// Prepare all groups
|
||||
///
|
||||
var testers = new Entities.Group { Gid = (int)TBF.Grp.GID.Testers, Name = Strings.Tester };
|
||||
var testingSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.TestingSpecialists, Name = Strings.Testing_Specialist };
|
||||
var headOfLab = new Entities.Group { Gid = (int)TBF.Grp.GID.HeadOfLab, Name = Strings.Head_of_Lab };
|
||||
var maintenanceSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.MaintenanceSpecialists, Name = Strings.Maintenance_Specialist };
|
||||
var metrologists = new Entities.Group { Gid = (int)TBF.Grp.GID.Metrologists, Name = Strings.Metrologist };
|
||||
var calibrationSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.CalibrationSpecialists, Name = Strings.Calibration_Specialist };
|
||||
var administrators = new Entities.Group { Gid = (int)TBF.Grp.GID.Administrators, Name = Strings.Administrator };
|
||||
|
||||
/// Create the user 'admin' add his groups
|
||||
var admin = new Entities.User
|
||||
{
|
||||
Name = Program.AdminUsername,
|
||||
Description = "Administrator",
|
||||
LastPwChange = DateTime.Now
|
||||
};
|
||||
admin.SetPassword(Program.AdminPassword);
|
||||
admin.AddGroup(testers);
|
||||
admin.AddGroup(testingSpecialists);
|
||||
admin.AddGroup(headOfLab);
|
||||
admin.AddGroup(maintenanceSpecialists);
|
||||
admin.AddGroup(metrologists);
|
||||
admin.AddGroup(calibrationSpecialists);
|
||||
admin.AddGroup(administrators);
|
||||
|
||||
session.SaveOrUpdate(admin);
|
||||
|
||||
/// Create the control board component
|
||||
var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
|
||||
session.SaveOrUpdate(cmpnt);
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty bench database
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyBenchDB(DBSettings dbSettings)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Database.Users, dbSettings, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
//using (var session = sessionFactory.OpenSession())
|
||||
//{
|
||||
// using (var transaction = session.BeginTransaction())
|
||||
// {
|
||||
// /// Create one component
|
||||
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
|
||||
// session.SaveOrUpdate(cmpnt);
|
||||
// transaction.Commit();
|
||||
// }
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty procedures database
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyProceduresDB(DBSettings dbSettings)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Database.Users, dbSettings, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
//using (var session = sessionFactory.OpenSession())
|
||||
//{
|
||||
// using (var transaction = session.BeginTransaction())
|
||||
// {
|
||||
// /// Create one component
|
||||
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
|
||||
// session.SaveOrUpdate(cmpnt);
|
||||
// transaction.Commit();
|
||||
// }
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty water meters database
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyWaterMetersDB(DBSettings dbSettings)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Database.Users, dbSettings, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
//using (var session = sessionFactory.OpenSession())
|
||||
//{
|
||||
// using (var transaction = session.BeginTransaction())
|
||||
// {
|
||||
// /// Create one component
|
||||
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
|
||||
// session.SaveOrUpdate(cmpnt);
|
||||
// transaction.Commit();
|
||||
// }
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
partial class AdditionalDataDlg
|
||||
{
|
||||
/// <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.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.typeApprovalTextBox = new System.Windows.Forms.TextBox();
|
||||
this.metrologicalClassTextBox = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.typeTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(34, 56);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(75, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Type approval";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(34, 88);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(91, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Metrological class";
|
||||
//
|
||||
// typeApprovalTextBox
|
||||
//
|
||||
this.typeApprovalTextBox.Location = new System.Drawing.Point(154, 53);
|
||||
this.typeApprovalTextBox.Name = "typeApprovalTextBox";
|
||||
this.typeApprovalTextBox.Size = new System.Drawing.Size(133, 20);
|
||||
this.typeApprovalTextBox.TabIndex = 3;
|
||||
//
|
||||
// metrologicalClassTextBox
|
||||
//
|
||||
this.metrologicalClassTextBox.Location = new System.Drawing.Point(154, 85);
|
||||
this.metrologicalClassTextBox.Name = "metrologicalClassTextBox";
|
||||
this.metrologicalClassTextBox.Size = new System.Drawing.Size(133, 20);
|
||||
this.metrologicalClassTextBox.TabIndex = 5;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(246, 200);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 50);
|
||||
this.okButton.TabIndex = 6;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(337, 200);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 50);
|
||||
this.cancelButton.TabIndex = 7;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// typeTextBox
|
||||
//
|
||||
this.typeTextBox.Location = new System.Drawing.Point(154, 21);
|
||||
this.typeTextBox.Name = "typeTextBox";
|
||||
this.typeTextBox.Size = new System.Drawing.Size(133, 20);
|
||||
this.typeTextBox.TabIndex = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(34, 24);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(31, 13);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Text = "Type";
|
||||
//
|
||||
// AdditionalDataDlg
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(428, 262);
|
||||
this.Controls.Add(this.typeTextBox);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.metrologicalClassTextBox);
|
||||
this.Controls.Add(this.typeApprovalTextBox);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "AdditionalDataDlg";
|
||||
this.Text = "AdditionalDataDlg";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox typeApprovalTextBox;
|
||||
private System.Windows.Forms.TextBox metrologicalClassTextBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.TextBox typeTextBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
public partial class AdditionalDataDlg : Form
|
||||
{
|
||||
public string Type { get { return typeTextBox.Text; } }
|
||||
public string TypeApproval { get { return typeApprovalTextBox.Text; } }
|
||||
public string MetrologicalClass { get { return metrologicalClassTextBox.Text; } }
|
||||
|
||||
public AdditionalDataDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using ResultsBrowser.Resources;
|
||||
|
||||
namespace ResultsBrowser.Forms
|
||||
@@ -18,7 +14,7 @@ namespace ResultsBrowser.Forms
|
||||
// Private fields
|
||||
string user;
|
||||
string password;
|
||||
Grp.GID requiredGroupMembership = Grp.GID.Invalid;
|
||||
Config.Grp.GID requiredGroupMembership = Config.Grp.GID.Invalid;
|
||||
bool noDatabase;
|
||||
|
||||
/// <summary>
|
||||
@@ -51,7 +47,7 @@ namespace ResultsBrowser.Forms
|
||||
/// <summary>
|
||||
/// Constructor when a specific group membership is required.
|
||||
/// </summary>
|
||||
public LoginDlg(Grp.GID requiredGroupMembership)
|
||||
public LoginDlg(Config.Grp.GID requiredGroupMembership)
|
||||
: this()
|
||||
{
|
||||
this.requiredGroupMembership = requiredGroupMembership;
|
||||
@@ -60,7 +56,7 @@ namespace ResultsBrowser.Forms
|
||||
/// <summary>
|
||||
/// Constructor with a predefined user when a specific group membership is required.
|
||||
/// </summary>
|
||||
public LoginDlg(string predefinedUser, Grp.GID requiredGroupMembership)
|
||||
public LoginDlg(string predefinedUser, Config.Grp.GID requiredGroupMembership)
|
||||
: this()
|
||||
{
|
||||
user = predefinedUser;
|
||||
@@ -88,14 +84,14 @@ namespace ResultsBrowser.Forms
|
||||
user = userNameTextBox.Text;
|
||||
password = passwordTextBox.Text;
|
||||
|
||||
bool authorized = Entities.User.IsPowerUser(user, password);
|
||||
bool authorized = Config.Entities.User.IsPowerUser(user, password);
|
||||
|
||||
if (!authorized && !noDatabase)
|
||||
{
|
||||
Entities.User loadedUser = Entities.User.LoadUserByName(user);
|
||||
User loadedUser = User.LoadUserByName(user);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
if (requiredGroupMembership == Grp.GID.Invalid)
|
||||
if (requiredGroupMembership == Config.Grp.GID.Invalid)
|
||||
{
|
||||
authorized = loadedUser.Authorize(user, password);
|
||||
}
|
||||
@@ -110,7 +106,6 @@ namespace ResultsBrowser.Forms
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -124,9 +119,9 @@ namespace ResultsBrowser.Forms
|
||||
/// </summary>
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (requiredGroupMembership == Grp.GID.Invalid)
|
||||
if (requiredGroupMembership == Config.Grp.GID.Invalid)
|
||||
{
|
||||
Entities.User.Unauthorize();
|
||||
User.Unauthorize();
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.Cancel;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user