Compare commits

...
Author SHA1 Message Date
Milan Hanajik 002b1b04e7 Reconfigured for iPerl 2017-05-16 19:43:12 +02:00
Milan Hanajik 2387ab28fa Results, ResultsBrowser: iPerl specific results added, Passed item fixed for a water meter (it was correct only for a test), ver. 2.12.561 2017-05-16 19:41:31 +02:00
Milan Hanajik 84a7f21dfa ResultsBrowser supports 5 test benches (connection strings and UI). 2017-05-16 09:58:22 +02:00
Milan Hanajik 72b7af914e Bug fix: Missing 'using' for ORACLE_DB 2017-05-16 09:57:49 +02:00
Milan Hanajik e522ea0a85 DataEntry changes specific to SLM50 undone. 2017-05-12 15:03:29 +02:00
Milan Hanajik daf8b6ddee FixedStartMassCollection : Test time fixed, cBrd.TTime not used. 2017-05-12 15:02:36 +02:00
Milan Hanajik b1c54c9182 Bug fix 2017-05-12 09:01:19 +02:00
Milan Hanajik 36b3f31352 ver. 2.12.556 2017-05-11 13:43:01 +02:00
Milan Hanajik 261d3a7406 SequenceBase.LogProcessDataHeader() added. 2017-05-11 13:34:17 +02:00
Milan Hanajik 8c7d418b89 UpdateTempPressDensAmb(tstRslt) function added to SequenceBase, used by all sequences. 2017-05-11 13:34:14 +02:00
Milan Hanajik 954e9db303 German language, etc. 2017-05-11 13:34:11 +02:00
Milan Hanajik 01ad1993f1 More CoverTest, avoid interference with DataEntry forms, 'bypass' logging. 2017-05-05 22:25:45 +02:00
Milan Hanajik f0140e2bd1 TankDraining sequence conditions added (MettlerToledo scales). 2017-05-05 14:18:49 +02:00
Milan Hanajik ed83ae57c5 Progress bars are not displayed as 'completed' when a test was aborted. 2017-05-05 12:46:37 +02:00
Milan Hanajik e746d0179f BenchControlPanel modifications/layout changes. 2017-05-05 12:46:16 +02:00
Milan Hanajik 6ba2a663b4 More CoverTest (inversion, login dialog when bypasing, default values). 2017-05-05 12:45:25 +02:00
Milan Hanajik 95f14f9879 Bug fixes in: (1) Output.FileWriters, (2) MainSeq and TestProgressControls, more logging in CoverTest. 2017-05-04 22:13:33 +02:00
Milan Hanajik 2933bd24e7 CoverTest introduced. 2017-05-04 17:13:11 +02:00
Milan Hanajik 73eefe6649 Improvement: Prevents to click 'x' on YesNoForm and MessageBoxForm 2017-05-04 16:34:17 +02:00
Milan Hanajik 0f7ff301c4 Output.Printers.Enhanced component added. 2017-05-04 16:34:03 +02:00
Milan Hanajik 17c685148e (1) Flow selection in New Test Wizard extended, (2) MainSeq and BencControlPael modified, etc. 2017-05-03 22:24:25 +02:00
Milan Hanajik 54a6c1e402 ProcedureDlg ROI wizard fixed, creates Roi.ProcedureParams. 2017-05-01 16:03:47 +02:00
Milan Hanajik fa57c51786 ProcedureParams initialization/constructors modified. ProcedureParamsBase modified. 2017-05-01 16:03:45 +02:00
Milan Hanajik 8a9eba9e76 Bug when creating a new Config database fixed. 2017-05-01 11:16:23 +02:00
Milan Hanajik 59392d8bdc MakeSimulated fixed when there are multiple test repetitions, ver. 2.12.555 2017-05-01 10:28:43 +02:00
Milan Hanajik 45d35ec108 'X' button disabled on all DataEntry forms. 2017-04-28 13:04:09 +02:00
Milan Hanajik a773e42fca iPerl type checked after reading Calibration structure. 2017-04-28 12:59:02 +02:00
Milan Hanajik 80697ed65f ver. 2.12.550 2017-04-24 14:22:51 +02:00
Milan Hanajik 43fd99cea6 output.FileWriter.Enhanced copes with WaterMeters.Count==0, etc. 2017-04-24 12:21:12 +02:00
Milan Hanajik eafcf016f3 Setting regulation valves before flow setting disabled, caused porbles all the time, ver. 2.12 549 2017-04-24 11:58:57 +02:00
Milan Hanajik 5a89a5d43f ver. 2.12.548 2017-04-24 11:02:12 +02:00
Milan Hanajik 33715395dc ReadMassOp fixed, was freezing when draining tanks, ver. 2.12.547 2017-04-24 10:49:28 +02:00
Milan Hanajik 05982cc2ff Endurance test method sequence modified. 2017-04-24 09:44:11 +02:00
Milan Hanajik 6706b296c0 ver. 2.12.546 2017-04-24 08:29:51 +02:00
Milan Hanajik e4be90b7bc ver. 2.12.545 2017-04-20 15:59:35 +02:00
Milan Hanajik 9cc9e4b4c9 MainSeq change to Restore a previously saved batch results, ver. 2.12.544 2017-04-20 15:53:11 +02:00
Milan Hanajik 45869401ad BatchNr of restored session fixed, ver. 2.12.544 2017-04-20 11:00:41 +02:00
Milan Hanajik 5a88e8909f Culture parameter added to all Output.FileWriters components, ver. 2.12.543 2017-04-18 15:29:28 +02:00
Milan Hanajik a4dc7435d0 PreviousResultsCtrl modification: Reload/Restore button was hidden. 2017-04-14 11:51:37 +02:00
Milan Hanajik df1689d458 MainSeq changes, CopyContentFrom() added to WaterMeter, TestRslt, MeterTestRslt, ver. 2.12.542 2017-04-13 14:34:58 +02:00
Milan Hanajik 76a54f41a7 Results.DBase added. 2017-04-12 21:43:57 +02:00
Milan Hanajik 89593b1dac 'Custom'/'Oprav DEWY' button added to BenchControlPanel, MainSeq changes 2017-04-12 17:59:48 +02:00
Milan Hanajik dbd6b7a9f7 SeqBase bug fixes. 2017-04-12 17:37:55 +02:00
Milan Hanajik e49fcdebfc ver. 2.12.539 2017-04-11 17:37:04 +02:00
Milan Hanajik 1ccdcf9bd2 Possibility to reload previous results, MainSeq modified - CreateNewBatchResults() and RestoreBatchResults(), ver. 2.12.538 2017-04-11 17:31:48 +02:00
Milan Hanajik 60f5359bd9 Culture invariant procedure import/export, ver. 2.12.537 2017-04-11 12:54:37 +02:00
Milan Hanajik 71cc77bee1 Keithley.Multimeter_2010_RS232.Multimeter shut-down bug fix, ver. 2.12.536 2017-04-10 15:06:56 +02:00
Milan Hanajik 460b40c9cd ver. 2.12.535 2017-04-10 12:04:04 +02:00
Milan Hanajik c2e32c774e RoiDetecion wizard forms added to TestWizard, ver. 2.12.534 2017-04-10 11:53:41 +02:00
Milan Hanajik 796d9fa554 Camera.Display.DisplayForm modifications 2017-04-09 14:10:49 +02:00
Milan Hanajik 8a8c6c9997 Camera measurement speed optimized, ver. 2.12.533 2017-04-09 13:30:30 +02:00
Milan Hanajik 6e420250b4 Possibility to switch off Telnet VirtualTerminal completely, IVirtualTerminal, DummyVT. 2017-04-07 16:04:43 +02:00
Milan Hanajik 4564f0424c Camera ; UDP listener implemented (but disabled) again, ver. 2.12.532 2017-04-07 15:49:14 +02:00
Milan Hanajik 099d635d3e RoiParams, DetectionImagesCount, P1, P2 are procedure parameters, ver. 2.12.531 2017-04-07 12:22:01 +02:00
Milan Hanajik d372a38e7d Camera time read with each sample, calculation : VolumeStart, VolumeEnd, TimestampStart, TimestampEnd used, ver. 2.12.530 2017-04-07 11:29:35 +02:00
Milan Hanajik fc26b95bdb RoiCfg.SaveImages introduced, Program.ImagesDir introduced - directory cleaned or created on program startup. 2017-04-06 23:49:51 +02:00
Milan Hanajik 44735260ce CLP1611 Measurement done only on successfully detected ROI-s, ver. 2.12.530 2017-04-06 23:47:24 +02:00
Milan Hanajik 6aa3cd96a6 RoiDetection : Changes while testing, ver. 2.12.528 2017-04-06 18:00:33 +02:00
Milan Hanajik e1eb582804 RoiDetection : Images/cameras for retry of ROI Detection can be selected, ver. 2.12.527 2017-04-06 16:54:27 +02:00
Milan Hanajik 0ad4847972 Network.Camera.Display and ICameraDisplay added, ver. 2.12.526 2017-04-06 15:17:56 +02:00
Milan Hanajik 323f2ede25 RoiDetectionOp modified : File transfer correctly initiated. 2017-04-06 10:27:21 +02:00
Milan Hanajik a64c547395 Output.FileWriters.Xml modifications, ver. 2.12.525 2017-04-06 08:29:03 +02:00
Milan Hanajik 40f5079846 MeasurementOp.cs deleted, MeasurementOp in Network/Camera/CLP1611/Camera.cs 2017-04-05 22:22:41 +02:00
Milan Hanajik 464dfc6dd1 FlyingStartMassCollection : 'Next' button can be used to stop the test. 2017-04-05 22:01:21 +02:00
Milan Hanajik c1b3cdde6d Camera bug fix 2017-04-05 22:00:01 +02:00
Milan Hanajik e688c4ba25 Speisung -> Wasserzulauf 2017-04-05 20:32:39 +02:00
Milan Hanajik 592823aa10 Program shutdown cleaned-up : StopOperations(), StopDevice() called appropriately. 2017-04-05 19:45:21 +02:00
Milan Hanajik 5ad871a7e0 Procedure 'Export' / 'Import' implemented, ver. 2.12.524 2017-04-03 14:24:35 +02:00
Milan Hanajik 049bbc8655 DEWA Q2 correction modified, Results.Entities.WaterMeter columns added (iPerl only). 2017-03-31 14:17:18 +02:00
Milan Hanajik dcf6df293f Changes agreed with Mr. Kolesnik in BWB, ver. 2.12.521 2017-03-30 12:38:50 +02:00
Milan Hanajik 0dd2245fe6 Berlin component upgraded 2017-03-29 12:45:14 +02:00
Milan Hanajik cd750cca2f Bug in DataEntry.Standard6.CycleEndForm fixed (end states, Berlin), ver. 2.12.520 2017-03-29 11:54:07 +02:00
Milan Hanajik 5f2da63339 Drain valve removed from Output path, outPath.Scale.DrainValve used instead of outPath.DrainValve, wait for Event. BalanceDone before 2nd mass measurement in FlyingStartMassCollection, ver. 2.12.519 2017-03-29 09:22:39 +02:00
Milan Hanajik d420128b4b Draining modified, in BERLIN done always before flow setting, ver. 2.12.518 2017-03-28 23:54:52 +02:00
Milan Hanajik 2ca5eec8e1 MassMethod : bool -> enum 2017-03-28 21:46:38 +02:00
Milan Hanajik 214a570ca6 Drain valves are specified as component parameters, tank draining on startup fixed, WaitTankEmptyOp, basic TankDraining management, etc, ver. 2.12.517 2017-03-28 12:50:09 +02:00
Milan Hanajik 8fb021da4c Draining management under construction 2017-03-27 23:05:02 +02:00
Milan Hanajik 439d98f99d ReadStableMassOp uses MassRepeats, MassSpread and MassMethod parameters, ver. 2.12.515 2017-03-27 18:32:28 +02:00
Milan Hanajik 3c4fe34c1d Test_volume_exceeds_the_scale_capacity situation handled correctly, no Error state. 2017-03-27 14:08:53 +02:00
Milan Hanajik 641353585c ResultsBrowser : Crash when using statistics for the first time on a new PC fixed, ver. 2.12.514 2017-03-27 12:35:17 +02:00
Milan Hanajik de9a47c2a1 Watermeter supports old and new Q names, Break button visible in German versions. 2017-03-27 11:51:11 +02:00
Milan Hanajik e902dd7c07 Results screen : 'Previous resuts' button always visible, ver.2.12.514 2017-03-27 10:37:59 +02:00
Milan Hanajik ac7076ee0f ver. 2.12.513 2017-03-27 09:15:50 +02:00
Milan Hanajik b5f218b657 OptoTelegramRaw simplified, ver. 2.12.512 2017-03-25 17:31:54 +01:00
Milan Hanajik c468854a76 ver. 2.12.511 2017-03-24 15:38:26 +01:00
Milan Hanajik 1037a68d96 Saving to Oracle DB bug fix, Opto-data processing bug fix, ver. 2.12.510 2017-03-24 15:31:50 +01:00
Milan Hanajik 9e84d894a7 ver. 2.12.507 2017-03-23 08:52:24 +01:00
Milan Hanajik dbbe11cbbc ver. 2.12.506 2017-03-22 14:03:13 +01:00
Milan Hanajik 8d287351b7 Saving to Oracle DB uses a list of tests extracted from VT_PRUEFPUNKT_SOLL_SD, required for DEWA water meters, ver. 2.12.505 2017-03-22 13:59:21 +01:00
Milan Hanajik 724869948f Coping with overflows in OptoData fixed (volume, timestamp). 2017-03-20 22:05:43 +01:00
Milan Hanajik 0497693968 Bug fix in UI when copying ListViewEx cell data into cels in the column below by the right-click, ver. 2.12.503 2017-03-20 21:28:47 +01:00
Milan Hanajik de90477276 ver. 2.12.502 2017-03-20 17:48:44 +01:00
Milan Hanajik 8d4af6f347 Bug in iPerl IRegisterReader usage by FlyingStartMassCollectionSeq fixed, ver. 2.12.501 2017-03-20 17:44:28 +01:00
Milan Hanajik 64cb33cdfd ver. 2.12.500 2017-03-20 13:43:57 +01:00
Milan Hanajik 042488ba79 try-catch when copying remote users to the local database, ver. 2.12.499 2017-03-20 09:14:00 +01:00
Milan Hanajik cd50494141 TestMethods.iPerlCommunication.iPerlCommunicationForm.WriteQ2CorrectionAlt() added. 2017-03-19 22:03:31 +01:00
Milan Hanajik f12b2c38f7 Logging well tested, fixed no 'remote' user DB, way of authorization indicated, copy all remote users, etc., ver. 2.12.498 2017-03-19 18:53:07 +01:00
Milan Hanajik dbfc06960f Invalid components are displayed in ComponentsManagerDlg (up/down bug fixed), etc. 2017-03-18 16:46:03 +01:00
Milan Hanajik 861aae753e User Management cleanup, bool showLocalExtensions added, UserManagement use from TBF fixed. 2017-03-17 13:03:20 +01:00
Milan Hanajik ccf99a3105 User number added to EditSelectedUser form. 2017-03-17 09:45:39 +01:00
Milan Hanajik e245ec80c6 Many changes, Config depends on Users, not vice versa. 2017-03-16 21:53:12 +01:00
Milan Hanajik 7564ed7ba6 UserManagement.DatabaseSettingsDlg and LocalSettings added 2017-03-16 11:09:38 +01:00
Milan Hanajik 721bfdf5c8 Users.Forms.EditUsers --> Users.Forms.UserManagementDlg 2017-03-15 13:52:44 +01:00
Milan Hanajik f3d9fdca7f UserManagement project added 2017-03-15 13:31:33 +01:00
Milan Hanajik 2b78f46efe gitignore and clean.bat changed - UserManagement 2017-03-15 13:31:19 +01:00
Milan Hanajik 77555aeebf 'EditUsers', 'EditSelectedUser' and 'LoginDlg' moved to 'Users' library 2017-03-15 12:56:53 +01:00
Milan Hanajik 58d34023b7 'Repeat password' field added, entered passwords are verified. 2017-03-15 08:11:54 +01:00
Milan Hanajik 42ac833091 All Output.FileWriters.* : Writing to files done in separate threads. 2017-03-15 07:37:42 +01:00
Milan Hanajik 94eb2909bc Oracle database selection includes 'None', component Simulate mode not required anymore, ver. 2.12.497 2017-03-14 13:31:03 +01:00
Milan Hanajik c46dea3ae7 ver. 2.12.496 2017-03-14 09:46:43 +01:00
Milan Hanajik 3160bfd43c TaskSelector State initialization : digital inputs read 3s after start-up, SelectTankOp fixed, ver. 2.12.495 2017-03-10 21:15:25 +01:00
Milan Hanajik e1f54cc49f Gnesis component updated 2017-03-10 17:06:18 +01:00
Milan Hanajik 8b297ba8a6 TankSelector reads CB digital inputs, detemines initial state and detects NoTankSelected, ver. 2.12.493 2017-03-10 16:55:36 +01:00
Milan Hanajik dcca6d9215 'NoStartEnd' DataEntry components added, ready to test FixedStartStopMethod with pulses. 2017-03-10 14:59:29 +01:00
Milan Hanajik 0d2099af10 IRegisterReader includes BeginWMState and EndWMState (both double). DataEnty.WMStartState and WMEndState are also double. 2017-03-10 14:31:08 +01:00
Milan Hanajik ff4dcc39db Component updated - displays pump power in %, crash when closing opto-serial port avoided, etc., ver. 2.12.492 2017-03-10 13:47:23 +01:00
Milan Hanajik 87bc0131cf Tests when test volume exceeds the tank capacity cannot be executed, an error message appears. 2017-03-10 13:10:57 +01:00
Milan Hanajik 20fce538de More TankSelector modifications, ver. 2.12.491 2017-03-10 12:54:18 +01:00
Milan Hanajik d2bed417f1 Emergency stop invokes STOP button press in BenchControlPanel. 2017-03-10 09:50:20 +01:00
Milan Hanajik 8d572a650a (1) Easytherm: proc. params, (2) TankSelector: no. proc. params, seq. conditions added., SetQuidoBitOp, SelectTankOp, UnselectTankOp, ver. 2.12.490 2017-03-09 21:36:44 +01:00
Milan Hanajik efc3efcbfb Munich : 'Drucker' removed from ProcedureDlg ... Process parameters controls 2017-03-09 16:38:59 +01:00
Milan Hanajik 56f8d64fc8 AskYesNoForm, AskYesNoOp, MessageBoxForm and MessageBoxOp fixed, bug was introduced when measuring the string length. 2017-03-09 15:24:10 +01:00
Milan Hanajik e93a817d4d Balance crash on program shut-down avoided. 2017-03-09 15:03:42 +01:00
Milan Hanajik f9c8c22d5e Tank selector: (1) temperature controllers added, (2) procedure parameters added, ver. 2.12.489 2017-03-09 15:03:31 +01:00
Milan Hanajik e423562806 Genesis : Well separated iPerl and Oracle DB support, ver. 2.12.487 2017-03-09 13:12:32 +01:00
Milan Hanajik aa47ce24f4 Modbus Easytherm modifications, SetTemperature works OK, ver. 2.12.487 2017-03-09 07:54:51 +01:00
Milan Hanajik 3c51b92e5e Serious bug in saving/printing results for compound meters fixed, ver. 2.12.486 2017-03-08 10:35:08 +01:00
Milan Hanajik 697b0b3538 Munich : ResultsBrowser prints the bench name, ver. 2.12.485 2017-03-08 07:26:03 +01:00
Milan Hanajik 08b47776ec German only text when a camera was not detected on startup. 2017-03-08 06:52:18 +01:00
Milan Hanajik 0370d1f582 TestStartEndForm (and IHasWMStatesForm interface) added to DataEntry.Munich3 2017-03-07 19:01:49 +01:00
Milan Hanajik fa5b427d4d Simulated mode for FixedStartMassCollection method, Bug fix in DataEntry.Standard6.TestStartEndForm, ver. 2.12.485 2017-03-07 19:00:36 +01:00
Milan Hanajik 21102bb991 Compound meter result items added, ver. 2.12.484 2017-03-07 11:53:29 +01:00
Milan Hanajik b00b6e8412 Munich : Printer clean-up and fixes, ver. 2.12.483 2017-03-07 09:45:00 +01:00
Milan Hanajik 5b4a9c0129 Network.Camera.CLP1611 : IP address can be specified. 2017-03-06 13:21:10 +01:00
Milan Hanajik dc2b945230 Some progress on Easytherm communication. 2017-03-06 00:33:44 +01:00
Milan Hanajik 9ff58c9e0b ver. 2.12.482 2017-03-02 14:12:14 +01:00
Milan Hanajik df0a38e3c6 MettlerToledo.TankDraining, ITankDrainingCfg, ITankDraining class/interfaces added, EmptyValve --> DrainValve 2017-03-02 09:17:22 +01:00
Milan Hanajik 33b349e333 ComponentsManagerDlg : Up and down button implemented. 2017-02-28 22:39:56 +01:00
Milan Hanajik ab14866575 'AskYesNoForm' and 'MessageBoxForm' widths are calculated from the text width. 2017-02-28 13:50:17 +01:00
Milan Hanajik 0f6a3ffa80 Width of the form with "Test bench framework program is closing" is calculated from the text width. 2017-02-28 13:49:18 +01:00
Milan Hanajik fde4b8b16f Resources cleanup 2017-02-28 12:35:41 +01:00
Milan Hanajik c450eaf339 Logging into TBF program in case central users server is not running (and login fails) is fixed, ver. 2.12.481 2017-02-28 11:09:09 +01:00
Milan Hanajik 30819bbacd Output.FileWriters.Enhanced : Bug fix for Badger Meter, ver. 2.12.479 2017-02-22 20:39:22 +01:00
420 changed files with 20241 additions and 10279 deletions
+2
View File
@@ -14,6 +14,8 @@ TBFSetup/Debug/
TBFSetup/Release/
Users/bin/
Users/obj/
UserManagement/bin/
UserManagement/obj/
Doc/
*.suo
*.bak
+8 -5
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -28,7 +28,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -66,7 +66,6 @@
<ItemGroup>
<Compile Include="Data.cs" />
<Compile Include="DatabaseSettings.cs" />
<Compile Include="DBSettings.cs" />
<Compile Include="Entities\BenchPath.cs" />
<Compile Include="Entities\Component.cs" />
<Compile Include="Entities\ComponentProcedure.cs" />
@@ -93,8 +92,6 @@
<Compile Include="Entities\Watermeter.cs" />
<Compile Include="Entities\WMType.cs" />
<Compile Include="FluentCommon.cs" />
<Compile Include="Grp.cs" />
<Compile Include="IUser.cs" />
<Compile Include="Mappings\BenchPathMap.cs" />
<Compile Include="Mappings\ComponentMap.cs" />
<Compile Include="Mappings\ComponentProcedureMap.cs" />
@@ -134,6 +131,12 @@
<EmbeddedResource Include="Resources\Strings.ru.resx" />
<EmbeddedResource Include="Resources\Strings.zh-CN.resx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
<Name>Users</Name>
</ProjectReference>
</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.
-31
View File
@@ -1,31 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
namespace Config
{
/// <summary>
/// Database settings required to make a connection
/// </summary>
public class DBSettings : ICloneable
{
public Entities.DBType DbType;
public string ConnectionString;
public DBSettings()
{
}
public DBSettings(Entities.DBType dbType, string connectionString)
{
this.DbType = dbType;
this.ConnectionString = connectionString;
}
public object Clone()
{
return new DBSettings(DbType, ConnectionString);
}
}
}
+1 -5
View File
@@ -2,12 +2,8 @@
namespace Config
{
public class Data
public class Data : Users.GlobalData
{
/// Current user
public static IUser CurrentUser;
public static DateTime LastAuthorization = DateTime.Now;
public const string AdminUsername = "admin";
public const string AdminPassword = "staratura";
public const string SQLiteDbFName = "SQLite.db";
+10 -10
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Text;
@@ -15,18 +15,18 @@ namespace Config
// Public fields
public string BenchName;
public bool IsRealBench;
public DBSettings ProceduresDBSettings; /// Config database settings
public DBSettings WaterMetersDBSettings; /// Results database settings
public DBSettings UsersDBSettings; /// Users database settings
public Users.DBSettings ProceduresDBSettings; /// Config database settings
public Users.DBSettings WaterMetersDBSettings; /// Results database settings
public Users.DBSettings UsersDBSettings; /// Users database settings
// Constructor
public DatabaseSettings()
{
BenchName = String.Empty; /// Empty string (avoid null)
IsRealBench = false;
ProceduresDBSettings = new DBSettings(Entities.DBType.MySql, string.Empty);
WaterMetersDBSettings = new DBSettings(Entities.DBType.MySql, string.Empty);
UsersDBSettings = new DBSettings(Entities.DBType.MySql, string.Empty);
ProceduresDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
WaterMetersDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
UsersDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
}
public object Clone()
@@ -35,9 +35,9 @@ namespace Config
result.BenchName = BenchName;
result.IsRealBench = IsRealBench;
result.ProceduresDBSettings = (DBSettings)ProceduresDBSettings.Clone();
result.WaterMetersDBSettings = (DBSettings)WaterMetersDBSettings.Clone();
result.UsersDBSettings = (DBSettings)ProceduresDBSettings.Clone();
result.ProceduresDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
result.WaterMetersDBSettings = (Users.DBSettings)WaterMetersDBSettings.Clone();
result.UsersDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
return result;
}
+25 -3
View File
@@ -1,6 +1,9 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.IO;
namespace Config.Entities
{
public class ComponentProcedure
@@ -10,13 +13,32 @@ namespace Config.Entities
public virtual string Parameters { get; set; }
public virtual Procedure Procedure { get; set; }
public virtual ComponentProcedure Clone()
public virtual ComponentProcedure Clone(Procedure newProcedure)
{
ComponentProcedure result = new ComponentProcedure();
result.CmpntName = CmpntName;
result.Parameters = Parameters;
result.Procedure = Procedure;
result.Procedure = newProcedure;
return result;
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(CmpntName);
output.WriteLine(Parameters.Replace(Environment.NewLine, "~"));
}
public static ComponentProcedure Import(StreamReader input, Procedure newProcedure)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return null;
ComponentProcedure result = new ComponentProcedure();
result.CmpntName = firstLine;
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
result.Procedure = newProcedure;
return result;
}
}
}
+24 -2
View File
@@ -1,6 +1,9 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.IO;
namespace Config.Entities
{
public class ComponentTest
@@ -18,5 +21,24 @@ namespace Config.Entities
result.Test = Test;
return result;
}
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(CmpntName);
output.WriteLine(Parameters.Replace(Environment.NewLine, "~"));
}
public static ComponentTest Import(StreamReader input, Test newTest)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return null;
ComponentTest result = new ComponentTest();
result.CmpntName = firstLine;
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
result.Test = newTest;
return result;
}
}
}
+34 -28
View File
@@ -38,27 +38,10 @@ namespace Config.Entities
}
}
/// <summary> Identifies the type of a database </summary>
public enum DBType
{
MySql, /// MySQL database
SQLite, /// SQLite
DbTypesCount,
}
/// <summary> Identifies the database based on the content </summary>
public enum DBKind
{
Config,
Results,
Count,
}
public enum ProcedureState
{
Active,
History,
Template,
Count,
}
@@ -78,6 +61,7 @@ namespace Config.Entities
Compound,
HeatMeterVolume,
HeatMeterEnergy,
SingleOrCompound, /// Only used when querying results
}
public enum Medium
@@ -205,6 +189,26 @@ namespace Config.Entities
Count
}
public enum MassMethod : byte
{
#if LANG_DE
/// nemecky
[Description("Waage")] Scale,
[Description("Spanne")] Spread,
[Description("Standardabw.")] StdDev,
#elif LANG_CS
/// cesky
[Description("váhou")] Scale,
[Description("max.rozdíl")] Spread,
[Description("std.dev.")] StdDev,
#else
[Description("Scale")] Scale,
[Description("Spread")] Spread,
[Description("Std.dev.")] StdDev,
#endif
Count
}
public enum TestRedType
{
Fix,
@@ -222,10 +226,11 @@ namespace Config.Entities
public enum Progress
{
JustStarted,
TransitionBefore,
TransitionBefore,
SwitchingFlowDetection,
FlowSetting,
Test,
Aborted, /// Use as an argument when a test was aborted
Test,
TransitionAfter,
Completed,
Count,
@@ -247,6 +252,15 @@ namespace Config.Entities
public enum ItemCategory
{
#if LANG_DE
[Description("Allgemein")] Other,
[Description("Prüfstanddaten")] BenchData,
[Description("Prüfstandergebnisse")] BenchResult,
[Description("Prüfpunktdaten")] TestData,
[Description("Prüfpunktergebnisse")] TestResult,
[Description("Wasserzelledaten")] MeterData,
[Description("Wasserzelleergebnisse")] MeterResult,
#else
[Description("Other")] Other,
[Description("Bench data")] BenchData,
[Description("Bench result")] BenchResult,
@@ -254,6 +268,7 @@ namespace Config.Entities
[Description("Test result")] TestResult,
[Description("Meter data")] MeterData,
[Description("Meter result")] MeterResult,
#endif
Count,
}
@@ -338,14 +353,5 @@ namespace Config.Entities
#endif
Count
}
public enum LoginMethod
{
UserName, /// = alias, abbreviation
FullName, /// = description
Number,
Count
}
}
+12 -3
View File
@@ -1,8 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
namespace Config.Entities
{
@@ -11,5 +10,15 @@ namespace Config.Entities
public virtual int Id { get; protected set; }
public virtual int Gid { get; set; }
public virtual string Name { get; set; }
}
public Group()
{
}
public Group(int gid, string name)
{
Gid = gid;
Name = name;
}
}
}
+6 -6
View File
@@ -11,16 +11,16 @@ namespace Config.Entities
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 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 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; }
public virtual string Scale { get; set; }
public virtual string EmptyTankValve { get; set; } /// Not used anywhere
/// Valves
public virtual string ValvesOpen { get; set; }
@@ -54,7 +54,7 @@ namespace Config.Entities
result.StartValve = StartValve;
result.Diverter = Diverter;
result.TempDiv = TempDiv;
result.Balance = Balance;
result.Scale = Scale;
result.EmptyTankValve = EmptyTankValve;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
+72 -7
View File
@@ -3,6 +3,8 @@
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
@@ -40,9 +42,6 @@ namespace Config.Entities
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()
@@ -53,7 +52,7 @@ namespace Config.Entities
///
/// Default values
///
CreationUser = (Config.Data.CurrentUser != null) ? Config.Data.CurrentUser.UserName : null;
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
CreationTime = DateTime.Now;
LastChgUser = CreationUser;
LastChgTime = CreationTime;
@@ -96,11 +95,77 @@ namespace Config.Entities
result.TransitionStart = TransitionStart;
result.TransitionEnd = TransitionEnd;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); }
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
//result.MetrologicalClass = MetrologicalClass;
//result.WMType = WMType.Clone();
return result;
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Name);
output.WriteLine(Description);
output.WriteLine(CreationUser);
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
output.WriteLine(LastChgUser);
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
output.WriteLine(MetersKind.ToString());
output.WriteLine(Watermeters);
output.WriteLine(ProtocolTitle);
output.WriteLine(DataEntry);
output.WriteLine(ResultsPrinter);
output.WriteLine(ResultsWriter);
output.WriteLine(TransitionStart);
output.WriteLine(TransitionEnd);
foreach (var prms in MoreParams) { prms.Export(output); }
output.WriteLine();
foreach (var test in Tests) { test.Export(output); }
output.WriteLine();
output.Close();
}
public static Procedure Import(StreamReader input)
{
Procedure result = new Procedure();
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.Name = input.ReadLine();
result.Description = input.ReadLine();
result.CreationUser = input.ReadLine();
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.LastChgUser = input.ReadLine();
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
string line = input.ReadLine();
result.MetersKind = line.Equals(MetersKind.Single.ToString()) ? MetersKind.Single : (line.Equals(MetersKind.Combined.ToString()) ? MetersKind.Combined : MetersKind.HeatMeter);
result.Watermeters = input.ReadLine();
result.ProtocolTitle = input.ReadLine();
result.DataEntry = input.ReadLine();
result.ResultsPrinter = input.ReadLine();
result.ResultsWriter = input.ReadLine();
result.TransitionStart = input.ReadLine();
result.TransitionEnd = input.ReadLine();
while(true)
{
ComponentProcedure prms = ComponentProcedure.Import(input, result);
if (prms == null)
break;
else
result.MoreParams.Add(prms);
}
while (true)
{
Test tst = Test.Import(input, result);
if (tst == null)
break;
else
result.Tests.Add(tst);
}
return result;
}
+119 -28
View File
@@ -1,9 +1,10 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Author: Milan Hanajik
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
@@ -22,23 +23,23 @@ namespace Config.Entities
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 float TstTime { get; set; } /// Test time (estimate) 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 float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; }
public virtual bool Emptying { get; set; }
public virtual bool Draining { 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 MassRepeats { get; set; } /// Number of mass. measurements at the beginning/end of test, 0 = default (=5)
public virtual float MassSpread { get; set; } /// Max spread of mass. measurements at the beginning/end of test, 0 = default
public virtual bool MassMethod { get; set; } /// method of mass. measurement at the beginning/end of test: false=slow (precise), true=fast (immediate)
public virtual int TimeBeforeFlow { get; set; } /// Delay time before the start of flow control in [s]
public virtual int TimeFlow2Mass { get; set; } /// Delay time from the flow stable to the 1st mass measurement in [s]
public virtual int TimePump2StartV { get; set; }/// Delay time from the start of the pump to opening the start valve in [s]
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
public virtual double TolerRed { get; set; } /// = Filter
public virtual 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 MassRepeats { get; set; } /// Number of mass. measurements at the beginning/end of test, 0 = default (=5)
public virtual float MassSpread { get; set; } /// Max spread of mass. measurements at the beginning/end of test, 0 = default
public virtual MassMethod MassMethod { get; set; } /// method of mass. measurement at the beginning/end of test: false=slow (precise), true=using immediate mass measurement and evaluation
public virtual int TimeBeforeFlow { get; set; } /// Delay time before the start of flow control in [s]
public virtual int TimeFlow2Mass { get; set; } /// Delay time from the flow stable to the 1st mass measurement in [s]
public virtual int TimePump2StartV { get; set; } /// Delay time from the start of the pump to opening the start valve in [s]
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
public virtual double TolerRed { get; set; } /// = Filter
public virtual TestRedType RedType { get; set; }
public virtual string FeedingPath { get; set; }
public virtual string BenchPath { get; set; }
@@ -68,23 +69,23 @@ namespace Config.Entities
Publish = (sbyte)Config.Entities.Publish.Always;
Evaluate = true;
Repeats = 1;
Emptying = false;
Draining = false;
Zeroing = false;
ErrLimLo = -2.0f; /// [%] lower error limit
ErrLimHi = 2.0f; /// [%] upper error limit
ErrLimLo = -2.0f; /// [%] lower error limit
ErrLimHi = 2.0f; /// [%] upper error limit
Uncertainty = 0;
PumpPower = 60.0f; /// [%]
MassRepeats = 0; /// default
MassSpread = 0; /// default
MassMethod = false; /// default
TimeBeforeFlow = 10; /// [s] time before the start of flow control in [s]
TimeFlow2Mass = 5; /// [s] time from the flow stable to the 1st mass measurement in [s]
TimePump2StartV = 1; /// [s] time from the 1st mass measurement to the test start in [s]
TimeStop2Mass = 5; /// [s] between the test end and the final mass measurement
TolerRed = 0; /// = Filter parameter
RelTransBefore = string.Empty;
PumpPower = 60.0f; /// [%]
MassRepeats = 0; /// default
MassSpread = 0; /// default
MassMethod = MassMethod.Scale; /// default
TimeBeforeFlow = 10; /// [s] time before the start of flow control in [s]
TimeFlow2Mass = 5; /// [s] time from the flow stable to the 1st mass measurement in [s]
TimePump2StartV = 1; /// [s] time from the 1st mass measurement to the test start in [s]
TimeStop2Mass = 5; /// [s] between the test end and the final mass measurement
TolerRed = 0; /// = Filter parameter
RelTransBefore = string.Empty;
RelTransBetween = string.Empty;
RelTransAfter = string.Empty;
RelTransAfter = string.Empty;
TransitionAfter = string.Empty;
}
@@ -109,7 +110,7 @@ namespace Config.Entities
result.Volume = Volume;
result.TstTime = TstTime;
result.Repeats = Repeats;
result.Emptying = Emptying;
result.Draining = Draining;
result.Zeroing = Zeroing;
result.PumpPower = PumpPower;
result.MassRepeats = MassRepeats;
@@ -141,6 +142,96 @@ namespace Config.Entities
return result;
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(Name);
output.WriteLine(Part.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Publish.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Evaluate.ToString());
output.WriteLine(Qfrom.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Qto.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Volume.ToString(CultureInfo.InvariantCulture));
output.WriteLine(TstTime.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Method);
output.WriteLine(ErrLimLo.ToString(CultureInfo.InvariantCulture));
output.WriteLine(ErrLimHi.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Uncertainty.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Repeats.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Draining.ToString());
output.WriteLine(Zeroing.ToString());
output.WriteLine(PumpPower.ToString(CultureInfo.InvariantCulture));
output.WriteLine(MassRepeats.ToString(CultureInfo.InvariantCulture));
output.WriteLine(MassSpread.ToString(CultureInfo.InvariantCulture));
output.WriteLine(((byte)MassMethod).ToString(CultureInfo.InvariantCulture));
output.WriteLine(TimeBeforeFlow.ToString(CultureInfo.InvariantCulture));
output.WriteLine(TimeFlow2Mass.ToString(CultureInfo.InvariantCulture));
output.WriteLine(TimePump2StartV.ToString(CultureInfo.InvariantCulture));
output.WriteLine(TimeStop2Mass.ToString(CultureInfo.InvariantCulture));
output.WriteLine(FeedingPath);
output.WriteLine(BenchPath);
output.WriteLine(OutputPath);
output.WriteLine(MetersPath);
output.WriteLine(RelTransBefore);
output.WriteLine(RelTransBetween);
output.WriteLine(RelTransAfter);
output.WriteLine(TransitionAfter);
foreach (var prms in MoreParams) { prms.Export(output); }
output.WriteLine();
}
public static Test Import(StreamReader input, Procedure newProcedure)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return null;
Test tst = new Test();
tst.Name = firstLine;
tst.Part = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.Publish = sbyte.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.Evaluate = bool.Parse(input.ReadLine());
tst.Qfrom = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.Qto = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.Volume = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.TstTime = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.Method = input.ReadLine();
tst.ErrLimLo = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.ErrLimHi = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.Uncertainty = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.Repeats = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.Draining = bool.Parse(input.ReadLine());
tst.Zeroing = bool.Parse(input.ReadLine());
tst.PumpPower = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.MassRepeats = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.MassSpread = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.MassMethod = (MassMethod)byte.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.TimeBeforeFlow = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.TimeFlow2Mass = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.TimePump2StartV = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.TimeStop2Mass = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
tst.FeedingPath = input.ReadLine();
tst.BenchPath = input.ReadLine();
tst.OutputPath = input.ReadLine();
tst.MetersPath = input.ReadLine();
tst.RelTransBefore = input.ReadLine();
tst.RelTransBetween = input.ReadLine();
tst.RelTransAfter = input.ReadLine();
tst.TransitionAfter = input.ReadLine();
while (true)
{
ComponentTest prms = ComponentTest.Import(input, tst);
if (prms == null)
break;
else
tst.MoreParams.Add(prms);
}
tst.Procedure = newProcedure;
return tst;
}
public override string ToString()
{
string partStr = (Part > 0) ? string.Format(", part {0}", Part) : string.Empty;
+1 -1
View File
@@ -153,7 +153,7 @@ namespace Config.Entities
Volume = test.Volume;
TstTime = test.TstTime;
Repeats = test.Repeats;
Emptying = test.Emptying;
Emptying = test.Draining;
Zeroing = test.Zeroing;
PumpPower = PumpPower;
Time2MassMsrmt = test.TimeStop2Mass;
+12 -370
View File
@@ -1,20 +1,13 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Diagnostics;
using Config.Resources;
using log4net;
namespace Config.Entities
{
public class User : IUser
public class User
{
static readonly ILog log = LogManager.GetLogger(typeof(User));
public virtual int Id { get; protected set; }
public virtual string UserName { get; set; } /// = name, alias, abbreviation
public virtual string FullName { get; set; } /// = description
@@ -23,379 +16,28 @@ namespace Config.Entities
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; /// true for built-in users, power users have full access even with empty Groups list
public User()
{
this.powerUser = false;
Groups = new List<Group>();
#if ORACLE_DB
Number = 6;
#else
Number = 0;
#endif
}
public User(string userName, int number, bool powerUser)
{
UserName = userName;
Number = number;
this.powerUser = powerUser;
Groups = new List<Group>();
FullName = powerUser ? "Power user" : string.Empty;
}
public virtual void AddGroup(Group group)
{
Groups.Add(group);
}
/// ------------- Additional stuff not mapped into the database -------------
/// <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">User name</param>
/// <param name="password">Password</param>
/// <param name="requiredGrupMembership"></param>
/// <returns>true = authorized</returns>
public virtual bool Authorize(string userName, string password, Grp.GID requiredGroupMembership)
{
if (Entities.User.IsPowerUser(userName, password))
{
Data.CurrentUser = this;
Data.LastAuthorization = DateTime.Now;
log.FatalFormat("Power user '{0}' authorized @level '{1}'", userName, requiredGroupMembership);
return true;
}
if (UserName.ToLower() == userName.ToLower())
{
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
{
Data.CurrentUser = this;
Data.LastAuthorization = DateTime.Now;
log.FatalFormat("User '{0}' authorized @level '{1}'", userName, requiredGroupMembership);
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.
/// </summary>
public virtual bool Authorize(string userName, string password)
{
return Authorize(userName, password, Grp.GID.None);
}
/// <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="number">User ID number</param>
/// <param name="password">Password</param>
/// <param name="requiredGrupMembership"></param>
/// <returns>true = authorized</returns>
public virtual bool AuthorizeNumber(int number, string password, Grp.GID requiredGroupMembership)
{
if (Number == number)
{
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
{
Data.CurrentUser = this;
Data.LastAuthorization = DateTime.Now;
log.FatalFormat("User ID={0} authorized @level '{1}'", number, requiredGroupMembership);
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.
/// </summary>
public virtual bool AuthorizeNumber(int number, string password)
{
return AuthorizeNumber(number, password, Grp.GID.None);
}
/// <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="fullName"></param>
/// <param name="password"></param>
/// <param name="requiredGrupMembership"></param>
/// <returns>true = authorized</returns>
public virtual bool AuthorizeFullName(string fullName, string password, Grp.GID requiredGroupMembership)
{
if (FullName.ToLower() == fullName.ToLower())
{
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
{
Data.CurrentUser = this;
Data.LastAuthorization = DateTime.Now;
log.FatalFormat("User alias={0} authorized @level '{1}'", fullName, requiredGroupMembership);
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.
/// </summary>
public virtual bool AuthorizeFullName(string fullName, string password)
{
return AuthorizeFullName(fullName, 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.UserName = username;
Data.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(DBKind.Config, dbSettings, false)
.OpenSession()
.CreateQuery("FROM User WHERE LOWER(UserName) = :username") /// Note: QueryOver<User>().Where(x => x.UserName.ToLower() == ... does not work
.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.
/// Adds a group to the user.
/// </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)
/// <param name="group">Group to be added</param>
public virtual void AddGroup(Group group)
{
IList<User> listOfUsers = FluentCommon.CreateSession(DBKind.Config)
.CreateQuery("FROM User WHERE LOWER(UserName) = :username") /// Note: QueryOver<User>().Where(x => x.UserName.ToLower() == ... does not work
.SetParameter("username", userName.ToLower())
.List<User>();
if (listOfUsers.Count > 0) return listOfUsers[0];
return null;
}
/// <summary>
/// Returns a 'User' with a given full name from an ARBITRARY database.
/// </summary>
/// <param name="fullName">Full name for the query</param>
/// <returns>reference to a 'User' (if it exists) or null</returns>
public static User LoadUserByFullName(string fullName, Config.DBSettings dbSettings)
{
IList<User> listOfUsers = FluentCommon.CreateSessionFactory(DBKind.Config, dbSettings, false)
.OpenSession()
.CreateQuery("FROM User WHERE LOWER(Description) = :fullname") /// Note: QueryOver<User>().Where(x => x.FullName.ToLower() == ... does not work
.SetParameter("fullname", fullName.ToLower())
.List<User>();
if (listOfUsers.Count > 0) return listOfUsers[0];
return null;
Groups.Add(group);
}
/// <summary>
/// Returns a 'User' with a given full name from the users database.
/// Encrypts and sets users password.
/// </summary>
/// <param name="fullName">Full name for the query</param>
/// <returns>reference to a 'User' (if it exists) or null</returns>
public static User LoadUserByFullName(string fullName)
/// <param name="password">Unencrypted password</param>
public virtual void SetPassword(string password)
{
IList<User> listOfUsers = FluentCommon.CreateSession(DBKind.Config)
.CreateQuery("FROM User WHERE LOWER(Description) = :fullname") /// Note: QueryOver<User>().Where(x => x.FullName.ToLower() == ... does not work
.SetParameter("fullname", fullName.ToLower())
.List<User>();
if (listOfUsers.Count > 0) return listOfUsers[0];
return null;
Password = Users.Entities.User.getHash(password);
LastPwChange = DateTime.Now;
}
/// <summary>
/// Returns a 'User' with a given username from an ARBITRARY database.
/// </summary>
/// <param name="number">User ID number for the query</param>
/// <returns>reference to a 'User' (if it exists) or null</returns>
public static User LoadUserByNumber(int number, Config.DBSettings dbSettings)
{
IList<User> listOfUsers = FluentCommon.CreateSessionFactory(DBKind.Config, dbSettings, false)
.OpenSession()
.QueryOver<User>()
.Where(x => (x.Number == number))
.List();
if (listOfUsers.Count > 0) return listOfUsers[0];
return null;
}
/// <summary>
/// Returns a 'User' with a given username from the users database.
/// </summary>
/// <param name="number">User ID number for the query</param>
/// <returns>reference to a 'User' (if it exists) or null</returns>
public static User LoadUserByNumber(int number)
{
IList<User> listOfUsers = FluentCommon.CreateSession(DBKind.Config)
.QueryOver<User>()
.Where(x => (x.Number == number))
.List();
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(DBKind.Config)
.CreateQuery("FROM User")
.List<User>();
}
/// <summary>
/// Unauthorize, abandon current users authorization.
/// </summary>
public static void Unauthorize()
{
Data.CurrentUser = null;
Data.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 (userName.Equals("milan") && password.Equals("napajedla")) ||
(userName.Equals("igor") && password.Equals("ronko4")) ||
(userName.Equals("vlado") && password.Equals("luskovica.430")) ||
(userName.Equals("pakan") && password.Equals("kuriatko")) ||
(userName.Equals("evinic") && password.Equals("stivik55")) ||
(userName.Equals("gilles") && password.Equals("alibaba"));
}
}
}
}
+1 -1
View File
@@ -41,7 +41,7 @@ namespace Config.Entities
WMType procedure = new WMType()
{
CreateTime = DateTime.Now,
CreateUserName = Config.Data.CurrentUser.UserName,
CreateUserName = Users.GlobalData.CurrentUser.UserName,
CreateDescription = "A default water meter created.",
Name = "Watermeter",
PulseRate = 1000,
+1 -1
View File
@@ -29,7 +29,7 @@ namespace Config.Entities
/// </summary>
public static Watermeter LoadBySerialnr(string SerialNr)
{
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(DBKind.Results)
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(Users.Entities.DBKind.Results)
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
.SetParameter("SerialNrParameter", SerialNr)
.List<Watermeter>();
+30 -30
View File
@@ -17,61 +17,61 @@ namespace Config
/// <summary>
/// Session factories for regular sessions.
/// </summary>
public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)Entities.DBKind.Count];
public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)Users.Entities.DBKind.Count];
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
static ISessionFactory CreateSessionFactory(Entities.DBKind database)
static ISessionFactory CreateSessionFactory(Users.Entities.DBKind database)
{
Entities.DBType dbType;
Users.Entities.DBType dbType;
string connectionString;
switch (database)
{
default:
case Entities.DBKind.Config:
case Users.Entities.DBKind.Config:
dbType = Data.CurrentBench.ProceduresDBSettings.DbType;
connectionString = Data.CurrentBench.ProceduresDBSettings.ConnectionString;
break;
case Entities.DBKind.Results:
case Users.Entities.DBKind.Results:
dbType = Data.CurrentBench.WaterMetersDBSettings.DbType;
connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
break;
}
return CreateSessionFactory(database, new DBSettings(dbType, connectionString), false);
return CreateSessionFactory(database, dbType, connectionString, false);
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
public static ISessionFactory CreateSessionFactory(Entities.DBKind database, DBSettings dbSettings, bool createDB)
public static ISessionFactory CreateSessionFactory(Users.Entities.DBKind database, Users.Entities.DBType dbType, string connectionString, bool createDB)
{
try
{
FluentConfiguration cfg = Fluently.Configure();
switch (dbSettings.DbType)
switch (dbType)
{
default:
case Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(dbSettings.ConnectionString));
case Users.Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Entities.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(dbSettings.ConnectionString));
case Users.Entities.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
switch (database)
{
default:
case Entities.DBKind.Config:
case Users.Entities.DBKind.Config:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
case Entities.DBKind.Results:
case Users.Entities.DBKind.Results:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
}
@@ -112,17 +112,17 @@ namespace Config
}
/// Create a NHibernate session for the given database
public static ISession CreateSession(Entities.DBKind database)
public static ISession CreateSession(Users.Entities.DBKind database)
{
int ix = (int)database;
if (ix < 0 || ix >= (int)Entities.DBKind.Count) return null;
if (ix < 0 || ix >= (int)Users.Entities.DBKind.Count) return null;
if (SessionFactories[ix] == null) SessionFactories[ix] = CreateSessionFactory(database);
return SessionFactories[ix].OpenSession();
}
public static void SaveToDb(Entities.DBKind database, object obj)
public static void SaveToDb(Users.Entities.DBKind database, object obj)
{
SaveToDb(CreateSession(database), obj);
}
@@ -137,7 +137,7 @@ namespace Config
}
}
public static void DeleteFromDb(Entities.DBKind database, object obj)
public static void DeleteFromDb(Users.Entities.DBKind database, object obj)
{
DeleteFromDb(CreateSession(database), obj);
}
@@ -158,9 +158,9 @@ namespace Config
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyConfigDB(DBSettings dbSettings)
public static bool CreateEmptyConfigDB(Users.Entities.DBType dbType, string connectionString)
{
ISessionFactory sessionFactory = CreateSessionFactory(Entities.DBKind.Config, dbSettings, true);
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Config, dbType, connectionString, true);
if (sessionFactory == null) return false;
/// Populate the database
@@ -171,16 +171,16 @@ namespace Config
///
/// Prepare all groups
///
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 };
var testers = new Config.Entities.Group((int)Users.Grp.GID.Testers, Strings.Tester);
var testingSpecialists = new Config.Entities.Group((int)Users.Grp.GID.TestingSpecialists, Strings.Testing_Specialist);
var headOfLab = new Config.Entities.Group((int)Users.Grp.GID.HeadOfLab, Strings.Head_of_Lab);
var maintenanceSpecialists = new Config.Entities.Group((int)Users.Grp.GID.MaintenanceSpecialists, Strings.Maintenance_Specialist);
var metrologists = new Config.Entities.Group((int)Users.Grp.GID.Metrologists, Strings.Metrologist);
var calibrationSpecialists = new Config.Entities.Group((int)Users.Grp.GID.CalibrationSpecialists, Strings.Calibration_Specialist);
var administrators = new Config.Entities.Group((int)Users.Grp.GID.Administrators, Strings.Administrator);
/// Create the user 'admin' add his groups
var admin = new Entities.User
var admin = new Config.Entities.User
{
UserName = Data.AdminUsername,
FullName = Strings.Administrator,
@@ -214,9 +214,9 @@ namespace Config
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyResultsDB(DBSettings dbSettings)
public static bool CreateEmptyResultsDB(Users.Entities.DBType dbType, string connectionString)
{
ISessionFactory sessionFactory = CreateSessionFactory(Entities.DBKind.Results, dbSettings, true);
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Results, dbType, connectionString, true);
if (sessionFactory == null) return false;
/// Populate the database
+2 -1
View File
@@ -21,7 +21,8 @@ namespace Config.Mappings
Map(x => x.StartValve);
Map(x => x.Diverter);
Map(x => x.TempDiv);
Map(x => x.Balance);
Map(x => x.Scale)
.Column("Balance");
Map(x => x.EmptyTankValve);
Map(x => x.ValvesOpen)
.CustomType("StringClob")
+4 -2
View File
@@ -22,12 +22,14 @@ namespace Config.Mappings
Map(x => x.Volume);
Map(x => x.TstTime);
Map(x => x.Repeats);
Map(x => x.Emptying);
Map(x => x.Draining)
.Column("Emptying");
Map(x => x.Zeroing);
Map(x => x.PumpPower);
Map(x => x.MassRepeats);
Map(x => x.MassSpread);
Map(x => x.MassMethod);
Map(x => x.MassMethod)
.CustomType<byte>();
Map(x => x.TimeBeforeFlow);
Map(x => x.TimeFlow2Mass);
Map(x => x.TimePump2StartV)
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.12.475.0")]
[assembly: AssemblyFileVersion("2.12.475.0")]
[assembly: AssemblyVersion("2.12.556.0")]
[assembly: AssemblyFileVersion("2.12.556.0")]
-6
View File
@@ -265,7 +265,6 @@ namespace DeviceTest
{
radioButton1.Text = "SetTemperature(10)";
radioButton2.Text = "SetTemperature(20)";
radioButton3.Text = "SetTemperature(30)";
}
else if (className == "Modbus.TankSelector")
{
@@ -286,7 +285,6 @@ namespace DeviceTest
{
radioButton21.Text = "SetTemperature(10)";
radioButton22.Text = "SetTemperature(20)";
radioButton23.Text = "SetTemperature(30)";
}
else if (className == "Modbus.TankSelector")
{
@@ -307,7 +305,6 @@ namespace DeviceTest
{
radioButton31.Text = "SetTemperature(10)";
radioButton32.Text = "SetTemperature(20)";
radioButton33.Text = "SetTemperature(30)";
}
else if (className == "Modbus.TankSelector")
{
@@ -659,7 +656,6 @@ namespace DeviceTest
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(30);
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
@@ -687,7 +683,6 @@ namespace DeviceTest
{
operation21 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation23 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(30);
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
@@ -715,7 +710,6 @@ namespace DeviceTest
{
operation31 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation33 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(30);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
+39 -4
View File
@@ -30,9 +30,9 @@ namespace Results
}
/// <summary> Database type (MySQL or SQLite) for all sessions </summary>
private static Config.Entities.DBType dbType;
private static Users.Entities.DBType dbType;
///
public static Config.Entities.DBType DbType
public static Users.Entities.DBType DbType
{
get { return dbType; }
set { dbType = value; SessionFactory = null; }
@@ -59,10 +59,10 @@ namespace Results
switch (dbType)
{
default:
case Config.Entities.DBType.SQLite:
case Users.Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Config.Entities.DBType.MySql:
case Users.Entities.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
@@ -270,5 +270,40 @@ namespace Results
return true;
}
public static Batch LoadBatch(int batchNr)
{
IList<Batch> batches;
ISession session = DB.CreateSession();
if (session == null) return null;
TestDataList = session.QueryOver<TestData>().List();
ComponentsList = session.QueryOver<Components>().List();
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
try
{
batches = session.QueryOver<Batch>()
.Where(x => (x.BatchNr == batchNr))
.List();
foreach (var batch in batches)
{
batch.TestRslts = session.QueryOver<TestRslt>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
batch.WaterMeters = session.QueryOver<WaterMeter>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
}
}
catch (Exception exc)
{
log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message);
return null;
}
return (batches.Count > 0) ? batches[0] : null;
}
}
}
+63
View File
@@ -0,0 +1,63 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using log4net;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using Results.Entities;
namespace Results
{
public class DBase
{
static readonly ILog log = LogManager.GetLogger(typeof(DBase));
/// <summary> Session factory for all regular sessions, not for CreateEmptyResultsDB(). </summary>
public static IList<DBase> Databases;
public static int Count { get { return Databases.Count; } }
static DBase()
{
Databases = new List<DBase>();
}
public readonly string Name;
public readonly string ConnectionString;
ISessionFactory sessionFactory;
public DBase(string connectionString, string name)
{
this.ConnectionString = connectionString;
this.Name = name;
sessionFactory = Fluently.Configure()
.Database(MySQLConfiguration.Standard.ConnectionString(connectionString))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.WaterMeterData>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}
public DBase(string connectionString)
: this(connectionString, string.Empty)
{
}
private void BuildSchema(Configuration config)
{
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
new SchemaExport(config).SetOutputFile("db_schema");
}
public ISession OpenSession()
{
return sessionFactory.OpenSession();
}
}
}
+19
View File
@@ -89,5 +89,24 @@ namespace Results.Entities
TestRslt = testRslt;
CompoundMeterId = (byte)compoundMeterId;
}
public virtual void CopyContentFrom(MeterTestRslt src)
{
if (src == null) return;
PulsesMeter = src.PulsesMeter;
PulsesMaster = src.PulsesMaster;
PulsesPerLiter = src.PulsesPerLiter;
VolumeStart = src.VolumeStart;
VolumeEnd = src.VolumeEnd;
VolumeMeter = src.VolumeMeter;
VolumeRef = src.VolumeRef;
TimestampStart = src.TimestampStart;
TimestampEnd = src.TimestampEnd;
TestTime = src.TestTime;
Error = src.Error;
TestDone = src.TestDone;
Passed = src.Passed;
}
}
}
+91 -3
View File
@@ -14,12 +14,12 @@ namespace Results.Entities
public virtual TestData TestData { get; set; }
public virtual Components Components { get; set; }
public virtual int Part { get; set; }
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
/// Main results
public virtual DateTime StartTime { get; set; } /// Date and time of the test start
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
public virtual double PulsesMaster { get; set; }
public virtual double ConstMaster { get; set; } /// [pls/l] Pulses per liter master flow meter
@@ -104,7 +104,7 @@ namespace Results.Entities
/// Wrappers
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
public virtual int Repeats() { return TestData.Repeats; }
public virtual int Repeats() { return TestData.Repeats; }
public virtual double Qfrom() { return TestData.Qfrom; }
public virtual double Qto() { return TestData.Qto; }
public virtual double TargetVolume() { return TestData.TargetVolume; }
@@ -130,6 +130,94 @@ namespace Results.Entities
RepetitionNr = repetitionNr;
}
public virtual void CopyContentFrom(TestRslt src)
{
if (src == null) return;
Components = src.Components; /// ???
Part = src.Part;
RepetitionNr = src.RepetitionNr;
StartTime = src.StartTime;
EndTime = src.EndTime;
FlowSetTime = src.FlowSetTime;
TestTime = src.TestTime;
PulsesMaster = src.PulsesMaster;
ConstMaster = src.ConstMaster;
MassStartRaw = src.MassStartRaw;
MassStart = src.MassStart;
MassEndRaw = src.MassEndRaw;
MassEnd = src.MassEnd;
DensityIn = src.DensityIn;
DensityOut = src.DensityOut;
DensityDiv = src.DensityDiv;
Buoyancy = src.Buoyancy;
FlowMass = src.FlowMass;
FlowVolume = src.FlowVolume;
VolumeCTV = src.VolumeCTV;
VolumeMaster = src.VolumeMaster;
ErrorMaster = src.ErrorMaster;
RefEnergy = src.RefEnergy;
AmbTempMean = src.AmbTempMean;
AmbTempStart = src.AmbTempStart;
AmbTempEnd = src.AmbTempEnd;
AmbTempMin = src.AmbTempMin;
AmbTempMax = src.AmbTempMax;
AmbPressMean = src.AmbPressMean;
AmbPressStart = src.AmbPressStart;
AmbPressEnd = src.AmbPressEnd;
AmbPressMin = src.AmbPressMin;
AmbPressMax = src.AmbPressMax;
AmbHumiMean = src.AmbHumiMean;
AmbHumiStart = src.AmbHumiStart;
AmbHumiEnd = src.AmbHumiEnd;
AmbHumiMin = src.AmbHumiMin;
AmbHumiMax = src.AmbHumiMax;
PressUpMean = src.PressUpMean;
PressUpStart = src.PressUpStart;
PressUpEnd = src.PressUpEnd;
PressUpMin = src.PressUpMin;
PressUpMax = src.PressUpMax;
PressDownMean = src.PressDownMean;
PressDownStart = src.PressDownStart;
PressDownEnd = src.PressDownEnd;
PressDownMin = src.PressDownMin;
PressDownMax = src.PressDownMax;
PressDeltaMean = src.PressDeltaMean;
PressDeltaStart = src.PressDeltaStart;
PressDeltaEnd = src.PressDeltaEnd;
PressDeltaMin = src.PressDeltaMin;
PressDeltaMax = src.PressDeltaMax;
TempUpMean = src.TempUpMean;
TempUpStart = src.TempUpStart;
TempUpEnd = src.TempUpEnd;
TempUpMin = src.TempUpMin;
TempUpMax = src.TempUpMax;
TempDownMean = src.TempDownMean;
TempDownStart = src.TempDownStart;
TempDownEnd = src.TempDownEnd;
TempDownMin = src.TempDownMin;
TempDownMax = src.TempDownMax;
TempDivMean = src.TempDivMean;
TempDivStart = src.TempDivStart;
TempDivEnd = src.TempDivEnd;
TempDivMin = src.TempDivMin;
TempDivMax = src.TempDivMax;
FlowStart = src.FlowStart;
FlowEnd = src.FlowEnd;
FlowMin = src.FlowMin;
FlowMax = src.FlowMax;
Custom1 = src.Custom1;
Custom2 = src.Custom2;
Custom3 = src.Custom3;
Custom4 = src.Custom4;
Custom5 = src.Custom5;
Custom6 = src.Custom6;
Custom7 = src.Custom7;
Custom8 = src.Custom8;
Custom9 = src.Custom9;
Custom10 = src.Custom10;
}
public override string ToString()
{
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", Batch.BatchNr, Batch.ProcedureName, Name(), StartTime.ToShortDateString(), StartTime.ToShortTimeString());
+77 -6
View File
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Config.Entities;
@@ -27,11 +26,15 @@ namespace Results.Entities
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
public virtual double Q2ErrWOCorrection { get; set; }
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
public virtual double Q2Correction { get; set; } /// iPerl Q2 correction used during the test
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
public virtual double Q2Correction { get; set; } /// !!! obsolete
public virtual int Q2CorrRFlow { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
public virtual int Q2CorrLFlow { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
public virtual double Diff2Hz8Hz { get; set; }
public virtual bool Hz2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
public virtual int Hz2Correction { get; set; } /// iPerl Q2 correction used during the test
#endif
#if ORACLE_DB
public virtual int Pruefindex { get; set; } /// Not mapped to DB !!! 0=unknown (saving to Oracle failed), >=1 ... pruefindex
public virtual int HydrPruefung { get; set; } /// Not mapped to DB !!!
#endif
@@ -84,6 +87,17 @@ namespace Results.Entities
return passed;
}
public virtual string PassedColorStr()
{
#if PUCHONG_PT200
return Passed ? "OK|Green" : "NG|Red";
#else
return Passed ? "OK|Green" : "NOK|Red";
#endif
}
///
/// Not mapped to the database
///
@@ -92,7 +106,7 @@ namespace Results.Entities
public virtual MeterTestRslt GetMeterTestRslt(string testName)
{
return GetMeterTestRslt(testName, CompoundMeterId.Single);
return GetMeterTestRslt(testName, CompoundMeterId.SingleOrCompound);
}
public virtual MeterTestRslt GetMeterTestRslt(string testName, Config.Entities.CompoundMeterId meterId)
@@ -101,9 +115,22 @@ namespace Results.Entities
string testNameL = testName.ToLower();
foreach (var mtr in MeterTestRslts)
{
if ((mtr.CompoundMeterId == (byte)meterId) && mtr.Name().ToLower().Equals(testNameL))
if (mtr.Name().ToLower().Equals(testNameL))
{
return mtr;
if (mtr.CompoundMeterId == (byte)meterId)
{
return mtr;
}
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.Single)
{
return mtr;
}
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.Compound)
{
return mtr;
}
}
}
return null;
@@ -127,6 +154,50 @@ namespace Results.Entities
}
public virtual void CopyContentFrom(WaterMeter src)
{
if (src == null) return;
SerialNr = src.SerialNr;
SerialNrAux = src.SerialNrAux;
PurchaseOrder = src.PurchaseOrder;
YearOfProduction = src.YearOfProduction;
// WMPosition skipped
EndState = src.EndState;
EndStateAux = src.EndStateAux;
QRise = src.QRise;
QFall = src.QFall;
Passed = src.Passed;
ResultCode = src.ResultCode;
#if IPERL
SerialNrEx = src.SerialNrEx;
OrigCalibFactor = src.OrigCalibFactor;
CalibFactor = src.CalibFactor;
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
Q2CorrectionDone = src.Q2CorrectionDone;
Q2Correction = src.Q2Correction;
Q2CorrRFlow = src.Q2CorrRFlow;
Q2CorrLFlow = src.Q2CorrLFlow;
Q2CorrFlowRight = src.Q2CorrFlowRight;
Diff2Hz8Hz = src.Diff2Hz8Hz;
Hz2CorrectionDone = src.Hz2CorrectionDone;
Hz2Correction = src.Hz2Correction;
#endif
#if ORACLE_DB
Pruefindex = src.Pruefindex;
HydrPruefung = src.HydrPruefung;
#endif
foreach (var mtr in MeterTestRslts)
{
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (Config.Entities.CompoundMeterId)mtr.CompoundMeterId);
if (srcMtr != null)
{
mtr.CopyContentFrom(srcMtr);
mtr.TestRslt.CopyContentFrom(srcMtr.TestRslt);
}
}
}
public override string ToString()
{
StringBuilder sb = new StringBuilder(80);
+5 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
/// Copyright (c) 2016-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -49,12 +49,12 @@ namespace Results.Entities
public virtual bool Compound { get; set; }
public virtual bool HeatMeter { get; set; }
#if IPERL
#if ORACLE_DB
public virtual int WMTypeId { get; set; }
public virtual int WMTypeRev { get; set; }
#endif
public WaterMeterData()
public WaterMeterData()
{
}
@@ -103,11 +103,11 @@ namespace Results.Entities
if (Compound != wmd.Compound) return false;
if (HeatMeter != wmd.HeatMeter) return false;
#if IPERL
#if ORACLE_DB
if (WMTypeId != wmd.WMTypeId) return false;
if (WMTypeRev != wmd.WMTypeRev) return false;
#endif
return true;
return true;
}
+5
View File
@@ -59,7 +59,12 @@ namespace Results.Forms
{
Text = Strings.Configuration;
availableResultsLabel.Text = Strings.Available_results;
availableTabControl.TabPages[0].Text = "A...Z";
availableTabControl.TabPages[1].Text = Strings.Quantity;
availableTabControl.TabPages[2].Text = Strings.Category;
selectedResultsLabel.Text = Strings.Selected_results;
addButton.Text = Strings.Add;
removeButton.Text = Strings.Remove;
removeAllButton.Text = Strings.Remove_all;
+18 -1
View File
@@ -102,7 +102,24 @@ namespace Results
Start_volume_aux, /// 92
End_volume, /// 93
End_volume_main, /// 94
End_volume_aux, /// 95
End_volume_aux, /// 95
Error_main, /// 96
Error_aux, /// 97
Serial_Nr_main, /// 98
Serial_Nr_aux, /// 99
End_state_main, /// 100
End_state_aux, /// 101
Q_rise, /// 102
Q_fall, /// 103
OrigCalibFactor, /// 104
CalibFactor, /// 105
Q2ErrWOCorrection, /// 106
Q2CorrectionDone, /// 107
Q2CorrRFlow, /// 108
Q2CorrLFlow, /// 109
Q2CorrFlowRight, /// 110
Count,
}
}
+2 -2
View File
@@ -49,10 +49,10 @@ namespace Results.Mappings
#if HEAT_METER_SUPPORT
Map(x => x.HeatMeter);
#endif
#if IPERL
#if ORACLE_DB
Map(x => x.WMTypeId);
Map(x => x.WMTypeRev);
#endif
}
}
}
}
+3 -1
View File
@@ -30,7 +30,9 @@ namespace Results.Mappings
Map(x => x.Q2ErrWOCorrection);
Map(x => x.Q2CorrectionDone);
Map(x => x.Q2Correction);
Map(x => x.Q2CorrFlowRight);
Map(x => x.Q2CorrRFlow);
Map(x => x.Q2CorrLFlow);
Map(x => x.Q2CorrFlowRight);
Map(x => x.Diff2Hz8Hz);
Map(x => x.Hz2CorrectionDone);
Map(x => x.Hz2Correction);
@@ -0,0 +1,342 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using Results.Resources;
namespace Results.Output.Printers.Enhanced
{
public class EnhancedPrintDocument : PrintDocument
{
const string FontFamilyName = "Arial"; //"Times New Roman";
const int SpacingOne = 18;
const int SpacingOneAndHalf = (3 * SpacingOne) / 2;
readonly int topMargin;
readonly int bottomMargin;
readonly int leftMargin;
readonly int TitleX;
readonly int TitleY; /// Depends on the size of the header
readonly int HdrTop; /// = TitleY + 60
readonly int BodyTop; /// = HdrTop + 160
/// Size of the printed area without margins, after taking into account 'pageOrientation'
int printHeight;
int printWidth;
/// <summary>
/// Property variable for the Font the user wishes to use
/// </summary>
Font font;
Font boldFont;
Font titleFont;
///
/// Data to print
///
Results.Entities.Batch batch;
///
/// Items to print
///
string header;
IList<WMeterRsltItemSpec> commonItems;
IList<WMeterRsltItemSpec> testItems;
string footer;
///
/// Layout and status
///
int nrWMsOnFirstPage;
int nrWMsOnNextPage;
int nextWMNr; /// nr. of watermeter to be printed as the first one on the next page
int nrPages;
int pageNr; /// Page number to be printed at the bottom of the page
/// <summary>
/// Constructor
/// </summary>
/// <param name="textToPrint">Text to be printed</param>
public EnhancedPrintDocument(Results.Entities.Batch batch,
PageOrientation pageOrientation,
int topMargin,
int bottomMargin,
int leftMargin,
string header,
IList<WMeterRsltItemSpec> commonItems,
IList<WMeterRsltItemSpec> testItems,
string footer)
{
this.batch = batch;
this.topMargin = topMargin;
this.bottomMargin = bottomMargin;
this.leftMargin = leftMargin;
this.header = header;
this.commonItems = commonItems;
this.testItems = testItems;
this.footer = footer;
TitleX = leftMargin;
TitleY = topMargin; /// Depends on the size of the header
HdrTop = TitleY + 60;
BodyTop = HdrTop + 160;
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
/// Set print area size and margins (in dots using 100 dpi)
if (DefaultPageSettings.Landscape)
{
printHeight = base.DefaultPageSettings.PaperSize.Width - topMargin - bottomMargin;
printWidth = base.DefaultPageSettings.PaperSize.Height - leftMargin - leftMargin;
}
else
{
printHeight = base.DefaultPageSettings.PaperSize.Height - topMargin - bottomMargin;
printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
}
int testsCount = 0;
if (batch.WaterMeters.Count > 0)
{
foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
{
if (mtr.Publish() == Config.Entities.Publish.Always) testsCount++;
}
}
if (batch.WaterMeters.Count > 0 && batch.WaterMeters[0].Compound()) testsCount /= 3;
int wmSectionHeight = (testsCount + 4) * SpacingOne;
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
pageNr = 1;
nextWMNr = 0;
}
/// <summary>
/// Override the default onbeginPrint method of the PrintDocument Object
/// </summary>
/// <param name=e></param>
/// <remarks></remarks>
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
{
base.OnBeginPrint(e);
if (font == null) { font = new Font(FontFamilyName, 10, FontStyle.Regular); }
if (boldFont == null) { boldFont = new Font(FontFamilyName, 10, FontStyle.Bold); }
if (titleFont == null) { titleFont = new Font(FontFamilyName, 18, FontStyle.Bold); }
}
/// <summary>
/// Override the default OnPrintPage method of the PrintDocument.
/// </summary>
/// <param name=e></param>
/// <remarks>This provides the print logic for our document</remarks>
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
{
/// Run base code
base.OnPrintPage(e);
if (File.Exists("C:\\TBF\\header.png"))
{
Image img = Image.FromFile("C:\\TBF\\header.png");
e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, 827, 1169));
}
/// Use the StringFormat class for the text layout of our document
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
if (pageNr == 1)
{
///----------
/// Header
///----------
RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, 40);
e.Graphics.DrawString(header, titleFont, Brushes.Black, printArea);
///----------------
/// Common items
///----------------
string[] leftColumn = new string[commonItems.Count];
string[] rightColumn = new string[commonItems.Count];
int cnt = 0;
foreach (var v in commonItems)
{
leftColumn[cnt] = v.Caption;
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
cnt++;
}
/// Determine max. left column width in characters
int maxLen = 0;
foreach (var s in leftColumn) if (s.Length > maxLen) maxLen = s.Length;
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
PrintAt(e, leftMargin, HdrTop + SpacingOne * i, leftColumn[i]);
PrintAt(e, 300, HdrTop + SpacingOne * i, rightColumn[i]);
}
}
///--------
/// Body
///--------
/// This variable represents the top coordinate of the area where WM results are printed
/// and it is updated (increased by) the value returned by PrintXyzWM() - the section size.
int nextWmTop = (pageNr == 1) ? BodyTop : TitleY;
int nrWMsOnPage = (pageNr == 1) ? nrWMsOnFirstPage : nrWMsOnNextPage;
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
{
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop);
}
nextWMNr += nrWMsOnPage;
e.HasMorePages = (nextWMNr < batch.WaterMeters.Count);
///----------
/// Footer
///----------
int footerWidth = (int)e.Graphics.MeasureString(footer, font).Width;
PrintAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * SpacingOne, footer);
string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
int pageNrWidth = (int)e.Graphics.MeasureString(pageNrText, font).Width;
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - SpacingOne, pageNrText);
}
/// <summary>
/// Print one water meter results
/// </summary>
/// <param name="wm">Water meter</param>
/// <param name="printedWMNr">Number of the water meter printed</param>
/// <param name="top">Top coordinate of watermeter data</param>
/// <returns>The height of the printed section</returns>
int PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
Results.Entities.WaterMeter wm, int printedWMNr, int top)
{
/// Determin column widths
float[] columnPos = new float[testItems.Count + 1];
columnPos[0] = (float)leftMargin;
for (int i = 0; i < testItems.Count; i++)
{
float columnWidth = e.Graphics.MeasureString(testItems[i].Caption, font).Width;
foreach (var mtr in wm.MeterTestRslts)
{
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
{
string itemText = testItems[i].Print(wm, mtr.Name());
/// Strip color information
string[] texts = itemText.Split(new char[] { '|' });
if (texts.Length == 2) { itemText = texts[0]; }
float width = e.Graphics.MeasureString(itemText, font).Width;
if (width > columnWidth) columnWidth = width;
}
}
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
}
int tableLeftX = (int)columnPos[0];
int tableRightX = (int)columnPos[testItems.Count] - 20;
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
PrintAt(e, leftMargin, top, wmText);
if (!string.IsNullOrEmpty(wm.SerialNr))
{
PrintAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, font).Width, top,
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
}
/// Horizontal line
int horY = top + 25;
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
for (int i = 0; i < testItems.Count; i++)
{
PrintAt(e, (int)columnPos[i], top + 27, testItems[i].Caption);
}
/// Horizontal line
horY = top + 27 + SpacingOne;
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
int testsCount = 0;
foreach (var mtr in wm.MeterTestRslts)
{
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
{
testsCount++;
for (int i = 0; i < testItems.Count; i++)
{
string itemText = testItems[i].Print(wm, mtr.Name());
/// Strip color information
string[] texts = itemText.Split(new char[] { '|' });
if (texts.Length == 2)
{
itemText = texts[0];
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
/// TODO: How to print colors?
}
PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText);
}
}
}
/// Horizontal line
horY = top + 30 + SpacingOne * (testsCount + 1);
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
return (testsCount + 4) * SpacingOne;
}
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
{
PrintAt(e, p.X, p.Y, text);
}
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
}
void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
{
PrintBoldAt(e, p.X, p.Y, text);
}
void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea);
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2016-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -111,10 +111,11 @@ namespace Results.Output.Printers.Munich
/// <remarks>This provides the print logic for our document</remarks>
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
{
// Run base code
/// Run base code
base.OnPrintPage(e);
e.Graphics.DrawImageUnscaled(Results.Properties.Resources.Headpic, 0, 0);
/// Draw 2550 x 3507 'headpic' scaled to A4 at 100 DPI
e.Graphics.DrawImage(Results.Properties.Resources.Headpic, new Rectangle(0, 0, 827, 1137));
/// Set print area size and margins (in dots using 80 dpi)
int printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
@@ -240,7 +241,7 @@ namespace Results.Output.Printers.Munich
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbientHumiAve().ToString("F0") + " %");
lineNr++;
PrintAt(e, Tab1, lineNr * SpacingOne, "Luftdruck");
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbientPressAve().ToString("F0") + " mbar");
PrintAt(e, Tab2, lineNr * SpacingOne, Config.Units.ConvertTo(Config.Unit.mbar, wm.Batch.AmbientPressAve()).ToString("F0") + " mbar");
lineNr++;
PrintAt(e, Tab3, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.12.475.0")]
[assembly: AssemblyFileVersion("2.12.475.0")]
[assembly: AssemblyVersion("2.12.561.0")]
[assembly: AssemblyFileVersion("2.12.561.0")]
+27
View File
@@ -132,6 +132,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Category.
/// </summary>
internal static string Category {
get {
return ResourceManager.GetString("Category", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Compound.
/// </summary>
@@ -609,6 +618,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Quantity.
/// </summary>
internal static string Quantity {
get {
return ResourceManager.GetString("Quantity", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ref.pulses.
/// </summary>
@@ -951,6 +969,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Water Meter.
/// </summary>
internal static string Water_Meter {
get {
return ResourceManager.GetString("Water_Meter", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Width.
/// </summary>
+15
View File
@@ -189,4 +189,19 @@
<data name="Page" xml:space="preserve">
<value>str.</value>
</data>
<data name="Category" xml:space="preserve">
<value>Kategorie</value>
</data>
<data name="Quantity" xml:space="preserve">
<value>Veličina</value>
</data>
<data name="sn" xml:space="preserve">
<value>sériové číslo</value>
</data>
<data name="Water_Meter" xml:space="preserve">
<value>Vodoměr</value>
</data>
<data name="Batch_nr" xml:space="preserve">
<value>Číslo dávky</value>
</data>
</root>
+12
View File
@@ -375,4 +375,16 @@
<data name="Single" xml:space="preserve">
<value>Einzel</value>
</data>
<data name="Category" xml:space="preserve">
<value>Kategorie</value>
</data>
<data name="Quantity" xml:space="preserve">
<value>Größe</value>
</data>
<data name="Page" xml:space="preserve">
<value>Blz.</value>
</data>
<data name="Water_Meter" xml:space="preserve">
<value>Wasserzähler</value>
</data>
</root>
+9
View File
@@ -426,4 +426,13 @@
<data name="Start_mass" xml:space="preserve">
<value>Start mass</value>
</data>
<data name="Category" xml:space="preserve">
<value>Category</value>
</data>
<data name="Quantity" xml:space="preserve">
<value>Quantity</value>
</data>
<data name="Water_Meter" xml:space="preserve">
<value>Water Meter</value>
</data>
</root>
+10 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -59,6 +59,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BatchResults.cs" />
<Compile Include="DBase.cs" />
<Compile Include="Entities\Batch.cs" />
<Compile Include="Entities\Components.cs" />
<Compile Include="Entities\MeterTestRslt.cs" />
@@ -93,6 +94,9 @@
<Compile Include="Output\Printers\Cevak\PrintDocumentCevak.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Enhanced\EnhancedPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Munich\MunichPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
@@ -116,6 +120,10 @@
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
<Name>Users</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="FileWriters\" />
+2 -2
View File
@@ -33,10 +33,10 @@ namespace Results
/// <summary>
/// Converts float number to a string with the specified number of valid digits
/// Converts float number to a string with the specified number of significant 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>
/// <param name="validDigits">Number of significant digits: 4, 3, or 2 (otherwise a full precision number is printed)</param>
/// <returns>String representation of the float number</returns>
public static string DoubleToStr(double value, int validDigits)
{
+25 -11
View File
@@ -168,7 +168,7 @@ namespace Results
#else
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, Strings.Error + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
#endif
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result + "()", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result + "()", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr() : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr())));
/// Water meter info
AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeter_type, Strings.WM_Type, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.ProductName));
@@ -217,18 +217,20 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndState));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PulsesMeter.ToString()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses__liter, Strings.PulsesLiter + "()", Quantity.PulsePerLtr, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t).PulsesPerLiter.ToString()
: w.GetMeterTestRslt(t).PulsesPerLiter.ToString(p))));
: w.GetMeterTestRslt(t).PulsesPerLiter.ToString(p))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses, Strings.RefPulses + "()", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PulsesMaster.ToString()));
/// Water meters results (combined)
//AllItems.Add(new ItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (z.QRise() == 0) ? "-" : Utils.DoubleToStr(z.QRise(), 4)));
//AllItems.Add(new ItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (z.QFall() == 0) ? "-" : Utils.DoubleToStr(z.QFall(), 4)));
//AllItems.Add(new ItemSpec("Error large WM", "Error-L [%]", null, (x, y, z) => x.Error.ToString("F2")));
//AllItems.Add(new ItemSpec("Error small WM", "Error-S [%]", null, (x, y, z) => y.Error.ToString("F2")));
//AllItems.Add(new ItemSpec("Serial Nr large WM", "s/n", null, (x, y, z) => x.SerialNr()));
//AllItems.Add(new ItemSpec("Serial Nr small WM", "s/n", null, (x, y, z) => y.SerialNr()));
//AllItems.Add(new ItemSpec("End state large WM", "End state", null, (x, y, z) => x.EndState()));
//AllItems.Add(new ItemSpec("End state small WM", "End state", null, (x, y, z) => y.EndState()));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_rise, Strings.Q_rise, Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (w.QRise == 0) ? "-" : Utils.DoubleToStr(w.QRise, 4)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_fall, Strings.Q_fall, Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (w.QFall == 0) ? "-" : Utils.DoubleToStr(w.QFall, 4)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : (string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error.ToString()
: w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error.ToString(p))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : (string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error.ToString()
: w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error.ToString(p))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_main, Strings.sn_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNr));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_aux, Strings.sn_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNrAux));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_main, Strings.EndState_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndState));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_aux, Strings.EndState_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndStateAux));
/// Batch info
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_bench_ID, Strings.Bench, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.TestBenchId.ToString()));
@@ -267,7 +269,17 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.TempLoEnd, "T lo en", Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).Custom8).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.TempLoAve, "T lo av", Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).Custom7 + w.GetTestRslt(t).Custom8) / 2).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
#endif
}
#if IPERL
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.OrigCalibFactor.ToString())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.CalibFactor.ToString())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2ErrWOCorrection.ToString(string.IsNullOrEmpty(p) ? "F2" : p))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? "yes" : "no")));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrRFlow.ToString())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrLFlow.ToString())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrFlowRight.ToString())));
#endif
}
/// <summary>
/// Converts a list of 'Output item specifications' to a string array
@@ -359,6 +371,7 @@ namespace Results
if (!added)
{
WMeterRsltItemSpec item = GetItem(0);
item.Caption = "Prs.Err.";
item.Format = string.Format("Parse error: {0}", strArray[i]);
result.Add(item);
}
@@ -367,6 +380,7 @@ namespace Results
catch
{
WMeterRsltItemSpec item = GetItem(0);
item.Caption = "Prs.Err.";
item.Format = string.Format("Parse error: {0}", strArray[i]);
result.Add(item);
}
+202 -156
View File
@@ -28,162 +28,204 @@
/// </summary>
private void InitializeComponent()
{
this.connectionStringTextBox1 = new System.Windows.Forms.TextBox();
this.benchNameLabel = new System.Windows.Forms.Label();
this.connectionStringLabel = new System.Windows.Forms.Label();
this.connectionStringTextBox2 = new System.Windows.Forms.TextBox();
this.connectionStringTextBox3 = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.benchNameTextBox1 = new System.Windows.Forms.TextBox();
this.benchNameTextBox2 = new System.Windows.Forms.TextBox();
this.benchNameTextBox3 = new System.Windows.Forms.TextBox();
this.languageLabel = new System.Windows.Forms.Label();
this.languageTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.timePeriodFormatTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// connectionStringTextBox1
//
this.connectionStringTextBox1.Location = new System.Drawing.Point(157, 45);
this.connectionStringTextBox1.Name = "connectionStringTextBox1";
this.connectionStringTextBox1.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox1.TabIndex = 0;
//
// benchNameLabel
//
this.benchNameLabel.AutoSize = true;
this.benchNameLabel.Location = new System.Drawing.Point(26, 20);
this.benchNameLabel.Name = "benchNameLabel";
this.benchNameLabel.Size = new System.Drawing.Size(67, 13);
this.benchNameLabel.TabIndex = 1;
this.benchNameLabel.Text = "Bench name";
//
// connectionStringLabel
//
this.connectionStringLabel.AutoSize = true;
this.connectionStringLabel.Location = new System.Drawing.Point(154, 20);
this.connectionStringLabel.Name = "connectionStringLabel";
this.connectionStringLabel.Size = new System.Drawing.Size(89, 13);
this.connectionStringLabel.TabIndex = 3;
this.connectionStringLabel.Text = "Connection string";
//
// connectionStringTextBox2
//
this.connectionStringTextBox2.Location = new System.Drawing.Point(157, 71);
this.connectionStringTextBox2.Name = "connectionStringTextBox2";
this.connectionStringTextBox2.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox2.TabIndex = 2;
//
// connectionStringTextBox3
//
this.connectionStringTextBox3.Location = new System.Drawing.Point(157, 97);
this.connectionStringTextBox3.Name = "connectionStringTextBox3";
this.connectionStringTextBox3.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox3.TabIndex = 4;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(506, 194);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(95, 38);
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(617, 194);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(95, 38);
this.cancelButton.TabIndex = 7;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// benchNameTextBox1
//
this.benchNameTextBox1.Location = new System.Drawing.Point(29, 45);
this.benchNameTextBox1.Name = "benchNameTextBox1";
this.benchNameTextBox1.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox1.TabIndex = 8;
//
// benchNameTextBox2
//
this.benchNameTextBox2.Location = new System.Drawing.Point(29, 71);
this.benchNameTextBox2.Name = "benchNameTextBox2";
this.benchNameTextBox2.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox2.TabIndex = 9;
//
// benchNameTextBox3
//
this.benchNameTextBox3.Location = new System.Drawing.Point(29, 97);
this.benchNameTextBox3.Name = "benchNameTextBox3";
this.benchNameTextBox3.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox3.TabIndex = 10;
//
// languageLabel
//
this.languageLabel.AutoSize = true;
this.languageLabel.Location = new System.Drawing.Point(26, 183);
this.languageLabel.Name = "languageLabel";
this.languageLabel.Size = new System.Drawing.Size(55, 13);
this.languageLabel.TabIndex = 11;
this.languageLabel.Text = "Language";
//
// languageTextBox
//
this.languageTextBox.Location = new System.Drawing.Point(29, 207);
this.languageTextBox.Name = "languageTextBox";
this.languageTextBox.Size = new System.Drawing.Size(100, 20);
this.languageTextBox.TabIndex = 12;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(26, 129);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(39, 13);
this.formatLabel.TabIndex = 13;
this.formatLabel.Text = "Format";
//
// timePeriodFormatTextBox
//
this.timePeriodFormatTextBox.Location = new System.Drawing.Point(29, 151);
this.timePeriodFormatTextBox.Name = "timePeriodFormatTextBox";
this.timePeriodFormatTextBox.Size = new System.Drawing.Size(683, 20);
this.timePeriodFormatTextBox.TabIndex = 14;
//
// DatabaseSettingsDlg
//
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(743, 254);
this.Controls.Add(this.timePeriodFormatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.languageTextBox);
this.Controls.Add(this.languageLabel);
this.Controls.Add(this.benchNameTextBox3);
this.Controls.Add(this.benchNameTextBox2);
this.Controls.Add(this.benchNameTextBox1);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.connectionStringTextBox3);
this.Controls.Add(this.connectionStringLabel);
this.Controls.Add(this.connectionStringTextBox2);
this.Controls.Add(this.benchNameLabel);
this.Controls.Add(this.connectionStringTextBox1);
this.Name = "DatabaseSettingsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Database Settings";
this.Load += new System.EventHandler(this.DatabaseSettings_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.connectionStringTextBox1 = new System.Windows.Forms.TextBox();
this.benchNameLabel = new System.Windows.Forms.Label();
this.connectionStringLabel = new System.Windows.Forms.Label();
this.connectionStringTextBox2 = new System.Windows.Forms.TextBox();
this.connectionStringTextBox3 = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.benchNameTextBox1 = new System.Windows.Forms.TextBox();
this.benchNameTextBox2 = new System.Windows.Forms.TextBox();
this.benchNameTextBox3 = new System.Windows.Forms.TextBox();
this.languageLabel = new System.Windows.Forms.Label();
this.languageTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.timePeriodFormatTextBox = new System.Windows.Forms.TextBox();
this.benchNameTextBox5 = new System.Windows.Forms.TextBox();
this.benchNameTextBox4 = new System.Windows.Forms.TextBox();
this.connectionStringTextBox5 = new System.Windows.Forms.TextBox();
this.connectionStringTextBox4 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// connectionStringTextBox1
//
this.connectionStringTextBox1.Location = new System.Drawing.Point(157, 45);
this.connectionStringTextBox1.Name = "connectionStringTextBox1";
this.connectionStringTextBox1.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox1.TabIndex = 3;
//
// benchNameLabel
//
this.benchNameLabel.AutoSize = true;
this.benchNameLabel.Location = new System.Drawing.Point(26, 20);
this.benchNameLabel.Name = "benchNameLabel";
this.benchNameLabel.Size = new System.Drawing.Size(67, 13);
this.benchNameLabel.TabIndex = 0;
this.benchNameLabel.Text = "Bench name";
//
// connectionStringLabel
//
this.connectionStringLabel.AutoSize = true;
this.connectionStringLabel.Location = new System.Drawing.Point(154, 20);
this.connectionStringLabel.Name = "connectionStringLabel";
this.connectionStringLabel.Size = new System.Drawing.Size(89, 13);
this.connectionStringLabel.TabIndex = 1;
this.connectionStringLabel.Text = "Connection string";
//
// connectionStringTextBox2
//
this.connectionStringTextBox2.Location = new System.Drawing.Point(157, 71);
this.connectionStringTextBox2.Name = "connectionStringTextBox2";
this.connectionStringTextBox2.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox2.TabIndex = 5;
//
// connectionStringTextBox3
//
this.connectionStringTextBox3.Location = new System.Drawing.Point(157, 97);
this.connectionStringTextBox3.Name = "connectionStringTextBox3";
this.connectionStringTextBox3.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox3.TabIndex = 7;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(506, 250);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(95, 38);
this.okButton.TabIndex = 16;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(617, 250);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(95, 38);
this.cancelButton.TabIndex = 17;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// benchNameTextBox1
//
this.benchNameTextBox1.Location = new System.Drawing.Point(29, 45);
this.benchNameTextBox1.Name = "benchNameTextBox1";
this.benchNameTextBox1.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox1.TabIndex = 2;
//
// benchNameTextBox2
//
this.benchNameTextBox2.Location = new System.Drawing.Point(29, 71);
this.benchNameTextBox2.Name = "benchNameTextBox2";
this.benchNameTextBox2.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox2.TabIndex = 4;
//
// benchNameTextBox3
//
this.benchNameTextBox3.Location = new System.Drawing.Point(29, 97);
this.benchNameTextBox3.Name = "benchNameTextBox3";
this.benchNameTextBox3.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox3.TabIndex = 6;
//
// languageLabel
//
this.languageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.languageLabel.AutoSize = true;
this.languageLabel.Location = new System.Drawing.Point(26, 239);
this.languageLabel.Name = "languageLabel";
this.languageLabel.Size = new System.Drawing.Size(55, 13);
this.languageLabel.TabIndex = 14;
this.languageLabel.Text = "Language";
//
// languageTextBox
//
this.languageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.languageTextBox.Location = new System.Drawing.Point(29, 263);
this.languageTextBox.Name = "languageTextBox";
this.languageTextBox.Size = new System.Drawing.Size(100, 20);
this.languageTextBox.TabIndex = 15;
//
// formatLabel
//
this.formatLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(26, 185);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(39, 13);
this.formatLabel.TabIndex = 12;
this.formatLabel.Text = "Format";
//
// timePeriodFormatTextBox
//
this.timePeriodFormatTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.timePeriodFormatTextBox.Location = new System.Drawing.Point(29, 207);
this.timePeriodFormatTextBox.Name = "timePeriodFormatTextBox";
this.timePeriodFormatTextBox.Size = new System.Drawing.Size(683, 20);
this.timePeriodFormatTextBox.TabIndex = 13;
//
// benchNameTextBox5
//
this.benchNameTextBox5.Location = new System.Drawing.Point(29, 149);
this.benchNameTextBox5.Name = "benchNameTextBox5";
this.benchNameTextBox5.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox5.TabIndex = 10;
//
// benchNameTextBox4
//
this.benchNameTextBox4.Location = new System.Drawing.Point(29, 123);
this.benchNameTextBox4.Name = "benchNameTextBox4";
this.benchNameTextBox4.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox4.TabIndex = 8;
//
// connectionStringTextBox5
//
this.connectionStringTextBox5.Location = new System.Drawing.Point(157, 149);
this.connectionStringTextBox5.Name = "connectionStringTextBox5";
this.connectionStringTextBox5.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox5.TabIndex = 11;
//
// connectionStringTextBox4
//
this.connectionStringTextBox4.Location = new System.Drawing.Point(157, 123);
this.connectionStringTextBox4.Name = "connectionStringTextBox4";
this.connectionStringTextBox4.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox4.TabIndex = 9;
//
// DatabaseSettingsDlg
//
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(743, 310);
this.Controls.Add(this.benchNameTextBox5);
this.Controls.Add(this.benchNameTextBox4);
this.Controls.Add(this.connectionStringTextBox5);
this.Controls.Add(this.connectionStringTextBox4);
this.Controls.Add(this.timePeriodFormatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.languageTextBox);
this.Controls.Add(this.languageLabel);
this.Controls.Add(this.benchNameTextBox3);
this.Controls.Add(this.benchNameTextBox2);
this.Controls.Add(this.benchNameTextBox1);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.connectionStringTextBox3);
this.Controls.Add(this.connectionStringLabel);
this.Controls.Add(this.connectionStringTextBox2);
this.Controls.Add(this.benchNameLabel);
this.Controls.Add(this.connectionStringTextBox1);
this.Name = "DatabaseSettingsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Database Settings";
this.Load += new System.EventHandler(this.DatabaseSettings_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -203,5 +245,9 @@
private System.Windows.Forms.TextBox languageTextBox;
private System.Windows.Forms.Label formatLabel;
private System.Windows.Forms.TextBox timePeriodFormatTextBox;
private System.Windows.Forms.TextBox benchNameTextBox5;
private System.Windows.Forms.TextBox benchNameTextBox4;
private System.Windows.Forms.TextBox connectionStringTextBox5;
private System.Windows.Forms.TextBox connectionStringTextBox4;
}
}
+8 -6
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ResultsBrowser.Resources;
@@ -24,10 +18,14 @@ namespace ResultsBrowser.Forms
benchNameTextBox1.Text = Program.LocalSettings.Bench1;
benchNameTextBox2.Text = Program.LocalSettings.Bench2;
benchNameTextBox3.Text = Program.LocalSettings.Bench3;
benchNameTextBox4.Text = Program.LocalSettings.Bench4;
benchNameTextBox5.Text = Program.LocalSettings.Bench5;
connectionStringTextBox1.Text = Program.LocalSettings.ConnectionString1;
connectionStringTextBox2.Text = Program.LocalSettings.ConnectionString2;
connectionStringTextBox3.Text = Program.LocalSettings.ConnectionString3;
connectionStringTextBox4.Text = Program.LocalSettings.ConnectionString4;
connectionStringTextBox5.Text = Program.LocalSettings.ConnectionString5;
timePeriodFormatTextBox.Text = Program.LocalSettings.TimePeriodFormat;
@@ -50,10 +48,14 @@ namespace ResultsBrowser.Forms
Program.LocalSettings.Bench1 = benchNameTextBox1.Text;
Program.LocalSettings.Bench2 = benchNameTextBox2.Text;
Program.LocalSettings.Bench3 = benchNameTextBox3.Text;
Program.LocalSettings.Bench4 = benchNameTextBox4.Text;
Program.LocalSettings.Bench5 = benchNameTextBox5.Text;
Program.LocalSettings.ConnectionString1 = connectionStringTextBox1.Text;
Program.LocalSettings.ConnectionString2 = connectionStringTextBox2.Text;
Program.LocalSettings.ConnectionString3 = connectionStringTextBox3.Text;
Program.LocalSettings.ConnectionString4 = connectionStringTextBox4.Text;
Program.LocalSettings.ConnectionString5 = connectionStringTextBox5.Text;
Program.LocalSettings.TimePeriodFormat = timePeriodFormatTextBox.Text;
+1 -1
View File
@@ -19,7 +19,7 @@ namespace ResultsBrowser.Forms
/// <summary>
/// Required access rights to make changes with this form
/// </summary>
const Config.Grp.GID RequiredGroupMembership = Config.Grp.GID.Metrologists;
const Users.Grp.GID RequiredGroupMembership = Users.Grp.GID.Metrologists;
public Config.Entities.TestsArrangement TestsArrangement;
public Config.Entities.MetersArrangement MetersArrangement;
public int NrMetersInOneGroup;
+24 -12
View File
@@ -46,19 +46,31 @@ namespace ResultsBrowser.Forms
columnsComboBox3.Items.Add(item.Caption);
}
///
rowsComboBox.Text = rowsComboBox.Items.Contains(Program.LocalSettings.RowItemCaption) ? Program.LocalSettings.RowItemCaption : string.Empty;
rowsComboBox2.Text = rowsComboBox2.Items.Contains(Program.LocalSettings.RowItemCaption2) ? Program.LocalSettings.RowItemCaption2 : string.Empty;
rowsComboBox3.Text = rowsComboBox3.Items.Contains(Program.LocalSettings.RowItemCaption3) ? Program.LocalSettings.RowItemCaption3 : string.Empty;
columnsComboBox.Text = columnsComboBox.Items.Contains(Program.LocalSettings.ColumnItemCaption) ? Program.LocalSettings.ColumnItemCaption : string.Empty;
columnsComboBox2.Text = columnsComboBox2.Items.Contains(Program.LocalSettings.ColumnItemCaption2) ? Program.LocalSettings.ColumnItemCaption2 : string.Empty;
columnsComboBox3.Text = columnsComboBox3.Items.Contains(Program.LocalSettings.ColumnItemCaption3) ? Program.LocalSettings.ColumnItemCaption3 : string.Empty;
rowsComboBox.Text = (!string.IsNullOrEmpty(Program.LocalSettings.RowItemCaption) && rowsComboBox.Items.Contains(Program.LocalSettings.RowItemCaption))
? Program.LocalSettings.RowItemCaption
: string.Empty;
rowsComboBox2.Text = (!string.IsNullOrEmpty(Program.LocalSettings.RowItemCaption2) && rowsComboBox2.Items.Contains(Program.LocalSettings.RowItemCaption2))
? Program.LocalSettings.RowItemCaption2
: string.Empty;
rowsComboBox3.Text = (!string.IsNullOrEmpty(Program.LocalSettings.RowItemCaption3) && rowsComboBox3.Items.Contains(Program.LocalSettings.RowItemCaption3))
? Program.LocalSettings.RowItemCaption3
: string.Empty;
columnsComboBox.Text = (!string.IsNullOrEmpty(Program.LocalSettings.ColumnItemCaption) && columnsComboBox.Items.Contains(Program.LocalSettings.ColumnItemCaption))
? Program.LocalSettings.ColumnItemCaption
: string.Empty;
columnsComboBox2.Text = (!string.IsNullOrEmpty(Program.LocalSettings.ColumnItemCaption2) && columnsComboBox2.Items.Contains(Program.LocalSettings.ColumnItemCaption2))
? Program.LocalSettings.ColumnItemCaption2
: string.Empty;
columnsComboBox3.Text = (!string.IsNullOrEmpty(Program.LocalSettings.ColumnItemCaption3) && columnsComboBox3.Items.Contains(Program.LocalSettings.ColumnItemCaption3))
? Program.LocalSettings.ColumnItemCaption3
: string.Empty;
rowTestSpecTextBox.Text = RowTestSpecifier = Program.LocalSettings.RowTestSpecifier;
rowTestSpecTextBox2.Text = RowTestSpecifier2 = Program.LocalSettings.RowTestSpecifier2;
rowTestSpecTextBox3.Text = RowTestSpecifier3 = Program.LocalSettings.RowTestSpecifier3;
columnTestSpecTextBox.Text = ColumnTestSpecifier = Program.LocalSettings.ColumnTestSpecifier;
columnTestSpecTextBox2.Text = ColumnTestSpecifier2 = Program.LocalSettings.ColumnTestSpecifier2;
columnTestSpecTextBox3.Text = ColumnTestSpecifier3 = Program.LocalSettings.ColumnTestSpecifier3;
rowTestSpecTextBox.Text = RowTestSpecifier = string.IsNullOrEmpty(Program.LocalSettings.RowTestSpecifier) ? string.Empty : Program.LocalSettings.RowTestSpecifier;
rowTestSpecTextBox2.Text = RowTestSpecifier2 = string.IsNullOrEmpty(Program.LocalSettings.RowTestSpecifier2) ? string.Empty : Program.LocalSettings.RowTestSpecifier2;
rowTestSpecTextBox3.Text = RowTestSpecifier3 = string.IsNullOrEmpty(Program.LocalSettings.RowTestSpecifier3) ? string.Empty : Program.LocalSettings.RowTestSpecifier3;
columnTestSpecTextBox.Text = ColumnTestSpecifier = string.IsNullOrEmpty(Program.LocalSettings.ColumnTestSpecifier) ? string.Empty : Program.LocalSettings.ColumnTestSpecifier;
columnTestSpecTextBox2.Text = ColumnTestSpecifier2 = string.IsNullOrEmpty(Program.LocalSettings.ColumnTestSpecifier2) ? string.Empty : Program.LocalSettings.ColumnTestSpecifier2;
columnTestSpecTextBox3.Text = ColumnTestSpecifier3 = string.IsNullOrEmpty(Program.LocalSettings.ColumnTestSpecifier3) ? string.Empty : Program.LocalSettings.ColumnTestSpecifier3;
}
void Localize()
+6
View File
@@ -27,15 +27,21 @@ namespace ResultsBrowser
public string Bench1;
public string Bench2;
public string Bench3;
public string Bench4;
public string Bench5;
/// Database settings of servers.
public string ConnectionString1;
public string ConnectionString2;
public string ConnectionString3;
public string ConnectionString4;
public string ConnectionString5;
public bool Bench1Selected;
public bool Bench2Selected;
public bool Bench3Selected;
public bool Bench4Selected;
public bool Bench5Selected;
public string TimePeriodFormat;
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("ResultsBrowser")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2016 Sensus Slovensko a.s.")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2017 Sensus Slovensko a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.12.478.0")]
[assembly: AssemblyFileVersion("2.12.478.0")]
[assembly: AssemblyVersion("2.12.561.0")]
[assembly: AssemblyFileVersion("2.12.561.0")]
+6 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -238,6 +238,10 @@
<Project>{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}</Project>
<Name>Results</Name>
</ProjectReference>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
<Name>Users</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+42 -12
View File
@@ -45,6 +45,8 @@
this.executeQueryBtn = new System.Windows.Forms.Button();
this.addFilterBtn = new System.Windows.Forms.Button();
this.testBenchesGroupBox = new System.Windows.Forms.GroupBox();
this.checkBox5 = new System.Windows.Forms.RadioButton();
this.checkBox4 = new System.Windows.Forms.RadioButton();
this.checkBox3 = new System.Windows.Forms.RadioButton();
this.checkBox2 = new System.Windows.Forms.RadioButton();
this.checkBox1 = new System.Windows.Forms.RadioButton();
@@ -151,7 +153,7 @@
//
// statisticsBtn
//
this.statisticsBtn.Location = new System.Drawing.Point(8, 562);
this.statisticsBtn.Location = new System.Drawing.Point(8, 581);
this.statisticsBtn.Name = "statisticsBtn";
this.statisticsBtn.Size = new System.Drawing.Size(125, 33);
this.statisticsBtn.TabIndex = 10;
@@ -161,7 +163,7 @@
//
// printQueryResultsBtn
//
this.printQueryResultsBtn.Location = new System.Drawing.Point(8, 487);
this.printQueryResultsBtn.Location = new System.Drawing.Point(8, 506);
this.printQueryResultsBtn.Name = "printQueryResultsBtn";
this.printQueryResultsBtn.Size = new System.Drawing.Size(125, 33);
this.printQueryResultsBtn.TabIndex = 9;
@@ -171,7 +173,7 @@
//
// exportQueryResultsBtn
//
this.exportQueryResultsBtn.Location = new System.Drawing.Point(8, 448);
this.exportQueryResultsBtn.Location = new System.Drawing.Point(8, 467);
this.exportQueryResultsBtn.Name = "exportQueryResultsBtn";
this.exportQueryResultsBtn.Size = new System.Drawing.Size(125, 33);
this.exportQueryResultsBtn.TabIndex = 8;
@@ -181,7 +183,7 @@
//
// formatOfResultsBtn
//
this.formatOfResultsBtn.Location = new System.Drawing.Point(8, 255);
this.formatOfResultsBtn.Location = new System.Drawing.Point(8, 274);
this.formatOfResultsBtn.Name = "formatOfResultsBtn";
this.formatOfResultsBtn.Size = new System.Drawing.Size(125, 33);
this.formatOfResultsBtn.TabIndex = 7;
@@ -191,7 +193,7 @@
//
// clearFiltersBtn
//
this.clearFiltersBtn.Location = new System.Drawing.Point(8, 177);
this.clearFiltersBtn.Location = new System.Drawing.Point(8, 196);
this.clearFiltersBtn.Name = "clearFiltersBtn";
this.clearFiltersBtn.Size = new System.Drawing.Size(125, 33);
this.clearFiltersBtn.TabIndex = 2;
@@ -211,7 +213,7 @@
//
// saveConfigBtn
//
this.saveConfigBtn.Location = new System.Drawing.Point(8, 294);
this.saveConfigBtn.Location = new System.Drawing.Point(8, 313);
this.saveConfigBtn.Name = "saveConfigBtn";
this.saveConfigBtn.Size = new System.Drawing.Size(125, 33);
this.saveConfigBtn.TabIndex = 5;
@@ -221,7 +223,7 @@
//
// loadConfigBtn
//
this.loadConfigBtn.Location = new System.Drawing.Point(8, 333);
this.loadConfigBtn.Location = new System.Drawing.Point(8, 352);
this.loadConfigBtn.Name = "loadConfigBtn";
this.loadConfigBtn.Size = new System.Drawing.Size(125, 33);
this.loadConfigBtn.TabIndex = 4;
@@ -231,7 +233,7 @@
//
// executeQueryBtn
//
this.executeQueryBtn.Location = new System.Drawing.Point(8, 409);
this.executeQueryBtn.Location = new System.Drawing.Point(8, 428);
this.executeQueryBtn.Name = "executeQueryBtn";
this.executeQueryBtn.Size = new System.Drawing.Size(125, 33);
this.executeQueryBtn.TabIndex = 6;
@@ -241,7 +243,7 @@
//
// addFilterBtn
//
this.addFilterBtn.Location = new System.Drawing.Point(8, 216);
this.addFilterBtn.Location = new System.Drawing.Point(8, 235);
this.addFilterBtn.Name = "addFilterBtn";
this.addFilterBtn.Size = new System.Drawing.Size(125, 33);
this.addFilterBtn.TabIndex = 3;
@@ -251,20 +253,46 @@
//
// testBenchesGroupBox
//
this.testBenchesGroupBox.Controls.Add(this.checkBox5);
this.testBenchesGroupBox.Controls.Add(this.checkBox4);
this.testBenchesGroupBox.Controls.Add(this.checkBox3);
this.testBenchesGroupBox.Controls.Add(this.checkBox2);
this.testBenchesGroupBox.Controls.Add(this.checkBox1);
this.testBenchesGroupBox.Location = new System.Drawing.Point(8, 54);
this.testBenchesGroupBox.Name = "testBenchesGroupBox";
this.testBenchesGroupBox.Size = new System.Drawing.Size(125, 99);
this.testBenchesGroupBox.Size = new System.Drawing.Size(125, 135);
this.testBenchesGroupBox.TabIndex = 1;
this.testBenchesGroupBox.TabStop = false;
this.testBenchesGroupBox.Text = "Test benches";
//
// checkBox5
//
this.checkBox5.AutoSize = true;
this.checkBox5.Location = new System.Drawing.Point(23, 106);
this.checkBox5.Name = "checkBox5";
this.checkBox5.Size = new System.Drawing.Size(85, 17);
this.checkBox5.TabIndex = 4;
this.checkBox5.TabStop = true;
this.checkBox5.Text = "radioButton5";
this.checkBox5.UseVisualStyleBackColor = true;
this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
//
// checkBox4
//
this.checkBox4.AutoSize = true;
this.checkBox4.Location = new System.Drawing.Point(23, 86);
this.checkBox4.Name = "checkBox4";
this.checkBox4.Size = new System.Drawing.Size(85, 17);
this.checkBox4.TabIndex = 3;
this.checkBox4.TabStop = true;
this.checkBox4.Text = "radioButton4";
this.checkBox4.UseVisualStyleBackColor = true;
this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
//
// checkBox3
//
this.checkBox3.AutoSize = true;
this.checkBox3.Location = new System.Drawing.Point(23, 69);
this.checkBox3.Location = new System.Drawing.Point(23, 65);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(85, 17);
this.checkBox3.TabIndex = 2;
@@ -276,7 +304,7 @@
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(23, 46);
this.checkBox2.Location = new System.Drawing.Point(23, 44);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(85, 17);
this.checkBox2.TabIndex = 1;
@@ -344,5 +372,7 @@
private System.Windows.Forms.Button printQueryResultsBtn;
private System.Windows.Forms.Button statisticsBtn;
private System.Windows.Forms.ListView resultsListView;
private System.Windows.Forms.RadioButton checkBox5;
private System.Windows.Forms.RadioButton checkBox4;
}
}
+76 -5
View File
@@ -5,6 +5,7 @@ using NHibernate;
using Results.Entities;
using ResultsBrowser.Filters;
using ResultsBrowser.Resources;
using System.IO;
namespace ResultsBrowser
{
@@ -49,6 +50,8 @@ namespace ResultsBrowser
checkBox1.Checked = Program.LocalSettings.Bench1Selected;
checkBox2.Checked = Program.LocalSettings.Bench2Selected;
checkBox3.Checked = Program.LocalSettings.Bench3Selected;
checkBox4.Checked = Program.LocalSettings.Bench4Selected;
checkBox5.Checked = Program.LocalSettings.Bench5Selected;
if (args.Length == 1 && args[0].IndexOf(".qry") == args[0].Length - 4)
{
@@ -69,12 +72,23 @@ namespace ResultsBrowser
checkBox1.Text = Program.LocalSettings.Bench1;
checkBox2.Text = Program.LocalSettings.Bench2;
checkBox3.Text = Program.LocalSettings.Bench3;
checkBox4.Text = Program.LocalSettings.Bench4;
checkBox5.Text = Program.LocalSettings.Bench5;
checkBox1.Visible = !string.IsNullOrEmpty(checkBox1.Text);
checkBox2.Visible = !string.IsNullOrEmpty(checkBox2.Text);
checkBox3.Visible = !string.IsNullOrEmpty(checkBox3.Text);
checkBox4.Visible = !string.IsNullOrEmpty(checkBox4.Text);
checkBox5.Visible = !string.IsNullOrEmpty(checkBox5.Text);
}
string BenchName()
{
return checkBox1.Checked ? Program.LocalSettings.Bench1
: checkBox2.Checked ? Program.LocalSettings.Bench2
: Program.LocalSettings.Bench3;
}
void Localize()
{
filtersGroupBox.Text = Strings.Filters;
@@ -103,12 +117,16 @@ namespace ResultsBrowser
private void checkBox1_CheckedChanged(object sender, EventArgs e) { SaveCheckBoxes(); }
private void checkBox2_CheckedChanged(object sender, EventArgs e) { SaveCheckBoxes(); }
private void checkBox3_CheckedChanged(object sender, EventArgs e) { SaveCheckBoxes(); }
private void checkBox4_CheckedChanged(object sender, EventArgs e) { SaveCheckBoxes(); }
private void checkBox5_CheckedChanged(object sender, EventArgs e) { SaveCheckBoxes(); }
void SaveCheckBoxes()
{
Program.LocalSettings.Bench1Selected = checkBox1.Checked;
Program.LocalSettings.Bench2Selected = checkBox2.Checked;
Program.LocalSettings.Bench3Selected = checkBox3.Checked;
Program.LocalSettings.Bench4Selected = checkBox4.Checked;
Program.LocalSettings.Bench5Selected = checkBox5.Checked;
Program.LocalSettings.Save();
}
@@ -207,7 +225,9 @@ namespace ResultsBrowser
Results.DB.ConnectionString = checkBox1.Checked ? Program.LocalSettings.ConnectionString1 :
(checkBox2.Checked ? Program.LocalSettings.ConnectionString2 :
(checkBox3.Checked ? Program.LocalSettings.ConnectionString3 :
Program.LocalSettings.ConnectionString1));
(checkBox4.Checked ? Program.LocalSettings.ConnectionString4 :
(checkBox5.Checked ? Program.LocalSettings.ConnectionString5 :
Program.LocalSettings.ConnectionString1))));
ISession[] sessions = new ISession[] { Results.DB.CreateSession() };
@@ -252,8 +272,15 @@ namespace ResultsBrowser
ListViewItem lvi = null;
foreach (var item in items)
{
if (lvi == null) lvi = new ListViewItem(item.Print(wm));
else lvi.SubItems.Add(item.Print(wm));
/// Get text and strip color information
string itemText = item.Print(wm);
string[] texts = itemText.Split(new char[] { '|' });
if (texts.Length == 2) { itemText = texts[0]; }
if (lvi == null)
lvi = new ListViewItem(itemText);
else
lvi.SubItems.Add(itemText);
}
if (lvi != null) resultsListView.Items.Add(lvi);
}
@@ -281,8 +308,52 @@ namespace ResultsBrowser
private void exportQueryResultsBtn_Click(object sender, EventArgs e)
{
if (waterMeters == null || waterMeters.Count == 0) return;
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
if (waterMeters == null || waterMeters.Count == 0 || items.Count == 0) return;
SaveFileDialog dlg = new SaveFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
using (TextWriter writer = new StreamWriter(dlg.FileName))
{
try
{
for (int i = 0; i < items.Count; i++)
{
writer.Write(items[i].Caption);
if (i == items.Count - 1)
writer.WriteLine(); /// New line after the last item
else
writer.Write(";"); /// Semicolon between two items
}
foreach (var wm in waterMeters)
{
for (int i = 0; i < items.Count; i++)
{
/// Get text and strip color information
string itemText = items[i].Print(wm);
string[] texts = itemText.Split(new char[] { '|' });
if (texts.Length == 2) { itemText = texts[0]; }
writer.Write(itemText);
if (i == items.Count - 1)
writer.WriteLine(); /// New line after the last item
else
writer.Write(";"); /// Semicolon between two items
}
}
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Strings.Error_displaying_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
}
private void printQueryResultsBtn_Click(object sender, EventArgs e)
@@ -292,7 +363,7 @@ namespace ResultsBrowser
#if MUNICH
foreach (var wm in waterMeters)
{
new Results.Output.Printers.Munich.MunichPrintDocument("", wm, Config.Entities.PageOrientation.Portrait).Print();
new Results.Output.Printers.Munich.MunichPrintDocument(string.Format("4/13 - {0}", BenchName()), wm, Config.Entities.PageOrientation.Portrait).Print();
}
#elif CEVAK_PT40_272
IList<Results.Entities.Batch> batches = new List<Results.Entities.Batch>();
+19
View File
@@ -16,11 +16,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsBrowser", "ResultsBr
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceTest", "DeviceTest\DeviceTest.csproj", "{6D3384DC-4638-4A92-91A8-F39D900377C6}"
ProjectSection(ProjectDependencies) = postProject
{439D0878-C76E-452B-B17D-209A89E91D36} = {439D0878-C76E-452B-B17D-209A89E91D36}
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB} = {9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dirichlet.Numerics", "Dirichlet.Numerics\Dirichlet.Numerics.csproj", "{439D0878-C76E-452B-B17D-209A89E91D36}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Users", "Users\Users.csproj", "{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserManagement", "UserManagement\UserManagement.csproj", "{B2CD81B3-AF09-4978-996C-02EDB5F819B7}"
ProjectSection(ProjectDependencies) = postProject
{743DF7DB-C7B6-42EB-986D-0F485E5588E4} = {743DF7DB-C7B6-42EB-986D-0F485E5588E4}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -107,6 +116,16 @@ Global
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}.Release|x86.ActiveCfg = Release|Any CPU
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|Any CPU.ActiveCfg = Debug|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|Mixed Platforms.Build.0 = Debug|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|x86.ActiveCfg = Debug|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|x86.Build.0 = Debug|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|Any CPU.ActiveCfg = Release|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|Mixed Platforms.ActiveCfg = Release|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|Mixed Platforms.Build.0 = Release|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|x86.ActiveCfg = Release|x86
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -47,6 +47,23 @@ namespace TBF.BenchControl.DB.SensusOracle
StreamWriter logger; /// Logs specified by LU
///
/// Information extracted from VT_PRUEFPUNKT_SOLL_SD for a given watermeter by query:
/// SELECT * FROM VT_PRUEFPUNKT_SOLL_SD WHERE ANBID=4 AND ID_WZTyp=x AND Rev_WZTyp=y
///
class TestInfo
{
public int PruefungsNr;
public string QBezeichnung;
public TestInfo(int p, string q) { PruefungsNr = p; QBezeichnung = q; }
public override string ToString() { return string.Format("({0},{1})", PruefungsNr, QBezeichnung); }
}
///
static int id_WZTyp;
static int rev_WZTyp;
static IList<TestInfo> testInfos = new List<TestInfo>();
public Database() {}
public Database(Generic.IComponentCfg cfg)
@@ -69,24 +86,39 @@ namespace TBF.BenchControl.DB.SensusOracle
public void Initialize()
{
connection = (DBCfg.DBUsed == DBUsed.Production)
? new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;")
: new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
switch (DBCfg.DBUsed)
{
case DBUsed.Production:
connection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
break;
case DBUsed.Quality:
connection = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;"); /// TODO: Quality database specification
break;
case DBUsed.Test:
connection = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
break;
default:
connection = null;
break;
}
if (DBCfg.DebugLevel == DebugMode.Simulate) return;
///
/// Do something with the database to see if the connection works well
///
connection.Open();
if (connection != null)
{
connection.Open();
string rslt = "none";
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection);
OracleDataReader dr = cmd.ExecuteReader();
if (dr.Read()) rslt = dr.GetString(0);
dr.Close();
string rslt = "none";
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection);
OracleDataReader dr = cmd.ExecuteReader();
if (dr.Read()) rslt = dr.GetString(0);
dr.Close();
connection.Close();
connection.Close();
}
}
public void RunDeviceBefore() {}
@@ -215,13 +247,13 @@ namespace TBF.BenchControl.DB.SensusOracle
bool anyError = false;
#if ORACLE_DB
if (DBCfg.DebugLevel != DebugMode.Simulate)
if (DBCfg.DebugLevel != DebugMode.Simulate && connection != null)
{
if (WriteResultsToDatabase(connection, batch, false) == Retv.Error) anyError = true;
}
#endif
WriteLogsToDisk(logger, batch);
WriteLogsToDisk(logger, batch);
if (anyError)
{
@@ -501,8 +533,8 @@ namespace TBF.BenchControl.DB.SensusOracle
logger.WriteLine(string.Format("JustierWert=0,2")); /// 0,2
logger.WriteLine(string.Format("Corrected2Hz={0}", wMtr.Hz2CorrectionDone ? 1 : 0));
logger.WriteLine(string.Format("Q2Corrected={0}", wMtr.Q2CorrectionDone ? 1 : 0));
logger.WriteLine(string.Format("Q2CorrectionRight={0}", (int)Math.Round(wMtr.Q2Correction / 2)));
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", (int)Math.Round(wMtr.Q2Correction)));
logger.WriteLine(string.Format("Q2CorrectionRight={0}", wMtr.Q2CorrRFlow));
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", wMtr.Q2CorrLFlow));
logger.WriteLine(string.Format("Q2CorrectionFlowRight={0}", wMtr.Q2CorrFlowRight));
logger.WriteLine(string.Format("FlowDirectionRight={0}", wMtr.Q2CorrFlowRight));
logger.WriteLine(string.Format("Position={0}", wMtr.WMPosition));
@@ -887,12 +919,40 @@ namespace TBF.BenchControl.DB.SensusOracle
cmd.ExecuteNonQuery(); /// Returns nr. of updated rows
for (int q = 1; q <= 3; q++)
if ((id_WZTyp != b.WaterMeters[0].WaterMeterData.WMTypeId) || (rev_WZTyp != b.WaterMeters[0].WaterMeterData.WMTypeRev) || testInfos.Count == 0)
{
Results.Entities.TestRslt tr = b.GetTestRslt(string.Format("Q{0}", q), 0);
testInfos.Clear();
id_WZTyp = b.WaterMeters[0].WaterMeterData.WMTypeId;
rev_WZTyp = b.WaterMeters[0].WaterMeterData.WMTypeRev;
if (tr == null) tr = b.GetTestRslt(string.Format("Q{0}", q), 1); /// TODO: Remove this workaround for large large watermeters with multiple parts at Q3
OracleCommand cmd1 = new OracleCommand("SELECT PruefungsNr, PosFehlerKalt, QBezeichnung FROM VT_PRUEFPUNKT_SOLL_SD WHERE ANBID=4 AND ID_WZTyp=:1 AND Rev_WZTyp=:2", conn);
parm = new OracleParameter("ID_WZTyp", OracleDbType.Int32); parm.Value = id_WZTyp; cmd1.Parameters.Add(parm); ///:1
parm = new OracleParameter("Rev_WZTyp", OracleDbType.Int32); parm.Value = rev_WZTyp; cmd1.Parameters.Add(parm); ///:2
OracleDataReader dr = cmd1.ExecuteReader();
while (dr.Read())
{
int pruefungsNr = dr.GetInt32(0);
double errLimHi = dr.GetDouble(1);
string qBezeichnung = dr.GetString(2);
if (qBezeichnung == "Q2" && errLimHi > 2.0) qBezeichnung = "Q2adj";
if (qBezeichnung.ToLower().Contains("just") && pruefungsNr == -1) qBezeichnung = "Adjustment";
if (qBezeichnung.Contains("Q") || qBezeichnung == "Adjustment")
{
testInfos.Add(new TestInfo(pruefungsNr, qBezeichnung));
log.WarnFormat("VT_PRUEFPUNKT_SOLL_SD info : ID_WZTyp={0} Rev_WZTyp={1} PruefungsNr={2} PosFehlerKalt={3} QBezeichnung={4}",
id_WZTyp, rev_WZTyp, pruefungsNr, errLimHi, qBezeichnung);
}
}
dr.Close();
}
foreach (var testInfo in testInfos)
{
Results.Entities.TestRslt tr = b.GetTestRslt(testInfo.QBezeichnung, 0);
if (tr == null) tr = b.GetTestRslt(testInfo.QBezeichnung, 1); /// TODO: Remove this workaround for large watermeters with multiple parts at Q3
if (tr == null) continue;
@@ -908,7 +968,7 @@ namespace TBF.BenchControl.DB.SensusOracle
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd2.Parameters.Add(parm); ///:1
parm = new OracleParameter("ID_Pruefstand", OracleDbType.Int32); parm.Value = 18000 + b.TestBenchId; cmd2.Parameters.Add(parm); ///:2
parm = new OracleParameter("ID_WzPruefreihe", OracleDbType.Int32); parm.Value = b.BatchNr; cmd2.Parameters.Add(parm); ///:3
parm = new OracleParameter("PruefungsNr", OracleDbType.Int32); parm.Value = ((q==0) ? -1 : q); cmd2.Parameters.Add(parm); ///:4
parm = new OracleParameter("PruefungsNr", OracleDbType.Int32); parm.Value = testInfo.PruefungsNr; cmd2.Parameters.Add(parm); ///:4
///
parm = new OracleParameter("PVOL", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.l, tr.VolumeCTV); cmd2.Parameters.Add(parm); ///:5
parm = new OracleParameter("PMasse", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.kg, tr.MassEnd-tr.MassStart); cmd2.Parameters.Add(parm); ///:6
@@ -1012,10 +1072,17 @@ namespace TBF.BenchControl.DB.SensusOracle
log.InfoFormat("VT_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pos={1}, pruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex % 100);
}
for (int q = 1; q <= 3; q++)
{
Results.Entities.MeterTestRslt mtr = wm.GetMeterTestRslt(string.Format("Q{0}", q));
SaveMeterTestResult(conn, mtr, q, max_Pruefindex);
foreach (var testInfo in testInfos)
{
Results.Entities.MeterTestRslt mtr = wm.GetMeterTestRslt(testInfo.QBezeichnung);
if (mtr == null)
{
throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", testInfo.QBezeichnung, wm.WMPosition));
}
SaveMeterTestResult(conn, mtr, testInfo.PruefungsNr, max_Pruefindex);
}
{
@@ -1035,8 +1102,8 @@ namespace TBF.BenchControl.DB.SensusOracle
parm = new OracleParameter("WITHQ2CORRECTION", OracleDbType.Int32); parm.Value = wm.Q2CorrectionDone ? 1 : 0; cmd.Parameters.Add(parm); ///:7
parm = new OracleParameter("ERRQ2", OracleDbType.Double); parm.Value = q2ErrWOCorrection; cmd.Parameters.Add(parm); ///:8
parm = new OracleParameter("Q2CORRECTIONFLOWRIGHT", OracleDbType.Int32);parm.Value = wm.Q2CorrFlowRight;/*1=right to left*/ cmd.Parameters.Add(parm); ///:9
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = (int)Math.Round(wm.Q2Correction); cmd.Parameters.Add(parm); ///:10
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = (int)Math.Round(wm.Q2Correction / 2); cmd.Parameters.Add(parm); ///:11
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = wm.Q2CorrLFlow; cmd.Parameters.Add(parm); ///:10
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = wm.Q2CorrRFlow; cmd.Parameters.Add(parm); ///:11
int rowsUpdated = cmd.ExecuteNonQuery();
log.InfoFormat("VT_IP_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pruefix={1}", wm.SerialNr, max_Pruefindex);
@@ -1049,11 +1116,10 @@ namespace TBF.BenchControl.DB.SensusOracle
/// </summary>
/// <param name="q">q = 0, 1, 2 or 3 (Adj., Q1, Q2, Q3)</param>
/// <returns>Nr. of rows updated</returns>
static int SaveMeterTestResult(OracleConnection conn, Results.Entities.MeterTestRslt mtr, int q, int max_Pruefindex) ///
static int SaveMeterTestResult(OracleConnection conn, Results.Entities.MeterTestRslt mtr, int qq, int max_Pruefindex) ///
{
double Q_wm = 3600.0 * mtr.VolumeMeter / mtr.TestTime; /// in [l/hour]
double Q_wm_with_upper_bound = Math.Min(2 * 1000 * mtr.TestRslt.FlowVolume, Math.Max(0.0, Q_wm));
int qq = (q == 0) ? -1 : q;
OracleCommand cmd = new OracleCommand("INSERT INTO VT_PRUEFREIHE_IST_PD(" +
"VT_Fernum, Pruefindex, PruefungsNr, ANBID, ID_WZTyp, Rev_WZTyp, Rev_WZPruefpunkt, " +
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -11,6 +11,7 @@ namespace TBF.BenchControl.DB.SensusOracle
{
public enum DBUsed
{
None,
Production,
Test,
Quality,
@@ -11,7 +11,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Combined
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -41,6 +41,7 @@ namespace TBF.BenchControl.DataEntry.Combined
public CycleBeginningForm()
{
InitializeComponent();
ControlBox = false;
TextBoxesCount = 3;
mainLabels = new Label[] { mainSN1Label, mainSN2Label, mainSN3Label };
@@ -33,6 +33,7 @@ namespace TBF.BenchControl.DataEntry.Combined
public CycleEndForm()
{
InitializeComponent();
ControlBox = false;
MainStateText = new string[Config.Data.CompoundWMsCount];
AuxStateText = new string[Config.Data.CompoundWMsCount];
@@ -32,11 +32,11 @@ namespace TBF.BenchControl.DataEntry.Combined
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
float[] wmStartState;
public float WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
float[] wmEndState;
public float WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
@@ -74,9 +74,9 @@ namespace TBF.BenchControl.DataEntry.Combined
serialNr = new string[Config.Data.CompoundWMsCount * 2];
disabled = new bool[Config.Data.CompoundWMsCount];
wmStartState = new float[Config.Data.CompoundWMsCount * 2];
wmStartState = new double[Config.Data.CompoundWMsCount * 2];
wmStartStateStr = new string[Config.Data.CompoundWMsCount * 2];
wmEndState = new float[Config.Data.CompoundWMsCount * 2];
wmEndState = new double[Config.Data.CompoundWMsCount * 2];
wmCycleEndState = new string[Config.Data.CompoundWMsCount * 2];
currentOp = CurrentOp.None;
@@ -55,6 +55,7 @@ namespace TBF.BenchControl.DataEntry.Combined
public TestStartEndForm()
{
InitializeComponent();
ControlBox = false;
TextBoxesCount = 3;
@@ -11,7 +11,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.HeatMeters12
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -49,6 +49,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
public CycleBeginningForm()
{
InitializeComponent();
ControlBox = false;
labels = new Label[] { label1, label2, label3, label4, label5, label6,
label7, label8, label9, label10, label11, label12 };
@@ -28,9 +28,11 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
EndStateText = new string[WaterMetersCount];
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
EndStateText = new string[WaterMetersCount];
completed = false;
StartForceCloseHandler();
}
@@ -35,11 +35,11 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
float[] wmStartState;
public float WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
float[] wmEndState;
public float WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
@@ -89,9 +89,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
serialNr = new string[Config.Data.HeatMetersCount];
disabled = new bool[Config.Data.HeatMetersCount];
wmStartState = new float[Config.Data.HeatMetersCount];
wmStartState = new double[Config.Data.HeatMetersCount];
wmStartStateStr = new string[Config.Data.HeatMetersCount];
wmEndState = new float[Config.Data.HeatMetersCount];
wmEndState = new double[Config.Data.HeatMetersCount];
energyStartState = new double[Config.Data.HeatMetersCount];
energyStartStateStr = new string[Config.Data.HeatMetersCount];
energyEndState = new double[Config.Data.HeatMetersCount];
@@ -60,6 +60,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
public TestStartEndForm()
{
InitializeComponent();
ControlBox = false;
TextBoxesCount = 12;
@@ -11,7 +11,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.HeatMeters6
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -49,6 +49,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
public CycleBeginningForm()
{
InitializeComponent();
ControlBox = false;
labels = new Label[] { label1, label2, label3, label4, label5, label6 };
comboBoxes = new ComboBox[] { comboBox1, comboBox2, comboBox3, comboBox4, comboBox5, comboBox6 };
@@ -28,9 +28,11 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
EndStateText = new string[WaterMetersCount];
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
EndStateText = new string[WaterMetersCount];
completed = false;
StartForceCloseHandler();
}
@@ -35,11 +35,11 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
float[] wmStartState;
public float WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
float[] wmEndState;
public float WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
@@ -89,9 +89,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
serialNr = new string[Config.Data.HeatMetersCount];
disabled = new bool[Config.Data.HeatMetersCount];
wmStartState = new float[Config.Data.HeatMetersCount];
wmStartState = new double[Config.Data.HeatMetersCount];
wmStartStateStr = new string[Config.Data.HeatMetersCount];
wmEndState = new float[Config.Data.HeatMetersCount];
wmEndState = new double[Config.Data.HeatMetersCount];
energyStartState = new double[Config.Data.HeatMetersCount];
energyStartStateStr = new string[Config.Data.HeatMetersCount];
energyEndState = new double[Config.Data.HeatMetersCount];
@@ -60,6 +60,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
public TestStartEndForm()
{
InitializeComponent();
ControlBox = false;
TextBoxesCount = 6;
@@ -10,7 +10,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Munich
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -25,6 +25,7 @@ namespace TBF.BenchControl.DataEntry.Munich
public CycleBeginningForm()
{
InitializeComponent();
ControlBox = false;
MainSNText = new string[Config.Data.CompoundWMsCount];
AuxSNText = new string[Config.Data.CompoundWMsCount];
@@ -35,6 +35,7 @@ namespace TBF.BenchControl.DataEntry.Munich
public CycleEndForm()
{
InitializeComponent();
ControlBox = false;
MainStateText = new string[Config.Data.CompoundWMsCount];
AuxStateText = new string[Config.Data.CompoundWMsCount];
@@ -8,7 +8,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Munich3
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -29,9 +29,11 @@ namespace TBF.BenchControl.DataEntry.Munich3
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleBeginningForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
SNText = new string[WaterMetersCount];
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
SNText = new string[WaterMetersCount];
Disabled = new bool[WaterMetersCount];
completed = false;
StartForceCloseHandler();
@@ -36,9 +36,11 @@ namespace TBF.BenchControl.DataEntry.Munich3
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
EndStateText = new string[WaterMetersCount];
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
EndStateText = new string[WaterMetersCount];
YearOfProduction = new int[WaterMetersCount];
completed = false;
StartForceCloseHandler();
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -10,7 +10,7 @@ using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Munich3
{
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
public override string ToString() { return string.Format("DataEntry.Munich3({0})", Cfg.ToString(1)); }
@@ -28,19 +28,24 @@ namespace TBF.BenchControl.DataEntry.Munich3
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : string.Empty; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
public float WMState(int wmNr)
{
float retVal;
if (wmNr >= 0 && wmNr < wmEndState.Length && Utils.TryParseUFloat(wmEndState[wmNr], out retVal)) return retVal;
return 0;
}
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved;
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
@@ -50,6 +55,8 @@ namespace TBF.BenchControl.DataEntry.Munich3
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
@@ -66,7 +73,10 @@ namespace TBF.BenchControl.DataEntry.Munich3
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmEndState = new string[Config.Data.WMsCount];
wmStartState = new double[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new double[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
@@ -90,11 +100,24 @@ namespace TBF.BenchControl.DataEntry.Munich3
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowWMSNsAndStatesFormOp()
{
return null;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryForm myRef);
///
@@ -114,6 +137,18 @@ namespace TBF.BenchControl.DataEntry.Munich3
myRef.modelessDlg = endForm;
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
@@ -127,7 +162,13 @@ namespace TBF.BenchControl.DataEntry.Munich3
case CurrentOp.ShowFormAtCycleEnd:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
break;
}
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
@@ -164,11 +205,36 @@ namespace TBF.BenchControl.DataEntry.Munich3
{
if (waterMeters[i] != null)
{
wmEndState[i] = waterMeters[i].EndState = dlg.EndStateText[i];
wmCycleEndState[i] = waterMeters[i].EndState = dlg.EndStateText[i];
waterMeters[i].YearOfProduction = dlg.YearOfProduction[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
@@ -0,0 +1,466 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Munich3
{
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
/// <summary> Number of water meters </summary>
public readonly int WaterMetersCount;
readonly bool[] disabled;
// To be retrieved after the form closes
public float[] WMStartState;
// To be retrieved after the form closes
public readonly string[] WMStartStateStr;
// To be retrieved after the form closes
public float[] WMEndState;
bool endStates; /// false=start states, true=end states
double refVolume;
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
/// <summary>
/// Constructor to fill in start states
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public TestStartEndForm(int waterMetersCount, bool[] disabled)
{
InitializeComponent();
ControlBox = false;
endStates = false;
this.WaterMetersCount = waterMetersCount;
this.disabled = disabled;
WMStartState = new float[waterMetersCount];
WMStartStateStr = new string[waterMetersCount];
completed = false;
StartForceCloseHandler();
}
/// <summary>
/// Constructor to fill in end states
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public TestStartEndForm(int waterMetersCount, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
{
endStates = true;
this.WaterMetersCount = waterMetersCount;
this.WMStartStateStr = wmStartStateStr;
if (wmStartStateStr == null || wmStartStateStr.Length != waterMetersCount)
throw (new Exception("Invalid 'wmStartStateStr' argument"));
this.disabled = disabled;
this.refVolume = refVolume;
this.warningLimLo = 2 * errLimLo;
this.warningLimHi = 2 * errLimHi;
InitializeComponent();
WMEndState = new float[waterMetersCount];
completed = false;
StartForceCloseHandler();
}
/// <summary> Parameterless constructor for all watermeters </summary>
public TestStartEndForm()
: this(Config.Data.WMsCount, null)
{
}
private void CycleEndForm_Load(object sender, EventArgs e)
{
Localize();
Height = 70 + 90 * WaterMetersCount;
if (WaterMetersCount < 1) groupBox1.Visible = false;
if (WaterMetersCount < 2) groupBox2.Visible = false;
if (WaterMetersCount < 3) groupBox3.Visible = false;
if (WaterMetersCount < 4) groupBox4.Visible = false;
if (WaterMetersCount < 5) groupBox5.Visible = false;
if (WaterMetersCount < 6) groupBox6.Visible = false;
if (endStates)
{
if (WaterMetersCount >= 1) wmStartStateTextBox1.Text = WMStartStateStr[0];
if (WaterMetersCount >= 2) wmStartStateTextBox2.Text = WMStartStateStr[1];
if (WaterMetersCount >= 3) wmStartStateTextBox3.Text = WMStartStateStr[2];
if (WaterMetersCount >= 4) wmStartStateTextBox4.Text = WMStartStateStr[3];
if (WaterMetersCount >= 5) wmStartStateTextBox5.Text = WMStartStateStr[4];
if (WaterMetersCount >= 6) wmStartStateTextBox6.Text = WMStartStateStr[5];
wmEndStateTextBox1.Enabled = (disabled.Length >= 1 && !disabled[0]);
wmEndStateTextBox2.Enabled = (disabled.Length >= 2 && !disabled[1]);
wmEndStateTextBox3.Enabled = (disabled.Length >= 3 && !disabled[2]);
wmEndStateTextBox4.Enabled = (disabled.Length >= 4 && !disabled[3]);
wmEndStateTextBox5.Enabled = (disabled.Length >= 5 && !disabled[4]);
wmEndStateTextBox6.Enabled = (disabled.Length >= 6 && !disabled[5]);
}
else
{
wmStartStateTextBox1.Enabled = (disabled.Length >= 1 && !disabled[0]);
wmStartStateTextBox2.Enabled = (disabled.Length >= 2 && !disabled[1]);
wmStartStateTextBox3.Enabled = (disabled.Length >= 3 && !disabled[2]);
wmStartStateTextBox4.Enabled = (disabled.Length >= 4 && !disabled[3]);
wmStartStateTextBox5.Enabled = (disabled.Length >= 5 && !disabled[4]);
wmStartStateTextBox6.Enabled = (disabled.Length >= 6 && !disabled[5]);
}
}
void Localize()
{
Text = Strings.Water_Meter_States;
groupBox1.Text = Strings.Water_Meter + " 1";
groupBox2.Text = Strings.Water_Meter + " 2";
groupBox3.Text = Strings.Water_Meter + " 3";
groupBox4.Text = Strings.Water_Meter + " 4";
groupBox5.Text = Strings.Water_Meter + " 5";
groupBox6.Text = Strings.Water_Meter + " 6";
wmStateLabel1.Text = Strings.WMState;
wmStateLabel2.Text = Strings.WMState;
wmStateLabel3.Text = Strings.WMState;
wmStateLabel4.Text = Strings.WMState;
wmStateLabel5.Text = Strings.WMState;
wmStateLabel6.Text = Strings.WMState;
startLabel.Text = Strings.Start;
endLabel.Text = Strings.End;
okButton.Text = Strings.OkBtnText;
}
private void okButton_Click(object sender, EventArgs e)
{
try
{
if (endStates)
{
if (wmEndStateTextBox1.Enabled) WMEndState[0] = Utils.ParseUFloat(wmEndStateTextBox1.Text);
if (wmEndStateTextBox2.Enabled) WMEndState[1] = Utils.ParseUFloat(wmEndStateTextBox2.Text);
if (wmEndStateTextBox3.Enabled) WMEndState[2] = Utils.ParseUFloat(wmEndStateTextBox3.Text);
if (wmEndStateTextBox4.Enabled) WMEndState[3] = Utils.ParseUFloat(wmEndStateTextBox4.Text);
if (wmEndStateTextBox5.Enabled) WMEndState[4] = Utils.ParseUFloat(wmEndStateTextBox5.Text);
if (wmEndStateTextBox6.Enabled) WMEndState[5] = Utils.ParseUFloat(wmEndStateTextBox6.Text);
}
else
{
if (wmStartStateTextBox1.Enabled)
{
WMStartStateStr[0] = wmStartStateTextBox1.Text;
WMStartState[0] = Utils.ParseUFloat(wmStartStateTextBox1.Text);
}
if (wmStartStateTextBox2.Enabled)
{
WMStartStateStr[1] = wmStartStateTextBox2.Text;
WMStartState[1] = Utils.ParseUFloat(wmStartStateTextBox2.Text);
}
if (wmStartStateTextBox3.Enabled)
{
WMStartStateStr[2] = wmStartStateTextBox3.Text;
WMStartState[2] = Utils.ParseUFloat(wmStartStateTextBox3.Text);
}
if (wmStartStateTextBox4.Enabled)
{
WMStartStateStr[3] = wmStartStateTextBox4.Text;
WMStartState[3] = Utils.ParseUFloat(wmStartStateTextBox4.Text);
}
if (wmStartStateTextBox5.Enabled)
{
WMStartStateStr[4] = wmStartStateTextBox5.Text;
WMStartState[4] = Utils.ParseUFloat(wmStartStateTextBox5.Text);
}
if (wmStartStateTextBox6.Enabled)
{
WMStartStateStr[5] = wmStartStateTextBox6.Text;
WMStartState[5] = Utils.ParseUFloat(wmStartStateTextBox6.Text);
}
}
}
catch
{
return;
}
completed = true;
Close();
}
#region Forced close handling
public void StartForceCloseHandler()
{
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
else OnForceClose(sender, args);
};
}
void OnForceClose(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
#endregion
private void wmEndStateTextBox1_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
float endState = Utils.ParseUFloat(wmEndStateTextBox1.Text);
float startState = Utils.ParseUFloat(wmStartStateTextBox1.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { };
exclamation1.Visible = (err < warningLimLo) || (warningLimHi < err);
}
private void wmEndStateTextBox2_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
float endState = Utils.ParseUFloat(wmEndStateTextBox2.Text);
float startState = Utils.ParseUFloat(wmStartStateTextBox2.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation2.Visible = (err < warningLimLo) || (warningLimHi < err);
}
private void wmEndStateTextBox3_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
float endState = Utils.ParseUFloat(wmEndStateTextBox3.Text);
float startState = Utils.ParseUFloat(wmStartStateTextBox3.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation3.Visible = (err < warningLimLo) || (warningLimHi < err);
}
private void wmEndStateTextBox4_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
float endState = Utils.ParseUFloat(wmEndStateTextBox4.Text);
float startState = Utils.ParseUFloat(wmStartStateTextBox4.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation4.Visible = (err < warningLimLo) || (warningLimHi < err);
}
private void wmEndStateTextBox5_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
float endState = Utils.ParseUFloat(wmEndStateTextBox5.Text);
float startState = Utils.ParseUFloat(wmStartStateTextBox5.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation5.Visible = (err < warningLimLo) || (warningLimHi < err);
}
private void wmEndStateTextBox6_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
float endState = Utils.ParseUFloat(wmEndStateTextBox6.Text);
float startState = Utils.ParseUFloat(wmStartStateTextBox6.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation6.Visible = (err < warningLimLo) || (warningLimHi < err);
}
private void wmStartStateTextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmStartStateTextBox2.Enabled) wmStartStateTextBox2.Focus();
else if (wmStartStateTextBox3.Enabled) wmStartStateTextBox3.Focus();
else if (wmStartStateTextBox4.Enabled) wmStartStateTextBox4.Focus();
else if (wmStartStateTextBox5.Enabled) wmStartStateTextBox5.Focus();
else if (wmStartStateTextBox6.Enabled) wmStartStateTextBox6.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmStartStateTextBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmStartStateTextBox3.Enabled) wmStartStateTextBox3.Focus();
else if (wmStartStateTextBox4.Enabled) wmStartStateTextBox4.Focus();
else if (wmStartStateTextBox5.Enabled) wmStartStateTextBox5.Focus();
else if (wmStartStateTextBox6.Enabled) wmStartStateTextBox6.Focus();
else if (wmStartStateTextBox1.Enabled) wmStartStateTextBox1.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmStartStateTextBox3_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmStartStateTextBox4.Enabled) wmStartStateTextBox4.Focus();
else if (wmStartStateTextBox5.Enabled) wmStartStateTextBox5.Focus();
else if (wmStartStateTextBox6.Enabled) wmStartStateTextBox6.Focus();
else if (wmStartStateTextBox1.Enabled) wmStartStateTextBox1.Focus();
else if (wmStartStateTextBox2.Enabled) wmStartStateTextBox2.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmStartStateTextBox4_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmStartStateTextBox5.Enabled) wmStartStateTextBox5.Focus();
else if (wmStartStateTextBox6.Enabled) wmStartStateTextBox6.Focus();
else if (wmStartStateTextBox1.Enabled) wmStartStateTextBox1.Focus();
else if (wmStartStateTextBox2.Enabled) wmStartStateTextBox2.Focus();
else if (wmStartStateTextBox3.Enabled) wmStartStateTextBox3.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmStartStateTextBox5_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmStartStateTextBox6.Enabled) wmStartStateTextBox6.Focus();
else if (wmStartStateTextBox1.Enabled) wmStartStateTextBox1.Focus();
else if (wmStartStateTextBox2.Enabled) wmStartStateTextBox2.Focus();
else if (wmStartStateTextBox3.Enabled) wmStartStateTextBox3.Focus();
else if (wmStartStateTextBox4.Enabled) wmStartStateTextBox4.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmStartStateTextBox6_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmStartStateTextBox1.Enabled) wmStartStateTextBox1.Focus();
else if (wmStartStateTextBox1.Enabled) wmStartStateTextBox1.Focus();
else if (wmStartStateTextBox3.Enabled) wmStartStateTextBox3.Focus();
else if (wmStartStateTextBox4.Enabled) wmStartStateTextBox4.Focus();
else if (wmStartStateTextBox5.Enabled) wmStartStateTextBox5.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmEndStateTextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmEndStateTextBox2.Enabled) wmEndStateTextBox2.Focus();
else if (wmEndStateTextBox3.Enabled) wmEndStateTextBox3.Focus();
else if (wmEndStateTextBox4.Enabled) wmEndStateTextBox4.Focus();
else if (wmEndStateTextBox5.Enabled) wmEndStateTextBox5.Focus();
else if (wmEndStateTextBox6.Enabled) wmEndStateTextBox6.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmEndStateTextBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmEndStateTextBox3.Enabled) wmEndStateTextBox3.Focus();
else if (wmEndStateTextBox4.Enabled) wmEndStateTextBox4.Focus();
else if (wmEndStateTextBox5.Enabled) wmEndStateTextBox5.Focus();
else if (wmEndStateTextBox6.Enabled) wmEndStateTextBox6.Focus();
else if (wmEndStateTextBox1.Enabled) wmEndStateTextBox1.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmEndStateTextBox3_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmEndStateTextBox4.Enabled) wmEndStateTextBox4.Focus();
else if (wmEndStateTextBox5.Enabled) wmEndStateTextBox5.Focus();
else if (wmEndStateTextBox6.Enabled) wmEndStateTextBox6.Focus();
else if (wmEndStateTextBox1.Enabled) wmEndStateTextBox1.Focus();
else if (wmEndStateTextBox2.Enabled) wmEndStateTextBox2.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmEndStateTextBox4_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmEndStateTextBox5.Enabled) wmEndStateTextBox5.Focus();
else if (wmEndStateTextBox6.Enabled) wmEndStateTextBox6.Focus();
else if (wmEndStateTextBox1.Enabled) wmEndStateTextBox1.Focus();
else if (wmEndStateTextBox2.Enabled) wmEndStateTextBox2.Focus();
else if (wmEndStateTextBox3.Enabled) wmEndStateTextBox3.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmEndStateTextBox5_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmEndStateTextBox6.Enabled) wmEndStateTextBox6.Focus();
else if (wmEndStateTextBox1.Enabled) wmEndStateTextBox1.Focus();
else if (wmEndStateTextBox2.Enabled) wmEndStateTextBox2.Focus();
else if (wmEndStateTextBox3.Enabled) wmEndStateTextBox3.Focus();
else if (wmEndStateTextBox4.Enabled) wmEndStateTextBox4.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
private void wmEndStateTextBox6_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
if (wmEndStateTextBox1.Enabled) wmEndStateTextBox1.Focus();
else if (wmEndStateTextBox1.Enabled) wmEndStateTextBox1.Focus();
else if (wmEndStateTextBox3.Enabled) wmEndStateTextBox3.Focus();
else if (wmEndStateTextBox4.Enabled) wmEndStateTextBox4.Focus();
else if (wmEndStateTextBox5.Enabled) wmEndStateTextBox5.Focus();
}
else if (e.KeyChar == '+') okButton_Click(sender, e);
}
}
}
@@ -0,0 +1,512 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
namespace TBF.BenchControl.DataEntry.Munich3
{
partial class TestStartEndForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.exclamation2 = new System.Windows.Forms.Label();
this.wmStartStateTextBox2 = new System.Windows.Forms.TextBox();
this.wmEndStateTextBox2 = new System.Windows.Forms.TextBox();
this.wmStateLabel2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.exclamation1 = new System.Windows.Forms.Label();
this.wmStartStateTextBox1 = new System.Windows.Forms.TextBox();
this.wmEndStateTextBox1 = new System.Windows.Forms.TextBox();
this.wmStateLabel1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.exclamation3 = new System.Windows.Forms.Label();
this.wmStartStateTextBox3 = new System.Windows.Forms.TextBox();
this.wmEndStateTextBox3 = new System.Windows.Forms.TextBox();
this.wmStateLabel3 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.exclamation4 = new System.Windows.Forms.Label();
this.wmStartStateTextBox4 = new System.Windows.Forms.TextBox();
this.wmEndStateTextBox4 = new System.Windows.Forms.TextBox();
this.wmStateLabel4 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.exclamation5 = new System.Windows.Forms.Label();
this.wmStartStateTextBox5 = new System.Windows.Forms.TextBox();
this.wmEndStateTextBox5 = new System.Windows.Forms.TextBox();
this.wmStateLabel5 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.exclamation6 = new System.Windows.Forms.Label();
this.wmStartStateTextBox6 = new System.Windows.Forms.TextBox();
this.wmEndStateTextBox6 = new System.Windows.Forms.TextBox();
this.wmStateLabel6 = new System.Windows.Forms.Label();
this.startLabel = new System.Windows.Forms.Label();
this.endLabel = new System.Windows.Forms.Label();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox6.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.exclamation2);
this.groupBox2.Controls.Add(this.wmStartStateTextBox2);
this.groupBox2.Controls.Add(this.wmEndStateTextBox2);
this.groupBox2.Controls.Add(this.wmStateLabel2);
this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox2.ForeColor = System.Drawing.Color.Black;
this.groupBox2.Location = new System.Drawing.Point(25, 122);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(547, 81);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Water Meter 2";
//
// exclamation2
//
this.exclamation2.AutoSize = true;
this.exclamation2.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.exclamation2.ForeColor = System.Drawing.Color.Red;
this.exclamation2.Location = new System.Drawing.Point(515, 27);
this.exclamation2.Name = "exclamation2";
this.exclamation2.Size = new System.Drawing.Size(30, 38);
this.exclamation2.TabIndex = 4;
this.exclamation2.Text = "!";
this.exclamation2.Visible = false;
//
// wmStartStateTextBox2
//
this.wmStartStateTextBox2.Enabled = false;
this.wmStartStateTextBox2.Location = new System.Drawing.Point(164, 31);
this.wmStartStateTextBox2.Name = "wmStartStateTextBox2";
this.wmStartStateTextBox2.Size = new System.Drawing.Size(163, 31);
this.wmStartStateTextBox2.TabIndex = 3;
this.wmStartStateTextBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmStartStateTextBox2_KeyPress);
//
// wmEndStateTextBox2
//
this.wmEndStateTextBox2.Enabled = false;
this.wmEndStateTextBox2.Location = new System.Drawing.Point(350, 31);
this.wmEndStateTextBox2.Name = "wmEndStateTextBox2";
this.wmEndStateTextBox2.Size = new System.Drawing.Size(163, 31);
this.wmEndStateTextBox2.TabIndex = 1;
this.wmEndStateTextBox2.TextChanged += new System.EventHandler(this.wmEndStateTextBox2_TextChanged);
this.wmEndStateTextBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmEndStateTextBox2_KeyPress);
//
// wmStateLabel2
//
this.wmStateLabel2.AutoSize = true;
this.wmStateLabel2.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel2.Name = "wmStateLabel2";
this.wmStateLabel2.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel2.TabIndex = 0;
this.wmStateLabel2.Text = "State:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.exclamation1);
this.groupBox1.Controls.Add(this.wmStartStateTextBox1);
this.groupBox1.Controls.Add(this.wmEndStateTextBox1);
this.groupBox1.Controls.Add(this.wmStateLabel1);
this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox1.ForeColor = System.Drawing.Color.Black;
this.groupBox1.Location = new System.Drawing.Point(25, 32);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(547, 81);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Water Meter 1";
//
// exclamation1
//
this.exclamation1.AutoSize = true;
this.exclamation1.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.exclamation1.ForeColor = System.Drawing.Color.Red;
this.exclamation1.Location = new System.Drawing.Point(515, 27);
this.exclamation1.Name = "exclamation1";
this.exclamation1.Size = new System.Drawing.Size(30, 38);
this.exclamation1.TabIndex = 3;
this.exclamation1.Text = "!";
this.exclamation1.Visible = false;
//
// wmStartStateTextBox1
//
this.wmStartStateTextBox1.Enabled = false;
this.wmStartStateTextBox1.Location = new System.Drawing.Point(164, 31);
this.wmStartStateTextBox1.Name = "wmStartStateTextBox1";
this.wmStartStateTextBox1.Size = new System.Drawing.Size(163, 31);
this.wmStartStateTextBox1.TabIndex = 2;
this.wmStartStateTextBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmStartStateTextBox1_KeyPress);
//
// wmEndStateTextBox1
//
this.wmEndStateTextBox1.Enabled = false;
this.wmEndStateTextBox1.Location = new System.Drawing.Point(350, 31);
this.wmEndStateTextBox1.Name = "wmEndStateTextBox1";
this.wmEndStateTextBox1.Size = new System.Drawing.Size(163, 31);
this.wmEndStateTextBox1.TabIndex = 1;
this.wmEndStateTextBox1.TextChanged += new System.EventHandler(this.wmEndStateTextBox1_TextChanged);
this.wmEndStateTextBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmEndStateTextBox1_KeyPress);
//
// wmStateLabel1
//
this.wmStateLabel1.AutoSize = true;
this.wmStateLabel1.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel1.Name = "wmStateLabel1";
this.wmStateLabel1.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel1.TabIndex = 0;
this.wmStateLabel1.Text = "State:";
//
// okButton
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(603, 46);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.exclamation3);
this.groupBox3.Controls.Add(this.wmStartStateTextBox3);
this.groupBox3.Controls.Add(this.wmEndStateTextBox3);
this.groupBox3.Controls.Add(this.wmStateLabel3);
this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox3.ForeColor = System.Drawing.Color.Black;
this.groupBox3.Location = new System.Drawing.Point(25, 212);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(547, 81);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Water Meter 3";
//
// exclamation3
//
this.exclamation3.AutoSize = true;
this.exclamation3.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.exclamation3.ForeColor = System.Drawing.Color.Red;
this.exclamation3.Location = new System.Drawing.Point(515, 27);
this.exclamation3.Name = "exclamation3";
this.exclamation3.Size = new System.Drawing.Size(30, 38);
this.exclamation3.TabIndex = 5;
this.exclamation3.Text = "!";
this.exclamation3.Visible = false;
//
// wmStartStateTextBox3
//
this.wmStartStateTextBox3.Enabled = false;
this.wmStartStateTextBox3.Location = new System.Drawing.Point(164, 31);
this.wmStartStateTextBox3.Name = "wmStartStateTextBox3";
this.wmStartStateTextBox3.Size = new System.Drawing.Size(163, 31);
this.wmStartStateTextBox3.TabIndex = 4;
this.wmStartStateTextBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmStartStateTextBox3_KeyPress);
//
// wmEndStateTextBox3
//
this.wmEndStateTextBox3.Enabled = false;
this.wmEndStateTextBox3.Location = new System.Drawing.Point(350, 31);
this.wmEndStateTextBox3.Name = "wmEndStateTextBox3";
this.wmEndStateTextBox3.Size = new System.Drawing.Size(163, 31);
this.wmEndStateTextBox3.TabIndex = 1;
this.wmEndStateTextBox3.TextChanged += new System.EventHandler(this.wmEndStateTextBox3_TextChanged);
this.wmEndStateTextBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmEndStateTextBox3_KeyPress);
//
// wmStateLabel3
//
this.wmStateLabel3.AutoSize = true;
this.wmStateLabel3.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel3.Name = "wmStateLabel3";
this.wmStateLabel3.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel3.TabIndex = 0;
this.wmStateLabel3.Text = "State:";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.exclamation4);
this.groupBox4.Controls.Add(this.wmStartStateTextBox4);
this.groupBox4.Controls.Add(this.wmEndStateTextBox4);
this.groupBox4.Controls.Add(this.wmStateLabel4);
this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox4.ForeColor = System.Drawing.Color.Black;
this.groupBox4.Location = new System.Drawing.Point(25, 302);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(547, 81);
this.groupBox4.TabIndex = 4;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Water Meter 4";
//
// exclamation4
//
this.exclamation4.AutoSize = true;
this.exclamation4.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.exclamation4.ForeColor = System.Drawing.Color.Red;
this.exclamation4.Location = new System.Drawing.Point(515, 27);
this.exclamation4.Name = "exclamation4";
this.exclamation4.Size = new System.Drawing.Size(30, 38);
this.exclamation4.TabIndex = 5;
this.exclamation4.Text = "!";
this.exclamation4.Visible = false;
//
// wmStartStateTextBox4
//
this.wmStartStateTextBox4.Enabled = false;
this.wmStartStateTextBox4.Location = new System.Drawing.Point(164, 31);
this.wmStartStateTextBox4.Name = "wmStartStateTextBox4";
this.wmStartStateTextBox4.Size = new System.Drawing.Size(163, 31);
this.wmStartStateTextBox4.TabIndex = 4;
this.wmStartStateTextBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmStartStateTextBox4_KeyPress);
//
// wmEndStateTextBox4
//
this.wmEndStateTextBox4.Enabled = false;
this.wmEndStateTextBox4.Location = new System.Drawing.Point(350, 31);
this.wmEndStateTextBox4.Name = "wmEndStateTextBox4";
this.wmEndStateTextBox4.Size = new System.Drawing.Size(163, 31);
this.wmEndStateTextBox4.TabIndex = 1;
this.wmEndStateTextBox4.TextChanged += new System.EventHandler(this.wmEndStateTextBox4_TextChanged);
this.wmEndStateTextBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmEndStateTextBox4_KeyPress);
//
// wmStateLabel4
//
this.wmStateLabel4.AutoSize = true;
this.wmStateLabel4.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel4.Name = "wmStateLabel4";
this.wmStateLabel4.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel4.TabIndex = 0;
this.wmStateLabel4.Text = "State:";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.exclamation5);
this.groupBox5.Controls.Add(this.wmStartStateTextBox5);
this.groupBox5.Controls.Add(this.wmEndStateTextBox5);
this.groupBox5.Controls.Add(this.wmStateLabel5);
this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox5.ForeColor = System.Drawing.Color.Black;
this.groupBox5.Location = new System.Drawing.Point(25, 392);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(547, 81);
this.groupBox5.TabIndex = 5;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Water Meter 5";
//
// exclamation5
//
this.exclamation5.AutoSize = true;
this.exclamation5.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.exclamation5.ForeColor = System.Drawing.Color.Red;
this.exclamation5.Location = new System.Drawing.Point(515, 27);
this.exclamation5.Name = "exclamation5";
this.exclamation5.Size = new System.Drawing.Size(30, 38);
this.exclamation5.TabIndex = 5;
this.exclamation5.Text = "!";
this.exclamation5.Visible = false;
//
// wmStartStateTextBox5
//
this.wmStartStateTextBox5.Enabled = false;
this.wmStartStateTextBox5.Location = new System.Drawing.Point(164, 31);
this.wmStartStateTextBox5.Name = "wmStartStateTextBox5";
this.wmStartStateTextBox5.Size = new System.Drawing.Size(163, 31);
this.wmStartStateTextBox5.TabIndex = 4;
this.wmStartStateTextBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmStartStateTextBox5_KeyPress);
//
// wmEndStateTextBox5
//
this.wmEndStateTextBox5.Enabled = false;
this.wmEndStateTextBox5.Location = new System.Drawing.Point(350, 31);
this.wmEndStateTextBox5.Name = "wmEndStateTextBox5";
this.wmEndStateTextBox5.Size = new System.Drawing.Size(163, 31);
this.wmEndStateTextBox5.TabIndex = 1;
this.wmEndStateTextBox5.TextChanged += new System.EventHandler(this.wmEndStateTextBox5_TextChanged);
this.wmEndStateTextBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmEndStateTextBox5_KeyPress);
//
// wmStateLabel5
//
this.wmStateLabel5.AutoSize = true;
this.wmStateLabel5.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel5.Name = "wmStateLabel5";
this.wmStateLabel5.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel5.TabIndex = 0;
this.wmStateLabel5.Text = "State:";
//
// groupBox6
//
this.groupBox6.Controls.Add(this.exclamation6);
this.groupBox6.Controls.Add(this.wmStartStateTextBox6);
this.groupBox6.Controls.Add(this.wmEndStateTextBox6);
this.groupBox6.Controls.Add(this.wmStateLabel6);
this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox6.ForeColor = System.Drawing.Color.Black;
this.groupBox6.Location = new System.Drawing.Point(25, 482);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(547, 81);
this.groupBox6.TabIndex = 6;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Water Meter 6";
//
// exclamation6
//
this.exclamation6.AutoSize = true;
this.exclamation6.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.exclamation6.ForeColor = System.Drawing.Color.Red;
this.exclamation6.Location = new System.Drawing.Point(515, 27);
this.exclamation6.Name = "exclamation6";
this.exclamation6.Size = new System.Drawing.Size(30, 38);
this.exclamation6.TabIndex = 5;
this.exclamation6.Text = "!";
this.exclamation6.Visible = false;
//
// wmStartStateTextBox6
//
this.wmStartStateTextBox6.Enabled = false;
this.wmStartStateTextBox6.Location = new System.Drawing.Point(164, 31);
this.wmStartStateTextBox6.Name = "wmStartStateTextBox6";
this.wmStartStateTextBox6.Size = new System.Drawing.Size(163, 31);
this.wmStartStateTextBox6.TabIndex = 4;
this.wmStartStateTextBox6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmStartStateTextBox6_KeyPress);
//
// wmEndStateTextBox6
//
this.wmEndStateTextBox6.Enabled = false;
this.wmEndStateTextBox6.Location = new System.Drawing.Point(350, 31);
this.wmEndStateTextBox6.Name = "wmEndStateTextBox6";
this.wmEndStateTextBox6.Size = new System.Drawing.Size(163, 31);
this.wmEndStateTextBox6.TabIndex = 1;
this.wmEndStateTextBox6.TextChanged += new System.EventHandler(this.wmEndStateTextBox6_TextChanged);
this.wmEndStateTextBox6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.wmEndStateTextBox6_KeyPress);
//
// wmStateLabel6
//
this.wmStateLabel6.AutoSize = true;
this.wmStateLabel6.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel6.Name = "wmStateLabel6";
this.wmStateLabel6.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel6.TabIndex = 0;
this.wmStateLabel6.Text = "State:";
//
// startLabel
//
this.startLabel.AutoSize = true;
this.startLabel.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.startLabel.Location = new System.Drawing.Point(245, 11);
this.startLabel.Name = "startLabel";
this.startLabel.Size = new System.Drawing.Size(56, 23);
this.startLabel.TabIndex = 8;
this.startLabel.Text = "Start";
//
// endLabel
//
this.endLabel.AutoSize = true;
this.endLabel.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.endLabel.Location = new System.Drawing.Point(431, 11);
this.endLabel.Name = "endLabel";
this.endLabel.Size = new System.Drawing.Size(46, 23);
this.endLabel.TabIndex = 9;
this.endLabel.Text = "End";
//
// TestStartEndForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.ClientSize = new System.Drawing.Size(729, 586);
this.Controls.Add(this.endLabel);
this.Controls.Add(this.startLabel);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "TestStartEndForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "End States";
this.TopMost = true;
this.Load += new System.EventHandler(this.CycleEndForm_Load);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox wmEndStateTextBox2;
private System.Windows.Forms.Label wmStateLabel2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox wmEndStateTextBox1;
private System.Windows.Forms.Label wmStateLabel1;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox wmEndStateTextBox3;
private System.Windows.Forms.Label wmStateLabel3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TextBox wmEndStateTextBox4;
private System.Windows.Forms.Label wmStateLabel4;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.TextBox wmEndStateTextBox5;
private System.Windows.Forms.Label wmStateLabel5;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.TextBox wmEndStateTextBox6;
private System.Windows.Forms.Label wmStateLabel6;
private System.Windows.Forms.TextBox wmStartStateTextBox2;
private System.Windows.Forms.TextBox wmStartStateTextBox1;
private System.Windows.Forms.TextBox wmStartStateTextBox3;
private System.Windows.Forms.TextBox wmStartStateTextBox4;
private System.Windows.Forms.TextBox wmStartStateTextBox5;
private System.Windows.Forms.TextBox wmStartStateTextBox6;
private System.Windows.Forms.Label startLabel;
private System.Windows.Forms.Label endLabel;
private System.Windows.Forms.Label exclamation2;
private System.Windows.Forms.Label exclamation1;
private System.Windows.Forms.Label exclamation3;
private System.Windows.Forms.Label exclamation4;
private System.Windows.Forms.Label exclamation5;
private System.Windows.Forms.Label exclamation6;
}
}
@@ -11,7 +11,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Standard12
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -49,6 +49,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
public CycleBeginningForm()
{
InitializeComponent();
ControlBox = false;
labels = new Label[] { label1, label2, label3, label4, label5, label6,
label7, label8, label9, label10, label11, label12 };
@@ -28,9 +28,11 @@ namespace TBF.BenchControl.DataEntry.Standard12
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
EndStateText = new string[WaterMetersCount];
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
EndStateText = new string[WaterMetersCount];
completed = false;
StartForceCloseHandler();
}
@@ -1,279 +1,20 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard12
{
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
public override string ToString() { return string.Format("DataEntry.Standard12({0})", Cfg.ToString(1)); }
readonly EntryFormCfg entryFormCfg;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
string[] serialNr;
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
float[] wmStartState;
public float WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
float[] wmEndState;
public float WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryForm()
: base()
{
}
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmStartState = new float[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new float[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryForm myRef);
///
void OpenBeginningDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleBeginningForm(myRef.waterMeters, entryFormCfg.EnterSerialNrsAtTheEnd, entryFormCfg.SensusExtensions);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -0,0 +1,279 @@
///
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard12
{
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
public override string ToString() { return string.Format("DataEntry.Standard12({0})", Cfg.ToString(1)); }
readonly EntryFormCfg entryFormCfg;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
string[] serialNr;
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryFormNoStartEnd()
{
}
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmStartState = new double[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new double[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
///
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleBeginningForm(myRef.waterMeters, entryFormCfg.EnterSerialNrsAtTheEnd, entryFormCfg.SensusExtensions);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -1,18 +1,18 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Standard12
{
public class EntryFormFactory : IComponentFactory
public class Factory : IComponentFactory
{
public string ClassName { get { return "DataEntry-Standard-12"; } }
public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryForm(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Standard12
{
public class FactoryNoStartEnd : IComponentFactory
{
public string ClassName { get { return "DataEntry-Standard-12-NoStartEnd"; } }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryFormNoStartEnd(cfg); }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
}
}
}
@@ -49,6 +49,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
public TestStartEndForm()
{
InitializeComponent();
ControlBox = false;
TextBoxesCount = 12;
@@ -151,8 +152,6 @@ namespace TBF.BenchControl.DataEntry.Standard12
{
Localize();
//Height = 115 + 90 * WaterMetersCount;
for (int i = 0; i < TextBoxesCount; i++)
{
if (i < WaterMetersCount)
@@ -196,6 +195,8 @@ namespace TBF.BenchControl.DataEntry.Standard12
}
}
}
//Height = 85 + 44 * WaterMetersCount;
}
void Localize()
@@ -51,6 +51,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
public AdvancedFixedStartTestForm()
{
InitializeComponent();
ControlBox = false;
TextBoxesCount = 24;
@@ -9,7 +9,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Standard24
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -37,6 +37,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
public CycleBeginningForm()
{
InitializeComponent();
ControlBox = false;
textBoxesCount = 24;
labels = new Label[]
@@ -28,9 +28,12 @@ namespace TBF.BenchControl.DataEntry.Standard24
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
EndStateText = new string[WaterMetersCount];
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
EndStateText = new string[WaterMetersCount];
completed = false;
StartForceCloseHandler();
}
@@ -1,279 +1,20 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard24
{
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
public override string ToString() { return string.Format("DataEntry.Standard24({0})", Cfg.ToString(1)); }
readonly EntryFormCfg entryFormCfg;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
string[] serialNr;
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
float[] wmStartState;
public float WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
float[] wmEndState;
public float WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryForm()
: base()
{
}
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmStartState = new float[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new float[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryForm myRef);
///
void OpenBeginningDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -0,0 +1,279 @@
///
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard24
{
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
public override string ToString() { return string.Format("DataEntry.Standard24({0})", Cfg.ToString(1)); }
readonly EntryFormCfg entryFormCfg;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
string[] serialNr;
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryFormNoStartEnd()
{
}
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmStartState = new double[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new double[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
///
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -1,18 +1,18 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Standard24
{
public class EntryFormFactory : IComponentFactory
public class Factory : IComponentFactory
{
public string ClassName { get { return "DataEntry-Standard-24"; } }
public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryForm(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Standard24
{
public class FactoryNoStartEnd : IComponentFactory
{
public string ClassName { get { return "DataEntry-Standard-24-NoStartEnd"; } }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryFormNoStartEnd(cfg); }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
}
}
}
@@ -49,6 +49,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
public TestStartEndForm()
{
InitializeComponent();
ControlBox = false;
TextBoxesCount = 24;
@@ -9,7 +9,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Standard48
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -37,6 +37,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
public CycleBeginningForm()
{
InitializeComponent();
ControlBox = false;
textBoxesCount = 48;
labels = new Label[]
@@ -28,10 +28,13 @@ namespace TBF.BenchControl.DataEntry.Standard48
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
EndStateText = new string[WaterMetersCount];
completed = false;
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
EndStateText = new string[WaterMetersCount];
completed = false;
StartForceCloseHandler();
}
@@ -1,279 +1,20 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard48
{
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
public override string ToString() { return string.Format("DataEntry.Standard48({0})", Cfg.ToString(1)); }
readonly EntryFormCfg entryFormCfg;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
string[] serialNr;
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
float[] wmStartState;
public float WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
float[] wmEndState;
public float WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryForm()
: base()
{
}
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmStartState = new float[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new float[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryForm myRef);
///
void OpenBeginningDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -0,0 +1,279 @@
///
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard48
{
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
public override string ToString() { return string.Format("DataEntry.Standard48({0})", Cfg.ToString(1)); }
readonly EntryFormCfg entryFormCfg;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
string[] serialNr;
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryFormNoStartEnd()
{
}
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmStartState = new double[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new double[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
///
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -1,18 +1,18 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Standard48
{
public class EntryFormFactory : IComponentFactory
public class Factory : IComponentFactory
{
public string ClassName { get { return "DataEntry-Standard-48"; } }
public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryForm(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Standard48
{
public class FactoryNoStartEnd : IComponentFactory
{
public string ClassName { get { return "DataEntry-Standard-48-NoStartEnd"; } }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryFormNoStartEnd(cfg); }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
}
}
}
@@ -49,6 +49,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
public TestStartEndForm()
{
InitializeComponent();
ControlBox = false;
TextBoxesCount = 24;
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -9,7 +9,7 @@ using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Standard6
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
@@ -33,16 +33,18 @@ namespace TBF.BenchControl.DataEntry.Standard6
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleBeginningForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
SNText = new string[WaterMetersCount];
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
SNText = new string[WaterMetersCount];
Disabled = new bool[WaterMetersCount];
completed = false;
enabledComboBoxes = new List<ComboBox>();
StartForceCloseHandler();
Height = 147 + WaterMetersCount * 90;
Height = 147 + WaterMetersCount * 90;
completed = false;
StartForceCloseHandler();
}
/// <summary> Parameterless constructor for all watermeters </summary>
@@ -73,24 +75,29 @@ namespace TBF.BenchControl.DataEntry.Standard6
if (WaterMetersCount < 4) { groupBox4.Visible = false; } else { enabledComboBoxes.Add(comboBox4); }
if (WaterMetersCount < 5) { groupBox5.Visible = false; } else { enabledComboBoxes.Add(comboBox5); }
if (WaterMetersCount < 6) { groupBox6.Visible = false; } else { enabledComboBoxes.Add(comboBox6); }
}
Height = 147 + WaterMetersCount * 90;
}
void Localize()
{
Text = Strings.Data;
orderGroupBox.Text = Strings.Purchase_order;
groupBox1.Text = Strings.Water_Meter + " 1";
groupBox2.Text = Strings.Water_Meter + " 2";
groupBox3.Text = Strings.Water_Meter + " 3";
groupBox4.Text = Strings.Water_Meter + " 4";
groupBox5.Text = Strings.Water_Meter + " 5";
groupBox6.Text = Strings.Water_Meter + " 6";
label1.Text = Strings.Serial_Number;
label2.Text = Strings.Serial_Number;
label3.Text = Strings.Serial_Number;
label4.Text = Strings.Serial_Number;
label5.Text = Strings.Serial_Number;
label6.Text = Strings.Serial_Number;
okButton.Text = Strings.OkBtnText;
clearButton.Text = Strings.ClearBtnText;
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
@@ -28,10 +28,13 @@ namespace TBF.BenchControl.DataEntry.Standard6
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
EndStateText = new string[WaterMetersCount];
completed = false;
ControlBox = false;
this.WaterMetersCount = waterMetersCount;
EndStateText = new string[WaterMetersCount];
completed = false;
StartForceCloseHandler();
}
@@ -76,10 +79,10 @@ namespace TBF.BenchControl.DataEntry.Standard6
private void okButton_Click(object sender, EventArgs e)
{
if (WaterMetersCount >= 1) EndStateText[0] = textBox1.Text;
if (WaterMetersCount >= 2) EndStateText[1] = textBox3.Text;
if (WaterMetersCount >= 3) EndStateText[2] = textBox4.Text;
if (WaterMetersCount >= 4) EndStateText[3] = textBox5.Text;
if (WaterMetersCount >= 5) EndStateText[4] = textBox6.Text;
if (WaterMetersCount >= 2) EndStateText[1] = textBox2.Text;
if (WaterMetersCount >= 3) EndStateText[2] = textBox3.Text;
if (WaterMetersCount >= 4) EndStateText[3] = textBox4.Text;
if (WaterMetersCount >= 5) EndStateText[4] = textBox5.Text;
if (WaterMetersCount >= 6) EndStateText[5] = textBox6.Text;
completed = true;
@@ -1,279 +1,20 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard6
{
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
public override string ToString() { return string.Format("DataEntry.Standard6({0})", Cfg.ToString(1)); }
readonly EntryFormCfg entryFormCfg;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
string[] serialNr;
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
float[] wmStartState;
public float WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
float[] wmEndState;
public float WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryForm()
: base()
{
}
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmStartState = new float[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new float[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryForm myRef);
///
void OpenBeginningDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -0,0 +1,279 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard6
{
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
public override string ToString() { return string.Format("DataEntry.Standard6({0})", Cfg.ToString(1)); }
readonly EntryFormCfg entryFormCfg;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
string[] serialNr;
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
bool[] disabled;
public bool Disabled(int wmNr) { return (wmNr >= 0 && wmNr < disabled.Length) ? disabled[wmNr] : false; }
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryFormNoStartEnd()
{
}
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
serialNr = new string[Config.Data.WMsCount];
disabled = new bool[Config.Data.WMsCount];
wmStartState = new double[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new double[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
///
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleBeginningForm(myRef.waterMeters.Length);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Length);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Length, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Length, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -1,18 +1,18 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Standard6
{
public class EntryFormFactory : IComponentFactory
public class Factory : IComponentFactory
{
public string ClassName { get { return "DataEntry-Standard"; } }
public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryForm(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }

Some files were not shown because too many files have changed in this diff Show More