Compare commits

...
Author SHA1 Message Date
Milan Hanajik bdb1c1f233 Reconfigured for iPerlST 2015-12-21 10:10:34 +01:00
Milan Hanajik 5f0c56b19f Measured flow into OptoTelegramRaw bugfix, version 2.0.169. 2015-12-21 10:09:44 +01:00
Milan Hanajik 714780d0b6 StopPreviousOp modified to re-send command if necessary. 2015-12-20 22:14:18 +01:00
Milan Hanajik d852e390b3 Flow measured by reference flowmeter into OptoTelegramRaw and opto-data logs. 2015-12-20 21:12:00 +01:00
Milan Hanajik bb2087c002 ProcessData base class with 'public static' process data introduced. 2015-12-20 20:48:50 +01:00
Milan Hanajik 15ac3608c4 Default values of 'Publish' and 'Evaluate' = yes, program version shown in LoginDlg title. 2015-12-20 13:52:26 +01:00
Milan Hanajik e4e8c97cfd SensusOracleDatabase code cleanup, version 2.0.168 2015-12-20 11:59:25 +01:00
Milan Hanajik 3ef8674caf ResultsBrowser used to generate report for the customer for 179 watermeters, TBF v. 2.0.167, Results v.2.0.2. 2015-12-18 17:43:38 +01:00
Milan Hanajik 58a2be10aa Decimal numbers in OptoData logfiles use commas instead of dots, Delta time fixed, test start/end labels added. 2015-12-17 14:38:46 +01:00
Milan Hanajik bcae594b3f WaterMeterResults -> Results, etc. 2015-12-17 09:31:41 +01:00
Milan Hanajik 763acec379 Way of querying serial numbers form Oracle DB changed. 2015-12-16 10:51:35 +01:00
Milan Hanajik 12bd4e80dd Many various changes. 2015-12-15 04:16:53 +01:00
Milan Hanajik 4f456e0c40 DataDeposit and WaterMeterResult added. Procedure selection criteria added. 2015-12-15 01:57:52 +01:00
Milan Hanajik c6ef378bc9 MySQL query works OK. 2015-12-14 19:19:48 +01:00
Milan Hanajik 9689080387 ResultsBrowser works, MySQL DB opens, Oracle DB in TBF works in 64-bit OS, TBF v.2.0.165. 2015-12-13 09:37:48 +01:00
Milan Hanajik 6ecddf07f6 ResultsBrowser re-created. 2015-12-12 23:54:22 +01:00
Milan Hanajik 89ecf478ba ResultsBrowser changes (does not run correctly). 2015-12-10 22:17:47 +01:00
Milan Hanajik d9e7efa15a TestBenchFramework project, resources changes 2015-12-10 22:16:38 +01:00
Milan Hanajik 6e6edde77f (1) MunichPrintDocument fixed for three single water meters: 3 pages printed. (2) Cycle end form fixed (end state). (3) DE 2015-12-09 16:12:06 +01:00
Milan Hanajik b2c944f9b1 Change of logic for 'disabled' water meters in LabelPrinter, version 2.0.164. 2015-12-09 14:31:40 +01:00
Milan Hanajik 852ffd0602 LabelPrinter component clean-up, disabled single watermeters are not printed. 2015-12-09 00:31:59 +01:00
Milan Hanajik a06fe00440 Label printer added, version 2.0.163. 2015-12-08 23:44:52 +01:00
Milan Hanajik 8c1c5ed4f0 Bugfix in FixedStartCombinedMeters test method and Combined/EntryForm, version 2.0.162. 2015-12-08 17:59:25 +01:00
Milan Hanajik 123187aa8a Version 2.0.159. 2015-12-08 11:16:19 +01:00
Milan Hanajik 644c26355c iPerl opto data file name setting bug fix (FlyingStartSeq). 2015-12-08 10:48:06 +01:00
Milan Hanajik 432b288c34 DB works OK, project changes, MessageBox when database cannot be open. 2015-12-06 21:26:42 +01:00
Milan Hanajik f6cec9d769 'Config', 'Results' projects added, includes iPerl opto logging bug-fixes, builds OK, cannot open DB, version 2.0.158. 2015-12-05 14:18:36 +01:00
Milan Hanajik 29ece2f91c iPerl opto data logging: calculated data added, TODO: (1) ref.flow, (2) start/end mark. 2015-12-04 13:52:00 +01:00
Milan Hanajik e3aa3f6721 Water meter data cleared at the beginning of each cycle. 2015-12-04 12:24:55 +01:00
Milan Hanajik b1ccdcb5c1 Procedure combo box and progress bar in MainWnd stretched. 2015-12-03 23:37:14 +01:00
Milan Hanajik a541ac4945 'Counter' value added to opto data logging, version 1.6.154. 2015-12-03 20:58:54 +01:00
Milan Hanajik 38cbcb6430 iPerl opto data logging format changed, version 1.6.153. 2015-12-02 18:03:37 +01:00
Milan Hanajik c593ed903e Diverter ADC calibration values used to initialize RegValveCalib[,] array, version 1.6.152. 2015-12-02 14:10:54 +01:00
Milan Hanajik d488f62648 Initial version for Fuzhou PT40, component, defines, etc. 2015-12-02 13:25:40 +01:00
Milan Hanajik aefbcdb2a0 'Measurement' menu item and tab page removed, 'Pictures' menu item added by code optionally (#if CAMERA). 2015-12-02 08:24:05 +01:00
Milan Hanajik c1bdb53a4d Version 1.6.150. 2015-12-01 22:28:36 +01:00
Milan Hanajik 38dc09af7f German version of 'Break' button OK. 2015-12-01 22:18:12 +01:00
Milan Hanajik d83b497fa0 Problems with 'standrohre' test results (parts) and test names in BenchControlPanel fixed, version 1.6.149. 2015-12-01 22:03:53 +01:00
Milan Hanajik 5b31a94b74 Modifications for initial version of BADGER-VELKA-TRAT, version 1.6.148. 2015-12-01 10:38:28 +01:00
Milan Hanajik ee1afaa78b DiverterEdge[] initialization for SendCalibData() fn fixed, version 1.6.147. 2015-11-27 16:41:40 +01:00
Milan Hanajik 910d5d58dc Component updated 2015-11-27 15:58:03 +01:00
Milan Hanajik 6dfba78dbf Communication column removed from TransitionStep table. 2015-11-27 15:58:01 +01:00
Milan Hanajik cd98f30ad2 Uncertainty added to Test and TestResult tables. 2015-11-27 15:58:00 +01:00
Milan Hanajik 893b7af55a Procedure History and related DB changes, version 1.6.146. 2015-11-27 15:57:06 +01:00
Milan Hanajik 3bb8cb2ab7 iPerl DN40 hotfix?, version 1.5.145. 2015-11-25 08:53:40 +01:00
Milan Hanajik 22b1fbca90 Exception logging in MainSeq.OpenIPerlCommForm{} 2015-11-23 20:31:01 +01:00
Milan Hanajik ddcfa71273 Column withs in Components and Procedures forms are saved, version 1.5.144. 2015-11-23 15:12:39 +01:00
Milan Hanajik 8d123d306f Flying start method (without use of a scale) modified for iPerl, version 1.5.143. 2015-11-19 18:49:15 +01:00
Milan Hanajik a380a68855 SampleConfig files updated 2015-11-18 08:54:19 +01:00
Milan Hanajik 39d0a73e39 TBFSetup configuration changed, version 1.5.142. 2015-11-17 23:53:40 +01:00
Milan Hanajik a01f99fa7e iPerl flow direction determination, saved into Oracle DB. 2015-11-13 01:11:36 +01:00
Milan Hanajik 8a0411bd92 Writing into VT_PRUEFREIHE_PD added, version 1.5.141. 2015-11-13 00:03:33 +01:00
Milan Hanajik 8cd4f12de3 Oracle DB exceptions logging, version 1.5.140. 2015-11-12 19:48:29 +01:00
Milan Hanajik 4a528dafb8 Oracle database test results bug fix: measured flow in l/h, version 1.5.139. 2015-11-11 16:40:13 +01:00
Milan Hanajik b3a9302f53 Test results are written into the Oracle database..WaterMeters.iPerl process parameters added. 2015-11-11 12:44:37 +01:00
Milan Hanajik 575b17a919 iPerlST component updated, version 1.5.138 2015-11-10 09:48:21 +01:00
Milan Hanajik 41433329da Bux fix in Torino simulation, version 1.5.137. 2015-11-05 18:25:09 +01:00
Milan Hanajik e52f9ea9e7 Make Q2 correction from ... modifications, no Q2 factors written in case of large error, version. 1.5.136 2015-10-23 18:32:58 +02:00
Milan Hanajik 1892f9de9f Oracle DB 'Update' (when testing a water meter for the 2nd time) works well, version 1.5.134 2015-10-23 15:08:49 +02:00
Milan Hanajik db0c850d70 Romanian strings added (MURES). 2015-10-21 11:48:57 +02:00
Milan Hanajik 060aba08a9 Behavior of Elde.PumpWithFM.TurnOn(pumpPower) fixed: pump power change forces sending a command. 2015-10-21 09:54:41 +02:00
Milan Hanajik 5ac7572a3d MURES component updated, SetFlowOp watches StatusP.RefPulsesMsrmnt flag, version 1.5.133. 2015-10-21 09:51:38 +02:00
Milan Hanajik c9e2742745 Bugfix, version 1.5.132. 2015-10-21 07:49:42 +02:00
Milan Hanajik 5a77c5f660 iPerl parameters FactorLimitLo, FactorLimitHi moved to iPerlCommunication (arguments in the activity string), version 1.5.131. 2015-10-16 11:24:03 +02:00
Milan Hanajik 1301db3af4 MURES component upgraded, version 1.5.130. 2015-10-15 21:48:45 +02:00
Milan Hanajik 2cd877fb17 SetFlowOp with verification and re-sending the command. 2015-10-15 19:50:26 +02:00
Milan Hanajik 9dc3759f99 Added to summary/all results: (1) reference flow meter number (MID), (2) ref. density, (3) @temperature 2015-10-14 21:40:16 +02:00
Milan Hanajik 66f1bfa14b Transition sequence 'New': (1) generated name# is incremented, (2) name checked for uniqueness, (3) fixed size form without maximize/minimize buttons, (4) 'x' works correctly (as Cancel). 2015-10-14 16:50:35 +02:00
Milan Hanajik d7c262c87a Emptying the tank displays remaining time in min and sec. 2015-10-14 15:45:51 +02:00
Milan Hanajik 02da6ae134 Default serial port settings of Comet Ambient sensor changed 2015-10-14 13:52:52 +02:00
Milan Hanajik 3336454719 Language resources exported. 2015-10-09 07:58:17 +02:00
Milan Hanajik 5967db86a1 Sk, Ro strings added. Many German resource files removed from the project. Localization done via strings. 2015-10-08 00:14:21 +02:00
Milan Hanajik 2acd67707e FixedStartAdvanced test method added. 2015-10-05 11:24:06 +02:00
Milan Hanajik 70f38e9352 Adjustment test method/adjustment form supports 10-12 water metes, version 1.5.129. 2015-10-05 09:59:27 +02:00
Milan Hanajik 687e843e5f Version 1.5.128 2015-10-04 22:52:18 +02:00
Milan Hanajik 43eaa61007 Adjustment test method for 24 WMs fixed, MakeSimulated(..) and MakeSimulatedCompound(..) moved to SequenceBase, version 1.5.127. 2015-10-04 22:41:52 +02:00
Milan Hanajik 518d87afe1 Added support for MURES_PT40, defines, component, version 1.5.125. 2015-09-26 20:59:31 +02:00
Milan Hanajik f2676993b1 Results from pressure and leak tests fixed for compound meters, version 1.5.124. 2015-09-25 10:15:46 +02:00
Milan Hanajik 786485f566 Language and layout changes for German. 2015-09-25 09:22:11 +02:00
Milan Hanajik e3df943946 Serious bug fixes: Leak and pressure tests did not use correct MetersKind info when saving results. 2015-09-25 09:21:37 +02:00
Milan Hanajik bdd2f5f89d Pre-selected water meter type when opening results page configuration. 2015-09-24 19:11:42 +02:00
Milan Hanajik 6318ce7700 Munich Printer page orientation can be selected in component properties, version 1.5.122. 2015-09-24 18:59:42 +02:00
Milan Hanajik 5e9f9e7425 Bug fix in Basic Results Writer: program crash when no items were selected. 2015-09-24 18:58:36 +02:00
Milan Hanajik 7ca07d78c6 Compound meter test simulations added to iPerlCommunication method. 2015-09-24 18:57:14 +02:00
Milan Hanajik 69a51908c2 DataEntry.Standars48.CycleBeginningForm completed, TODO: TestStartEndForm. 2015-09-22 20:38:35 +02:00
Milan Hanajik 656ef27a3b Flow control during a test - process data logging improvement 2015-09-22 20:37:32 +02:00
Milan Hanajik 72754ebe10 Flow control during a test, version 1.5.121. 2015-09-22 18:39:00 +02:00
Milan Hanajik d7e6a69ca9 StartMeasurementOp interface changed: OutputPath is the first argment 2015-09-22 17:03:26 +02:00
Milan Hanajik 2985338d7e DataEntry.Standard12 and DataEntry.Standard48 added, TODO: complete Standard48. 2015-09-22 14:01:43 +02:00
Milan Hanajik 120c1cc39d Remaining test time is shown in minutes and seconds. 2015-09-22 11:35:44 +02:00
Milan Hanajik f203c56e8b Program is protected against Ambient sensor serial port failure, version 1.5.120. 2015-09-22 11:35:43 +02:00
Milan Hanajik b3dc49e8b7 Flushed opto-data indication in iPerlCommunicationsForm, version 1.5.119. 2015-09-22 11:35:17 +02:00
Milan Hanajik 8c796eaeee Setting the flow - an attempt to solve bug, version 1.5.116. 2015-09-18 07:46:57 +02:00
Milan Hanajik c45f8298ac ResultsPrinters.Basic support for: (1) multiple pages, (2) page orientation, (3) top margin. 2015-09-18 00:10:06 +02:00
Milan Hanajik 4a35215be9 Adjustment for 24 water meters, fixed a bug in trransition sequence editor, version 1.5.115. 2015-09-17 20:58:56 +02:00
Milan Hanajik 62cd81b5f7 Defines re-arranged so that new benches do not require any modification, bug in BADGER fixed. 2015-09-17 19:14:18 +02:00
Milan Hanajik 7afb780d5b More RFID comm. logging, 'Set active mode' executed also when wm.CommFailed == true, version 1.5.114. 2015-09-16 16:30:30 +02:00
Milan Hanajik cdb8304287 Oracle DataAccess added to references, DLL added to packages/..., version 1.5.113. 2015-09-14 23:08:57 +02:00
Milan Hanajik ebda3f5127 Bug fix: iPerlCommunication simultaneously with evacuation repeated 2x, version 1.5.112. 2015-09-14 10:25:41 +02:00
Milan Hanajik 06c46785f6 (1) bug fixes, (2) common iPerlCommunication test result derived from the 1st test (Read configuration), version 1.5.111. 2015-09-11 19:36:37 +02:00
Milan Hanajik e230ce02bf 'CommFailed' flag in iPerl.WaterMeter, 'Disabled' not used for this purpose, all 40 meters displayed in results, version 1.5.109. 2015-09-11 14:15:32 +02:00
Milan Hanajik 2a0fbca1e0 Baujahr written into Oracle database 2015-09-11 08:23:13 +02:00
Milan Hanajik 2845cf20f5 iPerlCommunication simultaneously with evacuation (SimultWithNext test parameter), version 1.5.108. 2015-09-10 20:07:06 +02:00
Milan Hanajik e9440411bc RFID communication properties are iPerlCommunication component parameters. 2015-09-06 23:36:14 +02:00
Milan Hanajik d041cd1d20 Evaluate and Publish properties of test methods changed to stateless functions Evaluate(test) and Publish(test), this fixes results, version 1.5.107 2015-09-06 22:21:54 +02:00
Milan Hanajik 264830a36b iPerlCommunication simultaneously with purging fixed II., Invoke( ) in MainSeq. 2015-09-06 00:09:52 +02:00
Milan Hanajik 558f000198 iPerlCommunication simultaneously with purging fixed, uses IParamsProvider.Clone(). 2015-09-05 12:19:11 +02:00
Milan Hanajik cb4833664c Clone( ) function added to IParamsProvider and all procedure/test parameters classes. 2015-09-05 12:18:09 +02:00
Milan Hanajik d5cb6ca71b iPerlCommunication simultaneously with purging, STOP button function fixed, version 1.5.106 2015-09-05 09:58:01 +02:00
Milan Hanajik 7827fa4e5b Minor fix in FlyingStartCollectionMethod. 2015-09-04 13:47:41 +02:00
Milan Hanajik d1944753b3 Bug fix: When new test was added to a procedure, test parameters were not created correctly (strange iPerlCommunication activity after Add). 2015-08-30 08:31:53 +02:00
Milan Hanajik c6007d3b6a Check done on startup whether all RFID serial ports are free, version 1.5.105 2015-08-30 07:21:37 +02:00
Milan Hanajik 91a4ca3760 Q2 correction factor logging and display improvements, bug fix in iPerlCommunication, Action="Simulate Q#", version 1.5.103. 2015-08-27 07:03:42 +02:00
Milan Hanajik 36e0c177c7 Q@ correction logging in summary results, version 1.5.102. 2015-08-26 18:59:38 +02:00
Milan Hanajik e13b553ab5 iPerl.WaterMeter: Q2 correction with limits given by Q2adj error limits 2015-08-26 18:18:23 +02:00
Milan Hanajik 2799522a22 "Q2 corrected from ..." and "Simulate ..." in iPerlCommunication make a record in summary results, invoke OnTestCompleted(). 2015-08-26 18:00:46 +02:00
Milan Hanajik 3e86aa99cb Minimum and maximum value for the calculated calibration factor, version 1.5.101. 2015-08-26 17:57:49 +02:00
Milan Hanajik ebbc0528c6 "Q2 corrected from ..." fix, no correction when error <= 0.5% 2015-08-25 17:45:46 +02:00
Milan Hanajik 1d8156e4d7 Version 1.5.100: - serious bug in SensusOracle database configuration control fixed, etc.
- bug in ResultsWriter.Basic configuration control fixed
- FlyingStartMassCollection minor fixes
- iPerlCommunication activity "Q2 corrected from ..." implemented
- iPerl communication timeout increased to 1800 ms
- more comments in EntitiesTestResults
2015-08-25 17:03:36 +02:00
Milan Hanajik fcf4f6bdcf iPerlComm logging/display modifications: real PCB# shown, etc. Preparation for "Q2 corrected from ..." activity, version 1.5.99. 2015-08-25 11:47:21 +02:00
Milan Hanajik 08aed03cef Info message when at least one of the components is in Simulation mode, version 1.5.98. 2015-08-24 16:04:31 +02:00
Milan Hanajik da01b1fe61 CalibFactor included in 'summaryResults', version 1.5.97. 2015-08-24 15:16:14 +02:00
Milan Hanajik d4399c23ca DebugMode 'FailureDuringOperation' added. Redrawing results and reading iPerl opto-port more robust with extra exception handling, version 1.5.96. 2015-08-24 13:52:06 +02:00
Milan Hanajik 31fc49485a More DataEntry.iPerl changes, Oracle DB uses testResult.PurchaseOrder, opto-data logging creates ProcessData folder correctly. 2015-08-24 09:33:13 +02:00
Milan Hanajik 217ceffa67 DataEntry.iPerl forms added, version = 1.5.95. 2015-08-24 08:02:43 +02:00
Milan Hanajik 6b10e67c17 Fix in Q2 correction logging 2015-08-24 07:40:07 +02:00
Milan Hanajik 76b9f64029 Serious bugfixes - version 1.5.94 2015-08-22 20:37:43 +02:00
Milan Hanajik cabee1f06e Q2 correction finally solved, version 1.5.93. 2015-08-22 18:11:53 +02:00
Milan Hanajik 421474b990 Bugfixes: Q2 correction, both BenchID-s, ver.1.5.92 2015-08-22 16:25:35 +02:00
Milan Hanajik 6a7e1e5052 Start/Stop volume and time in logs for iPerl (datastream), ver.1.5.91. 2015-08-22 14:28:20 +02:00
Milan Hanajik f24cd89928 Bugfix in Q2 correction 2015-08-22 13:58:55 +02:00
Milan Hanajik 2b8f5ebec3 Bugfixes in: (1) use of iPerl Board# param, (2) Evaluate and Publish flying strt test params, (3) Q2 correction, (4) opto-log-file-name cleanup, etc. 2015-08-22 13:34:10 +02:00
Milan Hanajik f3dabcbcc1 Q2 correction 2015-08-22 07:55:17 +02:00
Milan Hanajik d390705df8 iPerlAdjustment removed from the project. 2015-08-22 06:27:57 +02:00
Milan Hanajik f75138eced FlyingStartCollectionMethod test parameters bool Evaluate and bool Publish added, ver.1.5.90. 2015-08-22 06:24:00 +02:00
Milan Hanajik 46b17fddc8 Many changes, iPerl-s have Board# param., iPerlCommunication has RFIT port nr. params, bugfixes, etc. 2015-08-21 20:52:10 +02:00
Milan Hanajik 5d00bcf456 Performance of reading opto-data improved, deferred logging, nr.threads in iPerlComm = 4version 1.5.89. 2015-08-21 16:09:36 +02:00
Milan Hanajik db8598579d Write given calibration factors function added, database almost implemented, version 1.5.88. 2015-08-21 14:30:47 +02:00
Milan Hanajik be1344034e SensusOracle.Database: TestBenchId added, working on queries. 2015-08-20 18:14:22 +02:00
Milan Hanajik a0c3ffd01a iPerlST: Use absolute value of volume difference in calculations. Comment added. 2015-08-20 18:12:43 +02:00
Milan Hanajik 4faf6b5d69 Fixed a problem with pumps P3 and P4 on iPerST bench, version 1.5.87. 2015-08-20 16:22:33 +02:00
Milan Hanajik 2e04076b30 Fixed a bug in iPerl decimal PCBNumber calculation, version 1.5.86 2015-08-20 05:13:20 +02:00
Milan Hanajik 20762b7fde iPerl decimal PCBNumber calculated from data in CaonfigStruct, TODO: fix a bug. 2015-08-20 05:06:23 +02:00
unknown 440199b3bc iPerlCommunication, etc: A correct calibration factor is written to iPerl. 2015-08-19 21:12:10 +02:00
Milan Hanajik 3647740d4a Oracle DB initialized and connection checked. 2015-08-19 17:45:29 +02:00
Milan Hanajik b8d9e1aa12 Manifest signing key problem fixed 2015-08-19 17:18:26 +02:00
Milan Hanajik 3ebeb4a0dc Sensus Oracle Database support (stub) added, version 1.5.85 2015-08-19 14:17:02 +02:00
Milan Hanajik 33963ec8cf Version 1.5.84. Reading registers, scales, temperature, pressure, ... during test done in one state in the sequence.
Many changes in TestMethods.iPerlCommunication and WaterMeters.iPerl.WaterMeter. iPerl measurement with opto-data works OK.
Logging in State changed, ...
2015-08-19 13:04:47 +02:00
Milan Hanajik fa6b99b980 StateMachine timing period is 2 seconds for iPerlST bench, 1 second for other all benches. 2015-08-19 13:00:00 +02:00
Milan Hanajik 22c652ad24 Bugfix: Reading of water meter pulses with overflow avoidance of 16-bit counters was not implemented correctly. 2015-08-19 12:56:28 +02:00
Milan Hanajik c376e67eab Watchdog function of QuidoRS device implemented permanently on output bit #4, mask 0x0010. 2015-08-19 12:53:34 +02:00
Milan Hanajik e349d6811d 'CommErr error' codes from RFID comm. routines instead of 'bool success'. 2015-08-17 16:02:30 +02:00
Milan Hanajik 7b134f7ba5 Version 1.5.82 2015-08-17 13:46:25 +02:00
Milan Hanajik 7f46e64a0d Version 1.5.81 2015-08-17 08:15:29 +02:00
Milan Hanajik ed4afff0b2 Changes: iPerl RR is reset at the beginnign of FlyingStartMassCollection test. etc. 2015-08-16 22:00:02 +02:00
Milan Hanajik 713fd9d0ae Raw opto telegram added, TODO: complete OptoTelegramRaw implementation. 2015-08-16 20:34:06 +02:00
Milan Hanajik 5db53ca6e3 Generic improvements: process page fixes, error format F2 or F3 (master), results page fixes, Comet ambient serial parameters (comment). 2015-08-16 19:58:43 +02:00
Milan Hanajik 752bfd98b1 iPerlST component updated, version 1.5.80 2015-08-16 18:07:04 +02:00
Milan Hanajik e302cb9335 OptoTelegram serial port data parsing, OptoData and RfidData logging, opto-measurement ready to be tested. 2015-08-16 12:54:44 +02:00
Milan Hanajik a6aa6739ad Modbus modification to support simulation mode. 2015-08-15 21:11:01 +02:00
Milan Hanajik ee044e3dd7 More iPerlCommunication changes: read/write Q2 correction factors from/to memory, cleanup of all functions. 2015-08-15 21:09:31 +02:00
Milan Hanajik 68a038d321 Version 1.5.79 2015-08-15 16:14:43 +02:00
Milan Hanajik a0cf76112d Version 1.5.78 2015-08-15 13:32:24 +02:00
Milan Hanajik 5f5ac87f42 iPerlCommunication: testModeConfig parsed and set, correct wm.Disabled behavior. 2015-08-14 20:18:44 +02:00
Milan Hanajik f85fbd0b55 Problems when passing flowmeter/diverter info to test start by SendCommand() fixed, version 1.5.77. 2015-08-14 18:14:08 +02:00
Milan Hanajik 90cfda893c ProcessTabPageCtrl48 functional for 40 watermeters. 2015-08-14 18:13:46 +02:00
Milan Hanajik 1bf987a6cd More iPerlST configuration changes (Entities, Mappings for 40 meters in MetersPath) 2015-08-14 14:37:53 +02:00
Milan Hanajik 4166bf8d87 More iPerl communication 2015-08-14 14:33:36 +02:00
Milan Hanajik bf376b4ff0 iPerlST configuration changes, etc., version 1.5.76 2015-08-14 12:01:00 +02:00
Milan Hanajik 7e28381df5 Working on iPerlCommunication activities required for the production cycle. 2015-08-14 11:39:28 +02:00
Milan Hanajik 289e06ce65 Added new components are unlocked - preparation, tests. 2015-08-13 08:36:28 +02:00
Milan Hanajik faeb940134 Communication with 40 iPerl meters in 1 worker thread. 2015-08-13 08:35:34 +02:00
Milan Hanajik 343c04061e Component updated. 2015-08-12 16:23:15 +02:00
Milan Hanajik 6440a8950c Communication in 4 parallel threads (4 boards, 4 RFID ports). 2015-08-12 16:05:06 +02:00
Milan Hanajik e569a80ec2 iPerl component updated + interface change: ulong DigitalInputs (it was uint), iPerlCommunication test method added, etc, version 1.5.75. 2015-08-12 14:55:35 +02:00
Milan Hanajik 40a43e46b4 Changes required for 'Zapiska'. 2015-08-02 17:23:47 +02:00
Milan Hanajik 7c1b713780 Zapiska and WaterMeterPL added, BenchInfo.Polska added, IBenchInfo infroduced, Version 1.5.74 2015-08-02 14:09:24 +02:00
Milan Hanajik 52c5679c00 iPerl test - iPerlAdjustment test method. 2015-08-01 21:24:32 +02:00
Milan Hanajik 5997a494bd OptoreeceivedEventArgs added to WaterMeters.iPerl 2015-07-31 19:45:10 +02:00
Milan Hanajik 3665f4d5d0 Dummy files deleted 2015-07-31 19:27:20 +02:00
Milan Hanajik f2da177517 Modbus and QuidoRS components added
WaterMeters folder created, WaterMeter component relocated within the project, iPerl component added
WaterMeters.iPerl implements IRegisterReader interface, TODO: Implement WaterMeter.ReadPulses( ) function
iPerlAdjustment test method added
2015-07-31 19:18:56 +02:00
Milan Hanajik 6ecae88518 iPerl ST support via define IPERLST, component added 2015-07-29 17:48:09 +02:00
Milan Hanajik 769bb5a9bc UiBridge simplified. 2015-07-29 16:42:59 +02:00
Milan Hanajik 083cfd0efd Version 1.5.72 2015-07-29 13:21:02 +02:00
Milan Hanajik 064de08d4b Version 1.5.71 2015-07-28 21:46:15 +02:00
Milan Hanajik f924e72088 Version 1.5.70 2015-07-27 10:54:26 +02:00
Milan Hanajik 81e6feded3 Version 1.5.69 2015-07-16 08:38:36 +02:00
576 changed files with 67439 additions and 11189 deletions
+10 -4
View File
@@ -1,7 +1,13 @@
TestBenchFramework/bin/
TestBenchFramework/obj/
Config/bin/
Config/obj/
Results/bin/
Results/obj/
ResultsBrowser/bin/
ResultsBrowser/obj/
TBFSetup/
TestBenchFramework/bin/
TestBenchFramework/obj/
TBFSetup/Debug/
TBFSetup/Release/
Doc/
*.suo
*.suo
*.bak
+139
View File
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Config</RootNamespace>
<AssemblyName>Config</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;IPERLST</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;IPERLST</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.1.3.0.733\lib\FluentNHibernate.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections">
<HintPath>..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net20\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\packages\NHibernate.3.3.3.4001\lib\Net35\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite">
<HintPath>..\packages\System.Data.SQLite.1.0.90.0\lib\net40\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.Linq">
<HintPath>..\packages\System.Data.SQLite.1.0.90.0\lib\net40\System.Data.SQLite.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Data.cs" />
<Compile Include="DatabaseSettings.cs" />
<Compile Include="DatabaseSettingsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DatabaseSettingsDlg.designer.cs">
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
</Compile>
<Compile Include="DBSettings.cs" />
<Compile Include="Entities\BenchPath.cs" />
<Compile Include="Entities\Component.cs" />
<Compile Include="Entities\ComponentProcedure.cs" />
<Compile Include="Entities\ComponentTest.cs" />
<Compile Include="Entities\Enums.cs" />
<Compile Include="Entities\FeedingPath.cs" />
<Compile Include="Entities\Group.cs" />
<Compile Include="Entities\IHasItemNr.cs" />
<Compile Include="Entities\IHasValves.cs" />
<Compile Include="Entities\MeasurementCorrection.cs" />
<Compile Include="Entities\MetersPath.cs" />
<Compile Include="Entities\MeterTestResult.cs" />
<Compile Include="Entities\OutputPath.cs" />
<Compile Include="Entities\Procedure.cs" />
<Compile Include="Entities\ProcedureHistory.cs" />
<Compile Include="Entities\Test.cs" />
<Compile Include="Entities\TestResult.cs" />
<Compile Include="Entities\TransitionSequence.cs" />
<Compile Include="Entities\TransitionStep.cs" />
<Compile Include="Entities\User.cs" />
<Compile Include="Entities\VirtualBenchSequence.cs" />
<Compile Include="Entities\VirtualBenchStep.cs" />
<Compile Include="Entities\Watermeter.cs" />
<Compile Include="Entities\WMType.cs" />
<Compile Include="FluentCommon.cs" />
<Compile Include="Grp.cs" />
<Compile Include="Mappings\BenchPathMap.cs" />
<Compile Include="Mappings\ComponentMap.cs" />
<Compile Include="Mappings\ComponentProcedureMap.cs" />
<Compile Include="Mappings\ComponentTestMap.cs" />
<Compile Include="Mappings\FeedingPathMap.cs" />
<Compile Include="Mappings\GroupMap.cs" />
<Compile Include="Mappings\MeasurementCorrectionMap.cs" />
<Compile Include="Mappings\MetersPathMap.cs" />
<Compile Include="Mappings\MeterTestResultMap.cs" />
<Compile Include="Mappings\OutputPathMap.cs" />
<Compile Include="Mappings\ProcedureMap.cs" />
<Compile Include="Mappings\TestMap.cs" />
<Compile Include="Mappings\TestResultMap.cs" />
<Compile Include="Mappings\TransitionSequenceMap.cs" />
<Compile Include="Mappings\TransitionStepMap.cs" />
<Compile Include="Mappings\UserMap.cs" />
<Compile Include="Mappings\VirtualBenchSequenceMap.cs" />
<Compile Include="Mappings\VirtualBenchStepMap.cs" />
<Compile Include="Mappings\WatermeterMap.cs" />
<Compile Include="Mappings\WMTypeMap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Strings.Designer.cs" />
<Compile Include="ResultItemSpec.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="DatabaseSettingsDlg.resx">
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -3,7 +3,7 @@
///
using System;
namespace TBF
namespace Config
{
/// <summary>
/// Database settings required to make a connection
+42
View File
@@ -0,0 +1,42 @@
using System;
namespace Config
{
public class Data
{
public const string AdminUsername = "admin";
public const string AdminPassword = "staratura";
public const string SQLiteDbFName = "SQLite.db";
#if MUNICH
public const int WMsCount = 3;
public const int LineSize = 1;
public const int CompoundWMsCount = 1;
#elif DN100 || BADGER_VELKA_TRAT
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
#elif FUZHOU300 || FUZHOU150 || PT200IL
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 3;
#elif TORINO50 || BADGER_MALA_TRAT
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
#elif TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40
public const int WMsCount = 20;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
#elif IPERLST
public const int WMsCount = 40;
public const int LineSize = 20;
public const int CompoundWMsCount = 1;
#endif
///
/// Database related: This object reference is set after a successful user login
///
public static DatabaseSettings CurrentBench;
}
}
@@ -5,7 +5,7 @@ using System;
using System.Text;
using System.Xml.Serialization;
namespace TBF
namespace Config
{
/// <summary>
/// Test bench database settings, contains bench name and settings od several databases
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF
namespace Config
{
partial class DatabaseSettingsDlg
{
@@ -69,7 +69,6 @@ namespace TBF
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.okButton, "okButton");
this.okButton.Name = "okButton";
this.okButton.UseVisualStyleBackColor = true;
@@ -78,7 +77,6 @@ namespace TBF
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.cancelButton, "cancelButton");
this.cancelButton.Name = "cancelButton";
this.cancelButton.UseVisualStyleBackColor = true;
@@ -87,7 +85,6 @@ namespace TBF
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.ImageKey = global::TBF.Resources.Strings.String1;
this.label1.Name = "label1";
//
// benchNameTextBox
@@ -103,7 +100,6 @@ namespace TBF
// connectionStringLabel
//
resources.ApplyResources(this.connectionStringLabel, "connectionStringLabel");
this.connectionStringLabel.ImageKey = global::TBF.Resources.Strings.String1;
this.connectionStringLabel.Name = "connectionStringLabel";
//
// benchConnectionStringTextBox
@@ -129,37 +125,31 @@ namespace TBF
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.ImageKey = global::TBF.Resources.Strings.String1;
this.label2.Name = "label2";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.ImageKey = global::TBF.Resources.Strings.String1;
this.label3.Name = "label3";
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.ImageKey = global::TBF.Resources.Strings.String1;
this.label4.Name = "label4";
//
// label5
//
resources.ApplyResources(this.label5, "label5");
this.label5.ImageKey = global::TBF.Resources.Strings.String1;
this.label5.Name = "label5";
//
// label6
//
resources.ApplyResources(this.label6, "label6");
this.label6.ImageKey = global::TBF.Resources.Strings.String1;
this.label6.Name = "label6";
//
// testConnUsersBtn
//
this.testConnUsersBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnUsersBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnUsersBtn, "testConnUsersBtn");
this.testConnUsersBtn.Name = "testConnUsersBtn";
this.testConnUsersBtn.UseVisualStyleBackColor = true;
@@ -168,7 +158,6 @@ namespace TBF
// createUsersDbBtn
//
this.createUsersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createUsersDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createUsersDbBtn, "createUsersDbBtn");
this.createUsersDbBtn.Name = "createUsersDbBtn";
this.createUsersDbBtn.UseVisualStyleBackColor = true;
@@ -177,14 +166,12 @@ namespace TBF
// realBenchCheckBox
//
resources.ApplyResources(this.realBenchCheckBox, "realBenchCheckBox");
this.realBenchCheckBox.ImageKey = global::TBF.Resources.Strings.String1;
this.realBenchCheckBox.Name = "realBenchCheckBox";
this.realBenchCheckBox.UseVisualStyleBackColor = true;
//
// dbTypeLabel
//
resources.ApplyResources(this.dbTypeLabel, "dbTypeLabel");
this.dbTypeLabel.ImageKey = global::TBF.Resources.Strings.String1;
this.dbTypeLabel.Name = "dbTypeLabel";
//
// usersDbTypeComboBox
@@ -220,7 +207,6 @@ namespace TBF
// testConnBenchBtn
//
this.testConnBenchBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnBenchBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnBenchBtn, "testConnBenchBtn");
this.testConnBenchBtn.Name = "testConnBenchBtn";
this.testConnBenchBtn.UseVisualStyleBackColor = true;
@@ -229,7 +215,6 @@ namespace TBF
// testConnProceduresBtn
//
this.testConnProceduresBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnProceduresBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnProceduresBtn, "testConnProceduresBtn");
this.testConnProceduresBtn.Name = "testConnProceduresBtn";
this.testConnProceduresBtn.UseVisualStyleBackColor = true;
@@ -238,7 +223,6 @@ namespace TBF
// testConnWMTypesBtn
//
this.testConnWMTypesBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnWMTypesBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnWMTypesBtn, "testConnWMTypesBtn");
this.testConnWMTypesBtn.Name = "testConnWMTypesBtn";
this.testConnWMTypesBtn.UseVisualStyleBackColor = true;
@@ -247,7 +231,6 @@ namespace TBF
// testConnWaterMetersBtn
//
this.testConnWaterMetersBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnWaterMetersBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnWaterMetersBtn, "testConnWaterMetersBtn");
this.testConnWaterMetersBtn.Name = "testConnWaterMetersBtn";
this.testConnWaterMetersBtn.UseVisualStyleBackColor = true;
@@ -256,7 +239,6 @@ namespace TBF
// createBenchDbBtn
//
this.createBenchDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createBenchDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createBenchDbBtn, "createBenchDbBtn");
this.createBenchDbBtn.Name = "createBenchDbBtn";
this.createBenchDbBtn.UseVisualStyleBackColor = true;
@@ -265,7 +247,6 @@ namespace TBF
// createProceduresDbBtn
//
this.createProceduresDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createProceduresDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createProceduresDbBtn, "createProceduresDbBtn");
this.createProceduresDbBtn.Name = "createProceduresDbBtn";
this.createProceduresDbBtn.UseVisualStyleBackColor = true;
@@ -274,7 +255,6 @@ namespace TBF
// createWMTypesDbBtn
//
this.createWMTypesDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createWMTypesDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createWMTypesDbBtn, "createWMTypesDbBtn");
this.createWMTypesDbBtn.Name = "createWMTypesDbBtn";
this.createWMTypesDbBtn.UseVisualStyleBackColor = true;
@@ -283,7 +263,6 @@ namespace TBF
// createWaterMetersDbBtn
//
this.createWaterMetersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createWaterMetersDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createWaterMetersDbBtn, "createWaterMetersDbBtn");
this.createWaterMetersDbBtn.Name = "createWaterMetersDbBtn";
this.createWaterMetersDbBtn.UseVisualStyleBackColor = true;
@@ -2,15 +2,10 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TBF.Resources;
using Config.Resources;
namespace TBF
namespace Config
{
/// <summary>
/// Dialog to process test bench name and database settings (BenchSettings)
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class BenchPath : IHasItemNr, IHasValves
{
@@ -26,7 +26,9 @@ namespace TBF.Entities
public BenchPath()
{
}
ValvesOpen = string.Empty;
ValvesClose = string.Empty;
}
public BenchPath(string name, int itemNr)
: this()
@@ -35,33 +37,6 @@ namespace TBF.Entities
ItemNr = itemNr;
}
public BenchPath(BenchControl.BenchPath path)
: this(path.Name, path.ItemNr)
{
Qfrom = path.Qfrom;
Qto = path.Qto;
TempIn = (path.TempIn != null) ? path.TempIn.Cfg.Name : null;
TempOut = (path.TempOut != null) ? path.TempOut.Cfg.Name : null;
PressIn = (path.PressIn != null) ? path.PressIn.Cfg.Name : null;
PressOut = (path.PressOut != null) ? path.PressOut.Cfg.Name : null;
string vOpen = string.Empty;
foreach (var valve in path.ValvesOpen)
{
if (vOpen != string.Empty) vOpen += ";";
vOpen += valve.Cfg.Name;
}
ValvesOpen = vOpen;
string vClose = string.Empty;
foreach (var valve in path.ValvesClose)
{
if (vClose != string.Empty) vClose += ";";
vClose += valve.Cfg.Name;
}
ValvesClose = vClose;
}
public virtual BenchPath Clone(string name, int itemNr)
{
BenchPath result = new BenchPath(name, itemNr);
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class Component : IHasItemNr
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.Entities
namespace Config.Entities
{
public class ComponentProcedure
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.Entities
namespace Config.Entities
{
public class ComponentTest
{
@@ -4,8 +4,16 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public enum ProcedureState
{
Active,
History,
Template,
Count,
}
/// <summary>
/// Kind of meters for the procedure / test
/// </summary>
@@ -15,6 +23,12 @@ namespace TBF.Entities
Combined,
}
public enum Medium
{
ColdWater,
HotWater,
}
/// <summary>
/// Transition step is finished when this condition is fulfilled
/// </summary>
@@ -49,6 +63,13 @@ namespace TBF.Entities
Disk,
}
public enum PageOrientation
{
Portrait,
Landscape,
Count,
}
public enum UnitsVolume
{
Liter,
@@ -62,12 +83,13 @@ namespace TBF.Entities
{
DetectedOff = -2,
DetectedOn = -1,
Normal = 0, /// Normal operation
AutoDetect, /// The component (device) will be auto-detected
Off, /// The component is off
Normal = 0, /// Normal operation
AutoDetect, /// The component (device) will be auto-detected
FailureDuringOperation, /// Failure during operation -> disabled
Off, /// The component is off
Record,
Reply,
Simulate, /// Test bench simulation, this mode does not require any hardware
Simulate, /// Test bench simulation, this mode does not require any hardware
Inherit,
Count,
}
@@ -83,5 +105,20 @@ namespace TBF.Entities
All,
Count,
}
/// Arrangement of tests
public enum TestsArrangement
{
Rows,
Columns,
}
/// Arrangement of meters
public enum MetersArrangement
{
Vertically,
Horizontally,
}
}
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class FeedingPath : IHasItemNr, IHasValves
{
@@ -23,7 +23,9 @@ namespace TBF.Entities
public FeedingPath()
{
}
ValvesOpen = string.Empty;
ValvesClose = string.Empty;
}
public FeedingPath(string name, int itemNr)
: this()
@@ -32,30 +34,6 @@ namespace TBF.Entities
ItemNr = itemNr;
}
public FeedingPath(BenchControl.FeedingPath path)
: this(path.Name, path.ItemNr)
{
Qfrom = path.Qfrom;
Qto = path.Qto;
Pump = (path.Pump != null) ? path.Pump.Cfg.Name : null;
string vOpen = string.Empty;
foreach (var valve in path.ValvesOpen)
{
if (vOpen != string.Empty) vOpen += ";";
vOpen += valve.Cfg.Name;
}
ValvesOpen = vOpen;
string vClose = string.Empty;
foreach (var valve in path.ValvesClose)
{
if (vClose != string.Empty) vClose += ";";
vClose += valve.Cfg.Name;
}
ValvesClose = vClose;
}
public virtual FeedingPath Clone(string name, int itemNr)
{
FeedingPath result = new FeedingPath(name, itemNr);
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class Group
{
@@ -1,9 +1,9 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.Entities
namespace Config.Entities
{
interface IHasItemNr
public interface IHasItemNr
{
int Id { get; }
int ItemNr { get; set; }
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.Entities
namespace Config.Entities
{
public interface IHasValves
{
@@ -3,7 +3,7 @@
///
using System;
namespace TBF.Entities
namespace Config.Entities
{
public class MeasurementCorrection
{
@@ -3,7 +3,7 @@
///
using System;
namespace TBF.Entities
namespace Config.Entities
{
public class MeterTestResult
{
@@ -22,7 +22,11 @@ namespace TBF.Entities
public virtual float PulsesPerLiter { get; set; } /// Pulses per liter
public virtual float PulsesMaster { get; set; }
public virtual float Time { get; set; } /// sec.
public virtual bool Passed { get; set; } /// true = test passed
public virtual float TimeStart { get; set; } /// sec. - Not mapped to DB !!!
public virtual float TimeEnd { get; set; } /// sec. - Not mapped to DB !!!
public virtual int CalibFactor { get; set; } /// iPerl calibration factor used during the test - Not mapped to DB !!!
public virtual double Q2Correction { get; set; } /// iPerl Q2 correction used during the test - Not mapped to DB !!!
public virtual bool Passed { get; set; } /// true=test passed - Not mapped to DB !!!
public MeterTestResult()
{
@@ -51,6 +55,10 @@ namespace TBF.Entities
result.PulsesPerLiter = PulsesPerLiter;
result.PulsesMaster = PulsesMaster;
result.Time = Time;
result.TimeStart = TimeStart;
result.TimeEnd = TimeEnd;
result.CalibFactor = CalibFactor;
result.Q2Correction = Q2Correction;
result.Passed = Passed;
return result;
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class MetersPath : IHasItemNr
{
@@ -35,6 +35,28 @@ namespace TBF.Entities
public virtual string Sensor18 { get; set; }
public virtual string Sensor19 { get; set; }
public virtual string Sensor20 { get; set; }
#if IPERLST
public virtual string Sensor21 { get; set; }
public virtual string Sensor22 { get; set; }
public virtual string Sensor23 { get; set; }
public virtual string Sensor24 { get; set; }
public virtual string Sensor25 { get; set; }
public virtual string Sensor26 { get; set; }
public virtual string Sensor27 { get; set; }
public virtual string Sensor28 { get; set; }
public virtual string Sensor29 { get; set; }
public virtual string Sensor30 { get; set; }
public virtual string Sensor31 { get; set; }
public virtual string Sensor32 { get; set; }
public virtual string Sensor33 { get; set; }
public virtual string Sensor34 { get; set; }
public virtual string Sensor35 { get; set; }
public virtual string Sensor36 { get; set; }
public virtual string Sensor37 { get; set; }
public virtual string Sensor38 { get; set; }
public virtual string Sensor39 { get; set; }
public virtual string Sensor40 { get; set; }
#endif
/// ------------- Additional stuff not mapped into the database -------------
@@ -49,35 +71,6 @@ namespace TBF.Entities
ItemNr = itemNr;
}
public MetersPath(BenchControl.MetersPath path)
: this(path.Name, path.ItemNr)
{
Qfrom = path.Qfrom;
Qto = path.Qto;
Sensor1 = (path.RegisterReaders[0] != null) ? path.RegisterReaders[0].Cfg.Name : null;
#pragma warning disable
if (Program.WMsCount >= 2) Sensor2 = (path.RegisterReaders[1] != null) ? path.RegisterReaders[1].Cfg.Name : null;
if (Program.WMsCount >= 3) Sensor3 = (path.RegisterReaders[2] != null) ? path.RegisterReaders[2].Cfg.Name : null;
if (Program.WMsCount >= 4) Sensor4 = (path.RegisterReaders[3] != null) ? path.RegisterReaders[3].Cfg.Name : null;
if (Program.WMsCount >= 5) Sensor5 = (path.RegisterReaders[4] != null) ? path.RegisterReaders[4].Cfg.Name : null;
if (Program.WMsCount >= 6) Sensor6 = (path.RegisterReaders[5] != null) ? path.RegisterReaders[5].Cfg.Name : null;
if (Program.WMsCount >= 7) Sensor7 = (path.RegisterReaders[6] != null) ? path.RegisterReaders[6].Cfg.Name : null;
if (Program.WMsCount >= 8) Sensor8 = (path.RegisterReaders[7] != null) ? path.RegisterReaders[7].Cfg.Name : null;
if (Program.WMsCount >= 9) Sensor9 = (path.RegisterReaders[8] != null) ? path.RegisterReaders[8].Cfg.Name : null;
if (Program.WMsCount >= 10) Sensor10 = (path.RegisterReaders[9] != null) ? path.RegisterReaders[9].Cfg.Name : null;
if (Program.WMsCount >= 11) Sensor11 = (path.RegisterReaders[10] != null) ? path.RegisterReaders[10].Cfg.Name : null;
if (Program.WMsCount >= 12) Sensor12 = (path.RegisterReaders[11] != null) ? path.RegisterReaders[11].Cfg.Name : null;
if (Program.WMsCount >= 13) Sensor13 = (path.RegisterReaders[12] != null) ? path.RegisterReaders[12].Cfg.Name : null;
if (Program.WMsCount >= 14) Sensor14 = (path.RegisterReaders[13] != null) ? path.RegisterReaders[13].Cfg.Name : null;
if (Program.WMsCount >= 15) Sensor15 = (path.RegisterReaders[14] != null) ? path.RegisterReaders[14].Cfg.Name : null;
if (Program.WMsCount >= 16) Sensor16 = (path.RegisterReaders[15] != null) ? path.RegisterReaders[15].Cfg.Name : null;
if (Program.WMsCount >= 17) Sensor17 = (path.RegisterReaders[16] != null) ? path.RegisterReaders[16].Cfg.Name : null;
if (Program.WMsCount >= 18) Sensor18 = (path.RegisterReaders[17] != null) ? path.RegisterReaders[17].Cfg.Name : null;
if (Program.WMsCount >= 19) Sensor19 = (path.RegisterReaders[18] != null) ? path.RegisterReaders[18].Cfg.Name : null;
if (Program.WMsCount >= 20) Sensor20 = (path.RegisterReaders[19] != null) ? path.RegisterReaders[19].Cfg.Name : null;
#pragma warning restore
}
public virtual MetersPath Clone(string name, int itemNr)
{
MetersPath result = new MetersPath(name, itemNr);
@@ -103,6 +96,28 @@ namespace TBF.Entities
result.Sensor18 = Sensor18;
result.Sensor19 = Sensor19;
result.Sensor20 = Sensor20;
#if IPERLST
result.Sensor21 = Sensor21;
result.Sensor22 = Sensor22;
result.Sensor23 = Sensor23;
result.Sensor24 = Sensor24;
result.Sensor25 = Sensor25;
result.Sensor26 = Sensor26;
result.Sensor27 = Sensor27;
result.Sensor28 = Sensor28;
result.Sensor29 = Sensor29;
result.Sensor30 = Sensor30;
result.Sensor31 = Sensor31;
result.Sensor32 = Sensor32;
result.Sensor33 = Sensor33;
result.Sensor34 = Sensor34;
result.Sensor35 = Sensor35;
result.Sensor36 = Sensor36;
result.Sensor37 = Sensor37;
result.Sensor38 = Sensor38;
result.Sensor39 = Sensor39;
result.Sensor40 = Sensor40;
#endif
return result;
}
@@ -129,6 +144,28 @@ namespace TBF.Entities
else if (i == 17) return Sensor18;
else if (i == 18) return Sensor19;
else if (i == 19) return Sensor20;
#if IPERLST
else if (i == 20) return Sensor21;
else if (i == 21) return Sensor22;
else if (i == 22) return Sensor23;
else if (i == 23) return Sensor24;
else if (i == 24) return Sensor25;
else if (i == 25) return Sensor26;
else if (i == 26) return Sensor27;
else if (i == 27) return Sensor28;
else if (i == 28) return Sensor29;
else if (i == 29) return Sensor30;
else if (i == 30) return Sensor31;
else if (i == 31) return Sensor32;
else if (i == 32) return Sensor33;
else if (i == 33) return Sensor34;
else if (i == 34) return Sensor35;
else if (i == 35) return Sensor36;
else if (i == 36) return Sensor37;
else if (i == 37) return Sensor38;
else if (i == 38) return Sensor39;
else if (i == 39) return Sensor40;
#endif
else return null;
}
@@ -155,6 +192,28 @@ namespace TBF.Entities
else if (i == 17) Sensor18 = cmpntName;
else if (i == 18) Sensor19 = cmpntName;
else if (i == 19) Sensor20 = cmpntName;
#if IPERLST
else if (i == 20) Sensor21 = cmpntName;
else if (i == 21) Sensor22 = cmpntName;
else if (i == 22) Sensor23 = cmpntName;
else if (i == 23) Sensor24 = cmpntName;
else if (i == 24) Sensor25 = cmpntName;
else if (i == 25) Sensor26 = cmpntName;
else if (i == 26) Sensor27 = cmpntName;
else if (i == 27) Sensor28 = cmpntName;
else if (i == 28) Sensor29 = cmpntName;
else if (i == 29) Sensor30 = cmpntName;
else if (i == 30) Sensor31 = cmpntName;
else if (i == 31) Sensor32 = cmpntName;
else if (i == 32) Sensor33 = cmpntName;
else if (i == 33) Sensor34 = cmpntName;
else if (i == 34) Sensor35 = cmpntName;
else if (i == 35) Sensor36 = cmpntName;
else if (i == 36) Sensor37 = cmpntName;
else if (i == 37) Sensor38 = cmpntName;
else if (i == 38) Sensor39 = cmpntName;
else if (i == 39) Sensor40 = cmpntName;
#endif
}
}
}
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class OutputPath : IHasItemNr, IHasValves
{
@@ -30,6 +30,8 @@ namespace TBF.Entities
public OutputPath()
{
ValvesOpen = string.Empty;
ValvesClose = string.Empty;
}
public OutputPath(string name, int itemNr)
@@ -39,37 +41,6 @@ namespace TBF.Entities
ItemNr = itemNr;
}
public OutputPath(BenchControl.OutputPath path)
: this(path.Name, path.ItemNr)
{
Qfrom = path.Qfrom;
Qto = path.Qto;
RegulValve = (path.RegulValve != null) ? path.RegulValve.Cfg.Name : null;
FlowMeter = (path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : null;
PidCoef = path.PidCoef;
StartValve = (path.StartValve != null) ? path.StartValve.Cfg.Name : null;
Diverter = (path.Diverter != null) ? path.Diverter.Cfg.Name : null;
TempDiv = (path.TempDiv != null) ? path.TempDiv.Cfg.Name : null;
Balance = (path.Balance != null) ? path.Balance.Cfg.Name : null;
EmptyTankValve = (path.EmptyTankValve != null) ? path.EmptyTankValve.Cfg.Name : null;
string vOpen = string.Empty;
foreach (var valve in path.ValvesOpen)
{
if (vOpen != string.Empty) vOpen += ";";
vOpen += valve.Cfg.Name;
}
ValvesOpen = vOpen;
string vClose = string.Empty;
foreach (var valve in path.ValvesClose)
{
if (vClose != string.Empty) vClose += ";";
vClose += valve.Cfg.Name;
}
ValvesClose = vClose;
}
public virtual OutputPath Clone(string name, int itemNr)
{
OutputPath result = new OutputPath(name, itemNr);
@@ -3,9 +3,8 @@
///
using System;
using System.Collections.Generic;
using TBF.Resources;
namespace TBF.Entities
namespace Config.Entities
{
/// <summary>
/// Stores one test procedure, supports revisions and history log
@@ -15,13 +14,20 @@ namespace TBF.Entities
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual MetersKind MetersKind { get; set; }
public virtual string Description { get; set; } /// Short description
public virtual string CreationUser { get; set; } /// Name of the user who has created or changed this procedure
public virtual DateTime CreationTime { get; set; } /// Date and time of the creation or change
public virtual string LastChgUser { get; set; } /// Name of the user who has created or changed this procedure
public virtual DateTime LastChgTime { get; set; } /// Date and time of the creation or change
public virtual string LongDescription { get; set; } /// Long description (notes)
public virtual ProcedureState ProcedureState { get; set; }
public virtual int Revision { get; set; }
public virtual int PredecessorId { get; set; }
public virtual bool ObtainedByCopy { get; set; }
///
public virtual MetersKind MetersKind { get; set; }
public virtual string Watermeters { get; set; } /// Water meter name or Id
public virtual string ProtocolTitle { get; set; } /// Title of the printed and saved protocol
@@ -74,6 +80,10 @@ namespace TBF.Entities
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.LongDescription = LongDescription;
result.ProcedureState = ProcedureState.Active;
result.PredecessorId = Id;
result.Watermeters = Watermeters;
result.DataEntry = DataEntry;
result.ResultsPrinter = ResultsPrinter;
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class ProcedureHistory
{
@@ -5,7 +5,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
/// <summary>
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
@@ -32,6 +32,7 @@ namespace TBF.Entities
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual double TolerRed { get; set; } /// = Filter
public virtual TestRedType RedType { get; set; }
public virtual string FeedingPath { get; set; }
@@ -66,7 +67,8 @@ namespace TBF.Entities
TimeStop2Mass = 5; /// [s] between the test end and the final mass measurement
ErrLimLo = -2.0f; /// [%] lower error limit
ErrLimHi = 2.0f; /// [%] upper error limit
TolerRed = 0.0; /// = Filter parameter
Uncertainty = 0;
TolerRed = 0; /// = Filter parameter
}
public Test(string name, int itemNr, Procedure procedure)
@@ -98,7 +100,8 @@ namespace TBF.Entities
result.Method = Method;
result.ErrLimLo = ErrLimLo;
result.ErrLimHi = ErrLimHi;
result.TolerRed = TolerRed;
result.Uncertainty = Uncertainty;
result.TolerRed = TolerRed;
result.RedType = RedType;
result.FeedingPath = FeedingPath;
result.BenchPath = BenchPath;
+171
View File
@@ -0,0 +1,171 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
namespace Config.Entities
{
public class TestResult
{
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual int BatchNr { get; set; }
public virtual string PurchaseOrder { get; set; }
public virtual MetersKind MetersKind { get; set; }
public virtual IList<MeterTestResult> Meters { get; set; }
public virtual IList<MeterTestResult> CombinedMeters { get; set; }
/// Value copied from the procedure (Entities.Procedure)
public virtual string ProcedureName { get; set; }
public virtual string ProtocolTitle { get; set; }
/// Values copied from the test (Entities.Test)
public virtual int TestId { get; set; } /// Test entity ID to distinguish between tests with the same name
public virtual string TestName { get; set; }
public virtual int Part { get; set; }
public virtual bool DoNotEvaluate { get; set; } /// Not mapped to the database
public virtual bool DoNotPublish { get; set; } /// Not mapped to the database
public virtual float Qfrom { get; set; } /// [m3/h] Water flow low limit
public virtual float Qto { get; set; } /// [m3/h] Water flow high limit
public virtual float Volume { get; set; } /// [l] Target test volume
public virtual float TstTime { get; set; } /// [s] Test time estimate
public virtual int Repeats { get; set; }
public virtual bool Emptying { get; set; }
public virtual bool Zeroing { get; set; }
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
public virtual int Time2MassMsrmt { get; set; }
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// [%] Lower error limit (usually < 0)
public virtual float ErrLimHi { get; set; } /// [%] Upper error limit (usually > 0)
public virtual float Uncertainty { get; set; } /// [%] Makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
/// To be replaced by the virtual bench component parameters
public virtual string FeedingPath { get; set; }
public virtual string BenchPath { get; set; }
public virtual string OutputPath { get; set; }
public virtual string MetersPath { get; set; }
/// Results
public virtual DateTime TimeStart { get; set; } /// Date and time of the test start
public virtual DateTime TimeEnd { get; set; } /// Date and time of the test end
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
public virtual float AmbientTempAve { get; set; } /// [deg.C] Average ambient air temperature
public virtual float AmbientPressAve { get; set; } /// Average ambient air pressure
public virtual float AmbientHumiAve { get; set; } /// [%] Average ambient air relative humidity
public virtual float PressInAvrg { get; set; } /// [Bar] Input water pressure (average)
public virtual float PressInStart { get; set; } /// [Bar]
public virtual float PressInEnd { get; set; } /// [Bar]
public virtual float PressOutAvrg { get; set; } /// [Bar]
public virtual float PressOutStart { get; set; } /// [Bar]
public virtual float PressOutEnd { get; set; } /// [Bar]
public virtual float TempInAvrg { get; set; } /// [deg.C]
public virtual float TempInStart { get; set; } /// [deg.C]
public virtual float TempInEnd { get; set; } /// [deg.C]
public virtual float TempOutAvrg { get; set; } /// [deg.C]
public virtual float TempOutStart { get; set; } /// [deg.C]
public virtual float TempOutEnd { get; set; } /// [deg.C]
public virtual float TempDivAvrg { get; set; } /// [deg.C]
public virtual float TempDivStart { get; set; } /// [deg.C]
public virtual float TempDivEnd { get; set; } /// [deg.C]
public virtual float MassStartRaw { get; set; } /// [kg]
public virtual float MassStart { get; set; } /// [kg]
public virtual float MassEndRaw { get; set; } /// [kg]
public virtual float MassEnd { get; set; } /// [kg]
public virtual float MassDiff { get; set; } /// [kg]
public virtual float DensityIn { get; set; } /// [kg/m3]
public virtual float DensityOut { get; set; } /// [kg/m3]
public virtual float DensityDiv { get; set; } /// [kg/m3]
public virtual float Buoyancy { get; set; } ///TODO -> map
public virtual float FlowMass { get; set; } /// [kg/h] calculated from conventional true value
public virtual float FlowVolume { get; set; } /// [l/h] calculated from conventional true value
public virtual float VolumeCTV { get; set; } /// [l] Volume conventional true value
public virtual float VolumeMaster { get; set; } /// [l] Volume from the master flow meter
public virtual float Time { get; set; } /// [s] Measurement time in seconds
public virtual float ErrorMaster { get; set; } /// [%]
public virtual float PulsesMaster { get; set; }
public virtual float ConstMaster { get; set; } /// [pls/l] Pulses per liter master flow meter
public virtual float QRise { get; set; } /// Detected Q_rise of a composed meter
public virtual float QFall { get; set; } /// Detected Q_fall of a composed meter
public virtual float TimeDivStart0 { get; set; }
public virtual float TimeDivStart1 { get; set; }
public virtual float TimeDivStart2 { get; set; }
public virtual float TimeDivStart3 { get; set; }
public virtual float TimeDivStart4 { get; set; }
public virtual float TimeDivStart5 { get; set; }
public virtual float TimeDivEnd0 { get; set; }
public virtual float TimeDivEnd1 { get; set; }
public virtual float TimeDivEnd2 { get; set; }
public virtual float TimeDivEnd3 { get; set; }
public virtual float TimeDivEnd4 { get; set; }
public virtual float TimeDivEnd5 { get; set; }
public TestResult()
{
Meters = new List<MeterTestResult>();
CombinedMeters = new List<MeterTestResult>();
}
public TestResult(MetersKind kind)
: this()
{
MetersKind = kind;
if (kind == MetersKind.Single)
{
for (int i = 0; i < Config.Data.WMsCount; i++) Meters.Add(new MeterTestResult(this));
}
else if (kind == MetersKind.Combined)
{
for (int i = 0; i < 2 * Config.Data.CompoundWMsCount; i++) Meters.Add(new MeterTestResult(this));
for (int i = 0; i < Config.Data.CompoundWMsCount; i++) CombinedMeters.Add(new MeterTestResult(this));
}
}
public TestResult(Test test, int repetitionNr, MetersKind kind)
: this(kind)
{
if (test.Repeats == 1)
{
Name = test.Name;
}
else
{
Name = string.Format("{0} ({1}/{2})", test.Name, repetitionNr, test.Repeats);
}
RepetitionNr = repetitionNr;
/// Copy test parameters from Entities.Procedure object
ProcedureName = test.Procedure.Name;
ProtocolTitle = test.Procedure.ProtocolTitle;
/// Copy test parameters from Entities.Test object
TestId = test.Id;
TestName = test.Name;
Part = test.Part;
Qfrom = test.Qfrom;
Qto = test.Qto;
Volume = test.Volume;
TstTime = test.TstTime;
Repeats = test.Repeats;
Emptying = test.Emptying;
Zeroing = test.Zeroing;
PumpPower = PumpPower;
Time2MassMsrmt = test.TimeStop2Mass;
Method = test.Method;
ErrLimLo = test.ErrLimLo;
ErrLimHi = test.ErrLimHi;
Uncertainty = test.Uncertainty;
FeedingPath = test.FeedingPath;
BenchPath = test.BenchPath;
OutputPath = test.OutputPath;
MetersPath = test.MetersPath;
}
public override string ToString()
{
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", BatchNr, ProcedureName, TestName, TimeStart.ToShortDateString(), TimeStart.ToShortTimeString());
}
}
}
@@ -3,7 +3,7 @@
///
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
/// <summary>
/// Stores one transition sequence containing a list of transition steps
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class TransitionStep : IHasItemNr, IHasValves
{
@@ -13,7 +13,6 @@ namespace TBF.Entities
public virtual int Duration { get; set; } /// Duration in seconds
public virtual string Message { get; set; } /// Message
public virtual StepCondition EndCondition { get; set; } /// Condition when transition step is finished (next to the duration)
public virtual string Communication { get; set; } /// String specifying type of communication with water meters
public virtual string ValvesOpen { get; set; } /// List of valves to be opened
public virtual string ValvesClose { get; set; } /// List of valves to be closed
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
@@ -42,7 +41,6 @@ namespace TBF.Entities
result.Duration = Duration;
result.Message = Message;
result.EndCondition = EndCondition;
result.Communication = Communication;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
result.RegulValvesPct = RegulValvesPct;
@@ -57,7 +55,6 @@ namespace TBF.Entities
result += indent + "Duration = " + Duration.ToString() + ", ";
result += indent + "Message = " + Message + ", ";
result += indent + "EndCondition = " + EndCondition.ToString() + ", ";
result += indent + "Communication = " + Communication + ", ";
result += indent + "ValvesOpen = " + ValvesOpen.ToString() + ", ";
result += indent + "ValvesClose = " + ValvesClose.ToString() + ", ";
result += indent + "RegulValvesPct = " + RegulValvesPct.ToString() + ", ";
@@ -6,9 +6,9 @@ using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Diagnostics;
using TBF.Resources;
using Config.Resources;
namespace TBF.Entities
namespace Config.Entities
{
public class User
{
@@ -123,7 +123,7 @@ namespace TBF.Entities
/// <param name="password"></param>
/// <param name="requiredGrupMembership"></param>
/// <returns>true = authorized</returns>
public virtual bool Authorize(string userName, string password, TBF.Grp.GID requiredGroupMembership)
public virtual bool Authorize(string userName, string password, Grp.GID requiredGroupMembership)
{
if (Entities.User.IsPowerUser(userName, password))
{
@@ -255,8 +255,9 @@ namespace TBF.Entities
public static bool IsPowerUser(string userName, string password)
{
return (userName.Equals("milan") && password.Equals("napajedla")) ||
(userName.Equals("igor") && password.Equals("ronko4")) ||
(userName.Equals("janb") && password.Equals("sen345bnaj21"));
(userName.Equals("igor") && password.Equals("ronko4")) ||
(userName.Equals("janb") && password.Equals("sen345bnaj21")) ||
(userName.Equals("vlado") && password.Equals("luskovica.430"));
}
}
}
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class VirtualBenchSequence : IHasItemNr
{
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace TBF.Entities
namespace Config.Entities
{
public class VirtualBenchStep : IHasItemNr
{
@@ -9,7 +9,7 @@ using System.Text;
/// This class holds the watermeter type specific data
/// that have all watermaters of the same type in common
namespace TBF.Entities
namespace Config.Entities
{
public class WMType
{
@@ -6,11 +6,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using TBF;
using NHibernate;
using FluentNHibernate;
namespace TBF.Entities
namespace Config.Entities
{
public class Watermeter
{
@@ -2,14 +2,15 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using TBF.Resources;
using Config.Resources;
namespace TBF
namespace Config
{
/// <summary>
/// Identifies the content of a database
@@ -54,20 +55,20 @@ namespace TBF
{
default:
case Database.Users:
dbType = Program.CurrentBench.UsersDBSettings.DbType;
connectionString = Program.CurrentBench.UsersDBSettings.ConnectionString;
dbType = Data.CurrentBench.UsersDBSettings.DbType;
connectionString = Data.CurrentBench.UsersDBSettings.ConnectionString;
break;
case Database.Bench:
dbType = Program.CurrentBench.BenchDBSettings.DbType;
connectionString = Program.CurrentBench.BenchDBSettings.ConnectionString;
dbType = Data.CurrentBench.BenchDBSettings.DbType;
connectionString = Data.CurrentBench.BenchDBSettings.ConnectionString;
break;
case Database.Procedures:
dbType = Program.CurrentBench.ProceduresDBSettings.DbType;
connectionString = Program.CurrentBench.ProceduresDBSettings.ConnectionString;
dbType = Data.CurrentBench.ProceduresDBSettings.DbType;
connectionString = Data.CurrentBench.ProceduresDBSettings.ConnectionString;
break;
case Database.WaterMeters:
dbType = Program.CurrentBench.WaterMetersDBSettings.DbType;
connectionString = Program.CurrentBench.WaterMetersDBSettings.ConnectionString;
dbType = Data.CurrentBench.WaterMetersDBSettings.DbType;
connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
break;
}
@@ -99,16 +100,16 @@ namespace TBF
{
default:
case Database.Users:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
case Database.Bench:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
case Database.Procedures:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
case Database.WaterMeters:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
}
@@ -121,8 +122,10 @@ namespace TBF
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
}
}
catch (Exception)
catch (Exception exc)
{
MessageBox.Show(string.Format("Cannot open database.\r\nReason:\r\n{0}", exc.Message),
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
}
@@ -205,22 +208,22 @@ namespace TBF
///
/// Prepare all groups
///
var testers = new Entities.Group { Gid = (int)TBF.Grp.GID.Testers, Name = Strings.Tester };
var testingSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.TestingSpecialists, Name = Strings.Testing_Specialist };
var headOfLab = new Entities.Group { Gid = (int)TBF.Grp.GID.HeadOfLab, Name = Strings.Head_of_Lab };
var maintenanceSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.MaintenanceSpecialists, Name = Strings.Maintenance_Specialist };
var metrologists = new Entities.Group { Gid = (int)TBF.Grp.GID.Metrologists, Name = Strings.Metrologist };
var calibrationSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.CalibrationSpecialists, Name = Strings.Calibration_Specialist };
var administrators = new Entities.Group { Gid = (int)TBF.Grp.GID.Administrators, Name = Strings.Administrator };
var testers = new Entities.Group { Gid = (int)Grp.GID.Testers, Name = Strings.Tester };
var testingSpecialists = new Entities.Group { Gid = (int)Grp.GID.TestingSpecialists, Name = Strings.Testing_Specialist };
var headOfLab = new Entities.Group { Gid = (int)Grp.GID.HeadOfLab, Name = Strings.Head_of_Lab };
var maintenanceSpecialists = new Entities.Group { Gid = (int)Grp.GID.MaintenanceSpecialists, Name = Strings.Maintenance_Specialist };
var metrologists = new Entities.Group { Gid = (int)Grp.GID.Metrologists, Name = Strings.Metrologist };
var calibrationSpecialists = new Entities.Group { Gid = (int)Grp.GID.CalibrationSpecialists, Name = Strings.Calibration_Specialist };
var administrators = new Entities.Group { Gid = (int)Grp.GID.Administrators, Name = Strings.Administrator };
/// Create the user 'admin' add his groups
var admin = new Entities.User
{
Name = Program.AdminUsername,
Name = Data.AdminUsername,
Description = "Administrator",
LastPwChange = DateTime.Now
};
admin.SetPassword(Program.AdminPassword);
admin.SetPassword(Data.AdminPassword);
admin.AddGroup(testers);
admin.AddGroup(testingSpecialists);
admin.AddGroup(headOfLab);
@@ -231,9 +234,9 @@ namespace TBF
session.SaveOrUpdate(admin);
/// Create the control board component
var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
session.SaveOrUpdate(cmpnt);
///// Create the control board component
//var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
//session.SaveOrUpdate(cmpnt);
transaction.Commit();
}
+2 -2
View File
@@ -5,11 +5,11 @@ using System;
using System.Collections.Generic;
using System.Text;
using TBF.Entities;
using Config.Entities;
using NHibernate;
using FluentNHibernate;
namespace TBF
namespace Config
{
/// <summary>
/// Enum Grp.GID specifies GID-s of user groups.
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class BenchPathMap : ClassMap<BenchPath>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class ComponentMap : ClassMap<Component>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class ComponentProcedureMap : ClassMap<ComponentProcedure>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class ComponentTestMap : ClassMap<ComponentTest>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class FeedingPathMap : ClassMap<FeedingPath>
{
@@ -3,7 +3,7 @@
///
using FluentNHibernate.Mapping;
namespace TBF.Mappings
namespace Config.Mappings
{
class GroupMap : ClassMap<Entities.Group>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class MeasurementCorrectionMap : ClassMap<MeasurementCorrection>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class MeterTestResultMap : ClassMap<MeterTestResult>
{
+64
View File
@@ -0,0 +1,64 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class MetersPathMap : ClassMap<MetersPath>
{
public MetersPathMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Sensor1);
#pragma warning disable
if (Config.Data.WMsCount >= 2) Map(x => x.Sensor2);
if (Config.Data.WMsCount >= 3) Map(x => x.Sensor3);
if (Config.Data.WMsCount >= 4) Map(x => x.Sensor4);
if (Config.Data.WMsCount >= 5) Map(x => x.Sensor5);
if (Config.Data.WMsCount >= 6) Map(x => x.Sensor6);
if (Config.Data.WMsCount >= 7) Map(x => x.Sensor7);
if (Config.Data.WMsCount >= 8) Map(x => x.Sensor8);
if (Config.Data.WMsCount >= 9) Map(x => x.Sensor9);
if (Config.Data.WMsCount >= 10) Map(x => x.Sensor10);
if (Config.Data.WMsCount >= 11) Map(x => x.Sensor11);
if (Config.Data.WMsCount >= 12) Map(x => x.Sensor12);
if (Config.Data.WMsCount >= 13) Map(x => x.Sensor13);
if (Config.Data.WMsCount >= 14) Map(x => x.Sensor14);
if (Config.Data.WMsCount >= 15) Map(x => x.Sensor15);
if (Config.Data.WMsCount >= 16) Map(x => x.Sensor16);
if (Config.Data.WMsCount >= 17) Map(x => x.Sensor17);
if (Config.Data.WMsCount >= 18) Map(x => x.Sensor18);
if (Config.Data.WMsCount >= 19) Map(x => x.Sensor19);
if (Config.Data.WMsCount >= 20) Map(x => x.Sensor20);
#if IPERLST
if (Config.Data.WMsCount >= 21) Map(x => x.Sensor21);
if (Config.Data.WMsCount >= 22) Map(x => x.Sensor22);
if (Config.Data.WMsCount >= 23) Map(x => x.Sensor23);
if (Config.Data.WMsCount >= 24) Map(x => x.Sensor24);
if (Config.Data.WMsCount >= 25) Map(x => x.Sensor25);
if (Config.Data.WMsCount >= 26) Map(x => x.Sensor26);
if (Config.Data.WMsCount >= 27) Map(x => x.Sensor27);
if (Config.Data.WMsCount >= 28) Map(x => x.Sensor28);
if (Config.Data.WMsCount >= 29) Map(x => x.Sensor29);
if (Config.Data.WMsCount >= 30) Map(x => x.Sensor30);
if (Config.Data.WMsCount >= 31) Map(x => x.Sensor31);
if (Config.Data.WMsCount >= 32) Map(x => x.Sensor32);
if (Config.Data.WMsCount >= 33) Map(x => x.Sensor33);
if (Config.Data.WMsCount >= 34) Map(x => x.Sensor34);
if (Config.Data.WMsCount >= 35) Map(x => x.Sensor35);
if (Config.Data.WMsCount >= 36) Map(x => x.Sensor36);
if (Config.Data.WMsCount >= 37) Map(x => x.Sensor37);
if (Config.Data.WMsCount >= 38) Map(x => x.Sensor38);
if (Config.Data.WMsCount >= 39) Map(x => x.Sensor39);
if (Config.Data.WMsCount >= 40) Map(x => x.Sensor40);
#endif
#pragma warning restore
}
}
}
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class OutputPathMap : ClassMap<OutputPath>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class ProcedureMap : ClassMap<Procedure>
{
@@ -13,13 +13,20 @@ namespace TBF.Mappings
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.MetersKind);
Map(x => x.Description);
Map(x => x.CreationUser);
Map(x => x.CreationTime);
Map(x => x.LastChgUser);
Map(x => x.LastChgTime);
Map(x => x.LongDescription);
Map(x => x.ProcedureState);
Map(x => x.Revision);
Map(x => x.PredecessorId);
Map(x => x.ObtainedByCopy);
Map(x => x.MetersKind);
Map(x => x.Watermeters);
Map(x => x.ProtocolTitle);
Map(x => x.DataEntry);
@@ -3,9 +3,9 @@
/// Author: Milan Hanajik
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class TestMap : ClassMap<Test>
{
@@ -30,6 +30,7 @@ namespace TBF.Mappings
Map(x => x.Method);
Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi);
Map(x => x.Uncertainty);
Map(x => x.TolerRed); /// ???
Map(x => x.RedType); /// ???
Map(x => x.FeedingPath);
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class TestResultMap : ClassMap<TestResult>
{
@@ -38,6 +38,7 @@ namespace TBF.Mappings
Map(x => x.Method);
Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi);
Map(x => x.Uncertainty);
Map(x => x.FeedingPath)
.CustomType("StringClob")
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class TransitionSequenceMap : ClassMap<TransitionSequence>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class TransitionStepMap : ClassMap<TransitionStep>
{
@@ -15,7 +15,6 @@ namespace TBF.Mappings
Map(x => x.Duration);
Map(x => x.Message);
Map(x => x.EndCondition);
Map(x => x.Communication);
Map(x => x.ValvesOpen)
.CustomType("StringClob")
.CustomSqlType("varchar(8000)");
@@ -3,7 +3,7 @@
///
using FluentNHibernate.Mapping;
namespace TBF.Mappings
namespace Config.Mappings
{
class UserMap : ClassMap<Entities.User>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class VirtualBenchSequenceMap : ClassMap<VirtualBenchSequence>
{
@@ -2,9 +2,9 @@
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using TBF.Entities;
using Config.Entities;
namespace TBF.Mappings
namespace Config.Mappings
{
class VirtualBenchStepMap : ClassMap<VirtualBenchStep>
{
@@ -3,7 +3,7 @@
///
using FluentNHibernate.Mapping;
namespace TBF.Mappings
namespace Config.Mappings
{
class WMTypeMap : ClassMap<Entities.WMType>
{
@@ -3,7 +3,7 @@
///
using FluentNHibernate.Mapping;
namespace TBF.Mappings
namespace Config.Mappings
{
class WatermeterMap : ClassMap<Entities.Watermeter>
{
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Config")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("Config")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2015 Sensus Slovensko a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3fc3ff67-7386-4aff-9855-bef33d5fa0d3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2.0")]
[assembly: AssemblyFileVersion("2.0.2.0")]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -3,9 +3,10 @@
///
using System;
using System.Collections.Generic;
using TBF.Resources;
using Config.Entities;
using Config.Resources;
namespace TBF.Forms
namespace Config
{
public class ResultItemSpec
{
@@ -19,14 +20,14 @@ namespace TBF.Forms
///
/// Function to pick a MeterTestResult field and convert it into a string
///
public delegate string PrintDlgt(Entities.MeterTestResult meterTestResult);
public delegate string PrintDlgt(MeterTestResult meterTestResult);
private readonly PrintDlgt printDlgt;
public bool CanPrintSingle { get { return (printDlgt != null); } }
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
public string Print(Entities.MeterTestResult meterTestResult)
public string Print(MeterTestResult meterTestResult)
{
string str = printDlgt(meterTestResult);
return (str == null) ? string.Empty : str;
@@ -36,17 +37,17 @@ namespace TBF.Forms
///
/// Function to pick a MeterTestResult field and convert it into a string
///
public delegate string PrintCombinedDlgt(Entities.MeterTestResult largeMeterTestResult,
Entities.MeterTestResult smallMeterTestResult,
Entities.MeterTestResult combinedMeterTestResult);
public delegate string PrintCombinedDlgt(MeterTestResult largeMeterTestResult,
MeterTestResult smallMeterTestResult,
MeterTestResult combinedMeterTestResult);
private readonly PrintCombinedDlgt printCombinedDlgt;
public bool CanPrintCombined { get { return (printCombinedDlgt != null); } }
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
public string PrintCombined(Entities.MeterTestResult largeMeterTestResult,
Entities.MeterTestResult smallMeterTestResult,
Entities.MeterTestResult combinedMeterTestResult)
public string PrintCombined(MeterTestResult largeMeterTestResult,
MeterTestResult smallMeterTestResult,
MeterTestResult combinedMeterTestResult)
{
string str = printCombinedDlgt(largeMeterTestResult, smallMeterTestResult, combinedMeterTestResult);
return (str == null) ? string.Empty : str;
@@ -75,17 +76,24 @@ namespace TBF.Forms
AllItems = new List<ResultItemSpec>();
/// Common
//AllItems.Add(new ResultItemSpec("Bench ID", "Bench ID", x => x.TestResult.BenchID,
// (x, y, z) => x.TestResult.BenchID));
AllItems.Add(new ResultItemSpec("Test name", "Test", x => x.TestResult.TestName,
(x, y, z) => x.TestResult.TestName));
AllItems.Add(new ResultItemSpec("Procedure name", Strings.Procedure, x => x.TestResult.ProcedureName,
AllItems.Add(new ResultItemSpec("Procedure name", "Procedure", x => x.TestResult.ProcedureName,
(x, y, z) => x.TestResult.ProcedureName));
AllItems.Add(new ResultItemSpec("Batch number", "Batch nr.", x => x.TestResult.BatchNr.ToString(),
(x, y, z) => x.TestResult.BatchNr.ToString()));
AllItems.Add(new ResultItemSpec("Test method", "Test method", x => x.TestResult.Method,
(x, y, z) => x.TestResult.Method));
AllItems.Add(new ResultItemSpec("Density", "Density", x => x.TestResult.DensityOut.ToString("F1"),
(x, y, z) => x.TestResult.DensityOut.ToString("F1"))); /// [kg/m3]
/// Target values
AllItems.Add(new ResultItemSpec("Q from", Strings.Q_from_m3h, x => x.TestResult.Qfrom.ToString("F3"),
AllItems.Add(new ResultItemSpec("Q from", "Q from [l/h]", x => x.TestResult.Qfrom.ToString("F3"),
(x, y, z) => x.TestResult.Qfrom.ToString("F3")));
AllItems.Add(new ResultItemSpec("Q to", Strings.Q_to_m3h, x => x.TestResult.Qto.ToString("F3"),
AllItems.Add(new ResultItemSpec("Q to", "Q to [l/h]", x => x.TestResult.Qto.ToString("F3"),
(x, y, z) => x.TestResult.Qto.ToString("F3")));
AllItems.Add(new ResultItemSpec("Test volume", "Test vol. [l]", x => x.TestResult.Volume.ToString("F1"),
(x, y, z) => x.TestResult.Volume.ToString("F1")));
@@ -93,6 +101,10 @@ namespace TBF.Forms
(x, y, z) => x.TestResult.ErrLimLo.ToString("F1")));
AllItems.Add(new ResultItemSpec("Error limit Hi", "Err.Lim.Hi [%]", x => x.TestResult.ErrLimHi.ToString("F1"),
(x, y, z) => x.TestResult.ErrLimHi.ToString("F1")));
AllItems.Add(new ResultItemSpec("Error limit sum", "Err.Lim.Sum [%]", x => (x.TestResult.ErrLimHi - x.TestResult.ErrLimLo).ToString("F1"),
(x, y, z) => (x.TestResult.ErrLimHi - x.TestResult.ErrLimLo).ToString("F1")));
AllItems.Add(new ResultItemSpec("Uncertainty", "Uncertainty [%]", x => x.TestResult.Uncertainty.ToString("F2"),
(x, y, z) => x.TestResult.Uncertainty.ToString("F2")));
/// Test results
AllItems.Add(new ResultItemSpec("Start time", "T start", x => x.TestResult.TimeStart.ToShortTimeString(),
@@ -101,25 +113,25 @@ namespace TBF.Forms
(x, y, z) => z.TestResult.TimeEnd.ToShortTimeString()));
AllItems.Add(new ResultItemSpec("Test time", "T [s]", x => x.TestResult.Time.ToString("F2"),
(x, y, z) => z.TestResult.Time.ToString("F2")));
AllItems.Add(new ResultItemSpec("Flow", Strings.Flow_m3h, x => Utils.FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
(x, y, z) => Utils.FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
AllItems.Add(new ResultItemSpec("T in", Strings.T_in, x => x.TestResult.TempInAvrg.ToString("F2"),
AllItems.Add(new ResultItemSpec("Flow", "Flow [m3/h]", x => FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
(x, y, z) => FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
AllItems.Add(new ResultItemSpec("T in", "T in", x => x.TestResult.TempInAvrg.ToString("F2"),
(x, y, z) => z.TestResult.TempInAvrg.ToString("F2")));
AllItems.Add(new ResultItemSpec("T out", Strings.T_out, x => x.TestResult.TempOutAvrg.ToString("F2"),
AllItems.Add(new ResultItemSpec("T out", "T out", x => x.TestResult.TempOutAvrg.ToString("F2"),
(x, y, z) => z.TestResult.TempOutAvrg.ToString("F2")));
AllItems.Add(new ResultItemSpec("T div", Strings.T_div, x => x.TestResult.TempDivAvrg.ToString("F2"),
AllItems.Add(new ResultItemSpec("T div", "T div", x => x.TestResult.TempDivAvrg.ToString("F2"),
(x, y, z) => z.TestResult.TempDivAvrg.ToString("F2")));
AllItems.Add(new ResultItemSpec("P up", Strings.P_in, x => x.TestResult.PressInAvrg.ToString("F3"),
AllItems.Add(new ResultItemSpec("P up", "P up", x => x.TestResult.PressInAvrg.ToString("F3"),
(x, y, z) => z.TestResult.PressInAvrg.ToString("F3")));
AllItems.Add(new ResultItemSpec("P up start", Strings.P_in_start, x => x.TestResult.PressInStart.ToString("F3"),
AllItems.Add(new ResultItemSpec("P up start", "P up start", x => x.TestResult.PressInStart.ToString("F3"),
(x, y, z) => z.TestResult.PressInStart.ToString("F3")));
AllItems.Add(new ResultItemSpec("P up end", Strings.P_in_end, x => x.TestResult.PressInEnd.ToString("F3"),
AllItems.Add(new ResultItemSpec("P up end", "P up end", x => x.TestResult.PressInEnd.ToString("F3"),
(x, y, z) => z.TestResult.PressInEnd.ToString("F3")));
AllItems.Add(new ResultItemSpec("P down", Strings.P_out, x => x.TestResult.PressOutAvrg.ToString("F3"),
AllItems.Add(new ResultItemSpec("P down", "P down", x => x.TestResult.PressOutAvrg.ToString("F3"),
(x, y, z) => z.TestResult.PressOutAvrg.ToString("F3")));
AllItems.Add(new ResultItemSpec("P down start", Strings.P_out_start, x => x.TestResult.PressOutStart.ToString("F3"),
AllItems.Add(new ResultItemSpec("P down start", "P down start", x => x.TestResult.PressOutStart.ToString("F3"),
(x, y, z) => z.TestResult.PressOutStart.ToString("F3")));
AllItems.Add(new ResultItemSpec("P down end", Strings.P_out_end, x => x.TestResult.PressOutEnd.ToString("F3"),
AllItems.Add(new ResultItemSpec("P down end", "P down end", x => x.TestResult.PressOutEnd.ToString("F3"),
(x, y, z) => z.TestResult.PressOutEnd.ToString("F3")));
AllItems.Add(new ResultItemSpec("Reference error", "Err.ref. [%]", x => x.TestResult.ErrorMaster.ToString("F3"),
(x, y, z) => z.TestResult.ErrorMaster.ToString("F3")));
@@ -148,8 +160,8 @@ namespace TBF.Forms
AllItems.Add(new ResultItemSpec("Reference pulses", "Ref.pulses", x => x.PulsesMaster.ToString(), null));
/// Combined water meters only results
AllItems.Add(new ResultItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (x.TestResult.QRise == 0) ? "-" : Utils.FloatToStr(x.TestResult.QRise, 4)));
AllItems.Add(new ResultItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (x.TestResult.QFall == 0) ? "-" : Utils.FloatToStr(x.TestResult.QFall, 4)));
AllItems.Add(new ResultItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (x.TestResult.QRise == 0) ? "-" : FloatToStr(x.TestResult.QRise, 4)));
AllItems.Add(new ResultItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (x.TestResult.QFall == 0) ? "-" : FloatToStr(x.TestResult.QFall, 4)));
AllItems.Add(new ResultItemSpec("Error large WM", "Error-L [%]", null, (x, y, z) => x.VolumeErrorPct.ToString("F2")));
AllItems.Add(new ResultItemSpec("Error small WM", "Error-S [%]", null, (x, y, z) => y.VolumeErrorPct.ToString("F2")));
AllItems.Add(new ResultItemSpec("Serial Nr large WM", "s/n", null, (x, y, z) => x.SerialNr));
@@ -185,5 +197,45 @@ namespace TBF.Forms
}
return result;
}
}
/// <summary>
/// Converts float number to a string with the specified number of valid digits
/// </summary>
/// <param name="value">Float value to be converted to a string</param>
/// <param name="validDigits">Number of valid digits: 4, 3, or 2 (otherwise a full precision number is printed)</param>
/// <returns>String representation of the float number</returns>
public static string FloatToStr(float value, int validDigits)
{
if (validDigits == 4)
{
if (value >= 999.5 || value < -999.5) return value.ToString("F0");
else if (value >= 99.95 || value < -99.95) return value.ToString("F1");
else if (value >= 9.995 || value < -9.995) return value.ToString("F2");
else if (value >= 0.9995 || value < -0.9995) return value.ToString("F3");
else if (value >= 0.09995 || value < -0.09995) return value.ToString("F4");
else if (value >= 0.009995 || value < -0.009995) return value.ToString("F5");
else return value.ToString("F6");
}
else if (validDigits == 3)
{
if (value >= 99.5 || value < -99.5) return value.ToString("F0");
else if (value >= 9.95 || value < -9.95) return value.ToString("F1");
else if (value >= 0.995 || value < -0.995) return value.ToString("F2");
else if (value >= 0.0995 || value < -0.0995) return value.ToString("F3");
else if (value >= 0.00995 || value < -0.00995) return value.ToString("F4");
else if (value >= 0.000995 || value < -0.000995) return value.ToString("F5");
else return value.ToString("F6");
}
else if (validDigits == 2)
{
if (value >= 9.5 || value < -9.5) return value.ToString("F0");
else if (value >= 0.95 || value < -0.95) return value.ToString("F1");
else if (value >= 0.095 || value < -0.095) return value.ToString("F2");
else if (value >= 0.0095 || value < -0.0095) return value.ToString("F3");
else if (value >= 0.00095 || value < -0.00095) return value.ToString("F4");
else return value.ToString("F5");
}
else return value.ToString();
}
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Results
{
public class Class1
{
}
}
+113
View File
@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Config.Entities;
namespace Results.Entities
{
public class WaterMeterResult
{
/// Set only once, used as a reference in some getters
private readonly MeterTestResult firstMeterTestResult;
///
/// Hard water meter data
///
public string SerialNr; /// iPerl : This is PCB Number
public int SerialNrEx; /// iPerl : This is the serial number assigned later
public int BenchId;
public int BatchNr { get { return firstMeterTestResult.TestResult.BatchNr; } }
public string ProcedureName { get { return firstMeterTestResult.TestResult.ProcedureName; } }
public DateTime TestStart;
public DateTime TestEnd;
public IList<MeterTestResult> MeterTestResults;
///
/// Soft water meter data
///
public string Type;
public string TypeApproval;
public string MetrologicalClass;
public string ProtocolTitle { get { return firstMeterTestResult.TestResult.ProtocolTitle; } }
public string PurchaseOrder;
public TestResult TestResult(string testName)
{
foreach (var tr in MeterTestResults)
{
if (tr.TestResult.TestName.ToLower().Equals(testName.ToLower())) return tr.TestResult;
}
return null;
}
public MeterTestResult MeterTestResult(string testName)
{
foreach (var tr in MeterTestResults)
{
if (tr.TestResult.TestName.ToLower().Equals(testName.ToLower())) return tr;
}
return null;
}
/// <summary>
/// Private constructor, initializes a list, used as a base
/// </summary>
private WaterMeterResult()
{
MeterTestResults = new List<MeterTestResult>();
}
/// <summary>
/// Constructor used to construct WaterMeterResults from the first meter test result
/// </summary>
public WaterMeterResult(MeterTestResult meterTestResult, int benchId)
: this()
{
if (meterTestResult == null) throw new Exception("meterTestResult cannot be null");
MeterTestResults.Add(firstMeterTestResult = meterTestResult);
SerialNr = meterTestResult.SerialNr;
BenchId = (benchId == 5) ? 20033 : ((benchId == 6) ? 20034 : 0);
TestStart = meterTestResult.TestResult.TimeStart;
TestEnd = meterTestResult.TestResult.TimeEnd;
}
/// <summary>
/// Function to append result to a list of results and update start/end dates
/// </summary>
public void Append(MeterTestResult meterTestResult)
{
MeterTestResults.Add(meterTestResult);
if (meterTestResult.TestResult.TimeStart < TestStart) TestStart = meterTestResult.TestResult.TimeStart;
if (meterTestResult.TestResult.TimeEnd > TestEnd) TestEnd = meterTestResult.TestResult.TimeEnd;
}
/// <summary>
/// Returns 'tests passed' information based on so far appended results
/// </summary>
public bool Passed()
{
bool passed = true;
foreach (var tr in MeterTestResults)
{
if (tr.TestResult.DoNotEvaluate) continue;
if (tr.VolumeErrorPct < tr.TestResult.ErrLimLo || tr.VolumeErrorPct > tr.TestResult.ErrLimHi) passed = false;
}
return passed;
}
public override string ToString()
{
StringBuilder sb = new StringBuilder(80);
sb.AppendFormat("PCB:{0} s/n:{1} ", SerialNr, SerialNrEx);
foreach (var tr in MeterTestResults) sb.AppendFormat(" {0}:{1}%", tr.TestResult.TestName, tr.VolumeErrorPct.ToString("F1"));
sb.AppendFormat(" test start: {0} {1} batch={2}", TestStart.ToShortDateString(), TestStart.ToShortTimeString(), BatchNr);
return sb.ToString();
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Results")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Results")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5da980c4-8924-4762-9b72-91e011e08f6c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2.0")]
[assembly: AssemblyFileVersion("2.0.2.0")]
+79
View File
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Results</RootNamespace>
<AssemblyName>Results</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.1.3.0.733\lib\FluentNHibernate.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections">
<HintPath>..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net20\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\packages\NHibernate.3.3.3.4001\lib\Net35\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Entities\WaterMeterResult.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Config\Config.csproj">
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
<Name>Config</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="FileWriters\" />
<Folder Include="Mappings\" />
<Folder Include="Printers\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-7
View File
@@ -43,7 +43,6 @@ namespace ResultsBrowser
//
resources.ApplyResources(this.okButton, "okButton");
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.ImageKey = global::TBF.Resources.Strings.String1;
this.okButton.Name = "okButton";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
@@ -52,7 +51,6 @@ namespace ResultsBrowser
//
resources.ApplyResources(this.cancelButton, "cancelButton");
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.ImageKey = global::TBF.Resources.Strings.String1;
this.cancelButton.Name = "cancelButton";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
@@ -67,13 +65,11 @@ namespace ResultsBrowser
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.ImageKey = global::TBF.Resources.Strings.String1;
this.label1.Name = "label1";
//
// editButton
//
resources.ApplyResources(this.editButton, "editButton");
this.editButton.ImageKey = global::TBF.Resources.Strings.String1;
this.editButton.Name = "editButton";
this.editButton.UseVisualStyleBackColor = true;
this.editButton.Click += new System.EventHandler(this.editButton_Click);
@@ -81,7 +77,6 @@ namespace ResultsBrowser
// addButton
//
resources.ApplyResources(this.addButton, "addButton");
this.addButton.ImageKey = global::TBF.Resources.Strings.String1;
this.addButton.Name = "addButton";
this.addButton.UseVisualStyleBackColor = true;
this.addButton.Click += new System.EventHandler(this.addButton_Click);
@@ -89,7 +84,6 @@ namespace ResultsBrowser
// removeButton
//
resources.ApplyResources(this.removeButton, "removeButton");
this.removeButton.ImageKey = global::TBF.Resources.Strings.String1;
this.removeButton.Name = "removeButton";
this.removeButton.UseVisualStyleBackColor = true;
this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
@@ -97,7 +91,6 @@ namespace ResultsBrowser
// copyButton
//
resources.ApplyResources(this.copyButton, "copyButton");
this.copyButton.ImageKey = global::TBF.Resources.Strings.String1;
this.copyButton.Name = "copyButton";
this.copyButton.UseVisualStyleBackColor = true;
this.copyButton.Click += new System.EventHandler(this.copyButton_Click);
+35 -29
View File
@@ -1,5 +1,9 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using ResultsBrowser.Resources;
namespace ResultsBrowser
{
@@ -18,8 +22,9 @@ namespace ResultsBrowser
/// </summary>
public BenchesDlg()
{
localSettings = new LocalSettings();
localSettings.Assign(Program.LocalSettings);
Program.LocalSettings.Save();
localSettings = LocalSettings.Load(Program.LocalSettingsFileName);
if (localSettings == null) throw new Exception("Cannot load local settings");
InitializeComponent();
RedrawTestBenchesListBox();
@@ -28,12 +33,12 @@ namespace ResultsBrowser
void RedrawTestBenchesListBox()
{
testBenchesListBox.Items.Clear();
if (localSettings.testBenches != null)
if (localSettings.TestBenches != null)
{
int nrBenches = localSettings.testBenches.GetLength(0);
int nrBenches = localSettings.TestBenches.GetLength(0);
for (int i = 0; i < nrBenches; i++)
{
testBenchesListBox.Items.Add(localSettings.testBenches[i].BenchName);
testBenchesListBox.Items.Add(localSettings.TestBenches[i].BenchName);
}
}
}
@@ -45,28 +50,28 @@ namespace ResultsBrowser
/// <param name="e">Not used</param>
private void addButton_Click(object sender, EventArgs e)
{
DatabaseSettings bench = new DatabaseSettings();
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench);
Config.DatabaseSettings bench = new Config.DatabaseSettings();
Config.DatabaseSettingsDlg dlg = new Config.DatabaseSettingsDlg(bench);
DialogResult dr = dlg.ShowDialog();
if (dr == DialogResult.OK)
{
int nrBenches =
(localSettings.testBenches == null) ? 0 : localSettings.testBenches.GetLength(0);
(localSettings.TestBenches == null) ? 0 : localSettings.TestBenches.GetLength(0);
if (nrBenches == 0)
{
localSettings.testBenches = new DatabaseSettings[1];
localSettings.testBenches[0] = bench;
localSettings.TestBenches = new Config.DatabaseSettings[1];
localSettings.TestBenches[0] = bench;
}
else
{
DatabaseSettings[] newTestBenches = new DatabaseSettings[nrBenches + 1];
Config.DatabaseSettings[] newTestBenches = new Config.DatabaseSettings[nrBenches + 1];
for (int i = 0; i < nrBenches; i++)
{
newTestBenches[i] = localSettings.testBenches[i];
newTestBenches[i] = localSettings.TestBenches[i];
}
newTestBenches[nrBenches] = bench;
localSettings.testBenches = newTestBenches;
localSettings.TestBenches = newTestBenches;
}
testBenchesListBox.Items.Add(bench.BenchName);
@@ -83,23 +88,23 @@ namespace ResultsBrowser
{
if (testBenchesListBox.SelectedIndex >= 0)
{
DatabaseSettings ori = localSettings.testBenches[testBenchesListBox.SelectedIndex];
DatabaseSettings bench = (DatabaseSettings)ori.Clone();
Config.DatabaseSettings ori = localSettings.TestBenches[testBenchesListBox.SelectedIndex];
Config.DatabaseSettings bench = (Config.DatabaseSettings)ori.Clone();
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench);
Config.DatabaseSettingsDlg dlg = new Config.DatabaseSettingsDlg(bench);
DialogResult dr = dlg.ShowDialog();
if (dr == DialogResult.OK)
{
int nrBenches =
(localSettings.testBenches == null) ? 0 : localSettings.testBenches.GetLength(0);
(localSettings.TestBenches == null) ? 0 : localSettings.TestBenches.GetLength(0);
DatabaseSettings[] newTestBenches = new DatabaseSettings[nrBenches + 1];
Config.DatabaseSettings[] newTestBenches = new Config.DatabaseSettings[nrBenches + 1];
for (int i = 0; i < nrBenches; i++)
{
newTestBenches[i] = localSettings.testBenches[i];
newTestBenches[i] = localSettings.TestBenches[i];
}
newTestBenches[nrBenches] = bench;
localSettings.testBenches = newTestBenches;
localSettings.TestBenches = newTestBenches;
testBenchesListBox.Items.Add(bench.BenchName);
}
@@ -115,13 +120,13 @@ namespace ResultsBrowser
{
if (testBenchesListBox.SelectedIndex >= 0)
{
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(localSettings.testBenches[testBenchesListBox.SelectedIndex]);
Config.DatabaseSettingsDlg dlg = new Config.DatabaseSettingsDlg(localSettings.TestBenches[testBenchesListBox.SelectedIndex]);
DialogResult dr = dlg.ShowDialog();
if (dr == DialogResult.OK)
{
// Update the item name
testBenchesListBox.Items[testBenchesListBox.SelectedIndex] =
localSettings.testBenches[testBenchesListBox.SelectedIndex].BenchName;
localSettings.TestBenches[testBenchesListBox.SelectedIndex].BenchName;
}
}
}
@@ -137,24 +142,24 @@ namespace ResultsBrowser
if (selectedIx >= 0)
{
int nrBenches =
(localSettings.testBenches == null) ? 0 : localSettings.testBenches.GetLength(0);
(localSettings.TestBenches == null) ? 0 : localSettings.TestBenches.GetLength(0);
if (nrBenches == 1)
{
localSettings.testBenches = null;
localSettings.TestBenches = null;
}
else
{
DatabaseSettings[] newTestBenches = new DatabaseSettings[nrBenches - 1];
Config.DatabaseSettings[] newTestBenches = new Config.DatabaseSettings[nrBenches - 1];
for (int i = 0; i < selectedIx; i++)
{
newTestBenches[i] = localSettings.testBenches[i];
newTestBenches[i] = localSettings.TestBenches[i];
}
for (int i = selectedIx + 1; i < nrBenches; i++)
{
newTestBenches[i - 1] = localSettings.testBenches[i];
newTestBenches[i - 1] = localSettings.TestBenches[i];
}
localSettings.testBenches = newTestBenches;
localSettings.TestBenches = newTestBenches;
}
RedrawTestBenchesListBox();
@@ -168,7 +173,8 @@ namespace ResultsBrowser
/// <param name="e">Not used</param>
private void okButton_Click(object sender, EventArgs e)
{
Program.LocalSettings.Assign(localSettings); // Update Program.localSettings
localSettings.Save();
Program.LocalSettings = LocalSettings.Load(Program.LocalSettingsFileName);
DialogResult = DialogResult.OK;
Close();
return;
-148
View File
@@ -1,148 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="okButton.Text" xml:space="preserve">
<value>&amp;OK</value>
</data>
<data name="cancelButton.Text" xml:space="preserve">
<value>&amp;Abbrechen</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>58, 13</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Prüfstände</value>
</data>
<data name="editButton.Text" xml:space="preserve">
<value>&amp;Bearbeiten...</value>
</data>
<data name="addButton.Text" xml:space="preserve">
<value>&amp;Neu...</value>
</data>
<data name="removeButton.Text" xml:space="preserve">
<value>&amp;Löschen</value>
</data>
<data name="copyButton.Text" xml:space="preserve">
<value>&amp;Kopieren</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Datenbank Einstellungen</value>
</data>
</root>
+18 -21
View File
@@ -134,8 +134,8 @@
<data name="addButton.Location" type="System.Drawing.Point, System.Drawing">
<value>192, 37</value>
</data>
<data name="testBenchesListBox.Size" type="System.Drawing.Size, System.Drawing">
<value>164, 134</value>
<data name="okButton.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="addButton.Text" xml:space="preserve">
<value>&amp;Add</value>
@@ -164,9 +164,6 @@
<data name="removeButton.Text" xml:space="preserve">
<value>&amp;Remove</value>
</data>
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
<value>344, 71</value>
</data>
<data name="&gt;&gt;cancelButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
@@ -209,8 +206,8 @@
<data name="&gt;&gt;removeButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>459, 185</value>
<data name="testBenchesListBox.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 37</value>
</data>
<data name="cancelButton.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
@@ -218,6 +215,9 @@
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="&gt;&gt;copyButton.Name" xml:space="preserve">
<value>copyButton</value>
</data>
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 28</value>
</data>
@@ -255,8 +255,8 @@
<data name="copyButton.Text" xml:space="preserve">
<value>&amp;Copy</value>
</data>
<data name="testBenchesListBox.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 37</value>
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
<value>344, 71</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>4</value>
@@ -270,8 +270,11 @@
<data name="&gt;&gt;addButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;copyButton.Name" xml:space="preserve">
<value>copyButton</value>
<data name="&gt;&gt;okButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;editButton.Name" xml:space="preserve">
<value>editButton</value>
</data>
<data name="removeButton.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 28</value>
@@ -282,8 +285,8 @@
<data name="&gt;&gt;editButton.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="&gt;&gt;editButton.Name" xml:space="preserve">
<value>editButton</value>
<data name="testBenchesListBox.Size" type="System.Drawing.Size, System.Drawing">
<value>164, 134</value>
</data>
<data name="&gt;&gt;cancelButton.Name" xml:space="preserve">
<value>cancelButton</value>
@@ -303,14 +306,11 @@
<data name="&gt;&gt;addButton.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="okButton.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Database Settings</value>
</data>
<data name="&gt;&gt;okButton.Parent" xml:space="preserve">
<value>$this</value>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>459, 185</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
@@ -333,7 +333,4 @@
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>de</value>
</metadata>
</root>
-28
View File
@@ -1,28 +0,0 @@
using System;
namespace ResultsBrowser
{
/// <summary>
/// Database settings required to make a connection
/// </summary>
public class DBSettings : ICloneable
{
public DBType DbType;
public string ConnectionString;
public DBSettings()
{
}
public DBSettings(DBType dbType, string connectionString)
{
this.DbType = dbType;
this.ConnectionString = connectionString;
}
public object Clone()
{
return new DBSettings(DbType, ConnectionString);
}
}
}
+146
View File
@@ -0,0 +1,146 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Config.Entities;
namespace ResultsBrowser
{
public static class DataDeposit
{
public static IList<TestResult> ReportTestResults;
public static IList<Results.Entities.WaterMeterResult> ReportWaterMeterResults;
public static IList<TestResult> QueryTestResults;
public static IList<Results.Entities.WaterMeterResult> QueryWaterMeterResults;
static DataDeposit()
{
Clear();
}
public static void Clear()
{
ReportTestResults = new List<TestResult>();
ReportWaterMeterResults = new List<Results.Entities.WaterMeterResult>();
QueryTestResults = new List<TestResult>();
QueryWaterMeterResults = new List<Results.Entities.WaterMeterResult>();
}
public static void ProcessQueryTestResults(IList<TestResult> testResults, bool resolveManually)
{
IList<TestResult> selectedTestResults = new List<TestResult>();
///
/// Place all batch numbers into one list without duplicates
///
IList<int> batchNrs = new List<int>();
foreach (var tr in testResults)
{
if (tr.TestName.ToLower().Contains("q") && !tr.TestName.ToLower().Contains("adj") /*&& tr.TestName.Length == 2*/)
{
selectedTestResults.Insert(0, tr);
if (!batchNrs.Contains(tr.BatchNr))
{
batchNrs.Add(tr.BatchNr);
}
}
}
/// TODO: Optionally sort them in reverse order (they should be now sorted in this way)
///
/// Iterate through all batch numbers
///
foreach (var batchNr in batchNrs)
{
IList<Results.Entities.WaterMeterResult> wmResults = new List<Results.Entities.WaterMeterResult>();
bool waterMetersCreated = false;
foreach (var tr in selectedTestResults)
{
//if (tr.TestName.ToLower().Contains("q2"))
{
if (tr.BatchNr == batchNr)
{
if (!waterMetersCreated)
{
foreach (var mtr in tr.Meters) wmResults.Add(new Results.Entities.WaterMeterResult(mtr, 5));
waterMetersCreated = true;
}
else
{
for (int i = 0; i < Math.Min(tr.Meters.Count, wmResults.Count); i++)
{
wmResults[i].Append(tr.Meters[i]);
}
}
}
}
}
/// Exclude 'failed' water meters
for (int i = wmResults.Count - 1; i >= 0; i--)
{
if (string.IsNullOrEmpty(wmResults[i].SerialNr) || !wmResults[i].Passed())
{
wmResults.RemoveAt(i);
}
}
int added = AddWMResultsAvoidDuplicates(wmResults, resolveManually);
Console.WriteLine("batch={0} added={1}", batchNr, added);
}
foreach (var tr in selectedTestResults) QueryTestResults.Add(tr);
}
public static int AddWMResultsAvoidDuplicates(IList<Results.Entities.WaterMeterResult> wmResults, bool resolveManually)
{
int added = 0;
foreach (var wmr in wmResults)
{
Results.Entities.WaterMeterResult foundWM = null;
foreach (var wm in QueryWaterMeterResults)
{
if (wm.SerialNr.Equals(wmr.SerialNr))
{
foundWM = wm;
break;
}
}
if (foundWM == null)
{
QueryWaterMeterResults.Add(wmr);
added++;
}
else if (resolveManually)
{
if (DialogResult.Yes == MessageBox.Show(string.Format("New watermeter: {0}\r\nWatermeter in data set: {1}\r\nDou you want to replace the watermeter in the data set?", wmr, foundWM),
"Resolve duplicity", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
QueryWaterMeterResults.Remove(foundWM);
QueryWaterMeterResults.Add(wmr);
added++;
}
}
}
return added;
}
public static void AddQueryToReport()
{
foreach (var wm in QueryWaterMeterResults) ReportWaterMeterResults.Add(wm);
QueryWaterMeterResults.Clear();
}
}
}
-48
View File
@@ -1,48 +0,0 @@
using System;
using System.Text;
using System.Xml.Serialization;
namespace ResultsBrowser
{
/// <summary>
/// Test bench database settings, contains bench name and settings od several databases
/// </summary>
public class DatabaseSettings : ICloneable
{
// Public fields
public string BenchName;
public bool IsRealBench;
public DBSettings UsersDBSettings;
public DBSettings BenchDBSettings;
public DBSettings ProceduresDBSettings;
public DBSettings WMTypesDBSettings;
public DBSettings WaterMetersDBSettings;
// Constructor
public DatabaseSettings()
{
BenchName = String.Empty; /// Empty string to avoid null
IsRealBench = false;
UsersDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_users; UID=root; PASSWORD=;");
BenchDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_bench; UID=root; PASSWORD=;");
ProceduresDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_procedures; UID=root; PASSWORD=;");
WMTypesDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_wmtypes; UID=root; PASSWORD=;");
WaterMetersDBSettings = new DBSettings(DBType.MySql, "SERVER=localhost; DATABASE=tbf_watermeters; UID=root; PASSWORD=;");
}
public object Clone()
{
DatabaseSettings result = new DatabaseSettings();
result.BenchName = BenchName;
result.IsRealBench = IsRealBench;
result.UsersDBSettings = (DBSettings)UsersDBSettings.Clone();
result.BenchDBSettings = (DBSettings)BenchDBSettings.Clone();
result.ProceduresDBSettings = (DBSettings)ProceduresDBSettings.Clone();
result.WMTypesDBSettings = (DBSettings)WMTypesDBSettings.Clone();
result.WaterMetersDBSettings = (DBSettings)WaterMetersDBSettings.Clone();
return result;
}
}
}
-21
View File
@@ -66,7 +66,6 @@ namespace ResultsBrowser
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.okButton, "okButton");
this.okButton.Name = "okButton";
this.okButton.UseVisualStyleBackColor = true;
@@ -75,7 +74,6 @@ namespace ResultsBrowser
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.cancelButton, "cancelButton");
this.cancelButton.Name = "cancelButton";
this.cancelButton.UseVisualStyleBackColor = true;
@@ -84,7 +82,6 @@ namespace ResultsBrowser
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.ImageKey = global::TBF.Resources.Strings.String1;
this.label1.Name = "label1";
//
// benchNameTextBox
@@ -100,7 +97,6 @@ namespace ResultsBrowser
// connectionStringLabel
//
resources.ApplyResources(this.connectionStringLabel, "connectionStringLabel");
this.connectionStringLabel.ImageKey = global::TBF.Resources.Strings.String1;
this.connectionStringLabel.Name = "connectionStringLabel";
//
// benchConnectionStringTextBox
@@ -126,37 +122,31 @@ namespace ResultsBrowser
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.ImageKey = global::TBF.Resources.Strings.String1;
this.label2.Name = "label2";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.ImageKey = global::TBF.Resources.Strings.String1;
this.label3.Name = "label3";
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.ImageKey = global::TBF.Resources.Strings.String1;
this.label4.Name = "label4";
//
// label5
//
resources.ApplyResources(this.label5, "label5");
this.label5.ImageKey = global::TBF.Resources.Strings.String1;
this.label5.Name = "label5";
//
// label6
//
resources.ApplyResources(this.label6, "label6");
this.label6.ImageKey = global::TBF.Resources.Strings.String1;
this.label6.Name = "label6";
//
// testConnUsersBtn
//
this.testConnUsersBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnUsersBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnUsersBtn, "testConnUsersBtn");
this.testConnUsersBtn.Name = "testConnUsersBtn";
this.testConnUsersBtn.UseVisualStyleBackColor = true;
@@ -165,7 +155,6 @@ namespace ResultsBrowser
// createUsersDbBtn
//
this.createUsersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createUsersDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createUsersDbBtn, "createUsersDbBtn");
this.createUsersDbBtn.Name = "createUsersDbBtn";
this.createUsersDbBtn.UseVisualStyleBackColor = true;
@@ -174,14 +163,12 @@ namespace ResultsBrowser
// realBenchCheckBox
//
resources.ApplyResources(this.realBenchCheckBox, "realBenchCheckBox");
this.realBenchCheckBox.ImageKey = global::TBF.Resources.Strings.String1;
this.realBenchCheckBox.Name = "realBenchCheckBox";
this.realBenchCheckBox.UseVisualStyleBackColor = true;
//
// dbTypeLabel
//
resources.ApplyResources(this.dbTypeLabel, "dbTypeLabel");
this.dbTypeLabel.ImageKey = global::TBF.Resources.Strings.String1;
this.dbTypeLabel.Name = "dbTypeLabel";
//
// usersDbTypeComboBox
@@ -217,7 +204,6 @@ namespace ResultsBrowser
// testConnBenchBtn
//
this.testConnBenchBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnBenchBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnBenchBtn, "testConnBenchBtn");
this.testConnBenchBtn.Name = "testConnBenchBtn";
this.testConnBenchBtn.UseVisualStyleBackColor = true;
@@ -226,7 +212,6 @@ namespace ResultsBrowser
// testConnProceduresBtn
//
this.testConnProceduresBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnProceduresBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnProceduresBtn, "testConnProceduresBtn");
this.testConnProceduresBtn.Name = "testConnProceduresBtn";
this.testConnProceduresBtn.UseVisualStyleBackColor = true;
@@ -235,7 +220,6 @@ namespace ResultsBrowser
// testConnWMTypesBtn
//
this.testConnWMTypesBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnWMTypesBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnWMTypesBtn, "testConnWMTypesBtn");
this.testConnWMTypesBtn.Name = "testConnWMTypesBtn";
this.testConnWMTypesBtn.UseVisualStyleBackColor = true;
@@ -244,7 +228,6 @@ namespace ResultsBrowser
// testConnWaterMetersBtn
//
this.testConnWaterMetersBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.testConnWaterMetersBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.testConnWaterMetersBtn, "testConnWaterMetersBtn");
this.testConnWaterMetersBtn.Name = "testConnWaterMetersBtn";
this.testConnWaterMetersBtn.UseVisualStyleBackColor = true;
@@ -253,7 +236,6 @@ namespace ResultsBrowser
// createBenchDbBtn
//
this.createBenchDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createBenchDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createBenchDbBtn, "createBenchDbBtn");
this.createBenchDbBtn.Name = "createBenchDbBtn";
this.createBenchDbBtn.UseVisualStyleBackColor = true;
@@ -262,7 +244,6 @@ namespace ResultsBrowser
// createProceduresDbBtn
//
this.createProceduresDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createProceduresDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createProceduresDbBtn, "createProceduresDbBtn");
this.createProceduresDbBtn.Name = "createProceduresDbBtn";
this.createProceduresDbBtn.UseVisualStyleBackColor = true;
@@ -271,7 +252,6 @@ namespace ResultsBrowser
// createWMTypesDbBtn
//
this.createWMTypesDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createWMTypesDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createWMTypesDbBtn, "createWMTypesDbBtn");
this.createWMTypesDbBtn.Name = "createWMTypesDbBtn";
this.createWMTypesDbBtn.UseVisualStyleBackColor = true;
@@ -280,7 +260,6 @@ namespace ResultsBrowser
// createWaterMetersDbBtn
//
this.createWaterMetersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.createWaterMetersDbBtn.ImageKey = global::TBF.Resources.Strings.String1;
resources.ApplyResources(this.createWaterMetersDbBtn, "createWaterMetersDbBtn");
this.createWaterMetersDbBtn.Name = "createWaterMetersDbBtn";
this.createWaterMetersDbBtn.UseVisualStyleBackColor = true;
+18 -15
View File
@@ -1,3 +1,6 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -5,9 +8,9 @@ using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TBF.Resources;
using ResultsBrowser.Resources;
namespace TBF
namespace ResultsBrowser
{
/// <summary>
/// Dialog to process test bench name and database settings (BenchSettings)
@@ -15,13 +18,13 @@ namespace TBF
public partial class DatabaseSettingsDlg : Form
{
// Reference to bench DB settins (not a local copy)
DatabaseSettings bench;
Config.DatabaseSettings bench;
/// <summary>
/// Constructor
/// </summary>
/// <param name="bench">Test bench database settings</param>
public DatabaseSettingsDlg(DatabaseSettings bench)
public DatabaseSettingsDlg(Config.DatabaseSettings bench)
{
this.bench = bench;
@@ -64,9 +67,9 @@ namespace TBF
realBenchCheckBox.Checked = bench.IsRealBench;
/// Initialize 'Database type' combo-boxes
for (int i = 0; i < (int)DBType.DbTypesCount; i++)
for (int i = 0; i < (int)Config.DBType.DbTypesCount; i++)
{
DBType dbType = (DBType)i;
Config.DBType dbType = (Config.DBType)i;
usersDbTypeComboBox.Items.Add(dbType);
benchDbTypeComboBox.Items.Add(dbType);
proceduresDbTypeComboBox.Items.Add(dbType);
@@ -108,11 +111,11 @@ namespace TBF
bench.WMTypesDBSettings.ConnectionString = wmTypesConnectionStringTextBox.Text;
bench.WaterMetersDBSettings.ConnectionString = watermetersConnectionStringTextBox.Text;
bench.UsersDBSettings.DbType = (DBType)usersDbTypeComboBox.SelectedIndex;
bench.BenchDBSettings.DbType = (DBType)benchDbTypeComboBox.SelectedIndex;
bench.ProceduresDBSettings.DbType = (DBType)proceduresDbTypeComboBox.SelectedIndex;
bench.WMTypesDBSettings.DbType = (DBType)wmTypesDbTypeComboBox.SelectedIndex;
bench.WaterMetersDBSettings.DbType = (DBType)watermetersDbTypeComboBox.SelectedIndex;
bench.UsersDBSettings.DbType = (Config.DBType)usersDbTypeComboBox.SelectedIndex;
bench.BenchDBSettings.DbType = (Config.DBType)benchDbTypeComboBox.SelectedIndex;
bench.ProceduresDBSettings.DbType = (Config.DBType)proceduresDbTypeComboBox.SelectedIndex;
bench.WMTypesDBSettings.DbType = (Config.DBType)wmTypesDbTypeComboBox.SelectedIndex;
bench.WaterMetersDBSettings.DbType = (Config.DBType)watermetersDbTypeComboBox.SelectedIndex;
return true;
}
@@ -155,7 +158,7 @@ namespace TBF
try
{
Cursor.Current = Cursors.WaitCursor;
FluentCommon.CreateEmptyUsersDB(bench.UsersDBSettings);
Config.FluentCommon.CreateEmptyUsersDB(bench.UsersDBSettings);
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
Cursor.Current = Cursors.Default;
DialogResult = DialogResult.None;
@@ -177,7 +180,7 @@ namespace TBF
try
{
Cursor.Current = Cursors.WaitCursor;
FluentCommon.CreateEmptyBenchDB(bench.BenchDBSettings);
Config.FluentCommon.CreateEmptyBenchDB(bench.BenchDBSettings);
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
Cursor.Current = Cursors.Default;
DialogResult = DialogResult.None;
@@ -199,7 +202,7 @@ namespace TBF
try
{
Cursor.Current = Cursors.WaitCursor;
FluentCommon.CreateEmptyProceduresDB(bench.ProceduresDBSettings);
Config.FluentCommon.CreateEmptyProceduresDB(bench.ProceduresDBSettings);
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
Cursor.Current = Cursors.Default;
DialogResult = DialogResult.None;
@@ -226,7 +229,7 @@ namespace TBF
try
{
Cursor.Current = Cursors.WaitCursor;
FluentCommon.CreateEmptyWaterMetersDB(bench.WaterMetersDBSettings);
Config.FluentCommon.CreateEmptyWaterMetersDB(bench.WaterMetersDBSettings);
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
Cursor.Current = Cursors.Default;
DialogResult = DialogResult.None;
-78
View File
@@ -1,78 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class BenchPath : IHasItemNr, IHasValves
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string TempIn { get; set; }
public virtual string TempOut { get; set; }
public virtual string PressIn { get; set; }
public virtual string PressOut { get; set; }
/// Valves
public virtual string ValvesOpen { get; set; }
public virtual string ValvesClose { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public BenchPath()
{
}
public BenchPath(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public BenchPath(BenchControl.BenchPath path)
: this(path.Name, path.ItemNr)
{
Qfrom = path.Qfrom;
Qto = path.Qto;
TempIn = (path.TempIn != null) ? path.TempIn.Cfg.Name : null;
TempOut = (path.TempOut != null) ? path.TempOut.Cfg.Name : null;
PressIn = (path.PressIn != null) ? path.PressIn.Cfg.Name : null;
PressOut = (path.PressOut != null) ? path.PressOut.Cfg.Name : null;
string vOpen = string.Empty;
foreach (var valve in path.ValvesOpen)
{
if (vOpen != string.Empty) vOpen += ";";
vOpen += valve.Cfg.Name;
}
ValvesOpen = vOpen;
string vClose = string.Empty;
foreach (var valve in path.ValvesClose)
{
if (vClose != string.Empty) vClose += ";";
vClose += valve.Cfg.Name;
}
ValvesClose = vClose;
}
public virtual BenchPath Clone(string name, int itemNr)
{
BenchPath result = new BenchPath(name, itemNr);
result.Qfrom = Qfrom;
result.Qto = Qto;
result.TempIn = TempIn;
result.TempOut = TempOut;
result.PressIn = PressIn;
result.PressOut = PressOut;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
return result;
}
}
}
-71
View File
@@ -1,71 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class Component : IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string ClassName { get; set; }
public virtual string ParentName { get; set; }
public virtual DebugMode Mode { get; set; }
public virtual LogLevel Logging { get; set; }
public virtual string Parameters { get; set; }
public virtual IList<MeasurementCorrection> Corrections { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public Component()
{
Corrections = new List<MeasurementCorrection>();
}
public static Component CreateFromCfg(string name, string className, string parentName, int itemNr,
DebugMode debugLevel, LogLevel logLevel, string parameters)
{
Component result = new Component();
result.ItemNr = itemNr;
result.Name = name;
result.ClassName = className;
result.ParentName = parentName;
result.Mode = debugLevel;
result.Logging = logLevel;
result.Parameters = parameters;
return result;
}
// Makes a new copy of this object (not just a reference)
public virtual Component Clone()
{
Component result = new Component();
result.ItemNr = ItemNr;
result.Name = Name;
result.ClassName = ClassName;
result.ParentName = ParentName;
result.Mode = Mode;
result.Logging = Logging;
result.Parameters = Parameters;
return result;
}
public virtual string ToString(string indent)
{
string result = string.Empty;
result += indent + "ItemNr = " + (ItemNr + 1).ToString() + Environment.NewLine;
result += indent + "Name = " + Name + Environment.NewLine;
result += indent + "ClassName = " + ClassName + Environment.NewLine;
if (ParentName != null)
{
result += indent + "ParentName = " + ParentName + Environment.NewLine;
}
result += indent + "DebugLevel = " + Mode.ToString() + Environment.NewLine;
result += indent + "LogLevel = " + Logging.ToString() + Environment.NewLine;
result += indent + "Parameters = " + Parameters + Environment.NewLine;
return result;
}
}
}
@@ -1,20 +0,0 @@
namespace ResultsBrowser.Entities
{
public class ComponentProcedure
{
public virtual int Id { get; protected set; }
public virtual string CmpntName { get; set; } /// Component name
public virtual string Parameters { get; set; }
public virtual Procedure Procedure { get; set; }
public virtual ComponentProcedure Clone()
{
ComponentProcedure result = new ComponentProcedure();
result.CmpntName = CmpntName;
result.Parameters = Parameters;
result.Procedure = Procedure;
return result;
}
}
}
-20
View File
@@ -1,20 +0,0 @@
namespace ResultsBrowser.Entities
{
public class ComponentTest
{
public virtual int Id { get; protected set; }
public virtual string CmpntName { get; set; } /// Component name
public virtual string Parameters { get; set; }
public virtual Test Test { get; set; }
public virtual ComponentTest Clone()
{
ComponentTest result = new ComponentTest();
result.CmpntName = CmpntName;
result.Parameters = Parameters;
result.Test = Test;
return result;
}
}
}
-85
View File
@@ -1,85 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
/// <summary>
/// Kind of meters for the procedure / test
/// </summary>
public enum MetersKind
{
Single,
Combined,
}
/// <summary>
/// Flow set method Std/ComposedMeter
/// </summary>
public enum QSetMethod
{
Std,
ComposedMeter,
Count,
}
/// <summary>
/// Procedure method FSS/SSS
/// </summary>
public enum TestMethod2
{
FSS,
SSS,
Count,
}
public enum TestRedType
{
Fix,
/// etc.
Count,
}
public enum FQC1
{
FQC1,
FQP1,
Count,
}
public enum Device
{
Screen,
Printer,
Disk,
}
/// <summary>
/// Possible modes of operation of components and devices.
/// </summary>
public enum DebugMode
{
DetectedOff = -2,
DetectedOn = -1,
Normal = 0, /// Normal operation
AutoDetect, /// The component (device) will be auto-detected
Off, /// The component is off
Record,
Reply,
Simulate, /// Test bench simulation, this mode does not require any hardware
Inherit,
Count,
}
public enum LogLevel
{
Off,
Fatal,
Error,
Warn,
Info,
Debug,
All,
Count,
}
}
-69
View File
@@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class FeedingPath : IHasItemNr, IHasValves
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string Pump { get; set; }
/// Valves
public virtual string ValvesOpen { get; set; }
public virtual string ValvesClose { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public FeedingPath()
{
}
public FeedingPath(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public FeedingPath(BenchControl.FeedingPath path)
: this(path.Name, path.ItemNr)
{
Qfrom = path.Qfrom;
Qto = path.Qto;
Pump = (path.Pump != null) ? path.Pump.Cfg.Name : null;
string vOpen = string.Empty;
foreach (var valve in path.ValvesOpen)
{
if (vOpen != string.Empty) vOpen += ";";
vOpen += valve.Cfg.Name;
}
ValvesOpen = vOpen;
string vClose = string.Empty;
foreach (var valve in path.ValvesClose)
{
if (vClose != string.Empty) vClose += ";";
vClose += valve.Cfg.Name;
}
ValvesClose = vClose;
}
public virtual FeedingPath Clone(string name, int itemNr)
{
FeedingPath result = new FeedingPath(name, itemNr);
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Pump = Pump;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
return result;
}
}
}
-12
View File
@@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class Group
{
public virtual int Id { get; protected set; }
public virtual int Gid { get; set; }
public virtual string Name { get; set; }
}
}
-9
View File
@@ -1,9 +0,0 @@
namespace ResultsBrowser.Entities
{
interface IHasItemNr
{
int Id { get; }
int ItemNr { get; set; }
}
}
-9
View File
@@ -1,9 +0,0 @@
namespace ResultsBrowser.Entities
{
public interface IHasValves
{
string ValvesOpen { get; set; } /// List of valves to be opened
string ValvesClose { get; set; } /// List of valves to be closed
}
}
@@ -1,11 +0,0 @@
using System;
namespace ResultsBrowser.Entities
{
public class MeasurementCorrection
{
public virtual int Id { get; protected set; }
public virtual float Measurement { get; set; }
public virtual float Correction { get; set; }
}
}
@@ -1,51 +0,0 @@
using System;
namespace ResultsBrowser.Entities
{
public class MeterTestResult
{
public virtual int Id { get; protected set; }
public virtual TestResult TestResult { get; set; } /// reference to the TestResult entity
public virtual string SerialNr { get; set; }
public virtual string EndState { get; set; }
public virtual float VolumeStart { get; set; } /// liter
public virtual float VolumeEnd { get; set; } /// liter
public virtual float VolumeMeter { get; set; } /// liter
public virtual float VolumeRef { get; set; } /// liter
public virtual float VolumeErrorPct { get; set; } /// %
public virtual float PulsesMeter { get; set; } /// Not applicable for a combined meter
public virtual float PulsesMaster { get; set; }
public virtual float Time { get; set; } /// sec.
public virtual bool Passed { get; set; } /// true = test passed
public MeterTestResult()
{
}
public MeterTestResult(TestResult testResult)
: this()
{
TestResult = testResult;
}
public virtual MeterTestResult Clone(TestResult testResult)
{
MeterTestResult result = new MeterTestResult(testResult);
result.SerialNr = SerialNr;
result.EndState = EndState;
result.VolumeStart = VolumeStart;
result.VolumeEnd = VolumeEnd;
result.VolumeMeter = VolumeMeter;
result.VolumeRef = VolumeRef;
result.VolumeErrorPct = VolumeErrorPct;
result.PulsesMeter = PulsesMeter;
result.PulsesMaster = PulsesMaster;
result.Time = Time;
result.Passed = Passed;
return result;
}
}
}
-157
View File
@@ -1,157 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class MetersPath : IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
/// Sensors
public virtual string Sensor1 { get; set; }
public virtual string Sensor2 { get; set; }
public virtual string Sensor3 { get; set; }
public virtual string Sensor4 { get; set; }
public virtual string Sensor5 { get; set; }
public virtual string Sensor6 { get; set; }
public virtual string Sensor7 { get; set; }
public virtual string Sensor8 { get; set; }
public virtual string Sensor9 { get; set; }
public virtual string Sensor10 { get; set; }
public virtual string Sensor11 { get; set; }
public virtual string Sensor12 { get; set; }
public virtual string Sensor13 { get; set; }
public virtual string Sensor14 { get; set; }
public virtual string Sensor15 { get; set; }
public virtual string Sensor16 { get; set; }
public virtual string Sensor17 { get; set; }
public virtual string Sensor18 { get; set; }
public virtual string Sensor19 { get; set; }
public virtual string Sensor20 { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public MetersPath()
{
}
public MetersPath(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public MetersPath(BenchControl.MetersPath path)
: this(path.Name, path.ItemNr)
{
Qfrom = path.Qfrom;
Qto = path.Qto;
Sensor1 = (path.RegisterReaders[0] != null) ? path.RegisterReaders[0].Cfg.Name : null;
#pragma warning disable
if (Program.WMsCount >= 2) Sensor2 = (path.RegisterReaders[1] != null) ? path.RegisterReaders[1].Cfg.Name : null;
if (Program.WMsCount >= 3) Sensor3 = (path.RegisterReaders[2] != null) ? path.RegisterReaders[2].Cfg.Name : null;
if (Program.WMsCount >= 4) Sensor4 = (path.RegisterReaders[3] != null) ? path.RegisterReaders[3].Cfg.Name : null;
if (Program.WMsCount >= 5) Sensor5 = (path.RegisterReaders[4] != null) ? path.RegisterReaders[4].Cfg.Name : null;
if (Program.WMsCount >= 6) Sensor6 = (path.RegisterReaders[5] != null) ? path.RegisterReaders[5].Cfg.Name : null;
if (Program.WMsCount >= 7) Sensor7 = (path.RegisterReaders[6] != null) ? path.RegisterReaders[6].Cfg.Name : null;
if (Program.WMsCount >= 8) Sensor8 = (path.RegisterReaders[7] != null) ? path.RegisterReaders[7].Cfg.Name : null;
if (Program.WMsCount >= 9) Sensor9 = (path.RegisterReaders[8] != null) ? path.RegisterReaders[8].Cfg.Name : null;
if (Program.WMsCount >= 10) Sensor10 = (path.RegisterReaders[9] != null) ? path.RegisterReaders[9].Cfg.Name : null;
if (Program.WMsCount >= 11) Sensor11 = (path.RegisterReaders[10] != null) ? path.RegisterReaders[10].Cfg.Name : null;
if (Program.WMsCount >= 12) Sensor12 = (path.RegisterReaders[11] != null) ? path.RegisterReaders[11].Cfg.Name : null;
if (Program.WMsCount >= 13) Sensor13 = (path.RegisterReaders[12] != null) ? path.RegisterReaders[12].Cfg.Name : null;
if (Program.WMsCount >= 14) Sensor14 = (path.RegisterReaders[13] != null) ? path.RegisterReaders[13].Cfg.Name : null;
if (Program.WMsCount >= 15) Sensor15 = (path.RegisterReaders[14] != null) ? path.RegisterReaders[14].Cfg.Name : null;
if (Program.WMsCount >= 16) Sensor16 = (path.RegisterReaders[15] != null) ? path.RegisterReaders[15].Cfg.Name : null;
if (Program.WMsCount >= 17) Sensor17 = (path.RegisterReaders[16] != null) ? path.RegisterReaders[16].Cfg.Name : null;
if (Program.WMsCount >= 18) Sensor18 = (path.RegisterReaders[17] != null) ? path.RegisterReaders[17].Cfg.Name : null;
if (Program.WMsCount >= 19) Sensor19 = (path.RegisterReaders[18] != null) ? path.RegisterReaders[18].Cfg.Name : null;
if (Program.WMsCount >= 20) Sensor20 = (path.RegisterReaders[19] != null) ? path.RegisterReaders[19].Cfg.Name : null;
#pragma warning restore
}
public virtual MetersPath Clone(string name, int itemNr)
{
MetersPath result = new MetersPath(name, itemNr);
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Sensor1 = Sensor1;
result.Sensor2 = Sensor2;
result.Sensor3 = Sensor3;
result.Sensor4 = Sensor4;
result.Sensor5 = Sensor5;
result.Sensor6 = Sensor6;
result.Sensor7 = Sensor7;
result.Sensor8 = Sensor8;
result.Sensor9 = Sensor9;
result.Sensor10 = Sensor10;
result.Sensor11 = Sensor11;
result.Sensor12 = Sensor12;
result.Sensor13 = Sensor13;
result.Sensor14 = Sensor14;
result.Sensor15 = Sensor15;
result.Sensor16 = Sensor16;
result.Sensor17 = Sensor17;
result.Sensor18 = Sensor18;
result.Sensor19 = Sensor19;
result.Sensor20 = Sensor20;
return result;
}
/// Returns the component name
public virtual string GetSensor(int i)
{
if (i == 0) return Sensor1;
else if (i == 1) return Sensor2;
else if (i == 2) return Sensor3;
else if (i == 3) return Sensor4;
else if (i == 4) return Sensor5;
else if (i == 5) return Sensor6;
else if (i == 6) return Sensor7;
else if (i == 7) return Sensor8;
else if (i == 8) return Sensor9;
else if (i == 9) return Sensor10;
else if (i == 10) return Sensor11;
else if (i == 11) return Sensor12;
else if (i == 12) return Sensor13;
else if (i == 13) return Sensor14;
else if (i == 14) return Sensor15;
else if (i == 15) return Sensor16;
else if (i == 16) return Sensor17;
else if (i == 17) return Sensor18;
else if (i == 18) return Sensor19;
else if (i == 19) return Sensor20;
else return null;
}
/// Sets the component name
public virtual void SetSensor(int i, string cmpntName)
{
if (i == 0) Sensor1 = cmpntName;
else if (i == 1) Sensor2 = cmpntName;
else if (i == 2) Sensor3 = cmpntName;
else if (i == 3) Sensor4 = cmpntName;
else if (i == 4) Sensor5 = cmpntName;
else if (i == 5) Sensor6 = cmpntName;
else if (i == 6) Sensor7 = cmpntName;
else if (i == 7) Sensor8 = cmpntName;
else if (i == 8) Sensor9 = cmpntName;
else if (i == 9) Sensor10 = cmpntName;
else if (i == 10) Sensor11 = cmpntName;
else if (i == 11) Sensor12 = cmpntName;
else if (i == 12) Sensor13 = cmpntName;
else if (i == 13) Sensor14 = cmpntName;
else if (i == 14) Sensor15 = cmpntName;
else if (i == 15) Sensor16 = cmpntName;
else if (i == 16) Sensor17 = cmpntName;
else if (i == 17) Sensor18 = cmpntName;
else if (i == 18) Sensor19 = cmpntName;
else if (i == 19) Sensor20 = cmpntName;
}
}
}
-91
View File
@@ -1,91 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class OutputPath : IHasItemNr, IHasValves
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string RegulValve { get; set; }
public virtual string FlowMeter { get; set; }
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
public virtual string StartValve { get; set; }
public virtual string Diverter { get; set; }
public virtual string TempDiv { get; set; }
public virtual string Balance { get; set; }
public virtual string EmptyTankValve { get; set; }
/// Valves
public virtual string ValvesOpen { get; set; }
public virtual string ValvesClose { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public OutputPath()
{
}
public OutputPath(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public OutputPath(BenchControl.OutputPath path)
: this(path.Name, path.ItemNr)
{
Qfrom = path.Qfrom;
Qto = path.Qto;
RegulValve = (path.RegulValve != null) ? path.RegulValve.Cfg.Name : null;
FlowMeter = (path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : null;
PidCoef = path.PidCoef;
StartValve = (path.StartValve != null) ? path.StartValve.Cfg.Name : null;
Diverter = (path.Diverter != null) ? path.Diverter.Cfg.Name : null;
TempDiv = (path.TempDiv != null) ? path.TempDiv.Cfg.Name : null;
Balance = (path.Balance != null) ? path.Balance.Cfg.Name : null;
EmptyTankValve = (path.EmptyTankValve != null) ? path.EmptyTankValve.Cfg.Name : null;
string vOpen = string.Empty;
foreach (var valve in path.ValvesOpen)
{
if (vOpen != string.Empty) vOpen += ";";
vOpen += valve.Cfg.Name;
}
ValvesOpen = vOpen;
string vClose = string.Empty;
foreach (var valve in path.ValvesClose)
{
if (vClose != string.Empty) vClose += ";";
vClose += valve.Cfg.Name;
}
ValvesClose = vClose;
}
public virtual OutputPath Clone(string name, int itemNr)
{
OutputPath result = new OutputPath(name, itemNr);
result.Name = Name;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.RegulValve = RegulValve;
result.FlowMeter = FlowMeter;
result.PidCoef = PidCoef;
result.StartValve = StartValve;
result.Diverter = Diverter;
result.TempDiv = TempDiv;
result.Balance = Balance;
result.EmptyTankValve = EmptyTankValve;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
return result;
}
}
}
-90
View File
@@ -1,90 +0,0 @@
using System;
using System.Collections.Generic;
using TBF.Resources;
namespace ResultsBrowser.Entities
{
/// <summary>
/// Stores one test procedure, supports revisions and history log
/// </summary>
public class Procedure : IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual MetersKind MetersKind { get; set; }
public virtual string Description { get; set; } /// Short description
public virtual string CreationUser { get; set; } /// Name of the user who has created or changed this procedure
public virtual DateTime CreationTime { get; set; } /// Date and time of the creation or change
public virtual string LastChgUser { get; set; } /// Name of the user who has created or changed this procedure
public virtual DateTime LastChgTime { get; set; } /// Date and time of the creation or change
public virtual string LongDescription { get; set; } /// Long description (notes)
public virtual string Watermeters { get; set; } /// Water meter name or Id
public virtual string ProtocolTitle { get; set; } /// Title of the printed and saved protocol
public virtual string DataEntry { get; set; } /// Component to use for data entry
public virtual string ResultsPrinter { get; set; } /// Component to use for printing the results
public virtual string ResultsWriter { get; set; } /// Component to use for saving the results into the file
public virtual string TransitionStart { get; set; }
public virtual string TransitionEnd { get; set; }
public virtual IList<ComponentProcedure> MoreParams { get; set; }
public virtual IList<Test> Tests { get; set; }
////public virtual string MetrologicalClass { get; set; }
////public virtual IList<WMType> WMTypes { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public Procedure()
{
MoreParams = new List<ComponentProcedure>();
Tests = new List<Test>();
///
/// Default values
///
CreationUser = (User.CurrentUser != null) ? User.CurrentUser.Name : null;
CreationTime = DateTime.Now;
LastChgUser = CreationUser;
LastChgTime = CreationTime;
MetersKind = Entities.MetersKind.Single;
ProtocolTitle = "Watermeter test protocol";
}
public Procedure(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public virtual Procedure Clone()
{
Procedure result = new Procedure();
result.Name = Name;
result.MetersKind = MetersKind;
result.Description = Description;
result.CreationUser = CreationUser;
result.CreationTime = CreationTime;
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.LongDescription = LongDescription;
result.Watermeters = Watermeters;
result.DataEntry = DataEntry;
result.ResultsPrinter = ResultsPrinter;
result.ResultsWriter = ResultsWriter;
result.TransitionStart = TransitionStart;
result.TransitionEnd = TransitionEnd;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
//result.MetrologicalClass = MetrologicalClass;
//result.WMType = WMType.Clone();
return result;
}
}
}
@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class ProcedureHistory
{
public virtual int Id { get; protected set; }
public virtual Procedure Current { get; set; }
public virtual IList<Procedure> OldProcedures { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public ProcedureHistory()
{
Current = new Procedure();
OldProcedures = new List<Procedure>();
}
public virtual ProcedureHistory Clone()
{
ProcedureHistory result = new ProcedureHistory();
result.Current = Current.Clone();
foreach (Procedure p in OldProcedures) result.OldProcedures.Add(p.Clone());
return result;
}
}
}
-97
View File
@@ -1,97 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
/// <summary>
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
/// </summary>
public class Test : IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s
/// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
public virtual int Repeats { get; set; }
public virtual bool Emptying { get; set; }
public virtual bool Zeroing { get; set; }
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
public virtual int Time2MassMsrmt { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
public virtual double TolerRed { get; set; } /// = Filter
public virtual TestRedType RedType { get; set; }
public virtual string FeedingPath { get; set; }
public virtual string BenchPath { get; set; }
public virtual string OutputPath { get; set; }
public virtual string MetersPath { get; set; }
public virtual string TransitionStart { get; set; }
public virtual string TransitionEnd { get; set; }
public virtual IList<ComponentTest> MoreParams { get; set; }
public virtual Procedure Procedure { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public Test()
{
MoreParams = new List<ComponentTest>();
///
/// Default values
///
Repeats = 1;
Emptying = false;
Zeroing = false;
PumpPower = 60.0f; /// [%]
Time2MassMsrmt = 5; /// [s] between the test end and the final mass measurement
ErrLimLo = -2.0f; /// [%] lower error limit
ErrLimHi = 2.0f; /// [%] upper error limit
TolerRed = 5.0; /// = Filter parameter
}
public Test(string name, int itemNr, Procedure procedure)
: this()
{
Name = name;
ItemNr = itemNr;
Procedure = procedure;
}
// Makes a new copy of this object (not just a reference)
public virtual Test Clone()
{
Test result = new Test(Name, ItemNr, Procedure);
result.Part = Part;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Volume = Volume;
result.TstTime = TstTime;
result.Repeats = Repeats;
result.Emptying = Emptying;
result.Zeroing = Zeroing;
result.PumpPower = PumpPower;
result.Time2MassMsrmt = Time2MassMsrmt;
result.Method = Method;
result.ErrLimLo = ErrLimLo;
result.ErrLimHi = ErrLimHi;
result.TolerRed = TolerRed;
result.RedType = RedType;
result.FeedingPath = FeedingPath;
result.BenchPath = BenchPath;
result.OutputPath = OutputPath;
result.MetersPath = MetersPath;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
return result;
}
}
}
-161
View File
@@ -1,161 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class TestResult
{
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual int BatchNr { get; set; }
public virtual MetersKind MetersKind { get; set; }
public virtual IList<MeterTestResult> Meters { get; set; }
public virtual IList<MeterTestResult> CombinedMeters { get; set; }
/// Value copied from the procedure (Entities.Procedure)
public virtual string ProcedureName { get; set; }
public virtual string ProtocolTitle { get; set; }
/// Values copied from the test (Entities.Test)
public virtual int TestId { get; set; } /// Test entity ID to distinguish between tests with the same name
public virtual string TestName { get; set; }
public virtual int Part { get; set; }
public virtual bool DoNotEvaluate { get; set; } /// Not mapped to the database
public virtual bool DoNotPublish { get; set; } /// Not mapped to the database
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
public virtual int Repeats { get; set; }
public virtual bool Emptying { get; set; }
public virtual bool Zeroing { get; set; }
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
public virtual int Time2MassMsrmt { get; set; }
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
/// To be replaced by the virtual bench component parameters
public virtual string FeedingPath { get; set; }
public virtual string BenchPath { get; set; }
public virtual string OutputPath { get; set; }
public virtual string MetersPath { get; set; }
/// Results
public virtual DateTime TimeStart { get; set; } /// Date and time of the test start
public virtual DateTime TimeEnd { get; set; } /// Date and time of the test end
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
public virtual float AmbientTempAve { get; set; } /// Average ambient air temperature [degC]
public virtual float AmbientPressAve { get; set; } /// Average ambient air pressure
public virtual float AmbientHumiAve { get; set; } /// Average ambient air relative humidity [%]
public virtual float PressInAvrg { get; set; } /// Input water pressure (average) [Bar]
public virtual float PressInStart { get; set; }
public virtual float PressInEnd { get; set; }
public virtual float PressOutAvrg { get; set; }
public virtual float PressOutStart { get; set; }
public virtual float PressOutEnd { get; set; }
public virtual float TempInAvrg { get; set; }
public virtual float TempInStart { get; set; }
public virtual float TempInEnd { get; set; }
public virtual float TempOutAvrg { get; set; }
public virtual float TempOutStart { get; set; }
public virtual float TempOutEnd { get; set; }
public virtual float TempDivAvrg { get; set; }
public virtual float TempDivStart { get; set; }
public virtual float TempDivEnd { get; set; }
public virtual float MassStartRaw { get; set; }
public virtual float MassStart { get; set; }
public virtual float MassEndRaw { get; set; }
public virtual float MassEnd { get; set; }
public virtual float MassDiff { get; set; }
public virtual float DensityIn { get; set; }
public virtual float DensityOut { get; set; }
public virtual float DensityDiv { get; set; }
public virtual float Buoyancy { get; set; } ///TODO -> map
public virtual float FlowMass { get; set; } /// from conventional true value
public virtual float FlowVolume { get; set; } /// from conventional true value
public virtual float VolumeCTV { get; set; } /// volume conventional true value
public virtual float VolumeMaster { get; set; } /// volume from the master flow meter
public virtual float Time { get; set; } /// measurement time in seconds
public virtual float ErrorMaster { get; set; }
public virtual float PulsesMaster { get; set; }
public virtual float ConstMaster { get; set; } /// Pulses per liter master flow meter
public virtual float QRise { get; set; } /// Detected Q_rise of a composed meter
public virtual float QFall { get; set; } /// Detected Q_fall of a composed meter
public virtual float TimeDivStart0 { get; set; }
public virtual float TimeDivStart1 { get; set; }
public virtual float TimeDivStart2 { get; set; }
public virtual float TimeDivStart3 { get; set; }
public virtual float TimeDivStart4 { get; set; }
public virtual float TimeDivStart5 { get; set; }
public virtual float TimeDivEnd0 { get; set; }
public virtual float TimeDivEnd1 { get; set; }
public virtual float TimeDivEnd2 { get; set; }
public virtual float TimeDivEnd3 { get; set; }
public virtual float TimeDivEnd4 { get; set; }
public virtual float TimeDivEnd5 { get; set; }
public TestResult()
{
Meters = new List<MeterTestResult>();
CombinedMeters = new List<MeterTestResult>();
}
public TestResult(MetersKind kind)
: this()
{
MetersKind = kind;
if (kind == MetersKind.Single)
{
for (int i = 0; i < Program.WMsCount; i++) Meters.Add(new MeterTestResult(this));
}
else if (kind == MetersKind.Combined)
{
int combinedCount = Program.WMsCount / 2;
for (int i = 0; i < 2 * combinedCount; i++) Meters.Add(new MeterTestResult(this));
for (int i = 0; i < combinedCount; i++) CombinedMeters.Add(new MeterTestResult(this));
}
}
public TestResult(Test test, int repetitionNr, MetersKind kind)
: this(kind)
{
if (test.Repeats == 1)
{
Name = test.Name;
}
else
{
Name = string.Format("{0} ({1}/{2})", test.Name, repetitionNr, test.Repeats);
}
RepetitionNr = repetitionNr;
/// Copy test parameters from Entities.Procedure object
ProcedureName = test.Procedure.Name;
ProtocolTitle = test.Procedure.ProtocolTitle;
/// Copy test parameters from Entities.Test object
TestId = test.Id;
TestName = test.Name;
Part = test.Part;
Qfrom = test.Qfrom;
Qto = test.Qto;
Volume = test.Volume;
TstTime = test.TstTime;
Repeats = test.Repeats;
Emptying = test.Emptying;
Zeroing = test.Zeroing;
PumpPower = PumpPower;
Time2MassMsrmt = test.Time2MassMsrmt;
Method = test.Method;
ErrLimLo = test.ErrLimLo;
ErrLimHi = test.ErrLimHi;
FeedingPath = test.FeedingPath;
BenchPath = test.BenchPath;
OutputPath = test.OutputPath;
MetersPath = test.MetersPath;
}
}
}
@@ -1,37 +0,0 @@
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
/// <summary>
/// Stores one transition sequence containing a list of transition steps
/// </summary>
public class TransitionSequence : IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; } /// Short description
public virtual IList<TransitionStep> TransitionSteps { get; set; }
public TransitionSequence()
{
TransitionSteps = new List<TransitionStep>();
}
public TransitionSequence(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public virtual TransitionSequence Clone()
{
TransitionSequence result = new TransitionSequence();
result.Name = Name;
result.Description = Description;
foreach (var step in TransitionSteps) { result.TransitionSteps.Add(step.Clone()); }
return result;
}
}
}
-58
View File
@@ -1,58 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class TransitionStep : IHasItemNr, IHasValves
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; } /// Order of the preparation step
public virtual int Duration { get; set; } /// Duration in seconds
public virtual string Message { get; set; } /// Message
public virtual string ValvesOpen { get; set; } /// List of valves to be opened
public virtual string ValvesClose { get; set; } /// List of valves to be closed
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
public virtual string PumpWithFMPcts { get; set; } /// Power of FM controlled pumps in % separated by ';'
public virtual TransitionSequence TransitionSequence { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public TransitionStep()
{
Duration = 5; /// sec.
}
public TransitionStep(int itemNr, TransitionSequence sequence)
: this()
{
ItemNr = itemNr;
TransitionSequence = sequence;
}
public virtual TransitionStep Clone()
{
TransitionStep result = new TransitionStep(ItemNr, TransitionSequence);
result.Duration = Duration;
result.Message = Message;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
result.RegulValvesPct = RegulValvesPct;
result.PumpWithFMPcts = PumpWithFMPcts;
return result;
}
public virtual string ToString(string indent)
{
string result = "";
result += indent + "ItemNr = " + ItemNr.ToString() + ", ";
result += indent + "Duration = " + Duration.ToString() + ", ";
result += indent + "Message = " + Message + ", ";
result += indent + "ValvesOpen = " + ValvesOpen.ToString() + ", ";
result += indent + "ValvesClose = " + ValvesClose.ToString() + ", ";
result += indent + "RegulValvesPct = " + RegulValvesPct.ToString() + ", ";
result += indent + "PumpsWithFMPct = " + RegulValvesPct.ToString() + Environment.NewLine;
return result;
}
}
}
-257
View File
@@ -1,257 +0,0 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Diagnostics;
using TBF.Resources;
namespace ResultsBrowser.Entities
{
public class User
{
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual string Password { get; set; }
public virtual string Description { get; set; }
public virtual DateTime LastPwChange { get; set; }
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
private bool powerUser; /// Set to tue for built-in users, power users have full access even with empty Groups
public User()
{
this.powerUser = false;
Groups = new List<Group>();
}
public virtual void AddGroup(Group group)
{
Groups.Add(group);
}
public User(string name)
{
this.powerUser = true;
Name = name;
Groups = new List<Group>();
Description = "Power user";
}
/// ------------- Additional stuff not mapped into the database -------------
///
/// Authorized user (static)
///
private static User currentUser = null; /// Updated by instance methods Authorize, Unauthorize
public static User CurrentUser
{
get { return currentUser; }
set { currentUser = value; }
}
private static DateTime lastAuthorization = DateTime.Now;
public static DateTime LastAuthorization { get { return lastAuthorization; } }
/// <summary>
/// Check whether user is a member of a group.
/// </summary>
/// <param name="groupId">Group GID</param>
/// <returns>true is user is a member of the specified group</returns>
public virtual bool IsMemberOf(Grp.GID groupId)
{
if (groupId == Grp.GID.None || powerUser)
{
return true;
}
else if (groupId >= 0 && (int)groupId < Grp.Count)
{
// for all group elements in User.groups
for (int i = 0; i < Groups.Count; ++i)
{
// element GID = parameter GroupId ?
if (((Group)Groups[i]).Gid == (int)groupId)
{
return true;
}
}
return false;
}
else
{
return false;
}
}
/// <summary>
/// Sets users password. It then will be encrypted.
/// </summary>
/// <param name="password">Password</param>
public virtual void SetPassword(string password)
{
this.Password = EncryptedPassword(password);
LastPwChange = DateTime.Now;
}
public virtual string EncryptedPassword(string password)
{
return getHash(password);
}
/// <summary>
/// Verifies users password. Used by static bool Authorisation(...)
/// </summary>
/// <param name="password">Password</param>
/// <returns>true if password is correct</returns>
public virtual bool CheckPassword(string password)
{
return (Password == EncryptedPassword(password));
}
/// <summary>
/// The FIRST of TWO possible user authorization method to be used
/// when a specific group membership is required (you can use Grp.GID.None).
/// If the user is not authorized, the current user remains to be a current user
/// (i.e. the access rights were not risen to a higher level).
/// If you require different behavior, use Unauthorize() before calling Authorize().
/// </summary>
/// <param name="userName"></param>
/// <param name="password"></param>
/// <param name="requiredGrupMembership"></param>
/// <returns>true = authorized</returns>
public virtual bool Authorize(string userName, string password, TBF.Grp.GID requiredGroupMembership)
{
if (Entities.User.IsPowerUser(userName, password))
{
currentUser = this;
lastAuthorization = DateTime.Now;
return true;
}
if (Name.ToLower() == userName.ToLower())
{
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
{
currentUser = this;
lastAuthorization = DateTime.Now;
return true;
}
else
{
return false;
}
}
return false;
}
/// <summary>
/// The SECOND of TWO possible user authorization method to be used when
/// no specific group membership is required.
/// If the user is not authorized, the current user remains to be a current user
/// (i.e. the access rights were not risen to a higher level).
/// If you require different behavior, use Unauthorize() before calling Authorize().
/// </summary>
/// <param name="userName"></param>
/// <param name="password"></param>
/// <param name="requiredGroupMembership"></param>
/// <returns>true = authorized</returns>
public virtual bool Authorize(string userName, string password)
{
return Authorize(userName, password, Grp.GID.None);
}
/// <summary>
/// Returns a 'User' with a given username from a database.
/// </summary>
/// <param name="username">User name for the query</param>
/// <returns>reference to a 'User' (if it exists) or null</returns>
public static User AuthorizeDummyUser(string username)
{
User user = new User();
user.Name = username;
currentUser = user;
return user;
}
/// <summary>
/// Returns a 'User' with a given username from an ARBITRARY database.
/// </summary>
/// <param name="username">User name for the query</param>
/// <returns>reference to a 'User' (if it exists) or null</returns>
public static User LoadUserByName(string username, DBSettings dbSettings)
{
IList<User> listOfUsers = FluentCommon.CreateSessionFactory(Database.Users, dbSettings, false)
.OpenSession()
.CreateQuery("FROM User WHERE LOWER(Name) = :username")
.SetParameter("username", username.ToLower())
.List<User>();
if (listOfUsers.Count > 0) return listOfUsers[0];
return null;
}
/// <summary>
/// Returns a 'User' with a given username from the users database.
/// </summary>
/// <param name="username">User name for the query</param>
/// <returns>reference to a 'User' (if it exists) or null</returns>
public static User LoadUserByName(string username)
{
IList<User> listOfUsers = FluentCommon.CreateSession(Database.Users)
.CreateQuery("FROM User WHERE LOWER(Name) = :username")
.SetParameter("username", username.ToLower())
.List<User>();
if (listOfUsers.Count > 0) return listOfUsers[0];
return null;
}
/// <summary>
/// returns an IList of all Users
/// </summary>
public static IList<User> GetAllUsers()
{
return FluentCommon.CreateSession(Database.Users)
.CreateQuery("FROM User")
.List<User>();
}
/// <summary>
/// Unauthorize, abandon current users authorization.
/// </summary>
public static void Unauthorize()
{
currentUser = null;
lastAuthorization = DateTime.Now;
}
/// <summary>
/// getHash encrypts a string
/// </summary>
/// <param name="text">the string to encrypt</param>
/// <returns></returns>
public static string getHash(string text)
{
byte[] bytes = Encoding.Unicode.GetBytes(text);
SHA512Managed hashstring = new SHA512Managed();
byte[] hash = hashstring.ComputeHash(bytes);
string hashString = string.Empty;
foreach (byte x in hash)
{
hashString += String.Format("{0:x2}", x);
}
return hashString;
}
/// <summary>
/// Returns 'true' when authentication data are valid for a power user.
/// </summary>
/// <param name="userName">User name</param>
/// <param name="password">Password</param>
/// <returns>true = authenticated, false = refused</returns>
public static bool IsPowerUser(string userName, string password)
{
return false;
}
}
}
@@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class VirtualBenchSequence : IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; } /// Short description
public virtual IList<VirtualBenchStep> VirtualBenchSteps { get; set; }
public VirtualBenchSequence()
{
VirtualBenchSteps = new List<VirtualBenchStep>();
}
public VirtualBenchSequence(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public virtual VirtualBenchSequence Clone()
{
VirtualBenchSequence result = new VirtualBenchSequence();
result.Name = Name;
result.Description = Description;
foreach (var step in VirtualBenchSteps) { result.VirtualBenchSteps.Add(step.Clone()); }
return result;
}
}
}
@@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
namespace ResultsBrowser.Entities
{
public class VirtualBenchStep : IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; } /// Order of the preparation step
public virtual int Duration { get; set; } /// Duration in seconds
///
public virtual VirtualBenchSequence VirtualBenchSequence { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public VirtualBenchStep()
{
Duration = 5; /// sec.
}
public VirtualBenchStep(int itemNr, VirtualBenchSequence sequence)
: this()
{
ItemNr = itemNr;
VirtualBenchSequence = sequence;
}
public virtual VirtualBenchStep Clone()
{
VirtualBenchStep result = new VirtualBenchStep(ItemNr, VirtualBenchSequence);
return result;
}
}
}
-75
View File
@@ -1,75 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/// This class holds the watermeter type specific data
/// that have all watermaters of the same type in common
namespace ResultsBrowser.Entities
{
public class WMType
{
// mapped
public virtual int Id { get; protected set; } /// primary key
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
public virtual string CreateDescription { get; set; } /// Description\
public virtual string Name { get; set; } /// type name
public virtual float PulseRate { get; set; } /// Pulses per Liter
// not yet mapped
public virtual int IdentNr { get; protected set; } /// identification number of watermeter tzpe
public virtual int Diameter { get; set; } /// nominal diameter
public virtual int Pressure { get; set; } /// nominal pressure
public virtual int Length { get; set; } /// construction length
public virtual int Temperatur { get; set; } /// nominal temperature in C
public virtual float NominalFlow { get; set; } /// nominal flow Qn
/// ------------- Additional stuff not mapped into the database -------------
public WMType()
{
}
public static WMType DefaultWMType()
{
WMType procedure = new WMType()
{
CreateTime = DateTime.Now,
CreateUserName = User.CurrentUser.Name,
CreateDescription = "A default water meter created.",
Name = "Watermeter",
PulseRate = 1000,
};
return procedure;
}
public virtual WMType Clone()
{
WMType result = new WMType();
result.CreateTime = CreateTime;
result.CreateUserName = CreateUserName;
result.CreateDescription = CreateDescription;
result.Name = Name;
result.PulseRate = PulseRate;
return result;
}
public override string ToString()
{
string result = "";
result += "WMTpe: " + Environment.NewLine;
result += " Name = " + Name + Environment.NewLine;
result += " Created by = " + CreateUserName + Environment.NewLine;
result += " Created on = " + CreateTime.ToString() + Environment.NewLine;
result += " Description = " + CreateDescription + Environment.NewLine;
result += " Pulse rate = " + PulseRate.ToString() + Environment.NewLine;
return result;
}
}
}
-38
View File
@@ -1,38 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TBF;
using NHibernate;
using FluentNHibernate;
namespace ResultsBrowser.Entities
{
public class Watermeter
{
public virtual int Id { get; protected set; } /// primary key
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
public virtual string CreateDescription { get; set; } /// Description
/// mapped
public virtual string Serial { get; set; } /// serial number
public virtual WMType WMType { get; set; } /// type of watermeter
///
/// <summary>
/// Load a watermeter from the database
/// </summary>
public static Watermeter LoadBySerialnr(string SerialNr)
{
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(Database.WaterMeters)
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
.SetParameter("SerialNrParameter", SerialNr)
.List<Watermeter>();
if (ListOfWatermeters.Count > 0) return ListOfWatermeters.ElementAt(0);
return null;
}
}
}
-316
View File
@@ -1,316 +0,0 @@
using System;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
namespace ResultsBrowser
{
/// <summary>
/// Identifies the content of a database
/// </summary>
public enum Database
{
Users,
Bench,
Procedures,
WaterMeters,
Count,
}
/// <summary>
/// Identifies the type of a database
/// </summary>
public enum DBType
{
SQLite, /// SQLite
MySql, /// MySQL database
DbTypesCount,
}
public static class FluentCommon
{
/// <summary>
/// Session factories for regular sessions.
/// </summary>
public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)Database.Count];
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
static ISessionFactory CreateSessionFactory(Database database)
{
DBType dbType;
string connectionString;
switch (database)
{
default:
case Database.Users:
dbType = Program.CurrentBench.UsersDBSettings.DbType;
connectionString = Program.CurrentBench.UsersDBSettings.ConnectionString;
break;
case Database.Bench:
dbType = Program.CurrentBench.BenchDBSettings.DbType;
connectionString = Program.CurrentBench.BenchDBSettings.ConnectionString;
break;
case Database.Procedures:
dbType = Program.CurrentBench.ProceduresDBSettings.DbType;
connectionString = Program.CurrentBench.ProceduresDBSettings.ConnectionString;
break;
case Database.WaterMeters:
dbType = Program.CurrentBench.WaterMetersDBSettings.DbType;
connectionString = Program.CurrentBench.WaterMetersDBSettings.ConnectionString;
break;
}
return CreateSessionFactory(database, new DBSettings(dbType, connectionString), false);
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
public static ISessionFactory CreateSessionFactory(Database database, DBSettings dbSettings, bool createDB)
{
try
{
FluentConfiguration cfg = Fluently.Configure();
switch (dbSettings.DbType)
{
default:
case DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(dbSettings.ConnectionString));
break;
case DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(dbSettings.ConnectionString));
break;
}
switch (database)
{
default:
case Database.Users:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
break;
case Database.Bench:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
break;
case Database.Procedures:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
break;
case Database.WaterMeters:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>());
break;
}
if (createDB)
{
return cfg.ExposeConfiguration(BuildSchemaCreate).BuildSessionFactory();
}
else
{
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
}
}
catch (Exception)
{
return null;
}
}
public delegate void BuildSchemaDlgt(Configuration config);
static void BuildSchema(Configuration config)
{
/// This NHibernate tool takes a configuration (with mapping info in)
/// and exports a database schema from it
new SchemaExport(config).SetOutputFile("db_schema");
}
static void BuildSchemaCreate(Configuration config)
{
/// This NHibernate tool takes a configuration (with mapping info in)
/// and exports a database schema from it
new SchemaExport(config).Create(true, true);
}
/// Create a NHibernate session for the given database
public static ISession CreateSession(Database database)
{
int ix = (int)database;
if (ix < 0 || ix >= (int)Database.Count) return null;
if (SessionFactories[ix] == null) SessionFactories[ix] = CreateSessionFactory(database);
return SessionFactories[ix].OpenSession();
}
public static void SaveToDb(Database database, object obj)
{
ISession session = FluentCommon.CreateSession(database);
SaveToDb(session, obj);
}
public static void SaveToDb(ISession session, object obj)
{
using (var transaction = session.BeginTransaction())
{
session.SaveOrUpdate(obj);
try { transaction.Commit(); }
catch { }
}
}
public static void DeleteFromDb(Database database, object obj)
{
ISession session = FluentCommon.CreateSession(database);
SaveToDb(session, obj);
}
public static void DeleteFromDb(ISession session, object obj)
{
using (var transaction = session.BeginTransaction())
{
session.Delete(obj);
transaction.Commit();
}
}
/// <summary>
/// Create an empty users database.
/// Database contains only the user 'admin' and the control board component 'CB'.
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyUsersDB(DBSettings dbSettings)
{
ISessionFactory sessionFactory = CreateSessionFactory(Database.Users, dbSettings, true);
if (sessionFactory == null) return false;
/// Populate the database
using (var session = sessionFactory.OpenSession())
{
using (var transaction = session.BeginTransaction())
{
///
/// Prepare all groups
///
var testers = new Entities.Group { Gid = (int)TBF.Grp.GID.Testers, Name = Strings.Tester };
var testingSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.TestingSpecialists, Name = Strings.Testing_Specialist };
var headOfLab = new Entities.Group { Gid = (int)TBF.Grp.GID.HeadOfLab, Name = Strings.Head_of_Lab };
var maintenanceSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.MaintenanceSpecialists, Name = Strings.Maintenance_Specialist };
var metrologists = new Entities.Group { Gid = (int)TBF.Grp.GID.Metrologists, Name = Strings.Metrologist };
var calibrationSpecialists = new Entities.Group { Gid = (int)TBF.Grp.GID.CalibrationSpecialists, Name = Strings.Calibration_Specialist };
var administrators = new Entities.Group { Gid = (int)TBF.Grp.GID.Administrators, Name = Strings.Administrator };
/// Create the user 'admin' add his groups
var admin = new Entities.User
{
Name = Program.AdminUsername,
Description = "Administrator",
LastPwChange = DateTime.Now
};
admin.SetPassword(Program.AdminPassword);
admin.AddGroup(testers);
admin.AddGroup(testingSpecialists);
admin.AddGroup(headOfLab);
admin.AddGroup(maintenanceSpecialists);
admin.AddGroup(metrologists);
admin.AddGroup(calibrationSpecialists);
admin.AddGroup(administrators);
session.SaveOrUpdate(admin);
/// Create the control board component
var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
session.SaveOrUpdate(cmpnt);
transaction.Commit();
}
}
return true;
}
/// <summary>
/// Create an empty bench database
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyBenchDB(DBSettings dbSettings)
{
ISessionFactory sessionFactory = CreateSessionFactory(Database.Users, dbSettings, true);
if (sessionFactory == null) return false;
/// Populate the database
//using (var session = sessionFactory.OpenSession())
//{
// using (var transaction = session.BeginTransaction())
// {
// /// Create one component
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
// session.SaveOrUpdate(cmpnt);
// transaction.Commit();
// }
//}
return true;
}
/// <summary>
/// Create an empty procedures database
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyProceduresDB(DBSettings dbSettings)
{
ISessionFactory sessionFactory = CreateSessionFactory(Database.Users, dbSettings, true);
if (sessionFactory == null) return false;
/// Populate the database
//using (var session = sessionFactory.OpenSession())
//{
// using (var transaction = session.BeginTransaction())
// {
// /// Create one component
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
// session.SaveOrUpdate(cmpnt);
// transaction.Commit();
// }
//}
return true;
}
/// <summary>
/// Create an empty water meters database
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyWaterMetersDB(DBSettings dbSettings)
{
ISessionFactory sessionFactory = CreateSessionFactory(Database.Users, dbSettings, true);
if (sessionFactory == null) return false;
/// Populate the database
//using (var session = sessionFactory.OpenSession())
//{
// using (var transaction = session.BeginTransaction())
// {
// /// Create one component
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
// session.SaveOrUpdate(cmpnt);
// transaction.Commit();
// }
//}
return true;
}
}
}
+142
View File
@@ -0,0 +1,142 @@
namespace ResultsBrowser.Forms
{
partial class AdditionalDataDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.typeApprovalTextBox = new System.Windows.Forms.TextBox();
this.metrologicalClassTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.typeTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(34, 56);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(75, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Type approval";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(34, 88);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(91, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Metrological class";
//
// typeApprovalTextBox
//
this.typeApprovalTextBox.Location = new System.Drawing.Point(154, 53);
this.typeApprovalTextBox.Name = "typeApprovalTextBox";
this.typeApprovalTextBox.Size = new System.Drawing.Size(133, 20);
this.typeApprovalTextBox.TabIndex = 3;
//
// metrologicalClassTextBox
//
this.metrologicalClassTextBox.Location = new System.Drawing.Point(154, 85);
this.metrologicalClassTextBox.Name = "metrologicalClassTextBox";
this.metrologicalClassTextBox.Size = new System.Drawing.Size(133, 20);
this.metrologicalClassTextBox.TabIndex = 5;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(246, 200);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 50);
this.okButton.TabIndex = 6;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(337, 200);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 50);
this.cancelButton.TabIndex = 7;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// typeTextBox
//
this.typeTextBox.Location = new System.Drawing.Point(154, 21);
this.typeTextBox.Name = "typeTextBox";
this.typeTextBox.Size = new System.Drawing.Size(133, 20);
this.typeTextBox.TabIndex = 1;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(34, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(31, 13);
this.label3.TabIndex = 0;
this.label3.Text = "Type";
//
// AdditionalDataDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(428, 262);
this.Controls.Add(this.typeTextBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.metrologicalClassTextBox);
this.Controls.Add(this.typeApprovalTextBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "AdditionalDataDlg";
this.Text = "AdditionalDataDlg";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox typeApprovalTextBox;
private System.Windows.Forms.TextBox metrologicalClassTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.TextBox typeTextBox;
private System.Windows.Forms.Label label3;
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Windows.Forms;
namespace ResultsBrowser.Forms
{
public partial class AdditionalDataDlg : Form
{
public string Type { get { return typeTextBox.Text; } }
public string TypeApproval { get { return typeApprovalTextBox.Text; } }
public string MetrologicalClass { get { return metrologicalClassTextBox.Text; } }
public AdditionalDataDlg()
{
InitializeComponent();
}
private void okButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
}
}
+9 -14
View File
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Config.Entities;
using ResultsBrowser.Resources;
namespace ResultsBrowser.Forms
@@ -18,7 +14,7 @@ namespace ResultsBrowser.Forms
// Private fields
string user;
string password;
Grp.GID requiredGroupMembership = Grp.GID.Invalid;
Config.Grp.GID requiredGroupMembership = Config.Grp.GID.Invalid;
bool noDatabase;
/// <summary>
@@ -51,7 +47,7 @@ namespace ResultsBrowser.Forms
/// <summary>
/// Constructor when a specific group membership is required.
/// </summary>
public LoginDlg(Grp.GID requiredGroupMembership)
public LoginDlg(Config.Grp.GID requiredGroupMembership)
: this()
{
this.requiredGroupMembership = requiredGroupMembership;
@@ -60,7 +56,7 @@ namespace ResultsBrowser.Forms
/// <summary>
/// Constructor with a predefined user when a specific group membership is required.
/// </summary>
public LoginDlg(string predefinedUser, Grp.GID requiredGroupMembership)
public LoginDlg(string predefinedUser, Config.Grp.GID requiredGroupMembership)
: this()
{
user = predefinedUser;
@@ -88,14 +84,14 @@ namespace ResultsBrowser.Forms
user = userNameTextBox.Text;
password = passwordTextBox.Text;
bool authorized = Entities.User.IsPowerUser(user, password);
bool authorized = Config.Entities.User.IsPowerUser(user, password);
if (!authorized && !noDatabase)
{
Entities.User loadedUser = Entities.User.LoadUserByName(user);
User loadedUser = User.LoadUserByName(user);
if (loadedUser != null)
{
if (requiredGroupMembership == Grp.GID.Invalid)
if (requiredGroupMembership == Config.Grp.GID.Invalid)
{
authorized = loadedUser.Authorize(user, password);
}
@@ -110,7 +106,6 @@ namespace ResultsBrowser.Forms
{
DialogResult = DialogResult.OK;
Close();
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
return;
}
@@ -124,9 +119,9 @@ namespace ResultsBrowser.Forms
/// </summary>
private void cancelButton_Click(object sender, EventArgs e)
{
if (requiredGroupMembership == Grp.GID.Invalid)
if (requiredGroupMembership == Config.Grp.GID.Invalid)
{
Entities.User.Unauthorize();
User.Unauthorize();
}
DialogResult = DialogResult.Cancel;

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