Compare commits

...

437 Commits

Author SHA1 Message Date
4257fdbea0 Added extra verification to catch a maybe very rare error 2025-11-10 17:00:08 +01:00
a3d6ed337a Improved error handling for message telemetry when sending messages 2025-11-10 16:48:10 +01:00
6375639387 Version bump to 7.2.12.7 2025-11-06 10:18:26 +01:00
9b45b902c7 Updated Gefahrgutliste 2025-11-06 10:09:02 +01:00
4174ea9e65 Net mass is now set to gross mass since the workaround doesn't seem to be necessary any more 2025-11-05 07:57:17 +01:00
b1b01532ca Version bump to 7.2.12.6 2025-10-23 22:00:33 +02:00
5eb181de91 minor fixes 2025-10-23 10:50:08 +02:00
6076b2529e Bumped Version to 7.2.12.5 2025-10-22 15:00:16 +02:00
5ee7cf2f2a Update messages when a id is received to show green line 2025-10-22 14:58:13 +02:00
be78399def Error correction fixes and some xtra functionality for easy peasy 2025-10-22 11:45:54 +02:00
3735735ef7 Error correction fixes 2025-10-22 09:48:29 +02:00
8bbf7e9cc9 Version bump to 7.2.12.4 2025-10-16 14:50:23 +02:00
83edca21de Fixes for comments 2025-10-15 07:08:58 +02:00
933a283a4b Version bump to 7.2.12.3 2025-10-14 09:15:57 +02:00
b6c1de3817 Added lighter green background for updated class in overview 2025-10-14 09:08:43 +02:00
bdc7131a1e Updated NuGet for ENI and NSWSendService 2025-10-14 08:53:41 +02:00
46ca051331 Refined the Easy Peasy Control with feedback from Christin 2025-10-10 09:57:49 +02:00
1d44b156f4 Bumped version and changed sendall button preselection behavior 2025-10-06 09:13:51 +02:00
eae9b42266 Fixed empty string/null comparison for waste disposal change detection 2025-10-06 08:47:59 +02:00
284d669dc7 lighter success background row for overview 2025-10-04 11:17:58 +02:00
731a7eff9c changed some details across various trello cards 2025-10-04 10:59:28 +02:00
4b49c78166 WAS not marked for change if the AGNT template (through WasteServiceProvider) did not change a field 2025-10-04 10:59:27 +02:00
d649c4ac16 Do not change PRE72H on Excel import for transit shipcalls 2025-10-04 10:59:27 +02:00
e3b12ae531 Added parsing from Excel and fixed grid refresh error 2025-10-04 10:59:27 +02:00
a0b72f63a8 Improved window labels and and layout 2025-10-04 10:59:27 +02:00
310819a527 bumped version to 7.2.12.1 2025-10-04 10:59:27 +02:00
012cbc4d6d Fix save and restore state 2025-10-04 10:59:27 +02:00
fa460ec8e4 Version bump 2025-10-04 10:59:11 +02:00
ec81631bd8 Adjusted the exporter to match the imported file better 2025-10-04 10:57:34 +02:00
e7ca08c65d Simpler erster ChatGPT Wurf :-) 2025-10-04 10:57:34 +02:00
680ebcdf84 Added plugin control 2025-10-04 10:57:34 +02:00
e965bc6b89 Version bump to 7.2.11.3 2025-09-10 17:11:48 +02:00
e96b03d595 fixed gefahrgutliste (this time including un-assigned entries) 2025-09-10 17:11:29 +02:00
6eb265ea55 Fixed a bug, updated hazard goods list and bumped version to 7.2.11.2 2025-09-10 11:51:04 +02:00
f58e9e7079 Version bump to 7.2.11.1 2025-09-04 07:42:17 +02:00
92998c2add Bugfixes and adjustments 2025-09-04 07:41:47 +02:00
c1e450c18b Updated assemblies to 7.2.11 2025-09-02 10:02:04 +02:00
8a836ed096 Applied some rules to the ready to send dialog (preselected messages) 2025-09-02 09:54:44 +02:00
cf81ec0225 Added default waste descriptions again for some waste types 2025-09-02 09:54:19 +02:00
43fc89c7d3 Highlight some overview rows depending on status 2025-09-02 08:35:03 +02:00
96ddbd5e0a Adjusted column width on overview page 2025-09-02 08:15:29 +02:00
3dd2439524 Untrack LockingService.csproj.user 2025-09-02 07:47:12 +02:00
1b97c7836b Bumped version and update Nuget packages 2025-09-02 07:44:58 +02:00
0e65d37ef9 Version bump to 7.2.10.8 2025-08-27 08:24:40 +02:00
0e43233edc fix cast when sending messages from grid 2025-08-27 08:20:19 +02:00
c650c78d90 Bumped version to 7.2.10.7 2025-08-25 20:35:13 +02:00
dd11e46a18 Bump version to 7.2.10.6 2025-08-25 20:29:38 +02:00
f5d473574e minor adjustments 2025-08-25 16:35:09 +02:00
97859d3cc8 Fixed distance of cancel button 2025-08-17 09:16:00 +02:00
dfa5b1cf33 Bump version to 7.2.10.5 2025-08-05 10:05:42 +02:00
a434b419ad Fixed a few bugs in the modified Excel import 2025-08-05 09:57:48 +02:00
973b0c267c Fixed small visual bugs 2025-08-05 09:05:11 +02:00
82c01c8936 Version bump to 7.2.10.4 2025-08-04 19:10:48 +02:00
1df95d2807 Excel: changed 2 subtables of SEC and a subtable of MDH to Dakosy read mode 2025-08-04 19:01:31 +02:00
9ad543e705 Fixes for things not understood.. ^^ 2025-08-04 18:06:47 +02:00
e620c2d0e5 Skip when HAZA HAZD BPOL are 'empty' based on the empty definition 2025-08-04 14:39:35 +02:00
f833aab844 Bump version to 7.2.10.3 2025-07-31 08:14:52 +02:00
4eacf85d8d if wrong values keep empty, if missing: use default placeholders 2025-07-30 17:27:37 +02:00
ce97aeca27 Always leave out ATA/ATD from send all dialog 2025-07-30 17:11:05 +02:00
ad2f7afd16 Added old and new value to confirmation dialog text 2025-07-30 16:51:22 +02:00
494e377b98 Bump Version to 7.2.10.2 2025-07-26 11:13:10 +02:00
9a4831283d Make WAS import via excel even dumber 2025-07-26 11:04:37 +02:00
0c9b38ddd9 Add a confirmation dialog if the waste service disposal provider field is not empty when the template is applied 2025-07-26 10:58:39 +02:00
54aa91afc1 Fixes for send all functionality 2025-07-26 10:44:22 +02:00
b979136467 Small adjustments to overview display 2025-07-26 09:55:01 +02:00
85bfd8b434 Bump version to 7.2.10.1 2025-07-26 09:31:19 +02:00
ffca8e5bdd Preview for send all functionality 2025-07-24 16:16:28 +02:00
4d65172fbf New Overview layout 2025-07-24 14:56:09 +02:00
87f5e601a3 Updated NuGet packages 2025-07-24 09:05:08 +02:00
36a79fe2dd Removing template from WAS, moving wasteserviceprovider template entry to AGNT 2025-07-23 18:50:08 +02:00
4d131f718f Remove default values from Waste import for amount and locode 2025-07-23 09:47:57 +02:00
8bc2ae99a8 Version bump to 7.2.10 2025-07-23 09:27:45 +02:00
57ed0b5b19 Bugfix font-resolver new MigraDoc Version 2025-07-15 11:09:23 +02:00
e2f7ef1486 Merge branch 'feature/echolot' into develop 2025-07-14 07:27:43 +02:00
d1e2e67d5f added SERV templates to the sheet display 2025-07-09 08:19:12 +02:00
ef96795bbf Fixed saving of name of master after programmatic update 2025-07-09 07:33:23 +02:00
abc2afdc11 SERV templates (only in classic mode yet) 2025-07-08 08:43:27 +02:00
626b058119 Add a button to copy masters name from first CREWA entry 2025-07-07 15:52:59 +02:00
a4a74da6f9 Layout changed in INFO, classic mode 2025-07-07 14:31:04 +02:00
37122c4144 Removing CREW effects from validation 2025-07-07 13:58:48 +02:00
37ee8e1edf Version bump and package updates 2025-07-07 13:39:37 +02:00
8e5a5b2d62 Added echolot tool 2025-06-15 13:58:33 +02:00
ba59b69f92 Updated port info database entries again and bumped version to 7.2.8 2025-05-14 10:06:52 +02:00
43df352318 Version bump and updated Nuget packages 2025-05-11 12:34:12 +02:00
1c5e938f9a Added DEWVN port mappings and allow multi-delete in value port mappings 2025-05-11 12:24:09 +02:00
2608b4fd5a Fixed broken image in report and bumped version to 7.2.7.9 2025-03-14 16:31:20 +01:00
9462920fce fixed dependencies 2025-03-14 15:57:10 +01:00
e50d165dc3 Added some missing defaults and bumped test version to 7.2.7.7 2025-03-14 08:06:12 +01:00
b7f0108f52 Fixed bug where index would not be read correctly 2025-03-14 07:54:22 +01:00
d1c131c52b Added logic to return to the previously selected tab page on a detail control,
but only if the control has a tab control and the save button was hit. In this case a complete reload happens.
2025-03-07 16:04:53 +01:00
83d57328fc Added some boolean defaults to avoid three-state checkboxes in display 2025-03-07 14:46:26 +01:00
c85291b179 fix for some smaller issues 2025-03-07 14:06:53 +01:00
78a3168d79 Even more fixes 2025-03-06 10:59:06 +01:00
8029aeeac3 Small corrections for testing feedback 2025-03-05 12:05:04 +01:00
bcee0383b7 smaller bugfixes for comments 2025-03-05 10:52:36 +01:00
6d0a258236 second number of smaller issues 2025-03-04 12:59:51 +01:00
c206226b3c a number of smaller issues 2025-03-04 10:02:39 +01:00
11d6bedc71 increase waste grid height 2025-03-04 09:15:36 +01:00
db92b35dec fixed layout of DG 2025-03-04 09:08:13 +01:00
4f1e4fca12 Fixed data binding on crew/pas counters 2025-03-04 08:48:31 +01:00
ef5cca3aab Resized some sheet displays by 50% to make them better align left 2025-03-04 08:03:38 +01:00
d97692ff94 Moved display selection to pw change, fixed bug in BRKD, increased version 2025-03-04 07:46:11 +01:00
afb33fd249 Updated package refs in test version and created a last-minute test release 2025-03-02 11:56:58 +01:00
6b456fc4f4 Merge branch 'feature/spreadsheet_layout' into develop 2025-02-25 10:52:15 +01:00
cabbdd88d6 Version bump to 7.2.6.3 2025-02-16 13:36:20 +01:00
b29811e6d7 Imported new DG table (GEFAHRGUTLISTE.xlsx) 2025-02-16 13:22:36 +01:00
63aca94ec4 Added new key for expired publish key 2025-02-12 09:30:50 +01:00
a10e7178f2 Added new key for expired publish key 2025-02-12 09:28:30 +01:00
f53b37eb12 Included tabs in some views to make the display more compact 2025-02-12 09:27:53 +01:00
661768abdd Grouped some view with tab controls as defined by CH 2025-02-11 11:26:46 +01:00
2004362e1a Set SetEnabled per override on top-level groupboxes. Not sure yet if this is going to cut it. 2025-01-31 18:28:42 +01:00
071b0ff5ee fix dbh send version string 2025-01-31 15:58:57 +01:00
7c8eed08bd Added sheet / logic part 12,13 ATA and WAS_RCPT 2025-01-30 09:25:42 +01:00
006a253fd7 Fixed test comments and bumped version to 7.2.6.2 2025-01-30 07:44:14 +01:00
40b9fff121 Added sheet / logic part 10,11 HAZ arrival/departure 2025-01-29 20:36:32 +01:00
082266f47c Version bump to 7.2.7 2025-01-29 16:13:52 +01:00
f3e398e07d Added sheet / logic part 8,9 PAS arrival/departure 2025-01-29 16:10:13 +01:00
c4006d0585 Added sheet / logic part 7 CREW departure 2025-01-29 15:07:54 +01:00
579e704a1b Added sheet / logic part 6 CREW arrival 2025-01-29 14:29:26 +01:00
0d80f6e514 bumped version to 7.2.6.1 2025-01-29 08:07:29 +01:00
b1051546b7 Fixed test comments 2025-01-29 07:57:04 +01:00
daf20a49b3 Added sheet / logic to part 5 Ship data 2025-01-27 15:47:28 +01:00
ebbcd1ad97 Added sheet / logic to part 4 Pre-Departure 2025-01-27 08:49:59 +01:00
51d6aeee74 Added sheet / logic to part 3 Pre-Arrival 2025-01-24 15:53:57 +01:00
ee1c17bb4f Added sheet / logic to Part 2. Port 2025-01-24 07:57:09 +01:00
e0e46b8613 Added logic to Part 1 Voyage 2025-01-23 16:06:34 +01:00
3c3fa5e1bd Added sample sheet control, made display type selectable through reporting party dialog, updated references 2025-01-22 17:05:28 +01:00
b2062c3227 Updated NuGet packages for NSW send service 2025-01-22 07:37:13 +01:00
2ce1d692d2 Updated old SQLite refs. These installer refs should go somewhere else 2024-12-29 13:07:12 +01:00
c8e22c6511 Fixed import error where a string was erroneously converted to a date 2024-12-29 12:35:51 +01:00
bdb50ea901 make KGM mass fields > 0 if they are included in HAZA HAZD 2024-12-29 11:52:00 +01:00
c15fdb8ee2 Set function on board to unknown if left null or empty for CREW 2024-12-29 11:28:01 +01:00
6ee9293fc8 Allow null for place of birth and country of birth for CREW/PAS 2024-12-29 10:54:43 +01:00
b0b6cef327 Limit BKRA/D fuel type to 25 chars (was 100) 2024-12-29 10:32:44 +01:00
c5bfc505d8 Version bump and library updates 2024-12-29 10:22:53 +01:00
b552bf2dd0 Make HiS-Nord transmitter a bit more verbose when it returns a failure in log 2024-11-07 14:35:39 +01:00
14931ce2c3 Version bump to 7.2.5.3 2024-11-06 10:22:53 +01:00
8e1d41cc0d create errors instead of violations for too large waste amounts 2024-11-06 10:22:31 +01:00
11b9b14fbd Version bump to 7.2.5.2 2024-11-05 14:51:44 +01:00
0dcae7cafe Limit waste input to 9999.999 2024-11-05 14:51:27 +01:00
5e8f111997 Added DEWHV back to locode DB 2024-11-04 15:42:59 +01:00
06509767e5 Fixed HAZ validation logic when there are positions and checkbox is set 2024-11-04 15:42:42 +01:00
ed666aff0c Disallow values larger than 10000 for waste quantities and improve the violation wording 2024-11-04 14:59:46 +01:00
135542ed70 Eliminated code warnings 2024-10-29 09:58:24 +01:00
3c57936caa Added validation if PRE72H is marked as tanker compared with STAT ship type 2024-10-26 12:43:28 +02:00
82a98ab9e6 Added violation for missing no DPG flag set 2024-10-25 19:09:23 +02:00
2ebb3f1838 Bump version to 7.2.5 2024-10-25 12:58:36 +02:00
4b34ca9c31 fixed small bug in log output 2024-10-23 08:31:24 +02:00
3c1e35a012 fixed small bug in log output 2024-10-23 07:27:14 +02:00
d299a286a9 Updated alle sender packages to release NSWSendService 2024-10-21 12:14:18 +02:00
74665defb3 Replaced MessageBox, returned to sqlite Version 117 2024-10-19 18:03:20 +02:00
2bb1dd03f4 Consolidated / Upgraded packages Pt.2 2024-10-14 07:31:46 +02:00
472c1e1b81 Consolidated / Upgraded packages Pt.1 2024-10-14 07:29:13 +02:00
c636c9b931 Merge branch 'feature/new_transmitter_tool' into develop 2024-10-14 07:21:32 +02:00
a3f2e4f7b3 Merge branch 'feature/new_transmitter_tool' into develop 2024-10-14 07:19:09 +02:00
56934660c1 small bugfixes regarding failsave moving of files and setting core state after receiving dbh messages 2024-09-27 10:42:27 +02:00
7db2736e12 removed unused/Test attribute 2024-09-09 18:35:39 +02:00
63a1436afc complete grid reload in case of dialog-editing a failed validation result entry 2024-09-02 14:24:49 +02:00
7e992576c8 Build project version bump to 7.2.4.2 2024-09-01 11:24:11 +02:00
ff574c1a5c Fixed missing enum vals 2024-09-01 11:22:30 +02:00
b5db6cdb33 fixed typo 2024-09-01 10:42:10 +02:00
259fe00f43 Update to new HIS-Nord Transmitter Tool (still experimental), upgraded log4net refs etc. 2024-08-28 09:40:03 +02:00
7967b4336d Updated dangerous goods table with provided Excel sheet 2024-08-26 14:46:18 +02:00
5d02cf1cfa Multi-Edit from Grid for CREWA/D und PASA/D 2024-08-26 11:08:36 +02:00
5085b82a13 bumped version to 7.2.4.1 2024-08-24 08:11:31 +02:00
50b65e6dea Fixed async call bug 2024-08-24 08:10:37 +02:00
c46881698f Fixed bug and added functionality to BKRD, LADG and WAS_RCPT 2024-08-24 07:19:24 +02:00
a90aa4b1ab fixed saving if change is only in grid 2024-08-14 11:52:35 +02:00
d83413c623 Added in-grid editing experimentically for BKRA in Arrival detail control 2024-08-14 11:38:27 +02:00
36b596709a Added special case for DEWHV for new Id dialogs (duh) 2024-08-12 16:09:27 +02:00
40908e1bb3 Remove DEWHV as a valid code for declaration classes, but leave it for initial application 2024-08-12 15:27:14 +02:00
c26c19d401 Added delete all buttons to CREWA CREWD PASA PASD in Border police ctrl 2024-08-12 13:56:37 +02:00
bed3fc397a Add copy shipname button to search control 2024-08-12 12:40:23 +02:00
c11e571473 Do not show ATA message as changed when changing CORE values on Overview page 2024-08-12 12:16:25 +02:00
c4cd477002 Allow trailing characters (m, cbm etc.) when importing numbers in Excel 2024-08-12 11:14:46 +02:00
28878447b8 Increased version to 7.2.4 2024-08-11 09:34:55 +02:00
47d6d4d073 Changed a dialog when closing a core without having SERV sent for DEHAM 2024-08-02 15:45:44 +02:00
a59daa7a78 Small bugfix and version bump 2024-07-30 08:36:11 +02:00
121ccaf295 Changed automatic notification if a call to BRE BRV or HAM is closed without SERV data 2024-07-29 07:54:17 +02:00
a4c340c2ec Adjust document expiry date to 31.12.2100 for all PAS/CREW if date cannot be read 2024-07-29 07:00:39 +02:00
3743b55ef6 Version bump to 7.2.3 2024-07-29 06:55:19 +02:00
f9f8980e09 completely reload core after copy operation 2024-07-23 08:48:27 +02:00
1947c30010 Removed unused VorgaengeControl 2024-07-23 07:24:40 +02:00
e0ca7a9074 Added templates for WAS_RCPT the same as for WAS. Templates are shared between these controls 2024-07-22 18:51:49 +02:00
d4db41de2c treat CREWA/D PASA/D the same on excel import for lastname and IdentityDocumentExpiryDate 2024-07-22 14:37:05 +02:00
fadc975b83 Validation for SERV missing or not confirmed 2024-07-22 14:20:12 +02:00
f6d74e87db fixed wrong existance check for new serv entries 2024-07-22 13:58:48 +02:00
ee6658bafd Replaced port area helper and avoided crash when searching at a harbour that has no entries 2024-07-22 13:29:54 +02:00
703986bbbc Updated address for Maersk when auto-generating SERV class entry 2024-07-12 13:28:33 +02:00
9d4eea244a example for evaluation telemetry 2024-07-08 07:19:09 +02:00
c7e502d658 Bugfix für gleichzeitiges Schließen / Ändern von Dialogen
..führt offenbar zu Placement Problemen (Timing). Für Error/Validation habe ich daher unterschiedliche Position genommen. Im
Grunde ist das aber immer noch ein gräßlicher Häck der von der Tatsache ablenkt, dass jedes Fenster seinen Position separat
gespeichert haben sollte.
2024-03-26 12:04:29 +01:00
7950d16f2b Merge branch 'feature/send_telemetry' into develop 2024-03-22 13:20:48 +01:00
cb1ff8a533 added special Excel import case for BRV/BRE, NSW by BSMD in INFO class 2024-03-21 08:19:41 +01:00
0d0cbe1949 fixed merge conflict 2024-03-20 08:26:56 +01:00
a695da8b4e Fixed another dumb error 2024-03-20 08:25:32 +01:00
5ac41ec075 fixed some small bugs and created new test version 7.2.2.6 2024-03-16 19:26:42 +01:00
23ce2b9088 refined evaluation script 2024-03-15 17:17:30 +01:00
cdeae588be Fixed some bugs with FCT Junge in Port notification ctrl. 2024-03-15 08:34:48 +01:00
7d4ec5de59 Increased version on all depending libraries, added message telemetry to record data dropoff duration 2024-03-15 06:47:12 +01:00
d9f5c37482 Updated sqlite DB by deleting a record an created a new test version for this 2024-03-12 19:34:01 +01:00
1454f80191 Created a simple logfile evaluation script to look at bad dbh response times 2024-03-12 08:12:15 +01:00
8482ebfd12 increased revision 2024-03-09 09:09:57 +01:00
b89e543e63 fixed crash when adding to empty WAS_RCPT list 2024-03-09 09:02:07 +01:00
f0ef7ee650 removed a specific entry 2024-03-09 08:49:12 +01:00
7efa78f29e fixed schengen flag for Dakosy PAS 2024-03-07 08:34:50 +01:00
b2af44895b CREWD und PASD wird jetzt auch im alten Format richtig gelesen 2024-03-07 08:03:29 +01:00
0adc7ab5c4 updated dg Liste yet again 2024-03-01 09:36:08 +01:00
bacc1f0685 Using Logon instead of Name in Password dialog display 2024-02-29 06:56:21 +01:00
858fc7f7b0 neue Gefahrgutliste 2024-02-29 06:53:58 +01:00
e36804e735 Added entries for Elbe Bulk and Fct Junge to port notification / SERV comboboxes 2024-02-23 12:14:04 +01:00
c5411570e4 Added dialog to change the password 2024-02-23 11:49:04 +01:00
2b9c6f445b Most windows now remember their previous location 2024-02-23 09:36:22 +01:00
ffc92bbfc6 Added validation for POBD vs departing CREW/PAS 2024-02-12 09:54:43 +01:00
7412f61ef9 Set defaults for Notification Schengen / PAX for sheets in old format 2024-02-12 09:25:26 +01:00
6c43b17d53 Added new self-signing certificate because Schiffsmelder-CA has expired 2024-02-12 09:20:23 +01:00
8e6d9aa0c0 fixed CREWD Import for Dakosy sheets 2024-02-12 09:19:47 +01:00
5a7346de43 Version bump to 7.2.2 2023-12-11 09:03:25 +01:00
f9ddd2c48e increased deployment version 2023-12-07 09:36:08 +01:00
932be48c24 Fixed counting of message classes 2023-12-07 09:32:36 +01:00
a974cf79a7 Optionaler Parameter für maximale Länge eines einzulesenden String von Excel 2023-12-07 09:16:46 +01:00
7d46f926cb Changed PAX violation message 2023-12-04 16:55:23 +01:00
a00cb9a791 fixed a late error for PAX/Schengen settings during Excel import 2023-11-30 16:40:08 +02:00
8ea5efe7cc fixed small errors in dbh send logic 2023-11-22 17:54:11 +01:00
c1c236d825 fixed another dumb error in Dakosy import 2023-11-22 09:59:26 +01:00
ff4fb86e78 Fixed PASA Dakosy import error 2023-11-20 18:01:27 +01:00
ed8d6adef6 fix for HIS-Nord response message (CREW TO CREWA) 2023-11-20 16:15:52 +01:00
0fa6e13690 more fixes for import 2023-11-16 16:58:51 +01:00
c22e9d8edd <12 PAS setzt PAX fix auf false 2023-11-16 15:51:50 +01:00
a8c8ce080e Fixed Dakosy import and CREWD delete from grid bug reports 2023-11-16 11:39:59 +01:00
c70e4700c3 official HIS-Nord xsd removed PAS and CREW completely from interface 2023-11-15 15:19:02 +01:00
da5ebaf226 Changed Auto-Generated Code to String-Based Timestamp Value 2023-11-13 13:38:48 +01:00
cacf9b6b1f fixed some more minor validation / correction funcs 2023-11-13 10:31:34 +01:00
332780e6eb Changed NSWSendService dbh to use WinSCP .NET Wrapper and API 2023-11-13 09:17:29 +01:00
ab04e3ce58 Updated project settings for Windows 11 Laptop. No idea why the path was wrong 2023-11-12 11:17:19 +01:00
b123ecdae1 removed flag check for PASD, still needs to be tested 2023-11-12 11:16:13 +01:00
e8b9ed80dc fixed excel import 2023-11-09 11:54:11 +01:00
5e85294375 Extended PDF Report with new fields 2023-11-09 10:27:00 +01:00
7232a455a6 first PAS/CREW entry sets Schengen flag, following entries copy first entries settings 2023-11-09 09:01:56 +01:00
a292caa666 Copy funcs CREWA <-> CREWD, PASA <-> PASD 2023-11-09 08:14:04 +01:00
c3b839635b small error fixes and additions 2023-11-09 07:19:47 +01:00
1e0dbb8c8c Korrekturen warnings und Validierung 2023-11-08 17:02:08 +01:00
fff9d05290 Updated tab sequence by moving controls in the xaml 2023-11-08 09:24:56 +01:00
eafc5f3b81 do not send empty VisaNumber fields 2023-11-08 09:04:04 +01:00
51ad5ab3ae fixed some smaller bugs 2023-11-07 12:17:17 +01:00
f4d2ba6291 added global validation for PAX set for > 12 passengers 2023-11-07 11:33:20 +01:00
51839b1748 Added Validation for CREW/PAS message classes as defined per document, fixed Resource references 2023-11-06 09:49:37 +01:00
0b677f36cc Bumped version and added some small fixes for first 7.2.0.0 test version 2023-11-06 08:39:52 +01:00
73da72ad8a Commented in all parts of code that have originally been removed when this was first implemented. Compiles. 2023-10-27 16:01:37 +02:00
a6831bc816 HIS-Nord file creation for PASA and CREWA added / changed from PAS and CREW 2023-10-27 13:10:21 +02:00
805ef43551 fixed errors and implemented sending for CREWA/D PASA/D through dbh 2023-10-27 12:28:55 +02:00
8249c8f01d added auto-generated files for dbh update, doesn't compile 2023-10-19 08:01:54 +02:00
b040531ec8 another small fix 2023-09-11 12:13:58 +02:00
8884eab404 GISIS Code kann jetzt nur mit digits eingegeben werden 2023-09-09 07:06:58 +02:00
ea31386310 Fixed port area data in sqlite and corrected some comparers 2023-09-08 09:01:37 +02:00
1643a22277 Merge branch 'feature/sending_7.13' into develop 2023-08-09 07:01:57 +02:00
0709ee53b7 copy pasta fehler gefixt 2023-08-06 10:46:02 +02:00
bc47aee394 alle Änderungswünsche von Christin komplett übernommen 2023-08-03 18:16:11 +02:00
05ea4b5783 fixed Date Plausi und settings für blacked out regions 2023-08-03 11:27:50 +02:00
f4fd9595a1 Korrekturen 2023-08-02 17:15:32 +02:00
c1b7bce386 Korrekturen nach Feedback 7.13.0.1 2023-08-02 09:10:13 +02:00
d596f1f7fb PortArea Helper erster Versuch
Ein Bereich in INFO mit Hilfsdaten zur Auswahl der passenden PortArea
2023-07-19 09:52:23 +02:00
6e8fdb0d35 added button to overwrite WAS_RCPT disposal values from WAS 2023-07-18 07:56:26 +02:00
73019a996d switched to remark as template display in Waste 2023-07-18 07:27:41 +02:00
68b52f0296 Version bump and avoid sending empty warnings 2023-07-17 08:00:16 +02:00
771032b137 Bug entfernt bei RESET Meldung 2023-07-17 07:52:36 +02:00
3af6bda7e5 fixed an error and created a preliminary test version 2023-07-17 07:17:09 +02:00
29cead2389 Templates für WasteDisposalServiceProvder Part IV 2023-07-15 15:52:00 +02:00
5eb9e1e170 Templates für WasteDisposalServiceProvider Part III: zusätzl. Feld Remark 2023-07-15 15:01:44 +02:00
c83146c9f4 Ergänzung NST2007 Liste 2023-07-15 14:37:52 +02:00
a36d0dd048 Templates für WasteDisposalServiceProvider Part II 2023-07-10 12:39:19 +02:00
ab2dde2f72 Templates für WasteDisposalServiceProvider Part I
Datenbank Klassen, Async Zugriff. AGNT_template bei der Gelegenheit auch umgebaut
2023-07-10 12:15:26 +02:00
59e51cd586 Added flag not to avoid parallel update of server status 2023-07-10 10:40:45 +02:00
1da414a782 MV / SH Hafenliste der SQlite DB hinzugefügt
Dadurch ist es möglich, für die betreffenden Häfen eine zusätzliche
Validierung zu machen.
2023-07-09 15:05:41 +02:00
12e65a27e4 Aus >100.000 Werten errors statt violations machen 2023-07-09 14:20:27 +02:00
ef65f2545f Beim Excel Import wird ChangedBy der Meldeklasse auf den aktuellen Benutzer gesetzt 2023-07-09 14:13:45 +02:00
b7ce7aea90 Value Mapping Menu Item is visible depending on user editor flag 2023-07-09 12:58:51 +02:00
85cfe5155f Version erhöht, zurückgestellt zur Testversion, Sortierung Waste / WAS_RCPT angepasst 2023-07-09 12:19:18 +02:00
04907e2104 SFTPSession entfernt
stattdessen wird ein open command gesendet. Gleichzeitig wird die Ausgabe nicht mehr
zum Ende gelesen sondern per Events abgefragt. Die Hoffnung ist hier, dass der Prozess nicht
mehr auf dem ReadToEnd() blockiert, wobei das nie bestätigt werden konnte.
2023-07-08 12:20:40 +02:00
0b2893ecde fixed missing / wrong comparer logic in case Identifier is null on the object 2023-07-07 09:37:35 +02:00
272dbcc1f3 Release 7.12.0.3 erzeugen 2023-06-16 10:47:50 +02:00
1ccb063ac7 Reload value mappings vor jedem Importvorgang. Sicher isch sicher 2023-06-14 07:05:58 +02:00
144c38661d Addon zu ValueMapping
Auch wenn ein key in InvalidKeys ist soll das Mapping (temporär) gespeichert werden.
Dazu wird ein Eintrag hinzugefügt, aber nicht gespeichert. Das wird womöglich Probleme
geben wenn der Anwender hinterher die Mapping Seite öffnet und dann speichert?
2023-06-12 09:03:39 +02:00
2fe98ca6ae fixed up the edit control for value mappings and added the star * as invalid value for a given key 2023-05-26 09:17:17 +02:00
1913328577 improved sorting by numerical sorting for CREW and PAS 2023-05-24 15:59:01 +02:00
21dddc9990 added JE JERSEY and fixed country of birth import for PAS 2023-05-24 09:56:57 +02:00
6df2c0224d added date of birth validation to PAS 2023-05-24 09:37:48 +02:00
a89ef42258 Value Mapping mit Excel getestet und einige Fehler korrigiert. Funktioniert soweit. 2023-05-12 10:47:14 +02:00
939b7fd23e Locode DB nochmals neu generiert mit Tool 2023-05-12 07:29:47 +02:00
5aec63ba4f fixes to the tool, changed signing key (expired) 2023-05-11 17:02:05 +02:00
545eb6d6f9 fixed port flag for DKORE 2023-05-11 10:48:56 +02:00
07215858fe Grid Control für ValueMappings mit allerlei FUntkionen. tut noch nicht alles 2023-05-09 16:51:06 +02:00
1f7ada5c58 MaerskData erbt jetzt auch von DatabaseEntityAsync 2023-05-09 14:29:59 +02:00
8c38001e42 ValueMapping speichern in der Datenbank 2023-05-09 14:15:20 +02:00
d37a92be6f Version bump to 7.12 2023-05-09 12:37:29 +02:00
de8b48feb7 Lernende Umsetzungsliste Part 2 2023-05-09 08:44:46 +02:00
2058161c79 Lernende Umsetzungsliste Part 1 2023-05-09 08:36:05 +02:00
f6316e52dc Validierung CREW DateOfBirth 2023-05-09 07:07:23 +02:00
78bc71d2ca Beim Excel-Import PAS wird CountryOfBirth nur dumm gelesen, ohne Nationalitäten Überprüfung 2023-05-08 20:59:53 +02:00
42b09532da added port 2023-05-08 20:51:28 +02:00
172f64d68e In WasteReceived dürfen keine Einträge hinzugefügt werden, bei denen der WasteCode null ist
d.h. in der Combobox nichts ausgewählt wurde. Das war eine Lücke, die zu einem 26. Eintrag in der Liste
geführt hat
2023-04-26 11:15:53 +02:00
c7cc69126c added missing port DEWHV 2023-04-16 13:58:49 +02:00
9f6a342c20 WasteDisposalDelivery entfernt 2023-04-14 07:10:08 +02:00
5694a3bf89 Obsoletes WasteDisposedAtLastPort_MTQ entfernt 2023-04-14 06:52:53 +02:00
0ad92218c2 Compare verbessert, Extended.Wpf.Toolkit aktualisiert 2023-04-14 06:38:22 +02:00
fda2da13d8 Optimierung Abruf Listenelemente: Alle ORDER BYs entfernt und Sortierung im Code 2023-04-13 09:22:09 +02:00
588385fc14 added ZZNOK 2023-04-12 08:56:00 +02:00
17ea1f080c added missing port ZZUKN 2023-04-06 18:35:07 +02:00
9ffbd23cb7 fixed validation even with some missing strings in the database 2023-04-06 12:30:16 +02:00
c97b9a72f5 evaluate UPDATED only if entry is not cancelled 2023-04-06 11:13:30 +02:00
ae0f6cae51 fixed Maersk Excel export (sorting and Remark) 2023-04-06 09:58:51 +02:00
3010d783f1 Gelb einfärben der Zeile der Meldeklasse im Overview, wenn PAS und Passagier Anzahl > 0 2023-04-06 09:44:38 +02:00
66c96daa92 add copy IMO to search control 2023-04-05 08:40:16 +02:00
6205efc7a2 Fixed SQLite truth value
Now true is 1 instead of a literal t.
Sounded better anyway.
2023-04-04 08:06:21 +02:00
8285519e3f Liste vor Ausgabe ins Excel nach COl A (ETA) sortieren 2023-04-02 11:53:32 +02:00
78a72caffc Validierung für IMOClass / UNnumber per Regex eingebaut.
Die maximale Zeichenlänge kann allerdings nicht stimmen, die im Excel mit 10 angegeben ist.
2023-04-02 11:42:41 +02:00
882861a328 updated tool project LOCODE import part 2 2023-04-02 09:14:55 +02:00
1bbccadd17 updated tool project LOCODE import part 1 2023-03-31 10:05:15 +02:00
1555e40ad1 updated the tool project 2023-03-30 13:50:50 +02:00
3ef5a35176 Maersk Anlauf mit vorhandener Id in Liste speichern 2023-03-30 12:56:54 +02:00
084f4de514 Version erhöht und IMSBC Validierung für dbh hinzugefügt 2023-03-30 11:13:09 +02:00
98b2b0adba das ist alles gar nicht so einfach 2023-03-22 10:54:52 +01:00
ce5327821b Maersk Import komplett abbrechen wenn eine ungültige IMO dabei ist 2023-03-22 09:52:33 +01:00
8d94534021 neue Testversion 2023-03-22 09:11:06 +01:00
e726ff43ba zwei Rückmeldungen bearbeitet 2023-03-16 06:55:08 +01:00
c9cf0f65c7 . 2023-03-11 16:23:33 +01:00
ec179966f3 fixed comparer enable buttons (ich depp) 2023-03-11 10:48:05 +01:00
e10ea34f1b warum habe ich den BS eingecheckt=!
?? ich werde es nie verstehen. Jedenfalls muss beim Update des Nuget Pakets
SQLite auch diese beiden Dateien aus den Stubs aktualisiert werden, sonst funktioniert
die installierte Version nicht. Lokal geht es bizarrerweise.
2023-03-10 18:10:01 +01:00
b9f8c8b667 set default call purpose description if left empty during excel import (and valid key exists) 2023-03-09 08:28:35 +01:00
81fbd7482f added some small improvements 2023-03-09 08:21:31 +01:00
8d01c15396 Increase Library version, corrected IMDG validation 2023-03-09 07:47:40 +01:00
dc9329bedf Merge branch 'feature/purge_transmission_files' into feature/eni_7.10 2023-03-09 07:09:08 +01:00
8c8bc199dc Maersk / SeaGo Flags vorbelegen und nicht mehr beim Suchfilter berücksichtigen 2023-03-08 17:24:32 +01:00
654746b704 neuer Status CANCELLED für Maersk Anmeldungen 2023-03-08 12:14:48 +01:00
f71c423b9a reduced his nord logging output 2023-03-07 09:37:49 +01:00
370158e0ec Added counter, logging and exception handling 2023-03-07 08:14:58 +01:00
c44a257209 added timer to purge old files after X days 2023-03-06 09:10:29 +01:00
3072796e55 compiles now 2023-03-06 08:06:07 +01:00
db5797c9dc bug wegen ID Work in Progress 2023-03-05 13:52:05 +01:00
e016bff028 Maersk page visible for everybody 2023-03-02 14:19:17 +01:00
8a98db9588 Bugfix for Import of Cargo Code NST (wrong logic) 2023-03-02 13:50:19 +01:00
7e23f5a98a Extra Korrekturen durch Anmerkungen von Basti 2023-03-02 11:02:16 +01:00
97bad2fbc0 publish 2023-03-01 14:53:28 +01:00
6fc09ad7da Filterung der Ergebnisse nach dem Zeitintervall hinzugefügt 2023-03-01 10:49:33 +01:00
47336e0b8d Datumsbereich Auswahl synchronisiert zwischen BRV und WHV, außerdem beim Enddatum die Stunden des Tages addiert 2023-03-01 09:54:24 +01:00
967a34dc79 fixed typo 2023-02-28 08:15:35 +01:00
e0c85b6576 Korrekturen gefixt 2023-02-24 18:34:34 +01:00
b175b17fec SendNSWMessageService etwas verboser gemacht um die Hänger zu identifizieren.
Außerdem gibt Transmit() jetzt ein boolean zurück und nur wenn der Prozess auch fertig war,
wird das Verzeichnis gelesen. Irgendwo ist da eine Race Condition..
2023-02-24 08:12:32 +01:00
6f5e5b66e9 reacted to some more corrections, Version 7.9.0.5 2023-02-23 12:28:18 +01:00
f529fa9ac9 merged wip 2023-02-22 09:42:45 +01:00
521786002b 7.9.0.4 Testversion, Status-Festlegung vereinheitlicht, Speichern Remark automatisch, kleinere Bugs beseitigt 2023-02-22 09:40:34 +01:00
2aef20130b 7.9.0.3 kleine Korrekturen 2023-02-19 11:50:43 +01:00
bcf4c33478 Testversion 7.9.0.2 mit Korrekturen 2023-02-17 09:18:50 +01:00
4d9b430cd3 fixed import / updating 2023-02-16 12:57:53 +01:00
65e45f40b8 Doppel-Klick auf den Maersk PO Listeneintrag öffnet die Anmeldung in der Übersicht, falls eine Messagecore vorhanden ist 2023-02-16 07:58:52 +01:00
d02fe72378 MainWindow nochmal etwas verbessert 2023-02-16 07:31:06 +01:00
d981bc4093 some bugfixes.. 2023-02-15 09:21:23 +01:00
c04099edb2 Bugfix PRE72H Excel scan and better logging output for SEND/REC HIS-Nord 2023-02-14 07:50:17 +01:00
13472ebe91 7.9.0.0 erste Testversion 2023-02-13 22:33:55 +01:00
2257a78326 Requesting ID now works 2023-02-13 17:19:40 +01:00
ed1f11c936 Simplen Excel export hinzugefügt 2023-02-13 10:19:39 +01:00
9f31b3cea4 Laden korrigiert, Status Enum statt Flags 2023-02-13 09:38:42 +01:00
6031b5df94 WIP 2023-02-12 14:27:35 +01:00
a596e197e1 more work on async loading.. 2023-02-09 14:44:44 +01:00
6d07baa4b0 WIP, import works now 2023-02-09 09:02:06 +01:00
1ab7641efe fixed a number of small things and continued on Maersk 2023-02-07 18:01:32 +01:00
8862d8e83c rework main screen Part I 2023-02-07 11:00:31 +01:00
af1a071664 Erster Versuch, eine ASYNC Version des DBManagers zu starten 2023-02-05 11:27:20 +01:00
5f28c8c7ea wip 2023-02-05 11:14:07 +01:00
2e91da8f3b Merge branch 'feature/eni_7.9' of ssh://lager/mnt/ext/git/git_bsmd into feature/eni_7.9 2023-02-05 08:09:09 +01:00
fc62386477 wip 2023-02-03 18:36:25 +01:00
f470fba78f wip 2023-02-03 18:34:59 +01:00
1d222259bb UI Umbau, WIP 2023-02-03 14:45:51 +01:00
b94835ee4b POListControl umbenannt, neue Übersicht mit Tabs 2023-02-03 14:13:15 +01:00
114b9db663 version bump 2023-02-03 08:32:51 +01:00
304f4d7404 Signing key für die Testversion ist der heupferd Schlüssel. Sonst konnte Christin nicht installieren 2023-02-02 13:19:21 +01:00
2faec717b8 Testversion erzeugt 2023-02-01 18:26:04 +01:00
da475a4754 Rundungsfehler durch sinnlosen Cast entfernt 2023-02-01 17:44:45 +01:00
4c5893c75b Version erhöht und HIS-Nord wieder den Default der Anmeldung gemacht 2023-02-01 17:28:24 +01:00
a58ecb68d1 version bump 2023-01-26 07:49:19 +01:00
baa0a9297e Einige Bugs beim Go-Live gefixt 2023-01-26 07:35:26 +01:00
1604b239b0 blöder rebase Fehler gefixt 2023-01-25 16:43:05 +01:00
1f5209bcd3 3 mutmaßliche kleine Fehler korrigiert 2023-01-25 16:13:35 +01:00
50e7d7eb5a Korrekturen 2023-01-19 15:05:48 +01:00
820d12611d Korrekturen 2023-01-19 15:05:48 +01:00
00bc43790d ein bunter Strauß an Korrekturen 2023-01-19 15:05:48 +01:00
c761c8a304 ATA/ATD: Korrektur des Datumsformats 2023-01-19 15:05:48 +01:00
2177e69d4c kleine Korrekturen 2023-01-19 15:05:48 +01:00
8cca412079 Korrektren für Maersk Dateiname, WAS Reihenfolge und Verbesseung der SFT Logausgaben 2023-01-19 15:05:48 +01:00
3dac392452 Testversion 7.8.0.1 ausgeliefert 2023-01-19 15:05:48 +01:00
e013591a40 Korrekturen nach Test Christin II 2023-01-19 15:04:49 +01:00
1777a81772 SEC KielCanalPassage dates fixed 2023-01-19 15:04:49 +01:00
d5d0045adb Korrekturen nach Test Christin I 2023-01-19 15:04:49 +01:00
09faf3ad81 no CREW effects warning for DE arrivals 2023-01-19 15:04:49 +01:00
bfb5fd2f60 Testversion dbh / Maersk Versand 7.8.0.0 2023-01-19 15:04:49 +01:00
bf80cb5fed DBH Maersk Flag in NSW Provider auswerten 2023-01-19 15:03:09 +01:00
9d53b3e251 added new HIS target 2023-01-19 15:03:09 +01:00
8f0711d4b6 Merge branch 'feature/dbh' into develop 2022-12-16 11:34:55 +01:00
ea6f8ac97a noch ein kleiner Fix.. 2022-12-16 07:33:42 +01:00
ae1747f2f3 small bugfixes 2022-12-15 08:36:38 +01:00
f14e758c98 Defaults hinzugefügt für fehlende Felder im Excel import 2022-12-15 07:26:23 +01:00
09220f1b9a weitere Bugs bei der Übertragung erschlagen 2022-12-14 18:34:22 +01:00
ee5884aa3f version increment 2022-12-14 16:34:04 +01:00
5118ed8aaf Korrekturen lt Rückmeldung 2022-12-14 16:18:44 +01:00
f0d3f5cbb1 Korrekturen für das dbh Format (peinlich, dass mir das zuvor entgangen ist..) 2022-12-14 11:58:18 +01:00
964e2aa967 Reporting Party nach Rückmeldung von Heinz-Dieter aus den Meldeklassen entfernt 2022-12-13 17:48:50 +01:00
a0bcbe4ccf publish version increase 2022-12-13 16:49:14 +01:00
d31cc825cb nochmal Datumsformate angepasst für ein anderes Problem 2022-12-13 10:38:06 +01:00
217dbcfcde Spezielle Abfrage für DEBRE / DEBRV wenn bestimmte Meldeklassen noch nicht versandt wurden 2022-12-13 09:13:12 +01:00
894aadc2d9 Korrekturen für 7.7 2022-12-13 08:39:17 +01:00
d63cb8034d Lookup für NST2007 Codes in LADG Detaildialog eingebaut.
Die dazu notwendigen Daten liegen in der SQLite Datenbank.
2022-12-09 17:57:04 +01:00
ad5f873d04 Label durch Button ersetzt für bessere Benutzerrückmeldung 2022-12-09 09:43:27 +01:00
c29a936fa2 Neue Benutzerberechtigung 'Editor', die dazu verwendet wird, den Speichern Knopf der Templates freizuschalten (IsEnabled) 2022-12-09 09:32:13 +01:00
bd93f98460 neue Datumsformate (DE + EN) hinzugefügt inkl. kurze Monatsnamen 2022-12-09 09:07:15 +01:00
177835440c defaults für POBA/POBD beim Excel import 2022-12-09 08:02:52 +01:00
652644bcb0 Abfangen und null setzen falls falsche Tastatureingabe (Datum, Datetime) 2022-12-09 07:51:36 +01:00
32ede83fd2 wrong formatting leads to DateTime Now in EditWasteReceiptDialog 2022-12-09 07:39:27 +01:00
2522ec3461 fixed validation for Canal transits (NOA_NOD) 2022-12-05 09:46:37 +01:00
9266fa90b4 version increment 2022-12-05 09:30:11 +01:00
18d52180b1 rumgepfusche an den Settings, alles zu application settings gemacht 2022-11-18 17:58:36 +01:00
0fd1cb0cd9 dbh connection wip 2022-11-16 15:57:52 +01:00
0ae84839d1 repaired message return handling 2022-11-15 18:44:38 +01:00
7bfa85e96d viele Bugfixes nach Test der DBH Schnittstelle 2022-11-15 09:42:36 +01:00
133c2e6bcc SFTP Settings 2022-11-14 18:40:26 +01:00
693c89e599 FILE NUM SEQUENCE
DBH will eine fortlaufende Nummer bei der Abgabe von Dateien über SFTP
Diese wird über einen zentralen Zähler vergeben und in MessageHeader gespeichert
2022-11-14 17:14:26 +01:00
b4e403eb16 added reference to reporting party for each message class 2022-11-13 15:54:40 +01:00
c11027790e added WAS_RCPT 2022-11-13 15:45:37 +01:00
3cec894142 alte Webservice Referenz entfernt, Code für alle alten Meldeklassen +bernommen 2022-11-13 15:18:44 +01:00
d16e7a42d6 Einstellungen, ATA ATD SEC 2022-11-11 10:57:32 +01:00
ba2bf9833e NOA_NOD, AGNT 2022-11-11 10:57:32 +01:00
c59e9f7e76 noch mehr Funktionen zum Versenden hinzugefügt 2022-11-11 10:57:32 +01:00
02c619011c SFTP Verzeichnis Einstellungen getrennt 2022-11-11 10:57:32 +01:00
ca58d091c5 Vorbereitung der Verwendung von SFTP aus dem Dakosy Projekt 2022-11-11 10:57:32 +01:00
fe2db2fa6b Serialisierung von Visit, Transit und STAT für DBH 2022-11-11 10:57:32 +01:00
d0be323df2 removing old send structure 2022-11-11 10:57:31 +01:00
db27fc2eb0 DigiCert signed Certificates for (www.)bsmd-emswe.eu 2022-11-05 13:38:33 +01:00
8711a84686 CSR Request für VServer: bsmd-emswe.eu 2022-11-05 13:29:10 +01:00
0213e29842 updated deployment info 2022-11-02 07:41:21 +01:00
319 changed files with 43940 additions and 19956 deletions

View File

@ -1,20 +1,8 @@
// Copyright (c) 2017 Informatibüro Daniel Schick
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using bsmd.database;
using System.Windows.Controls;
using System.Windows.Input;
namespace ENI2
{
@ -43,10 +31,9 @@ namespace ENI2
{
DataGrid grid = sender as DataGrid;
if(grid?.SelectedItems?.Count == 1)
{
DataGridRow dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;
MessageCore selectedCore = grid.SelectedItem as MessageCore;
this.DisplayCore(selectedCore);
{
MessageCore selectedCore = grid.SelectedItem as MessageCore;
this.DisplayCore(selectedCore);
}
}
}
@ -63,7 +50,7 @@ namespace ENI2
{
if((this.MessageCoreSelected != null) && (aMessageCore != null))
{
this.MessageCoreSelected(aMessageCore);
this.MessageCoreSelected(aMessageCore, DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].ShipcallDisplayMode);
}
}

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
(c) 2017-present Informatikbüro Daniel Schick
-->
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<applicationSettings>
<ENI2.Properties.Settings>
@ -26,28 +26,103 @@
<value>1000</value>
</setting>
<setting name="LockingServerAddress" serializeAs="String">
<value>http://192.168.2.24/LockingService/LockingService.svc</value>
<value>http://192.168.2.24/LockingService/LockingService.svc</value>
</setting>
<setting name="ReportAuthor" serializeAs="String">
<value>BSMD ReportGenerator</value>
</setting>
<setting name="ConnectionString" serializeAs="String">
<value>Initial Catalog=nswtest;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value>
<value>Initial Catalog=nswtest;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value>
</setting>
</ENI2.Properties.Settings>
</applicationSettings>
<userSettings>
<ENI2.Properties.Settings>
<setting name="MainWindowPlacement" serializeAs="String">
<value/>
<value />
</setting>
<setting name="Width" serializeAs="String">
<value>825</value>
</setting>
<setting name="Height" serializeAs="String">
<value>450</value>
</setting>
<setting name="W1Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="W1Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="W2Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="W2Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="W3Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="W3Top" serializeAs="String">
<value>0</value>
</setting>
</ENI2.Properties.Settings>
</userSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" maxReceivedMessageSize="2147483647"/>
<binding name="BasicHttpBinding_IService" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:11651/LockingService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService" contract="LockingServiceReference.IService" name="BasicHttpBinding_IService"/>
<endpoint address="http://localhost:11651/LockingService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService" contract="LockingServiceReference.IService" name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.9" newVersion="9.0.0.9" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.2" newVersion="6.0.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Pkcs" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.9" newVersion="9.0.0.9" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -6,6 +6,8 @@ using System.Windows;
using System.Windows.Markup;
using bsmd.database;
using log4net;
using System.Windows.Controls;
using System.Windows.Input;
using System;
@ -13,13 +15,16 @@ using System.Net;
using ENI2.LockingServiceReference;
using ENI2.Util;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;
using System.Drawing.Drawing2D;
namespace ENI2
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
public partial class App : System.Windows.Application
{
// "global" statics, da gibt es sicher noch einen eleganteren Weg..
private static ServiceClient _lockingServiceClient = null;
@ -30,6 +35,8 @@ namespace ENI2
private ManualResetEvent ResetSplashCreated;
private Thread _splashThread;
private readonly ILog _log = LogManager.GetLogger(typeof(App).Name);
public App() : base()
{
this.Dispatcher.UnhandledException += Dispatcher_UnhandledException;
@ -60,16 +67,18 @@ namespace ENI2
ResetSplashCreated.WaitOne();
base.OnStartup(e);
base.OnStartup(e);
// set connectnion string to async loader
DBManagerAsync.ConnectionString = ENI2.Properties.Settings.Default.ConnectionString;
// initialize static / localized lookups from sqlite database
string langKey = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
Dictionary<int, string> cargoHandlingDict = LocalizedLookup.getLADGCargoHandlingStrings(langKey);
foreach (int key in cargoHandlingDict.Keys)
LADG.CargoHandlingDict.Add(key, cargoHandlingDict[key]);
LADG.MVSHLocodes.AddRange(LocalizedLookup.getMVSHLocodes());
EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.PreviewKeyDownEvent, new KeyEventHandler(this.DatePicker_PreviewKeyDown));
CREW.NationalityDict = LocalizedLookup.getNationalities();
STAT.VesselTypeDict = LocalizedLookup.getVesselTypes();
@ -79,6 +88,9 @@ namespace ENI2
LADG.CargoCodesNST = LocalizedLookup.getCargoCodesNST();
LADG.CargoCodesNST3 = LocalizedLookup.getCargoCodesNST3();
// Load import value mappings
Task.Run(async () => await ValueMapping.LoadDicts());
// Preload validation fields
List<ValidationField> vFields = bsmd.database.ValidationRule.ValidationFields;
RuleEngine.RegisterLocodeChecker(Util.GlobalStructures.IsValidLocode);
@ -147,9 +159,9 @@ namespace ENI2
private void Dispatcher_UnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
string errorMessage = string.Format("An unhandled exception occurred: {0}\r\n{1}", e.Exception.Message, e.Exception.StackTrace);
MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// TODO: Dieser Fehler muss irgendwohin gesendet / gespeichert werden
Xceed.Wpf.Toolkit.MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
_log.Error(errorMessage);
}
private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e)

View File

@ -56,6 +56,33 @@
</Grid>
</ControlTemplate>
<!-- Validation Error Template for a DataGrid Row -->
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="ValidationErrorTemplate">
<Setter.Value>
<ControlTemplate>
<Grid Margin="0,-2,0,-2"
ToolTip="{Binding RelativeSource={RelativeSource
FindAncestor, AncestorType={x:Type DataGridRow}},
Path=(Validation.Errors)[0].ErrorContent}">
<Ellipse StrokeThickness="0" Fill="Red"
Width="{TemplateBinding FontSize}"
Height="{TemplateBinding FontSize}" />
<TextBlock Text="!" FontSize="{TemplateBinding FontSize}"
FontWeight="Bold" Foreground="White"
HorizontalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ToolTip}" >
<Setter Property="OverridesDefaultStyle" Value="true" />

View File

@ -1,13 +1,14 @@
<UserControl x:Class="ENI2.VorgaengeControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ENI2"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Background="#FF9EF0E8">
<Label x:Name="label" Content="Platzhalter für Vorgänge" HorizontalAlignment="Left" Margin="49,128,0,0" VerticalAlignment="Top"/>
</Grid>
</UserControl>
<UserControl x:Class="ENI2.Controls.BusyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:util="clr-namespace:ENI2.Util"
xmlns:local="clr-namespace:ENI2.Controls"
mc:Ignorable="d"
d:DesignHeight="28" d:DesignWidth="28">
<Grid>
<Image Source="../Resources/bullet_ball_grey.png" x:Name="imageBall" />
</Grid>
</UserControl>

View File

@ -0,0 +1,44 @@
// Copyright (c) 2023- schick Informatik
//
// Description: Idea to have a simple control that shows if the application is busy or not using a simple icon
// that will be set according to a state
//
using ENI2.Util;
using System.Windows.Controls;
namespace ENI2.Controls
{
/// <summary>
/// Interaction logic for BusyControl.xaml
/// </summary>
public partial class BusyControl : UserControl
{
UIHelper.BusyStateEnum _busyState = UIHelper.BusyStateEnum.NEUTRAL;
public BusyControl()
{
InitializeComponent();
}
public UIHelper.BusyStateEnum BusyState
{
set
{
_busyState = value;
//Dispatcher.Invoke(() =>
//{
switch (_busyState)
{
case UIHelper.BusyStateEnum.NEUTRAL: imageBall.Source = Properties.Resources.bullet_ball_grey.CreateBitmapSource(); break;
case UIHelper.BusyStateEnum.BUSY: imageBall.Source = Properties.Resources.bullet_ball_yellow.CreateBitmapSource(); break;
case UIHelper.BusyStateEnum.FAIL: imageBall.Source = Properties.Resources.bullet_ball_red.CreateBitmapSource(); break;
case UIHelper.BusyStateEnum.SUCCESS: imageBall.Source = Properties.Resources.bullet_ball_green.CreateBitmapSource(); break;
}
//});
}
get => _busyState;
}
}
}

View File

@ -8,6 +8,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
namespace ENI2.Controls
{
@ -161,8 +162,9 @@ namespace ENI2.Controls
}
if (!abort)
{
var tabControl = Parent as ItemsControl;
tabControl.Items.Remove(this);
var tabControl = Parent as TabControl;
tabControl.SelectedItem = null;
_ = Dispatcher.BeginInvoke(new Action(() => tabControl.Items.Remove(this)), DispatcherPriority.Background);
}
};
dockPanel.Children.Add(closeButton);

View File

@ -56,6 +56,7 @@ namespace ENI2.Controls
// das hier bildet 1:1 das Kontext-Menü des ANSW ab
public event Action<DatabaseEntity> EditRequested;
public event Action<List<DatabaseEntity>> MultiEditRequested;
public event Action<DatabaseEntity> DeleteRequested;
public event Action CreateRequested;
public event Action RefreshGrid;
@ -119,7 +120,7 @@ namespace ENI2.Controls
{
var grid = sender as ENIDataGrid;
if (Key.Delete == e.Key)
this.deleteItem(null, null);
this.deleteItem(null, null);
}
}
@ -203,9 +204,17 @@ namespace ENI2.Controls
{
if((this.SelectedItems != null) && (this.SelectedItems.Count == 1) && !this.IsReadOnly)
{
if (this.SelectedItems[0] is DatabaseEntity selectedEntity)
if (this.SelectedItems[0] is DatabaseEntity selectedEntity)
this.EditRequested?.Invoke(selectedEntity);
}
if((this.SelectedItems != null) && (this.SelectedItems.Count > 1) && !this.IsReadOnly)
{
List<DatabaseEntity> databaseEntities = new List<DatabaseEntity>();
foreach(DatabaseEntity databaseEntity in this.SelectedItems)
databaseEntities.Add(databaseEntity);
this.MultiEditRequested?.Invoke(databaseEntities);
}
}
protected void printItem(object sender, RoutedEventArgs e)

View File

@ -0,0 +1,113 @@
<UserControl x:Class="ENI2.Controls.EasyPeasyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ENI2.Controls"
mc:Ignorable="d"
d:DesignHeight="650" d:DesignWidth="1024" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded">
<DockPanel>
<!-- Header with logo -->
<Border DockPanel.Dock="Top" Padding="10" Background="#FFFDF6">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
<!-- Embed SVG via Image (optional): place your SVG as a DrawingImage in resources, or replace with PNG -->
<TextBlock Text="🍋 easy-peasy" FontSize="20" FontWeight="Bold" Margin="0,0,16,0"/>
<TextBlock Text="Edit • Paste • Export XML" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="12" Orientation="Vertical" >
<!-- Top-level fields -->
<UniformGrid Columns="4" Rows="3" Margin="0,0,0,12" Height="84">
<TextBlock Text="Art der Identification (Vertreter)" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right"/>
<TextBox Text="{Binding DelegateIdentificationType, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="Art der Identifikation (Kunde)" VerticalAlignment="Center" Margin="0,0,4,0" TextAlignment="Right" />
<TextBox Text="{Binding TraderIdentificationType, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="LRN" TextAlignment="Right" Margin="0,0,4,0" VerticalAlignment="Center"/>
<TextBox Text="{Binding LRN, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="Identifikationsnummer (Kunde)" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right" />
<TextBox Text="{Binding TraderIdentificationNumber, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="Land" TextAlignment="Right" Margin="0,0,4,0" VerticalAlignment="Center"/>
<TextBox Text="{Binding Country, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="Identifikationsnummer (Vertreter)" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right"/>
<TextBox Text="{Binding DelegateIdentificationNumber, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
</UniformGrid>
<!-- ProofInformation -->
<GroupBox Header="Kennung des Antrags auf Nachweis TZ2L(F)">
<StackPanel Margin="8">
<UniformGrid Columns="4" Rows="4" Margin="0,0,0,12" >
<TextBlock Text="Zuständige Zollstelle" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.CompetentCustomsOffice, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="Art der Anmeldung" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.DeclarationType, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="Datum Anmeldung
(yyyy-MM-ddTHH:mm:ss)" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.DeclarationDate, StringFormat={}{0:yyyy-MM-ddTHH:mm:ss}, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center" />
<TextBlock Text="Gesamtrohmasse (kg)" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox x:Name="textBoxTotalGrossMass" Text="{Binding ProofInformationT2LT2LF.TotalGrossMassKg, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="Antrag auf Gültigkeitsdauer des Nachweises (in Tagen)" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.RequestedValidityOfTheProof.NumberOfDays, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="Art des Antrags" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.RequestType, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
</UniformGrid>
<GroupBox Header="Warenort">
<UniformGrid Columns="6" Margin="8" Height="28">
<TextBlock Text="Art des Ortes" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.LocationOfGoods.TypeOfLocation}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="Art der Ortsbestimmung" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.LocationOfGoods.QualifierOfIdentification}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="UNLocode" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.LocationOfGoods.UNLocode}" Margin="2" VerticalContentAlignment="Center"/>
</UniformGrid>
</GroupBox>
<CheckBox Content="In Containern beförderte Waren" Margin="8"
IsChecked="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.ContainerIndication}"/>
<!-- Goods Items grid (paste target) -->
<TextBlock Text="Warenpositionen (Paste tab/CSV with columns: HS, Item#, Description, Gross, Net, Pkgs, Type, Marks)" Margin="4,12,0,4"/>
<DataGrid ItemsSource="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF}"
AutoGenerateColumns="False" SelectionMode="Extended" x:Name="dataGridGoodsItems" CanUserAddRows="False"
PreviewKeyDown="DataGrid_PreviewKeyDown" Focusable="True" MinHeight="80" IsTabStop="True" MaxHeight="320">
<DataGrid.Columns>
<DataGridTextColumn Header="HS Code" Binding="{Binding Commodity.HarmonizedSystemSubHeadingCode}"/>
<DataGridTextColumn Header="Item #" Binding="{Binding GoodsItemNumber}"/>
<DataGridTextColumn Header="Description" Binding="{Binding DescriptionOfGoods}" Width="2*"/>
<DataGridTextColumn Header="Gross" Binding="{Binding GoodsMeasure.GrossMass}"/>
<DataGridTextColumn Header="Net" Binding="{Binding GoodsMeasure.NetMass}"/>
<DataGridTextColumn Header="Pkgs" Binding="{Binding Packaging.NumberOfPackages}"/>
<DataGridTextColumn Header="Type" Binding="{Binding Packaging.TypeOfPackages}"/>
<DataGridTextColumn Header="Marks" Binding="{Binding Packaging.ShippingMarks}" Width="*"/>
</DataGrid.Columns>
</DataGrid>
<GroupBox Header="Dokumente" Margin="0,12,0,0">
<UniformGrid Columns="4" Margin="8" Height="28">
<TextBlock Text="Art des Dokuments" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.TransportDocuments.Type}" Margin="2" VerticalContentAlignment="Center"/>
<TextBlock Text="Referenznummer" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right"/>
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.TransportDocuments.ReferenceNumber}" Margin="2" VerticalContentAlignment="Center" />
</UniformGrid>
</GroupBox>
</StackPanel>
</GroupBox>
<!-- Actions -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
<Button x:Name="buttonImport" Content="Import" Width="100" Margin="0,0,8,0" Click="buttonImport_Click" />
<Button x:Name="buttonClear" Content="Clear" Width="100" Margin="0,0,8,0" Click="buttonClear_Click"/>
<Button x:Name="buttonExport" Content="Export" Width="120" Click="buttonExport_Click"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
</DockPanel>
</UserControl>

View File

@ -0,0 +1,506 @@
// Copyright (c) 2017- schick Informatik
// Description: Display dialog for customs XML data upload app
//
using bsmd.database.EasyPeasy;
using ENI2.Util;
using Microsoft.Win32;
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using System.Xml;
using System.Xml.Serialization;
namespace ENI2.Controls
{
/// <summary>
/// Interaction logic for EasyPeasyControl.xaml
/// </summary>
public partial class EasyPeasyControl : UserControl
{
private ProofRequest _vm;
#region Construction
public EasyPeasyControl()
{
InitializeComponent();
this.dataGridGoodsItems.ContextMenu = new ContextMenu();
MenuItem addItem = new MenuItem();
addItem.Header = Properties.Resources.textAdd;
addItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) };
addItem.Click += AddItem_Click;
this.dataGridGoodsItems.ContextMenu.Items.Add(addItem);
MenuItem deleteItem = new MenuItem();
deleteItem.Header = Properties.Resources.textDelete;
deleteItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) };
deleteItem.Click += DeleteItem_Click;
this.dataGridGoodsItems.ContextMenu.Items.Add(deleteItem);
// Add separator and paste option
this.dataGridGoodsItems.ContextMenu.Items.Add(new Separator());
MenuItem pasteItem = new MenuItem();
pasteItem.Header = "Paste";
pasteItem.Click += (s, e) => HandlePasteOperation();
this.dataGridGoodsItems.ContextMenu.Items.Add(pasteItem);
// Add command bindings for proper keyboard handling
this.dataGridGoodsItems.CommandBindings.Add(new CommandBinding(
ApplicationCommands.Paste,
(s, e) => HandlePasteOperation(),
(s, e) => e.CanExecute = Clipboard.ContainsText()));
}
#endregion
public void SaveState()
{
try
{
EasyPeasyState.Save(_vm);
}
catch { }
}
#region context menu event handler
private void AddItem_Click(object sender, RoutedEventArgs e)
{
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null) return;
var list = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF;
int nextItemNo = list.Any() ? list.Max(x => x.GoodsItemNumber) + 1 : 1;
var item = new GoodsItemForT2LT2LF
{
GoodsItemNumber = nextItemNo
};
list.Add(item);
}
private void DeleteItem_Click(object sender, RoutedEventArgs e)
{
foreach(GoodsItemForT2LT2LF item in this.dataGridGoodsItems.SelectedItems.Cast<GoodsItemForT2LT2LF>().ToArray())
{
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null) return;
var list = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF;
list.Remove(item);
}
}
#endregion
#region button event handler
private void buttonClear_Click(object sender, RoutedEventArgs e)
{
CleanupAutoCalculation();
this._vm = EasyPeasyState.CreateDefault();
if (_vm.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null)
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF = new ObservableCollection<GoodsItemForT2LT2LF>();
_vm.ProofInformationT2LT2LF.DeclarationDate = DateTime.Now; // reset to today
_vm.ProofInformationT2LT2LF.RequestedValidityOfTheProof.NumberOfDays = 90; // default 90 days
this.DataContext = this._vm;
SetupAutoCalculation();
}
private void buttonExport_Click(object sender, RoutedEventArgs e)
{
var dlg = new SaveFileDialog
{
FileName = "proofRequest.xml",
Filter = "XML file|*.xml",
OverwritePrompt = true
};
if (dlg.ShowDialog() == true)
{
try
{
var ser = new XmlSerializer(typeof(ProofRequest));
// Namespaces (if needed)
// var ns = new XmlSerializerNamespaces();
// ns.Add("xsd", "http://www.w3.org/2001/XMLSchema");
// ns.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
var settings = new XmlWriterSettings
{
Indent = true,
OmitXmlDeclaration = true
};
using (var fs = File.Create(dlg.FileName))
using (var xw = XmlWriter.Create(fs, settings))
{
ser.Serialize(xw, _vm); //, ns);
}
MessageBox.Show("Exported successfully.", "easy-peasy", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch (Exception ex)
{
MessageBox.Show("Export failed:\n" + ex.Message, "easy-peasy", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
private void buttonImport_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "XML file|*.xml";
ofd.RestoreDirectory = true;
ofd.Multiselect = false;
if (ofd.ShowDialog() == true)
{
using (var fs = File.OpenRead(ofd.FileName))
{
CleanupAutoCalculation();
var ser = new XmlSerializer(typeof(ProofRequest));
_vm = (ProofRequest)ser.Deserialize(fs);
// after loading/creating _vm
if (_vm.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null)
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF = new ObservableCollection<GoodsItemForT2LT2LF>();
_vm.ProofInformationT2LT2LF.DeclarationDate = DateTime.Now; // reset to today
if(_vm.ProofInformationT2LT2LF.RequestedValidityOfTheProof.NumberOfDays == 9)
_vm.ProofInformationT2LT2LF.RequestedValidityOfTheProof.NumberOfDays = 90; // default 90 days
this.DataContext = _vm;
SetupAutoCalculation();
}
}
}
#endregion
#region loaded/unloaded event handler
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
_vm = EasyPeasyState.LoadOrCreate();
if (_vm.ProofInformationT2LT2LF == null)
_vm.ProofInformationT2LT2LF = new ProofInformationT2LT2LF();
if (_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF == null)
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF = new GoodsShipmentForT2LT2LF
{
LocationOfGoods = new LocationOfGoods(),
TransportDocuments = new TransportDocuments()
};
_vm.ProofInformationT2LT2LF.DeclarationDate = DateTime.Now; // reset to today
this.DataContext = _vm;
SetupAutoCalculation();
}
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
{
CleanupAutoCalculation();
try
{
EasyPeasyState.Save(_vm);
}
catch { }
}
#endregion
#region auto calculation total gross mass
private void SetupAutoCalculation()
{
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF != null)
{
// Subscribe to collection changes (add/remove items)
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF.CollectionChanged += GoodsItems_CollectionChanged;
// Subscribe to DataGrid cell changes
dataGridGoodsItems.CellEditEnding += DataGridGoodsItems_CellEditEnding;
// Calculate initial total
CalculateTotalGrossMass();
}
}
private void CleanupAutoCalculation()
{
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF != null)
{
// Unsubscribe from collection changes
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF.CollectionChanged -= GoodsItems_CollectionChanged;
dataGridGoodsItems.CellEditEnding -= DataGridGoodsItems_CellEditEnding;
}
}
private void DataGridGoodsItems_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
// Check if the edited column is GrossMass
if (e.Column.Header.ToString() == "Gross")
{
// Delay calculation to allow the binding to update
Dispatcher.BeginInvoke(new Action(() => {
CalculateTotalGrossMass();
}), System.Windows.Threading.DispatcherPriority.Background);
}
}
private void GoodsItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
// Recalculate total after any collection change
CalculateTotalGrossMass();
}
private void CalculateTotalGrossMass()
{
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF != null)
{
var total = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF
.Sum(item => item.GoodsMeasure?.GrossMass ?? 0m);
_vm.ProofInformationT2LT2LF.TotalGrossMassKg = total;
// Force UI update by refreshing the binding
var binding = BindingOperations.GetBindingExpression(
FindTotalGrossMassTextBox(), TextBox.TextProperty);
binding?.UpdateTarget();
}
}
// Simple property changed notification helper
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private TextBox FindTotalGrossMassTextBox()
{
// Find the TextBox that displays TotalGrossMassKg
return this.FindName("textBoxTotalGrossMass") as TextBox ??
this.GetTemplateChild("textBoxTotalGrossMass") as TextBox;
}
#endregion
#region cut & paste logic
private void HandlePasteOperation()
{
if (Clipboard.ContainsText())
{
var text = Clipboard.GetText();
if (!TryPaste_EspHsPkgsGross(text))
PasteGoodsItems(text);
}
}
private void DataGrid_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.V && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
{
if (Clipboard.ContainsText())
{
var text = Clipboard.GetText();
if(!TryPaste_EspHsPkgsGross(text))
PasteGoodsItems(text);
e.Handled = true;
}
}
}
private void PasteGoodsItems(string text)
{
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF == null) return;
var lines = text.Replace("\r\n", "\n").Replace('\r', '\n')
.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var line in lines)
{
// Split by tab first; if only one column, try CSV
var cells = line.Split('\t');
if (cells.Length == 1) cells = SplitCsv(line);
// Expected order: HS, Item#, Description, Gross, Net, Pkgs, Type, Marks
var item = new GoodsItemForT2LT2LF();
if (cells.Length > 0) item.Commodity.HarmonizedSystemSubHeadingCode = cells[0].Trim();
if (cells.Length > 1 && int.TryParse(cells[1], out var n)) item.GoodsItemNumber = n;
if (cells.Length > 2) item.DescriptionOfGoods = cells[2].Trim();
if (cells.Length > 3 && decimal.TryParse(cells[3], out var gross)) item.GoodsMeasure.GrossMass = gross;
if (cells.Length > 4 && decimal.TryParse(cells[4], out var net)) item.GoodsMeasure.NetMass = net;
if (cells.Length > 5 && int.TryParse(cells[5], out var pkgs)) item.Packaging.NumberOfPackages = pkgs;
if (cells.Length > 6) item.Packaging.TypeOfPackages = cells[6].Trim();
if (cells.Length > 7) item.Packaging.ShippingMarks = cells[7].Trim();
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF.Add(item);
}
}
// Very small CSV splitter (handles quotes)
private static string[] SplitCsv(string line)
{
var res = new System.Collections.Generic.List<string>();
var sb = new StringBuilder();
bool inQuotes = false;
for (int i = 0; i < line.Length; i++)
{
char c = line[i];
if (c == '\"')
{
if (inQuotes && i + 1 < line.Length && line[i + 1] == '\"')
{ sb.Append('\"'); i++; }
else { inQuotes = !inQuotes; }
}
else if (c == ',' && !inQuotes)
{ res.Add(sb.ToString()); sb.Clear(); }
else { sb.Append(c); }
}
res.Add(sb.ToString());
return res.ToArray();
}
private bool TryPaste_EspHsPkgsGross(string text)
{
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF == null) return false;
// Normalize and split lines
var lines = text.Replace("\r\n", "\n").Replace('\r', '\n')
.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
if (lines.Length == 0) return false;
// Determine next item number
var list = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF;
int nextItemNo = list.Any() ? list.Max(x => x.GoodsItemNumber) + 1 : 1;
bool anyAdded = false;
bool countrySeen = false;
foreach (var raw in lines)
{
var line = raw; // do not Trim() entirely; keep leading tab as empty first cell
var cells = line.Split('\t'); // keeps empty entries
// Expected:
// - 4 cells: [ESP or ""], [HS], [Pkgs], [Gross]
// - 3 cells: [HS], [Pkgs], [Gross]
string hs = null, pkgs = null, gross = null;
if (cells.Length >= 4)
{
string c0 = cells[0]?.Trim();
// Optionally capture the first token like "ESP" (country tag),
// only once and only if alphabetic (won't throw if numeric)
if (!countrySeen && !string.IsNullOrWhiteSpace(c0) && c0.All(ch => char.IsLetter(ch)))
{
// If you decide later this should set a field, uncomment:
// if (string.IsNullOrWhiteSpace(_vm.Country)) _vm.Country = c0;
countrySeen = true;
}
hs = (cells.Length > 1 ? cells[1] : null);
pkgs = (cells.Length > 2 ? cells[2] : null);
gross = (cells.Length > 3 ? cells[3] : null);
}
else if (cells.Length == 3)
{
hs = cells[0];
pkgs = cells[1];
gross = cells[2];
}
else
{
// Not enough data for this format; skip the row
continue;
}
if (string.IsNullOrWhiteSpace(hs)) continue;
var item = new GoodsItemForT2LT2LF
{
GoodsItemNumber = nextItemNo++,
DescriptionOfGoods = "" // per spec
};
item.Commodity.HarmonizedSystemSubHeadingCode = hs.Trim();
if (TryParseIntFlexible(pkgs, out var pk))
item.Packaging.NumberOfPackages = pk;
if (TryParseDecimalFlexible(gross, out var g))
{
item.GoodsMeasure.GrossMass = g;
var net = g; // - 1m; // now net mass equals gross mass (no deduction)
if (net < 0m) net = 0m;
item.GoodsMeasure.NetMass = net;
}
item.DescriptionOfGoods = "Brand New Vehicles"; // per spec
item.Packaging.TypeOfPackages = "UN"; // per spec
item.Packaging.ShippingMarks = "-"; // per spec
list.Add(item);
anyAdded = true;
}
return anyAdded;
}
#endregion
#region static utils
// this will go somewhere else later
// Try parse decimal with current culture, invariant, and comma/dot flip
private static bool TryParseDecimalFlexible(string s, out decimal value)
{
s = (s ?? "").Trim();
// 1) current culture
if (decimal.TryParse(s, NumberStyles.Number, CultureInfo.CurrentCulture, out value)) return true;
// 2) invariant
if (decimal.TryParse(s, NumberStyles.Number, CultureInfo.InvariantCulture, out value)) return true;
// 3) flip comma/dot and retry (helps when clipboard mixes locales)
string flipped = s.Contains(",") ? s.Replace(",", ".") : s.Replace(".", ",");
if (decimal.TryParse(flipped, NumberStyles.Number, CultureInfo.CurrentCulture, out value)) return true;
if (decimal.TryParse(flipped, NumberStyles.Number, CultureInfo.InvariantCulture, out value)) return true;
value = 0m;
return false;
}
private static bool TryParseIntFlexible(string s, out int value)
{
s = (s ?? "").Trim();
// Extract leading integer if something like "12 pcs"
var digits = new string(s.TakeWhile(ch => char.IsDigit(ch) || ch == '-' || ch == '+').ToArray());
if (string.IsNullOrEmpty(digits)) digits = s;
return int.TryParse(digits, NumberStyles.Integer, CultureInfo.CurrentCulture, out value)
|| int.TryParse(digits, NumberStyles.Integer, CultureInfo.InvariantCulture, out value);
}
#endregion
}
}

View File

@ -12,6 +12,8 @@ using Xceed.Wpf.Toolkit;
using bsmd.database;
using ENI2.Util;
using System.Windows.Data;
using System.Xml.Linq;
namespace ENI2.Controls
{
@ -47,6 +49,12 @@ namespace ENI2.Controls
cancelButton.Click += (s, e) => { if (this.IsModal()) DialogResult = false; CancelClicked?.Invoke(); this.Close(); };
addButton.Click += (s, e) => AddClicked?.Invoke();
this.Closing += Window_Closing;
SettingBindingExtension stBinding = new SettingBindingExtension("W1Top");
BindingOperations.SetBinding(this, Window.TopProperty, stBinding);
SettingBindingExtension slBinding = new SettingBindingExtension("W1Left");
BindingOperations.SetBinding(this, Window.LeftProperty, slBinding);
};
}
@ -55,10 +63,17 @@ namespace ENI2.Controls
get { var addButton = (Button)Template.FindName("buttonAdd", this); return addButton.Visibility == Visibility.Visible; }
set
{
var addButton = (Button)Template.FindName("buttonAdd", this); addButton.Visibility = value ? Visibility.Visible : Visibility.Hidden;
var addButton = (Button)Template.FindName("buttonAdd", this);
if (addButton != null)
{
addButton.Visibility = value ? Visibility.Visible : Visibility.Hidden;
}
var okButton = (Button)Template.FindName("buttonOK", this);
if (okButton.Visibility == Visibility.Hidden)
okButton.Width = 1; // we are in a DockPanel, try to collapse okButton to place addButton more to the right
if (okButton != null)
{
if (okButton.Visibility == Visibility.Hidden)
okButton.Width = 1; // we are in a DockPanel, try to collapse okButton to place addButton more to the right
}
}
}
@ -109,6 +124,7 @@ namespace ENI2.Controls
thePicker.Value = new DateTime(year, month, day, hour, minute, 0);
}
catch (FormatException) { }
catch (ArgumentOutOfRangeException) { thePicker.Value = null; }
}
}
@ -121,10 +137,11 @@ namespace ENI2.Controls
string timevalText = rd.Match(thePicker.Text).Captures[0].Value;
int day = Int32.Parse(timevalText.Substring(0, 2));
int month = Int32.Parse(timevalText.Substring(2, 2));
int year = Int32.Parse(timevalText.Substring(4, 4));
int year = Int32.Parse(timevalText.Substring(4, 4));
thePicker.SelectedDate = new DateTime(year, month, day, 0, 0, 0);
}
catch (FormatException) { }
catch (ArgumentOutOfRangeException) { thePicker.SelectedDate = null; }
}
}

View File

@ -79,6 +79,11 @@ namespace ENI2.Controls
portName = LocodeDB.PortNameFromLocode(value); break;
case RuleEngine.LocodeMode.SSN:
portName = LocodeDB.SSNPortNameFromLocode(value); break;
case RuleEngine.LocodeMode.OLD:
portName = LocodeDB.PortNameFromLocode(value);
if ((portName == null) && value.Equals("DEWHV"))
portName = "Stadthafen Wilhelmshaven";
break;
}
LocodeState locodeState = portName.IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK;
this.SetLocodeStateImage(this.imageLocodeState, locodeState);
@ -164,6 +169,18 @@ namespace ENI2.Controls
portname = LocodeDB.PortNameFromLocode(directLocode); break;
case RuleEngine.LocodeMode.SSN:
portname = LocodeDB.SSNPortNameFromLocode(directLocode); break;
case RuleEngine.LocodeMode.OLD:
{
if (directLocode.Equals("DEWHV"))
{
portname = "Stadthafen Wilhelmshaven";
}
else
{
portname = LocodeDB.PortNameFromLocode(directLocode);
}
}
break;
}
bool isLocode = !portname.IsNullOrEmpty();
@ -191,6 +208,8 @@ namespace ENI2.Controls
locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(lookupString); break;
case RuleEngine.LocodeMode.SSN:
locodeEntries = LocalizedLookup.SSNAllLocodesForCityNameAsEntries(lookupString); break;
case RuleEngine.LocodeMode.OLD:
locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(lookupString); break;
}
locodeEntries.Sort();

View File

@ -0,0 +1,118 @@
<UserControl x:Class="ENI2.Controls.MaerskListControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:util="clr-namespace:ENI2.Util"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:col="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:local="clr-namespace:ENI2.Controls"
xmlns:db="clr-namespace:bsmd.database;assembly=bsmd.database"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="900">
<UserControl.Resources>
<col:ArrayList x:Key="arrList">
<col:DictionaryEntry Key="None" Value="0" />
<col:DictionaryEntry Key="Maersk BRV/WHV" Value="1" />
<col:DictionaryEntry Key="SeaGo BHV" Value="2" />
<col:DictionaryEntry Key="SeaGo WHV" Value="4" />
</col:ArrayList>
</UserControl.Resources>
<GroupBox Name="groupBoxRP" Header="{x:Static p:Resources.textPOLists}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="40" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="80" />
</Grid.ColumnDefinitions>
<Label Content="From" Grid.Column="0" />
<DatePicker x:Name="dateTimePickerFrom" Margin="2" Grid.Column="1" SelectedDateChanged="dateTimePickerFrom_SelectedDateChanged"/>
<Label Content="To" Grid.Column="2" />
<DatePicker x:Name="dateTimePickerTo" Margin="2" Grid.Column="3" SelectedDateChanged="dateTimePickerFrom_SelectedDateChanged"/>
<Button x:Name="buttonLoad" Grid.Column="4" Content="Load" Margin="2" Click="buttonLoad_Click" />
<!--Button x:Name="buttonSave" Grid.Column="5" Content="Save" Margin="2" Click="buttonSave_Click" /-->
<Button x:Name="buttonRequestIds" Grid.Column="6" Content="Request marked Ids" Margin="2" Click="buttonRequestIds_Click" />
<Button x:Name="buttonRequestPlus3" Grid.Column="7" Content="Request +4" Margin="2" Click="buttonRequestIds_Click" />
<Button x:Name="buttonImport" Grid.Column="9" Margin="2" Content="Import" Click="buttonImport_Click" />
<Button x:Name="buttonExport" Grid.Column="10" Margin="2" Content="Export" Click="buttonExport_Click" />
<local:BusyControl x:Name="busyControl" Grid.Column="5" />
</Grid>
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridPOCores" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Extended" AutoGenerateColumns="False" CellEditEnding="dataGridPOCores_CellEditEnding" CanUserAddRows="False"
MouseDoubleClick="dataGridPOCores_MouseDoubleClick">
<local:ENIDataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.ID}">
<Setter Property="Background" Value="LightGreen"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.NO_ID}">
<Setter Property="Background" Value="LightPink"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.UPDATED}">
<Setter Property="Background" Value="LightYellow"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.NO_ETA}">
<Setter Property="Background" Value="LightCoral"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.REQUESTING_ID}">
<Setter Property="Background" Value="Yellow"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.ID_ASSIGNED}">
<Setter Property="Background" Value="GreenYellow"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.NO_ID_AND_DUE}">
<Setter Property="Background" Value="Red"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.CANCELLED}">
<Setter Property="Foreground" Value="DarkGray"/>
</DataTrigger>
</Style.Triggers>
</Style>
</local:ENIDataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="Status" Binding="{Binding Status}" IsReadOnly="True" />
<DataGridTextColumn Header="ETA" Binding="{Binding ColA}" IsReadOnly="True" />
<DataGridTextColumn Header="ETD" Binding="{Binding ColB}" IsReadOnly="True" />
<DataGridTextColumn Header="Rotation name" Binding="{Binding ColC}" IsReadOnly="True" />
<DataGridTextColumn Header="Vessel code" Binding="{Binding ColD}" IsReadOnly="True" />
<DataGridTextColumn Header="Vessel name" Binding="{Binding ColE}" IsReadOnly="True" />
<DataGridTextColumn Header="IMO" Binding="{Binding ColF}" IsReadOnly="True" />
<DataGridTextColumn Header="Arr voy" Binding="{Binding ColG}" IsReadOnly="True" />
<DataGridTextColumn Header="Dep voy" Binding="{Binding ColH}" IsReadOnly="True" />
<DataGridTextColumn Header="Terminal name" Binding="{Binding ColI}" IsReadOnly="True" />
<DataGridTextColumn Header="Operator code" Binding="{Binding ColJ}" IsReadOnly="True" />
<DataGridTextColumn Header="Pro arr" Binding="{Binding ColK}" IsReadOnly="True" />
<DataGridTextColumn Header="Pro dep" Binding="{Binding ColL}" IsReadOnly="True" />
<DataGridTextColumn Header="Id" Binding="{Binding ColM}" IsReadOnly="True" />
<DataGridTextColumn Header="Remark" Binding="{Binding Remark, Mode=TwoWay}" x:Name="gridColumnRemark" />
<!--DataGridTextColumn x:Name="gridColumnPONumber" Header="PO number" Binding="{Binding PONumber, Mode=TwoWay}" IsReadOnly="False" /-->
<!--DataGridComboBoxColumn x:Name="gridColumnGroup" Header="Group" IsReadOnly="False" SelectedValueBinding="{Binding Flags, Mode=TwoWay}"
ItemsSource="{StaticResource arrList}" DisplayMemberPath="Key" SelectedValuePath="Value">
</DataGridComboBoxColumn-->
<!--DataGridTextColumn Header="ETA" Binding="{Binding ETA_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" /-->
<!--DataGridTextColumn x:Name="gridColumnATA" Header="ATA" Binding="{Binding POATA, StringFormat=\{0:dd.MM.yyyy\}, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="False" /-->
<!--DataGridTextColumn Header="ATD" Binding="{Binding ATD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" /-->
</DataGrid.Columns>
</local:ENIDataGrid>
</Grid>
</GroupBox>
</UserControl>

View File

@ -0,0 +1,634 @@
// Copyright (c) 2017 / 2023 schick Informatik
// Description: Request dbh ids for Maersk data lists
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Win32;
using bsmd.database;
using ExcelDataReader;
using System.Collections.ObjectModel;
using ENI2.Excel;
using ENI2.Locode;
using ENI2.Util;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace ENI2.Controls
{
/// <summary>
/// Interaction logic for MaerskListControl.xaml
/// </summary>
public partial class MaerskListControl : UserControl
{
#region Fields
private readonly ObservableCollection<MaerskData> maerskDataList = new ObservableCollection<MaerskData>();
private readonly DatabaseEntityWatchdog _dbWatchDog;
#endregion
#region Construction
public MaerskListControl()
{
InitializeComponent();
Loaded += POList_Loaded;
this.dateTimePickerFrom.SelectedDate = DateTime.Today.AddDays(-14);
this.dateTimePickerTo.SelectedDate = DateTime.Today.AddDays(14);
this._dbWatchDog = new DatabaseEntityWatchdog();
this._dbWatchDog.DatabaseEntityChanged += _dbWatchDog_DatabaseEntityChanged;
this._dbWatchDog.VisitTransitIdUpdated += _dbWatchDog_VisitTransitIdUpdated;
}
#endregion
#region Events
public delegate void DateChanged(DateTime date);
public event DateChanged FromDateChanged;
public event DateChanged ToDateChanged;
#endregion
#region DB Watchdog
private async void _dbWatchDog_VisitTransitIdUpdated(DatabaseEntity entity)
{
if (entity is MessageCore core)
{
foreach (MaerskData md in this.maerskDataList)
{
if ((md.MessageCore != null) && (md.MessageCore.Id == core.Id))
{
md.MessageCore = core;
md.Status = MaerskData.MDStatus.ID;
md.ColM = core.VisitId;
if (core.PoC.Equals("DEBRE") && md.ColJ.Equals("MSK"))
core.Flags = 1;
if (core.PoC.Equals("DEWVN") && md.ColJ.Equals("MSK"))
core.Flags = 1;
if (core.PoC.Equals("DEBRE") && md.ColJ.Equals("SGL"))
core.Flags = 2;
if (core.PoC.Equals("DEWVN") && md.ColJ.Equals("SGL"))
core.Flags = 3;
await DBManagerAsync.SaveAsync(core);
await DBManagerAsync.SaveAsync(md);
_dbWatchDog.UnRegister(core);
this.Dispatcher.Invoke(() =>
{
this.dataGridPOCores.Items.Refresh();
if(_dbWatchDog.Idle)
busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL;
});
}
}
}
}
private void _dbWatchDog_DatabaseEntityChanged(DatabaseEntity entity)
{
if (entity is MessageCore core)
System.Diagnostics.Trace.WriteLine($"Core state changed to {core.BSMDStatusInternal}");
}
#endregion
#region Properties
/// <summary>
/// Locode of the port that is concerned by this import list. Is to be set in the surrounding container:
/// </summary>
public string PortLocode { get; set; }
/// <summary>
/// synchronize selection props
/// </summary>
public DateTime? FromDate {
get { return this.dateTimePickerFrom.SelectedDate; }
set { this.dateTimePickerFrom.SelectedDate = value; }
}
/// <summary>
/// synchronize selection props
/// </summary>
public DateTime? ToDate
{
get { return this.dateTimePickerTo.SelectedDate; }
set { this.dateTimePickerTo.SelectedDate = value; }
}
#endregion
#region events
public event MessageCore.MessageCoreSelectedHandler MessageCoreSelected;
#endregion
#region control event handler
private void POList_Loaded(object sender, RoutedEventArgs e)
{
dataGridPOCores.ItemsSource = maerskDataList;
}
private async void dataGridPOCores_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (e.EditAction == DataGridEditAction.Commit)
{
if (e.Column == gridColumnRemark)
{
MaerskData maerskData = this.maerskDataList[e.Row.GetIndex()];
var el = e.EditingElement as System.Windows.Controls.TextBox;
if (el.Text.Length > 100)
{
el.Text = el.Text.Trim().Substring(0, 100);
}
maerskData.Remark = el.Text;
if (maerskData.MessageCore != null)
await DBManagerAsync.SaveAsync(maerskData);
}
/*
if(e.Column == gridColumnGroup)
{
var el = e.EditingElement as ComboBox;
DictionaryEntry selectedItem = (DictionaryEntry) el.SelectedItem;
MessageCore.CoreFlags coreFlag = (MessageCore.CoreFlags) Enum.Parse(typeof(MessageCore.CoreFlags), selectedItem.Value.ToString());
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
// clear all first
editedCore.SetFlag(false, MessageCore.CoreFlags.MAERSK_BHV);
editedCore.SetFlag(false, MessageCore.CoreFlags.SEAGO_BHV);
editedCore.SetFlag(false, MessageCore.CoreFlags.SEAGO_WHV);
editedCore.SetFlag(false, MessageCore.CoreFlags.HOEGH);
if (coreFlag != MessageCore.CoreFlags.NONE)
{
editedCore.SetFlag(true, coreFlag);
}
// buttonSaveChanges.IsEnabled = true;
editedCore.IsDirty = true;
}
if(e.Column == gridColumnATA)
{
var el = e.EditingElement as System.Windows.Controls.TextBox;
if(DateTime.TryParse(el.Text, out DateTime localATA))
{
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
editedCore.ATA = DateTime.SpecifyKind(localATA, DateTimeKind.Local).ToUniversalTime();
// buttonSaveChanges.IsEnabled = true;
editedCore.IsDirty = true;
}
else
{
el.Text = string.Empty;
e.Cancel = true;
}
}
*/
}
}
#endregion
#region private methods
/// <summary>
/// "Status" of a Maersk Data element is a momentary evaluation that is relevant for display purposes only
/// It is not saved
/// </summary>
private void UpdateStatus(MaerskData md)
{
// here we set the following: NO_ID, NO_ID_AND_DUE, ID, NO_ETA and DONE
// the other status are set during active processing
if(md.ETA.HasValue)
{
if((md.ETA.Value - DateTime.Now).TotalSeconds > 0) // future
{
if(!md.ColM.IsNullOrEmpty() || ((md.MessageCore != null) && (!md.MessageCore.VisitId.IsNullOrEmpty())))
{
md.Status = MaerskData.MDStatus.ID;
}
else
{
if(md.ETA.Value.IsNextXDays(4))
{
md.Status = MaerskData.MDStatus.NO_ID_AND_DUE;
}
else
{
md.Status = MaerskData.MDStatus.NO_ID;
}
}
}
else // past
{
md.Status = MaerskData.MDStatus.DONE;
}
}
else
{
// no ETA means done
md.Status = MaerskData.MDStatus.NO_ETA;
}
// if there is an declaration and it has been cancelled.. override the state to CANCELLED
if (md.MessageCore != null && (md.MessageCore.Cancelled ?? false))
md.Status = MaerskData.MDStatus.CANCELLED;
}
private async void PerformSearch()
{
busyControl.BusyState = Util.UIHelper.BusyStateEnum.BUSY;
Dictionary<MessageCore.SearchFilterType, string> filterDict = new Dictionary<MessageCore.SearchFilterType, string>();
// Die Suche findet in dem eingestellten Intervall statt
uint from = this.dateTimePickerFrom.SelectedDate.Value.ToUniversalTime().ToUnixTimeStamp();
DateTime toDate = this.dateTimePickerTo.SelectedDate.Value.ToUniversalTime().Add(new TimeSpan(23, 59, 59));
uint to = toDate.ToUnixTimeStamp();
filterDict.Add(MessageCore.SearchFilterType.FILTER_ETA, string.Format("{0}:{1}", from.ToString() ?? "", to.ToString() ?? ""));
// suche auslösen
List<MessageCore> searchResult = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict);
// alle anderen Häfen weg
searchResult.RemoveAll(item => (item.PoC == null) || (!item.PoC.Equals(PortLocode)));
// alles entfernen was keine Maersk Xtra-Data hat (=noch nicht schon einmal importiert wurde)
foreach(MessageCore core in searchResult)
{
MaerskData md = await DBManagerAsync.LoadMaerskDataForCoreAsync(core.Id.Value);
if(md != null)
{
md.MessageCore = core;
md.MessageCoreId = core.Id.Value;
this.UpdateStatus(md);
if (!maerskDataList.Contains(md)) // DatabaseEntity implements IEquatable
{
this.maerskDataList.Add(md);
if(!core.VisitId.IsNullOrEmpty() && md.ColM.IsNullOrEmpty())
{
md.ColM = core.VisitId; // this can happen if client is closed before an Id has been returned, so we have to manually set it here
Task<int> saveResult = DBManagerAsync.SaveAsync(md); // actually we do not need to await this
}
}
}
}
this.TimeFilterItemSource();
this.dataGridPOCores.SelectedItem = null;
busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL;
}
private void TimeFilterItemSource()
{
List<MaerskData> removeList = new List<MaerskData>();
foreach (MaerskData md in this.maerskDataList)
{
if (md.ETA.HasValue)
{
if (this.dateTimePickerFrom.SelectedDate.HasValue && (md.ETA.Value < this.dateTimePickerFrom.SelectedDate.Value))
removeList.Add(md);
if (this.dateTimePickerTo.SelectedDate.HasValue) {
DateTime toDate = this.dateTimePickerTo.SelectedDate.Value.ToUniversalTime().Add(new TimeSpan(23, 59, 59));
if(md.ETA.Value > toDate)
removeList.Add(md);
}
}
}
foreach (MaerskData md in removeList)
this.maerskDataList.Remove(md);
}
#endregion
#region button event handler
private void buttonLoad_Click(object sender, RoutedEventArgs e)
{
Util.UIHelper.SetBusyState();
this.PerformSearch();
}
private async void buttonImport_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog
{
Filter = "Excel Files|*.xls;*.xlsx"
};
if (ofd.ShowDialog() ?? false)
{
FileStream stream;
try
{
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream))
{
List<MaerskData> importData = new List<MaerskData>();
bool isFirstRow = true;
int currentRow = 0;
bool imosAreOkay = true;
try
{
while (reader.Read())
{
currentRow++;
if (isFirstRow)
{
isFirstRow = false; // this must be a header row, skip
continue;
}
if (reader.FieldCount < 13)
{
throw new InvalidDataException("Sheet must have 13 columns of data");
}
MaerskData md = new MaerskData();
if (!reader.IsDBNull(0))
{
if (reader.GetFieldType(0) == typeof(DateTime))
{
md.ETA = reader.GetDateTime(0);
md.ColA = md.ETA.ToString();
}
else
{
md.ColA = reader.GetString(0);
if (DateTime.TryParse(md.ColA, out DateTime aDateTime))
md.ETA = aDateTime;
}
}
if (!reader.IsDBNull(1)) md.ColB = reader.ReadAsString(1);
if (!reader.IsDBNull(2)) md.ColC = reader.ReadAsString(2);
if (!reader.IsDBNull(3)) md.ColD = reader.ReadAsString(3);
if (!reader.IsDBNull(4)) md.ColE = reader.ReadAsString(4);
if (!reader.IsDBNull(5)) md.ColF = reader.ReadAsString(5);
if (!reader.IsDBNull(6)) md.ColG = reader.ReadAsString(6);
if (!reader.IsDBNull(7)) md.ColH = reader.ReadAsString(7);
if (!reader.IsDBNull(8)) md.ColI = reader.ReadAsString(8);
if (md.ColI != null)
{
if ((md.ColI.Contains("bremerhaven", StringComparison.OrdinalIgnoreCase) && this.PortLocode.Equals("DEWVN")) ||
(md.ColI.Contains("eurogate", StringComparison.OrdinalIgnoreCase) && this.PortLocode.Equals("DEBRV")))
throw new InvalidOperationException($"{md.ColI} found in import to {PortLocode}, this is probably an error. Aborting import");
}
if (!reader.IsDBNull(9)) md.ColJ = reader.ReadAsString(9);
if (md.ColJ == null) continue;
if (!(md.ColJ.Equals("msk", StringComparison.OrdinalIgnoreCase) || md.ColJ.Equals("sgl", StringComparison.OrdinalIgnoreCase))) continue; // skip operator we are not interested in
if (!reader.IsDBNull(10)) md.ColK = reader.ReadAsString(10);
if (!reader.IsDBNull(11)) md.ColL = reader.ReadAsString(11);
if (!reader.IsDBNull(12)) md.ColM = reader.ReadAsString(12);
if (!reader.IsDBNull(13)) md.Remark = reader.ReadAsString(13);
if(!md.ColF.IsNullOrEmpty())
{
if (Int32.TryParse(md.ColF, out int imo))
{
if ((imo < 1000000) || (imo > 9999999))
{
imosAreOkay = false;
}
}
else
{
imosAreOkay = false;
}
}
else
{
imosAreOkay = false;
}
if (!imosAreOkay)
{
MessageBox.Show($"Invalid IMO in row {currentRow}, aborting import", Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
break;
}
importData.Add(md);
if (isFirstRow) isFirstRow = false;
}
}
catch (Exception ex)
{
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
}
if (imosAreOkay && importData.Count > 0)
{
busyControl.BusyState = Util.UIHelper.BusyStateEnum.BUSY;
foreach (MaerskData md in importData)
{
if (this.maerskDataList.Contains(md))
{
// update record with imported record
MaerskData foundData = this.maerskDataList.First((m) => (m.ColF != null) ? m.ColF.Equals(md.ColF) : (md.ColF == null) &&
(m.ColG != null) ? m.ColG.Equals(md.ColG) : (md.ColG == null) &&
(m.ColH != null) ? m.ColH.Equals(md.ColH) : (md.ColH == null));
if ((foundData.MessageCore == null) || !(foundData.MessageCore.Cancelled ?? false))
{
if (foundData.ETA.HasValue && ((foundData.ETA.Value - DateTime.Now).TotalSeconds > 0) && foundData.Update(md))
foundData.Status = MaerskData.MDStatus.UPDATED;
}
}
else
{
if (!md.ColM.IsNullOrEmpty())
{
md.MessageCore = await DBManagerAsync.LoadCoreByVisitIdAsync(md.ColM);
if (md.MessageCore != null)
{
MaerskData existingMD = await DBManagerAsync.LoadMaerskDataForCoreAsync(md.MessageCore.Id.Value);
if(existingMD == null)
{
// we have a core but no MarskData for this import -> save it
md.MessageCoreId = (Guid) md.MessageCore.Id;
_ = DBManagerAsync.SaveAsync(md);
}
else
{
existingMD.Update(md);
_ = DBManagerAsync.SaveAsync(existingMD);
this.UpdateStatus(existingMD);
maerskDataList.Add(existingMD);
continue; // add existing instead of new one
}
}
}
this.UpdateStatus(md);
maerskDataList.Add(md);
}
}
this.TimeFilterItemSource();
busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL;
this.dataGridPOCores.Items.Refresh();
}
}
stream.Close();
}
}
private void buttonExport_Click(object sender, RoutedEventArgs e)
{
// Export of the current collection
string predefFilename = string.Format("{0}_{1}.xlsx", this.PortLocode, DateTime.Today.ToString("yyyyMMdd"));
SaveFileDialog sfd = new SaveFileDialog()
{
Filter = "Excel Files|*.xlsx;*.xls",
FileName = predefFilename
};
if(sfd.ShowDialog() ?? false)
{
Util.UIHelper.SetBusyState();
ExcelManager em = new ExcelManager();
try
{
List<MaerskData> exportList = new List<MaerskData>(this.maerskDataList);
em.ExportMaersk(exportList, sfd.FileName);
Process.Start(sfd.FileName);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Export failed", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
private async void buttonRequestIds_Click(object sender, RoutedEventArgs e)
{
// find all entries from now until 4 days into the future and track parallel requests
List<MaerskData> requestList = new List<MaerskData>();
if (sender == this.buttonRequestIds)
{
foreach (MaerskData md in this.dataGridPOCores.SelectedItems)
{
if (md.MessageCore?.VisitId.IsNullOrEmpty() == false) continue; // already requested
if (md.ColM?.IsNullOrEmpty() == false) continue; // already something there
requestList.Add(md);
}
}
if(sender == this.buttonRequestPlus3)
{
foreach(MaerskData md in this.maerskDataList)
{
if(((md.MessageCore == null) && md.ColM.IsNullOrEmpty()) ||
((md.MessageCore != null) && md.MessageCore.VisitId.IsNullOrEmpty()))
{
if (md.ETA.HasValue && md.ETA.Value.IsNextXDays(4))
requestList.Add(md);
}
}
}
if(requestList.Count == 0)
{
MessageBox.Show("No valid rows selected", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation);
}
else
{
busyControl.BusyState = Util.UIHelper.BusyStateEnum.BUSY;
foreach (MaerskData md in requestList)
{
md.Status = MaerskData.MDStatus.REQUESTING_ID;
// create MessageCore and message classes
md.MessageCore = new MessageCore();
md.MessageCore.InitialHIS = Message.NSWProvider.DBH_MAERSK;
md.MessageCore.IMO = md.ColF;
md.MessageCore.ETA = md.ETA;
md.MessageCore.IsTransit = false;
md.MessageCore.PoC = this.PortLocode;
md.MessageCore.Portname = LocodeDB.PortNameFromLocode(md.MessageCore.PoC);
md.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
md.MessageCore.Incoming = true;
md.MessageCore.DefaultReportingPartyId = App.UserId.Value;
await DBManagerAsync.SaveAsync(md.MessageCore);
md.MessageCoreId = md.MessageCore.Id.Value;
await DBManagerAsync.SaveAsync(md);
// Meldeklassen für neuen Anlauf erzeugen
// TODO: pre-set certain fields taken from Maersk data
await bsmd.database.Util.CreateMessagesForCoreAsync(md.MessageCore, null);
// watchdog registrieren
this._dbWatchDog.Register(md.MessageCore);
}
}
this.dataGridPOCores.Items.Refresh();
}
#endregion
#region grid event handler
private void dataGridPOCores_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (sender != null)
{
DataGrid grid = sender as DataGrid;
if (grid?.SelectedItems?.Count == 1)
{
MaerskData md = grid.SelectedItem as MaerskData;
if(md.MessageCore != null) {
Util.UIHelper.SetBusyState();
this.MessageCoreSelected?.Invoke(md.MessageCore, DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].ShipcallDisplayMode);
}
}
}
}
#endregion
#region DateTime picker event handler
private void dateTimePickerFrom_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
if (sender == dateTimePickerFrom)
this.FromDateChanged?.Invoke(dateTimePickerFrom.SelectedDate.Value);
if (sender == dateTimePickerTo)
this.ToDateChanged?.Invoke(dateTimePickerTo.SelectedDate.Value);
}
#endregion
}
}

View File

@ -0,0 +1,24 @@
<UserControl x:Class="ENI2.Controls.MaerskOverviewControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ENI2.Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="Maersk lists" />
<TabControl x:Name="tabControlMaersk" Grid.Row="1">
<TabItem Name="tabItemBRV" Header="DEBRV">
<local:MaerskListControl x:Name="brvListControl" />
</TabItem>
<TabItem Name="tabItemWVN" Header="DEWVN">
<local:MaerskListControl x:Name="wvnListControl" />
</TabItem>
</TabControl>
</Grid>
</UserControl>

View File

@ -0,0 +1,51 @@
using System.Collections.Generic;
using System.Windows.Controls;
namespace ENI2.Controls
{
/// <summary>
/// Interaction logic for MaerskOverviewControl.xaml
/// </summary>
public partial class MaerskOverviewControl : UserControl
{
public MaerskOverviewControl()
{
InitializeComponent();
this.brvListControl.PortLocode = "DEBRV";
this.wvnListControl.PortLocode = "DEWVN";
this.brvListControl.FromDateChanged += BrvListControl_FromDateChanged;
this.brvListControl.ToDateChanged += BrvListControl_ToDateChanged;
this.wvnListControl.FromDateChanged += WvnListControl_FromDateChanged;
this.wvnListControl.ToDateChanged += WvnListControl_ToDateChanged;
}
private void WvnListControl_ToDateChanged(System.DateTime date)
{
this.brvListControl.ToDate = date;
}
private void WvnListControl_FromDateChanged(System.DateTime date)
{
this.brvListControl.FromDate = date;
}
private void BrvListControl_ToDateChanged(System.DateTime date)
{
this.wvnListControl.ToDate = date;
}
private void BrvListControl_FromDateChanged(System.DateTime date)
{
this.wvnListControl.FromDate = date;
}
public List<MaerskListControl> ListControls
{
get
{
return new List<MaerskListControl>() { this.brvListControl, this.wvnListControl };
}
}
}
}

View File

@ -1,56 +0,0 @@
<UserControl x:Class="ENI2.Controls.POListControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:util="clr-namespace:ENI2.Util"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:col="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:local="clr-namespace:ENI2.Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<col:ArrayList x:Key="arrList">
<col:DictionaryEntry Key="None" Value="0" />
<col:DictionaryEntry Key="Maersk BRV/WHV" Value="1" />
<col:DictionaryEntry Key="SeaGo BHV" Value="2" />
<col:DictionaryEntry Key="SeaGo WHV" Value="4" />
</col:ArrayList>
</UserControl.Resources>
<GroupBox Name="groupBoxRP" Header="{x:Static p:Resources.textPOLists}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Label Content="Calendar week" />
<xctk:DoubleUpDown x:Name="doubleUpDownCalendarWeek" VerticalContentAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Stretch" Margin="2" Value="01" ValueChanged="doubleUpDownCalendarWeek_ValueChanged"/>
<Label Content="Type" />
<ComboBox x:Name="comboBoxFilterType" Margin="2" SelectionChanged="comboBoxFilterType_SelectionChanged" Width="100" />
<Button x:Name="buttonExcelExport" Margin="2" Click="buttonExcelExport_Click" Content="Export Excel" Width="100" />
<Button x:Name="buttonSaveChanges" Margin="2" Click="buttonSaveChanges_Click" Content="Save changes" Width="100" IsEnabled="False" />
</StackPanel>
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridPOCores" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" CellEditEnding="dataGridPOCores_CellEditEnding" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTextColumn Header="IMO/ENI" Binding="{Binding IMOENIDisplay}" IsReadOnly="True" />
<DataGridTextColumn x:Name="gridColumnPONumber" Header="PO number" Binding="{Binding PONumber, Mode=TwoWay}" IsReadOnly="False" />
<DataGridComboBoxColumn x:Name="gridColumnGroup" Header="Group" IsReadOnly="False" SelectedValueBinding="{Binding Flags, Mode=TwoWay}"
ItemsSource="{StaticResource arrList}" DisplayMemberPath="Key" SelectedValuePath="Value">
</DataGridComboBoxColumn>
<DataGridTextColumn Header="Ship name" Binding="{Binding Shipname}" IsReadOnly="True" />
<DataGridTextColumn Header="ETA" Binding="{Binding ETA_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
<DataGridTextColumn Header="ETD" Binding="{Binding ETD_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
<DataGridTextColumn x:Name="gridColumnATA" Header="ATA" Binding="{Binding POATA, StringFormat=\{0:dd.MM.yyyy\}, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="False" />
<DataGridTextColumn Header="ATD" Binding="{Binding ATD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
<DataGridTextColumn Header="Hafen" Binding="{Binding PortnameDisplay}" IsReadOnly="True" />
<DataGridTextColumn Header="Id" Binding="{Binding DisplayId}" IsReadOnly="True" />
</DataGrid.Columns>
</local:ENIDataGrid>
</Grid>
</GroupBox>
</UserControl>

View File

@ -1,278 +0,0 @@
// Copyright (c) 2017 schick Informatik
// Description: PO Nummer Übersicht. Ergänzung Nummern. Excel Export
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Win32;
using Microsoft.Office.Interop.Excel;
using System.Runtime.InteropServices;
using bsmd.database;
namespace ENI2.Controls
{
/// <summary>
/// Interaction logic for POListControl.xaml
/// </summary>
public partial class POListControl : UserControl
{
#region Fields
private readonly string[] _comboBoxEntries =
{
"All",
"Maersk BRV/WHV",
"SeaGo BHV",
"SeaGo WHV"
};
private List<MessageCore> searchResult = new List<MessageCore>();
private readonly List<MessageCore> filteredResult = new List<MessageCore>();
#endregion
#region Construction
public POListControl()
{
InitializeComponent();
Loaded += POList_Loaded;
}
#endregion
#region control event handler
private void POList_Loaded(object sender, RoutedEventArgs e)
{
this.comboBoxFilterType.ItemsSource = this._comboBoxEntries;
this.doubleUpDownCalendarWeek.Value = bsmd.database.Util.GetIso8601WeekOfYear(DateTime.Now);
this.dataGridPOCores.ItemsSource = this.filteredResult;
}
private void buttonExcelExport_Click(object sender, RoutedEventArgs e)
{
if (this.filteredResult.Count == 0) return;
OpenFileDialog ofd = new OpenFileDialog
{
Filter = "Excel Files|*.xls;*.xlsx"
};
if (ofd.ShowDialog() ?? false)
{
try
{
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
excelApp.DisplayAlerts = false;
Workbook workBook = excelApp.Workbooks.Open(ofd.FileName);
Worksheet workSheet = workBook.Worksheets[1];
int rowIndex = 3;
foreach(MessageCore core in this.filteredResult)
{
workSheet.Cells[rowIndex, 7].Value = core.Shipname;
workSheet.Cells[rowIndex, 10].Value = core.PoC.Substring(2);
if(core.POATA.HasValue)
workSheet.Cells[rowIndex, 11].Value = core.POATA.Value.ToShortDateString();
workSheet.Cells[rowIndex, 13].Value = core.PONumber;
rowIndex++;
}
workBook.Save();
workBook.Close();
Marshal.ReleaseComObject(workBook);
excelApp.Quit();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
}
}
private void buttonSaveChanges_Click(object sender, RoutedEventArgs e)
{
foreach(MessageCore messageCore in this.filteredResult)
{
if (messageCore.IsDirty)
{
DBManager.Instance.Save(messageCore);
messageCore.IsDirty = false;
// load ATA for this Core
/* DAS ATA WIRD JETZT NICHT MEHR IN DIE MELDEKLASSE GESPEICHERT
Message ataMessage = DBManager.Instance.GetMessage(messageCore, Message.NotificationClass.ATA);
if(ataMessage?.Elements.Count == 1)
{
if(messageCore.ATA != ((ATA)ataMessage.Elements[0]).ATAPortOfCall)
{
((ATA)ataMessage.Elements[0]).ATAPortOfCall = messageCore.ATA;
DBManager.Instance.Save(ataMessage.Elements[0]);
}
}
*/
}
}
this.buttonSaveChanges.IsEnabled = false;
}
private void doubleUpDownCalendarWeek_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (!this.IsLoaded) return;
this.comboBoxFilterType.SelectedIndex = -1;
this.PerformSearch();
}
private void comboBoxFilterType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.dataGridPOCores.ItemsSource = null;
if (this.comboBoxFilterType.SelectedIndex == -1) return;
this.filteredResult.Clear();
foreach (MessageCore core in this.searchResult)
{
switch (this.comboBoxFilterType.SelectedIndex)
{
case 0: this.filteredResult.Add(core); break;
case 1: if (core.IsFlagSet(MessageCore.CoreFlags.MAERSK_BHV)) this.filteredResult.Add(core); break;
case 2: if (core.IsFlagSet(MessageCore.CoreFlags.SEAGO_BHV)) this.filteredResult.Add(core); break;
case 3: if (core.IsFlagSet(MessageCore.CoreFlags.SEAGO_WHV)) this.filteredResult.Add(core); break;
case 4: if (core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.filteredResult.Add(core); break;
}
}
this.dataGridPOCores.ItemsSource = this.filteredResult;
}
private void dataGridPOCores_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (e.EditAction == DataGridEditAction.Commit)
{
if (e.Column == gridColumnPONumber)
{
// validate for "true" number
var el = e.EditingElement as System.Windows.Controls.TextBox;
if (!el.Text.IsDigitsOnly())
{
el.Text = string.Empty;
e.Cancel = true;
}
else
{
buttonSaveChanges.IsEnabled = true;
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
editedCore.IsDirty = true;
}
}
if(e.Column == gridColumnGroup)
{
var el = e.EditingElement as ComboBox;
DictionaryEntry selectedItem = (DictionaryEntry) el.SelectedItem;
MessageCore.CoreFlags coreFlag = (MessageCore.CoreFlags) Enum.Parse(typeof(MessageCore.CoreFlags), selectedItem.Value.ToString());
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
// clear all first
editedCore.SetFlag(false, MessageCore.CoreFlags.MAERSK_BHV);
editedCore.SetFlag(false, MessageCore.CoreFlags.SEAGO_BHV);
editedCore.SetFlag(false, MessageCore.CoreFlags.SEAGO_WHV);
editedCore.SetFlag(false, MessageCore.CoreFlags.HOEGH);
if (coreFlag != MessageCore.CoreFlags.NONE)
{
editedCore.SetFlag(true, coreFlag);
}
buttonSaveChanges.IsEnabled = true;
editedCore.IsDirty = true;
}
if(e.Column == gridColumnATA)
{
var el = e.EditingElement as System.Windows.Controls.TextBox;
if(DateTime.TryParse(el.Text, out DateTime localATA))
{
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
editedCore.ATA = DateTime.SpecifyKind(localATA, DateTimeKind.Local).ToUniversalTime();
buttonSaveChanges.IsEnabled = true;
editedCore.IsDirty = true;
}
else
{
el.Text = string.Empty;
e.Cancel = true;
}
}
}
}
#endregion
#region private methods
private void PerformSearch()
{
this.dataGridPOCores.ItemsSource = null;
this.filteredResult.Clear();
if (!this.doubleUpDownCalendarWeek.Value.HasValue) return;
Dictionary<MessageCore.SearchFilterType, string> filterDict = new Dictionary<MessageCore.SearchFilterType, string>();
DateTime start = bsmd.database.Util.FirstDateOfWeekISO8601(DateTime.Now.Year, (int)this.doubleUpDownCalendarWeek.Value);
DateTime end = start.Add(new TimeSpan(6, 23, 59, 59));
// Die Suche findet in einem erweiterten Intervall statt, da später wenn möglich nach ATA gefiltert wird
uint from = start.Subtract(new TimeSpan(10, 0, 0, 0)).ToUniversalTime().ToUnixTimeStamp();
uint to = end.Add(new TimeSpan(5, 0, 0, 0)).ToUniversalTime().ToUnixTimeStamp();
filterDict.Add(MessageCore.SearchFilterType.FILTER_ETA, string.Format("{0}:{1}", from.ToString() ?? "", to.ToString() ?? ""));
Util.UIHelper.SetBusyState();
// suche auslösen
this.searchResult = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict);
// alle anderen Häfen weg
this.searchResult.RemoveAll(item => (item.PoC == null) || (!item.PoC.Equals("DEBRV") && !item.PoC.Equals("DEWHV") && !item.PoC.Equals("DEWVN")));
// rückwärts iterieren um nach ETA und ATA zu filtern
if (this.searchResult.Count > 0)
{
for (int i = this.searchResult.Count - 1; i >= 0; i--)
{
MessageCore messageCore = this.searchResult[i];
if (messageCore.ATA.HasValue)
{
if ((messageCore.ATA.Value < start) || (messageCore.ATA.Value > end))
{
this.searchResult.RemoveAt(i);
}
else
{
if(!messageCore.POATA.HasValue)
{
messageCore.POATA = messageCore.ATA;
messageCore.IsDirty = true;
this.buttonSaveChanges.IsEnabled = true;
}
}
}
else
{
if ((messageCore.ETA.Value < start) || (messageCore.ETA.Value > end)) this.searchResult.RemoveAt(i);
}
}
}
searchResult.Sort((x, y) => DateTime.Compare(x.ATA ?? DateTime.MaxValue, y.ATA ?? DateTime.MaxValue));
this.dataGridPOCores.SelectedItem = null;
this.filteredResult.AddRange(searchResult);
this.dataGridPOCores.ItemsSource = this.filteredResult;
}
#endregion
}
}

View File

@ -20,6 +20,7 @@
<DataGridTextColumn Header="{x:Static p:Resources.textLogin}" Binding="{Binding Logon}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textEMail}" Binding="{Binding UserEMail}" IsReadOnly="True" Width="0.2*" />
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textAdministrator}" Binding="{Binding IsAdmin}" IsReadOnly="True" Width="0.1*" />
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textEditor}" Binding="{Binding IsEditor}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCreated}" Binding="{Binding Created}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textChanged}" Binding="{Binding Changed}" IsReadOnly="True" Width="0.1*" />
</DataGrid.Columns>

View File

@ -59,7 +59,7 @@ namespace ENI2.Controls
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedParty);
}
}
}
}
}
#region grid event handler
@ -98,13 +98,13 @@ namespace ENI2.Controls
{
ReportingParty rp = new ReportingParty();
EditReportingPartyDialog ebd = new EditReportingPartyDialog();
ebd.ReportingParty = rp;
ebd.ReportingParty = rp;
if (ebd.ShowDialog() ?? false)
{
DBManager.Instance.GetReportingPartyDict().Add(Guid.NewGuid(), rp);
this.ReportingParties.Add(rp);
this.dataGridReportingParties.Items.Refresh();
this.dataGridReportingParties.Items.Refresh();
}
}

View File

@ -16,12 +16,8 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Label Content="Excel:" />
<Label Name="labelStatusExcel" Content="?" FontWeight="Bold" />
<Label Content="Transmitter:" />
<Label Name="labelStatusTransmitter" Content="?" FontWeight="Bold" />
<Label Content="Report:" />
<Label Name="labelStatusReport" Content="?" FontWeight="Bold" />
<Button Name="refreshButton" Content="{x:Static p:Resources.textRefresh}" Margin="4" Background="Transparent" Click="refreshButton_Click"/>
</StackPanel>
<local:ENIDataGrid Grid.Row="1"

View File

@ -27,13 +27,14 @@ namespace ENI2.Controls
private readonly static ILog _log = LogManager.GetLogger("ServerStatus");
private ProgressBar _updateProgressBar;
private TextBlock _updateTextBlock;
private bool _isUpdating = false;
private readonly static Dictionary<Guid, string> coreIdVisitIdMap = new Dictionary<Guid, string>();
public ServerStatusControl()
{
InitializeComponent();
this.dataGridStatus.ItemsSource = this.entries;
this.Loaded += ServerStatusControl_Loaded;
}
private void ServerStatusControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
@ -43,6 +44,8 @@ namespace ENI2.Controls
internal void Update(LockingServiceReference.ServerStatus serverStatus)
{
if (this._isUpdating) return;
_isUpdating = true;
int totalNum = serverStatus.IMPFiles.Length + serverStatus.READYFiles.Length + serverStatus.CORRUPTFiles.Length;
entries.Clear();
BackgroundWorker bgWorker = new BackgroundWorker();
@ -95,24 +98,20 @@ namespace ENI2.Controls
System.Windows.Application.Current.Dispatcher.Invoke(delegate {
foreach (StatusEntry se in tmpList)
entries.Add(se);
entries.Add(se);
});
};
bgWorker.RunWorkerCompleted += (o, e) =>
{
{
// Enumeration parsen und text ausgeben
ServiceControllerStatus excel = (ServiceControllerStatus)serverStatus.Excel;
this.labelStatusExcel.Content = excel.ToString();
ServiceControllerStatus report = (ServiceControllerStatus)serverStatus.Report;
this.labelStatusReport.Content = report.ToString();
ServiceControllerStatus transmitter = (ServiceControllerStatus)serverStatus.Transmitter;
this.labelStatusTransmitter.Content = transmitter.ToString();
this.busyIndicator.IsBusy = false;
_isUpdating = false;
};
this.busyIndicator.IsBusy = true;
@ -147,15 +146,23 @@ namespace ENI2.Controls
string guidString = m.Groups[2].Value;
string idString = "";
if (!guidIdDict.ContainsKey(guidString))
{
string idString = "";
if (Guid.TryParse(m.Groups[2].Value, out Guid coreId))
{
MessageCore aCore = DBManager.Instance.GetMessageCoreById(coreId);
if (aCore != null)
if (!coreIdVisitIdMap.ContainsKey(coreId))
{
idString = aCore.DisplayId;
MessageCore aCore = DBManager.Instance.GetMessageCoreById(coreId);
if (aCore != null)
{
coreIdVisitIdMap[coreId] = aCore.DisplayId;
idString = aCore.DisplayId;
}
}
else
{
idString = coreIdVisitIdMap[coreId];
}
}
guidIdDict[guidString] = idString;

View File

@ -8,12 +8,13 @@ using System.Windows;
using System.Windows.Controls;
using System.ComponentModel;
using ENI2.Util;
using System.Windows.Data;
namespace ENI2.Controls
{
[TemplatePart(Name = "buttonRefresh", Type = typeof(Button))]
[TemplatePart(Name = "buttonClose", Type = typeof(Button))]
[TemplatePart(Name = "buttonClose", Type = typeof(Button))]
public class StatusWindowBase : Window
{
@ -34,9 +35,23 @@ namespace ENI2.Controls
closeButton.Click += (s, e) => { if (this.IsModal()) DialogResult = true; CloseClicked?.Invoke(); this.Close(); };
refreshButton.Click += (s, e) => { RefreshClicked?.Invoke(); };
};
}
string topProperty = "W2Top";
string leftProperty = "W2Left";
if(this.GetType().Name == "ViolationListDialog")
{
topProperty = "W3Top";
leftProperty = "W3Left";
}
SettingBindingExtension stBinding = new SettingBindingExtension(topProperty);
this.SetBinding(Window.TopProperty, stBinding);
SettingBindingExtension slBinding = new SettingBindingExtension(leftProperty);
this.SetBinding (Window.LeftProperty, slBinding);
};
}
public bool RefreshVisible
{

View File

@ -0,0 +1,68 @@
<UserControl x:Class="ENI2.Controls.ValueMappingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="{x:Static p:Resources.textExcelValueMappings}" />
<GroupBox Name="groupBoxRP" Header="" Grid.Row="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="40" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="80" />
</Grid.ColumnDefinitions>
<Label Content="Type" Grid.Column="0" />
<ComboBox Margin="2" Grid.Column="1" x:Name="comboBoxType" SelectionChanged="comboBoxType_SelectionChanged" />
<local:BusyControl x:Name="busyControl" Grid.Column="2" />
<Button x:Name="buttonSave" Grid.Column="6" Margin="2" Content="Save all changes" Click="buttonSave_Click" />
<Button x:Name="buttonImport" Grid.Column="9" Margin="2" Content="Import" Click="buttonImport_Click" IsEnabled="False" />
<Button x:Name="buttonExport" Grid.Column="10" Margin="2" Content="Export" Click="buttonExport_Click" IsEnabled="False" />
</Grid>
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridValueMappings" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Extended" AutoGenerateColumns="False" CellEditEnding="dataGridValueMappings_CellEditEnding" CanUserAddRows="False"
MouseDoubleClick="dataGridValueMappings_MouseDoubleClick" BeginningEdit="dataGridValueMappings_BeginningEdit">
<local:ENIDataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding Value}" Value="*">
<Setter Property="Background" Value="Pink"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</local:ENIDataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn x:Name="columnKey" Header="Key" Binding="{Binding Key, Mode=TwoWay}" IsReadOnly="False" />
<DataGridTextColumn x:Name="columnValue" Header="Value key" Binding="{Binding Value, Mode=TwoWay}" IsReadOnly="False" />
<DataGridTextColumn x:Name="columnValueText" Header="Value text" Binding="{Binding ValueText, Mode=TwoWay}" IsReadOnly="True" />
<DataGridTextColumn Header="Created" Binding="{Binding Created}" IsReadOnly="True" />
<DataGridTextColumn Header="Changed" Binding="{Binding Changed}" IsReadOnly="True" />
</DataGrid.Columns>
</local:ENIDataGrid>
</Grid>
</GroupBox>
</Grid>
</UserControl>

View File

@ -0,0 +1,218 @@
using bsmd.database;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media.Imaging;
namespace ENI2.Controls
{
/// <summary>
/// Interaction logic for ValueMappingsControl.xaml
/// </summary>
public partial class ValueMappingsControl : UserControl
{
private readonly ObservableCollection<ValueMapping> _mappings = new ObservableCollection<ValueMapping>();
private DataGridCellInfo activeCellAtEdit;
public ValueMappingsControl()
{
InitializeComponent();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
this.comboBoxType.ItemsSource = Enum.GetValues(typeof(ValueMapping.MappingType)).Cast<ValueMapping.MappingType>();
this.dataGridValueMappings.ItemsSource = _mappings;
this.dataGridValueMappings.ContextMenu = new ContextMenu();
MenuItem addItem = new MenuItem
{
Header = Properties.Resources.textAdd,
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) }
};
addItem.Click += AddItem_Click;
this.dataGridValueMappings.ContextMenu.Items.Add(addItem);
MenuItem delItem = new MenuItem
{
Header = Properties.Resources.textDelete,
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) }
};
delItem.Click += DelItem_Click;
this.dataGridValueMappings.ContextMenu.Items.Add(delItem);
MenuItem invalidItem = new MenuItem
{
Header = "Set as invalid key",
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/sign_warning_radiation.png")) }
};
invalidItem.Click += InvalidItem_Click;
this.dataGridValueMappings.ContextMenu.Items.Add(invalidItem);
}
#region context menu event handler
private void InvalidItem_Click(object sender, RoutedEventArgs e)
{
if (this.dataGridValueMappings.SelectedItem is ValueMapping vm)
{
vm.Value = "*";
}
}
private async void DelItem_Click(object sender, RoutedEventArgs e)
{
if (this.dataGridValueMappings.SelectedItems.Count > 0)
{
if (MessageBox.Show($"Are you sure to delete the selected values?", Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) ==
MessageBoxResult.Yes)
{
var selectedItems = new List<ValueMapping>();
foreach(ValueMapping vm in this.dataGridValueMappings.SelectedItems)
selectedItems.Add(vm);
foreach(ValueMapping vm in selectedItems)
{
int result = await DBManagerAsync.DeleteAsync(vm);
if (result == 1)
{
_mappings.Remove(vm);
}
}
}
}
}
private void AddItem_Click(object sender, RoutedEventArgs e)
{
ValueMapping.MappingType? mappingType = (ValueMapping.MappingType?) this.comboBoxType.SelectedItem;
if (mappingType == null) return;
ValueMapping vm = ValueMapping.Create(mappingType.Value);
_mappings.Add(vm);
}
#endregion
private void dataGridValueMappings_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
// we need to check that there are no keys entered twice or changed into something that is already here
string newValue = ((TextBox)e.EditingElement).Text;
if (newValue == null) return;
if (e.Column == columnKey)
{
ValueMapping editedMapping = e.Row.Item as ValueMapping;
foreach(ValueMapping vm in _mappings)
{
if (vm == editedMapping) continue; // dont compare with myself
if (vm.Key == newValue)
{
((TextBox)e.EditingElement).Text = editedMapping.Key;
e.Cancel = true; // hopefully this avoids writing back to the model
}
}
}
if(e.Column == columnValue)
{
ValueMapping editedMapping = e.Row.Item as ValueMapping;
ValueMapping.MappingType? mappingType = (ValueMapping.MappingType)this.comboBoxType.SelectedItem;
if ((mappingType != null) && (newValue != null))
{
switch (mappingType)
{
case ValueMapping.MappingType.GENDER:
if (Util.GlobalStructures.GenderDict.ContainsKey(newValue))
editedMapping.ValueText = Util.GlobalStructures.GenderDict[newValue];
else
editedMapping.ValueText = "";
break;
case ValueMapping.MappingType.DOCUMENT_TYPE:
if (Util.GlobalStructures.IDDocTypeDict.ContainsKey(newValue))
editedMapping.ValueText = Util.GlobalStructures.IDDocTypeDict[newValue];
else
editedMapping.ValueText = "";
break;
default:
editedMapping.ValueText = newValue;
break;
}
}
}
}
private void dataGridValueMappings_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
}
private void buttonImport_Click(object sender, RoutedEventArgs e)
{
}
private void buttonExport_Click(object sender, RoutedEventArgs e)
{
}
private async void comboBoxType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this._mappings.Clear();
if(this.comboBoxType.SelectedItem != null)
{
ValueMapping.MappingType mappingType = (ValueMapping.MappingType)this.comboBoxType.SelectedItem;
List<ValueMapping> mappings = await DBManagerAsync.LoadValuesForType(mappingType);
foreach (ValueMapping vm in mappings)
{
// add "Klartext"
switch(mappingType)
{
case ValueMapping.MappingType.GENDER:
if (Util.GlobalStructures.GenderDict.ContainsKey(vm.Value))
vm.ValueText = Util.GlobalStructures.GenderDict[vm.Value];
break;
case ValueMapping.MappingType.DOCUMENT_TYPE:
if (Util.GlobalStructures.IDDocTypeDict.ContainsKey(vm.Value))
vm.ValueText = Util.GlobalStructures.IDDocTypeDict[vm.Value];
break;
default:
vm.ValueText = vm.Value;
break;
}
_mappings.Add(vm);
}
}
}
private void dataGridValueMappings_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{
this.activeCellAtEdit = this.dataGridValueMappings.CurrentCell;
}
private async void buttonSave_Click(object sender, RoutedEventArgs e)
{
int totalSaves = 0;
foreach(ValueMapping vm in _mappings)
{
if (vm.Key.IsNullOrEmpty()) continue;
if (vm.IsNew || vm.IsDirty)
{
totalSaves += await DBManagerAsync.SaveAsync(vm);
}
}
if(totalSaves > 0)
{
MessageBox.Show($"{totalSaves} value mappings saved", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}
}

View File

@ -34,8 +34,7 @@ namespace ENI2
if (parentObject == null) return null;
//check if the parent matches the type we're looking for
T parent = parentObject as T;
if (parent != null)
if (parentObject is T parent)
return parent;
else
return FindParent<T>(parentObject);

View File

@ -33,6 +33,7 @@ namespace ENI2
private DependencyPropertyDescriptor _dpComboboxValue;
private DependencyPropertyDescriptor _dpNumericUpdown;
private DependencyPropertyDescriptor _dpIntUpdown;
private readonly Dictionary<Object, Message.NotificationClass> _controlClassDict = new Dictionary<object, Message.NotificationClass>();
private readonly Dictionary<Message.NotificationClass, Message> _typeMessageDict = new Dictionary<Message.NotificationClass, Message>();
@ -69,7 +70,7 @@ namespace ENI2
/// <summary>
/// Damit kann ein Listenelement eine Validierung der gesamten Anmeldung auslösen (inkl. Highlighting) (auf Knopfdruck)
/// </summary>
public event Action RequestValidate;
public event Action<bool> RequestValidate;
/// <summary>
/// Alle Meldeklassen die auf "zu versenden" stehen werden validiert und falls die Validierung scheitert auf "SUSPEND" gestellt
@ -89,7 +90,7 @@ namespace ENI2
/// <summary>
/// Eine in der Detailansicht enthaltene Meldeklasse hat sich geändert
/// </summary>
public event Action<Message.NotificationClass> NotificationClassChanged;
public event Action<Message.NotificationClass?> NotificationClassChanged;
/// <summary>
/// Eine Maske soll neu erzeugt werden weil sich dort "indirekt" etwas geändert hat durch eine Änderung in einer anderen Maske.
@ -132,8 +133,7 @@ namespace ENI2
_dpComboboxIndex = DependencyPropertyDescriptor.FromProperty(ComboBox.SelectedIndexProperty, typeof(ComboBox));
_dpComboboxValue = DependencyPropertyDescriptor.FromProperty(ComboBox.SelectedValueProperty, typeof(ComboBox));
_dpNumericUpdown = DependencyPropertyDescriptor.FromProperty(Xceed.Wpf.Toolkit.DoubleUpDown.ValueProperty, typeof(Xceed.Wpf.Toolkit.DoubleUpDown));
_dpIntUpdown = DependencyPropertyDescriptor.FromProperty(Xceed.Wpf.Toolkit.IntegerUpDown.ValueProperty, typeof(Xceed.Wpf.Toolkit.IntegerUpDown));
_dpIntUpdown = DependencyPropertyDescriptor.FromProperty(Xceed.Wpf.Toolkit.IntegerUpDown.ValueProperty, typeof(Xceed.Wpf.Toolkit.IntegerUpDown));
foreach(Message message in this.Messages)
{
@ -160,9 +160,9 @@ namespace ENI2
this.RequestReload?.Invoke(coreId);
}
protected virtual void OnRequestValidate()
protected virtual void OnRequestValidate(bool showDialog)
{
this.RequestValidate?.Invoke();
this.RequestValidate?.Invoke(showDialog);
}
protected virtual void OnRequestSendValidation()
@ -185,6 +185,17 @@ namespace ENI2
this.ResetControlCache?.Invoke(messageGroupName);
}
protected virtual void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
public virtual int SelectedTabIndex { get; set; } = -1;
#endregion
#region event handling for control content changes (signal dirty etc)
protected void RegisterTextboxChange(TextBox textBox, Message.NotificationClass notificationClass)
@ -246,7 +257,7 @@ namespace ENI2
{
this._dpIntUpdown.AddValueChanged(intUpDown, this.controlContentChanged);
this._controlClassDict[intUpDown] = notificationClass;
}
}
protected void SublistElementChanged(Message.NotificationClass notificationClass)
{
@ -258,12 +269,17 @@ namespace ENI2
{
_typeMessageDict[notificationClass].IsDirty = true;
// signal this notification class changed..
this.NotificationClassChanged?.Invoke(notificationClass);
this.OnNotificationClassChanged(notificationClass);
}
}
}
}
protected void OnNotificationClassChanged(Message.NotificationClass? notificationClass)
{
this.NotificationClassChanged?.Invoke(notificationClass);
}
#region "BHV Spezial" Datetime Parsing..
protected void DateTimePicker_PreviewKeyUp(object sender, System.Windows.Input.KeyEventArgs e)
@ -298,7 +314,9 @@ namespace ENI2
int year = Int32.Parse(timevalText.Substring(4, 4));
thePicker.SelectedDate = new DateTime(year, month, day, 0, 0, 0);
}
catch (FormatException) { }
catch (Exception) {
thePicker.SelectedDate = null;
}
}
}
@ -331,9 +349,7 @@ namespace ENI2
GlobalStructures.FilterCombobox(cmb, e.Key);
}
#endregion
#endregion
#endregion
#region IHighlightControlContainer implementation

View File

@ -15,7 +15,7 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220" />
<ColumnDefinition Width="220" x:Name="leftColumnDefinition"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
@ -28,7 +28,7 @@
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" >
<xctk:AutoSelectTextBox x:Name="displayIdLabel" Width="Auto" VerticalContentAlignment="Center" FontWeight="Bold" IsReadOnly="True" BorderThickness="0" AutoSelectBehavior="OnFocus" />
<Label Margin="10,0,0,0" Content="Ship e-mail:" VerticalContentAlignment="Center" />
<Label Margin="10,0,0,0" Content="{x:Static p:Resources.textShipEmail}" VerticalContentAlignment="Center" />
<xctk:AutoSelectTextBox Width="400" x:Name="shipEMailLabel" VerticalContentAlignment="Center" FontWeight="Normal" IsReadOnly="True" BorderThickness="0" AutoSelectBehavior="OnFocus" />
</StackPanel>
<Button Name="buttonSave" Grid.Column="1" Grid.Row="0" Margin="2" Click="buttonSave_Click" BorderThickness="0" Background="Transparent" Visibility="Hidden">

View File

@ -15,6 +15,8 @@ using ENI2.Util;
using ENI2.EditControls;
using System.Windows.Input;
using System.Linq;
using ENI2.SheetDisplayControls;
namespace ENI2
{
@ -29,7 +31,7 @@ namespace ENI2
private readonly List<MessageGroup> _listBoxList = new List<MessageGroup>();
private List<Message> _messages;
private readonly Dictionary<string, DetailBaseControl> controlCache = new Dictionary<string, DetailBaseControl>();
// private readonly Dictionary<Message.NotificationClass, string> messageClassControlDict = new Dictionary<Message.NotificationClass, string>();
// private readonly Dictionary<Message.NotificationClass, string> messageClassControlDict = new Dictionary<Message.NotificationClass, string>();
private readonly object messageListLock = new object();
private readonly HighlightService highlightService = new HighlightService();
@ -41,7 +43,7 @@ namespace ENI2
#region Properties
public MessageCore Core { get; private set; }
public MessageCore Core { get; private set; }
public bool LockedByOtherUser { get; set; }
@ -63,7 +65,7 @@ namespace ENI2
get
{
// Bedingung:
// wenn in einer Meldeklasse zwar Daten vorhanden sind, eingespielt durch Excel import oder
// wenn in einer Meldeklasse zwar Daten vorhanden sind, eingespielt durch Excel import oder
// Handeingabe, diese aber NICHT gesendet wurden.
// TODO: Hier wird noch ein Flag benötigt, dass die erfolgte Anzeige des Warndialogs speichert
List<string> result = new List<string>();
@ -72,7 +74,7 @@ namespace ENI2
{
if (((aMessage.InternalStatus == Message.BSMDStatus.UPDATED) ||
(aMessage.InternalStatus == Message.BSMDStatus.SAVED)) && // ||
// (aMessage.InternalStatus == Message.BSMDStatus.EXCEL)) &&
// (aMessage.InternalStatus == Message.BSMDStatus.EXCEL)) &&
!aMessage.UnsentMessageWarningShown)
{
aMessage.UnsentMessageWarningShown = true;
@ -80,7 +82,7 @@ namespace ENI2
result.Add(aMessage.MessageNotificationClassDisplay);
}
}
return result;
}
}
@ -106,35 +108,89 @@ namespace ENI2
}
}
public bool HasCriticalInfoMissing(out string messageText, string locode)
{
messageText = "";
// Hier haben wir Logik für Spezialfälle, z.B. dass für BRE und BRV bestimmte Meldeklassen gesendet werden *müssen*
switch (locode)
{
case "DEBRV":
case "DEBRE":
{
foreach (Message aMessage in _messages)
{
if ((aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "NOA_NOD"; return true; }
if ((aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "AGNT"; return true; }
if ((aMessage.MessageNotificationClass == Message.NotificationClass.INFO) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "INFO"; return true; }
if ((aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "SEC"; return true; }
if ((aMessage.MessageNotificationClass == Message.NotificationClass.TIEFA) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "TIEFA"; return true; }
}
}
break;
case "DEHAM":
foreach (Message aMessage in _messages)
{
if ((aMessage.MessageNotificationClass == Message.NotificationClass.SERV) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "SERV"; return true; }
}
break;
default:
break;
}
return false;
}
#endregion
#region Construction
public DetailRootControl(MessageCore aCore)
public DetailRootControl(MessageCore aCore, ReportingParty.ShipcallDisplayModeEnum displayMode)
{
Core = aCore;
InitializeComponent();
shipNameLabel.Text = aCore.Shipname;
shipEMailLabel.Text = aCore.HerbergEmailContactReportingVessel;
displayIdLabel.Text = aCore.DisplayId;
// Listbox befüllen
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPortCall, MessageGroupControlType = typeof(PortCallDetailControl), ImagePath = "Resources/eye_blue.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPortNotification, MessageGroupControlType = typeof(PortNotificationDetailControl), ImagePath = "Resources/anchor.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textWaste, MessageGroupControlType = typeof(WasteDetailControl), ImagePath = "Resources/garbage.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textArrivalNotification, MessageGroupControlType = typeof(ArrivalNotificationDetailControl), ImagePath = "Resources/arrow_down_right_red.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textSecurity, MessageGroupControlType = typeof(SecurityDetailControl), ImagePath = "Resources/shield_yellow.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPSC72h, MessageGroupControlType = typeof(PSC72hDetailControl), ImagePath = "Resources/alarmclock.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textMDH, MessageGroupControlType = typeof(MaritimeHealthDeclarationDetailControl), ImagePath = "Resources/medical_bag.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDepartureNotification, MessageGroupControlType = typeof(DepartureNotificationDetailControl), ImagePath = "Resources/arrow_up_right_green.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textShipData, MessageGroupControlType = typeof(ShipDataDetailControl), ImagePath = "Resources/containership.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textBorderPolice, MessageGroupControlType = typeof(BorderPoliceDetailControl), ImagePath = "Resources/policeman_german.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGArrival, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGDeparture, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textTowage, MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" });
// Unterscheidung in welchem Darstellungs-Mode der Anlauf dargestellt wird (Classic oder Formblatt)
if (displayMode == ReportingParty.ShipcallDisplayModeEnum.CLASSIC)
{
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPortCall, MessageGroupControlType = typeof(PortCallDetailControl), ImagePath = "Resources/eye_blue.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPortNotification, MessageGroupControlType = typeof(PortNotificationDetailControl), ImagePath = "Resources/anchor.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textWaste, MessageGroupControlType = typeof(WasteDetailControl), ImagePath = "Resources/garbage.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textArrivalNotification, MessageGroupControlType = typeof(ArrivalNotificationDetailControl), ImagePath = "Resources/arrow_down_right_red.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textSecurity, MessageGroupControlType = typeof(SecurityDetailControl), ImagePath = "Resources/shield_yellow.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textPSC72h, MessageGroupControlType = typeof(PSC72hDetailControl), ImagePath = "Resources/alarmclock.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textMDH, MessageGroupControlType = typeof(MaritimeHealthDeclarationDetailControl), ImagePath = "Resources/medical_bag.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDepartureNotification, MessageGroupControlType = typeof(DepartureNotificationDetailControl), ImagePath = "Resources/arrow_up_right_green.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textShipData, MessageGroupControlType = typeof(ShipDataDetailControl), ImagePath = "Resources/containership.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textBorderPolice, MessageGroupControlType = typeof(BorderPoliceDetailControl), ImagePath = "Resources/policeman_german.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGArrival, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGDeparture, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textTowage, MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" });
}
else
{
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text1Voyage, MessageGroupControlType = typeof(VoyageControl), ImagePath = "Resources/ship2.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text2PortCall, MessageGroupControlType = typeof(PortControl), ImagePath = "Resources/anchor.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text3PreArrival, MessageGroupControlType = typeof(PreArrivalControl), ImagePath = "Resources/arrow_down_right_red.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text4PreDeparture, MessageGroupControlType = typeof(PreDepartureControl), ImagePath = "Resources/arrow_up_right_green.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text5ShipData, MessageGroupControlType = typeof(ShipDataControl), ImagePath = "Resources/containership.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text6CrewDataOnArrival, MessageGroupControlType = typeof(CrewPreArrivalControl), ImagePath = "Resources/arrival_worker.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text7CrewDeparture, MessageGroupControlType = typeof(CrewDepartureControl), ImagePath = "Resources/departure_worker.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text8PassengerArrival, MessageGroupControlType = typeof(PassengerPreArrivalControl), ImagePath = "Resources/arrival_user.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text9PassengerDeparture, MessageGroupControlType = typeof(PassengerDepartureControl), ImagePath = "Resources/departure_user.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text10DangerousCargoArrival, MessageGroupControlType = typeof(DangerousCargoControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text11DangerousCargoDeparture, MessageGroupControlType = typeof(DangerousCargoControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text12ATAATD, MessageGroupControlType = typeof(ATAControl), ImagePath = "Resources/clock.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text13WasteReceipts, MessageGroupControlType = typeof(WasteReceiptsControl), ImagePath = "Resources/garbage.png" });
this.leftColumnDefinition.Width = new GridLength(260);
}
this.listBoxMessages.ItemsSource = this._listBoxList;
@ -143,7 +199,7 @@ namespace ENI2
_messages.AddRange(missingMessages);
BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock);
Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0));
Dispatcher.BeginInvoke((System.Action)(() => this.listBoxMessages.SelectedIndex = 0));
RoutedCommand saveCmd = new RoutedCommand();
saveCmd.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control));
@ -170,7 +226,8 @@ namespace ENI2
public void CoreChanged(MessageCore newCore)
{
this.Core = newCore;
Application.Current.Dispatcher.Invoke(delegate
this.ReloadCore();
System.Windows.Application.Current.Dispatcher.Invoke(delegate
{
if(controlCache.ContainsKey(Properties.Resources.textOverview))
{
@ -216,6 +273,8 @@ namespace ENI2
// Spezial-Balkon für die Wiederverwendung von HAZD / HAZA als ein Control (es tut mir leid :D)
if (mg.MessageGroupName.Equals(Properties.Resources.textDGDeparture))
((DangerousGoodsDetailControl)detailControl).IsDeparture = true;
if (mg.MessageGroupName.Equals(Properties.Resources.text11DangerousCargoDeparture))
((DangerousCargoControl)detailControl).IsDeparture = true;
detailControl.Core = Core;
detailControl.Messages = _messages;
detailControl.LockedByOtherUser = this.LockedByOtherUser;
@ -241,7 +300,7 @@ namespace ENI2
detailControl.SetEnabled(isEnabled);
if (!isEnabled && (detailControl is OverViewDetailControl control) && !(Core.Cancelled ?? false))
control.ShowLockedBy(this.LockedBy);
control.ShowLockedBy(this.LockedBy);
controlCache.Add(mg.MessageGroupName, detailControl);
this.buttonSave.Visibility = Visibility.Hidden;
@ -275,7 +334,7 @@ namespace ENI2
MessageCore newCore = new MessageCore();
cdd.NewCore = newCore;
cdd.OldCore = this.Core;
cdd.Closed += (senderDialog, closeArgs) =>
{
CopyDeclarationDialog closedDialog = senderDialog as CopyDeclarationDialog;
@ -308,19 +367,19 @@ namespace ENI2
if(existingCore != null)
{
if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists,
if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists,
MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
{
List<Message> existingMessages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(existingCore, DBManager.MessageLoad.ALL);
foreach(Message existingMessage in existingMessages)
{
if((existingMessage.InternalStatus == Message.BSMDStatus.SENT) &&
if((existingMessage.InternalStatus == Message.BSMDStatus.SENT) &&
(existingMessage.MessageNotificationClass != Message.NotificationClass.VISIT) &&
(existingMessage.MessageNotificationClass != Message.NotificationClass.TRANSIT))
{
MessageBox.Show(Properties.Resources.textMessagesAlreadySent, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Stop);
return;
}
}
}
// delete all existing data of core
@ -334,7 +393,7 @@ namespace ENI2
// Bearbeitungsinformationen für bestehende ID-Beantragung beibehalten, falls bereits vorhanden
if(existingCore.IsTransit &&
(existingMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) &&
(existingMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) &&
(existingMessage.InternalStatus == Message.BSMDStatus.CONFIRMED))
{
skipCopyTransit = true;
@ -366,7 +425,7 @@ namespace ENI2
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore);
// Meldeklassen für neuen Anlauf erzeugen
// Meldeklassen für neuen Anlauf erzeugen
List<Message> newMessages = new List<Message>();
foreach (Message oldMessage in this._messages)
{
@ -394,6 +453,7 @@ namespace ENI2
newMessage.SaveElements();
}
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).LoadXtraData(newCore); // reload data from DB and set all rel properites
this.OnOpenNewCoreRequested(newCore);
}
};
@ -404,12 +464,12 @@ namespace ENI2
{
this.LockedByOtherUser = true; // fake flag
// clear existing controls
// clear existing controls
this.detailView.Children.Clear();
this.controlCache.Clear();
// return to "new" overview
Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages_SelectionChanged(this, null)));
Dispatcher.BeginInvoke((System.Action)(() => this.listBoxMessages_SelectionChanged(this, null)));
}
private void DetailControl_ResetControlCache(string messageGroupName)
@ -421,12 +481,13 @@ namespace ENI2
private void buttonSave_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSavePage, Properties.Resources.textConfirmation,
MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSavePage, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
Util.UIHelper.SetBusyState();
int currentMainTabIndex = -1;
if (this.detailView.Children[0] is DetailBaseControl currentControl)
{
@ -441,10 +502,24 @@ namespace ENI2
// ggf. hat sich die Ticketnr geändert..
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
}
}
}
this.DetailControl_RequestReload(this.Core.Id.Value);
currentMainTabIndex = currentControl.SelectedTabIndex;
}
this.DetailControl_RequestReload(this.Core.Id.Value);
System.Action<int> SetTabAction = x =>
{
// this hopefully happens *after* the view was completely reloaded
if (this.detailView.Children[0] is DetailBaseControl currentNewControl)
{
currentNewControl.SelectedTabIndex = x;
}
};
if (currentMainTabIndex >= 0)
Dispatcher.BeginInvoke(SetTabAction, currentMainTabIndex);
}
}
private void SaveMessage(Message message)
@ -453,9 +528,14 @@ namespace ENI2
{
if ((message.Status == Message.MessageStatus.ACCEPTED) &&
((message.InternalStatus == Message.BSMDStatus.CONFIRMED) || (message.InternalStatus == Message.BSMDStatus.VIOLATION)))
{
message.InternalStatus = Message.BSMDStatus.UPDATED;
message.Status = null; // reset send status
}
else
{
message.InternalStatus = Message.BSMDStatus.SAVED;
}
string userName = "?";
if(App.UserId.HasValue && DBManager.Instance.GetReportingPartyDict().ContainsKey(App.UserId.Value))
@ -472,7 +552,7 @@ namespace ENI2
if(message.MessageNotificationClass == Message.NotificationClass.ATA)
{
DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl;
DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl;
// ggf. hat sich die Ticketnr geändert..
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
}
@ -489,12 +569,13 @@ namespace ENI2
private void buttonSaveAll_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSaveAll, Properties.Resources.textConfirmation,
MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSaveAll, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
Util.UIHelper.SetBusyState();
int currentMainTabIndex = -1;
foreach (Message message in this._messages)
{
@ -505,16 +586,33 @@ namespace ENI2
if (currentControl is OverViewDetailControl)
{
// ggf. hat sich die Ticketnr geändert..
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
}
currentMainTabIndex = currentControl.SelectedTabIndex;
Trace.WriteLine($"Last selected tab index: {currentMainTabIndex}");
this.buttonSaveAll.Visibility = Visibility.Hidden;
this.buttonSave.Visibility = Visibility.Hidden;
this.DetailControl_RequestReload(this.Core.Id.Value);
Action<int> SetTabAction = x =>
{
// this hopefully happens *after* the view was completely reloaded
if (this.detailView.Children[0] is DetailBaseControl currentNewControl)
{
currentNewControl.SelectedTabIndex = x;
}
};
if(currentMainTabIndex >= 0)
Dispatcher.BeginInvoke(SetTabAction, currentMainTabIndex);
}
this.DetailControl_RequestReload(this.Core.Id.Value);
}
private void DetailControl_NotificationClassChanged(Message.NotificationClass notificationClass)
private void DetailControl_NotificationClassChanged(Message.NotificationClass? notificationClass)
{
// in der Übersicht die Meldeklasse als geändert markieren..?
this.buttonSaveAll.Visibility = Visibility.Visible;
@ -566,7 +664,7 @@ namespace ENI2
private void ShortCutValidate(object sender, ExecutedRoutedEventArgs e)
{
this.DetailControl_RequestValidate();
this.DetailControl_RequestValidate(true);
}
private void DetailControl_RequestReload(Guid id)
@ -586,12 +684,15 @@ namespace ENI2
this.detailView.Children.Clear();
this.controlCache.Clear();
// return to "new" overviewdan
Dispatcher.BeginInvoke((Action)(() =>
int currentIndex = this.listBoxMessages.SelectedIndex;
// return to "new" overview
Dispatcher.BeginInvoke((System.Action)(() =>
{
this.listBoxMessages_SelectionChanged(this, null);
shipNameLabel.Text = this.Core.Shipname;
shipEMailLabel.Text = this.Core.HerbergEmailContactReportingVessel;
this.listBoxMessages.SelectedIndex = currentIndex;
}
));
@ -676,16 +777,16 @@ namespace ENI2
}
}
private void DetailControl_RequestValidate()
private void DetailControl_RequestValidate(bool showDialog)
{
this.Validate(true, out _, out _);
this.Validate(showDialog, out _, out _);
}
private void Validate(bool showMessages, out List<MessageViolation> vViolations, out List<MessageError> vErrors)
{
vViolations = new List<MessageViolation>();
vErrors = new List<MessageError>();
// TODO: clear highlighting
Util.UIHelper.SetBusyState();
@ -693,17 +794,27 @@ namespace ENI2
RuleEngine ruleEngine = new RuleEngine();
foreach (Message aMessage in _messages)
{
// XXX : TODO wegmachen wenn CREWD/PASD kommt
if ((aMessage.MessageNotificationClass == Message.NotificationClass.PASD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.CREWD))
continue;
if (!aMessage.EvaluateForValidation(this.Core.IsTransit)) continue;
List<MessageError> errors = new List<MessageError>();
List<MessageViolation> violations = new List<MessageViolation>();
ruleEngine.ValidateMessage(aMessage, out errors, out violations);
if (errors.Count > 0)
aMessage.ErrorCount = errors.Count;
else
aMessage.ErrorCount = null;
if (violations.Count > 0)
{
aMessage.ViolationCount = violations.Count;
aMessage.PositionViolationCount = violations.Count(v => !v.Identifier.IsNullOrEmpty());
}
else
{
aMessage.ViolationCount = null;
aMessage.PositionViolationCount = null;
}
string messageGroup = this.MessageGroupForMessage(aMessage);
if (messageGroup != null)
@ -718,17 +829,22 @@ namespace ENI2
vViolations.AddRange(violations);
}
#region 12.11.18 / 6.3.21 / 23.5.22: globale Plausi-Prüfungen
Message crewaMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREW);
#region 12.11.18 / 6.3.21 / 23.5.22 / 26.10.24: globale Plausi-Prüfungen
Message crewaMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREWA);
Message crewdMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREWD);
Message pasaMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.PAS);
Message pasaMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.PASA);
Message pasdMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.PASD);
Message pobaMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.POBA);
Message pobdMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.POBD);
Message secMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.SEC);
Message noanodMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.NOA_NOD);
Message mdhMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.MDH);
Message was_rcptMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.WAS_RCPT);
Message wasMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.WAS);
Message servMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.SERV);
Message statMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.STAT);
Message pre72hMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.PRE72H);
#region CREW / PAS Count Plausibility
@ -736,29 +852,43 @@ namespace ENI2
{
POBA poba = pobaMessage.Elements[0] as POBA;
if (crewaMessage.Elements.Count != poba.TotalCrewMembersOnBoardUponArrival)
if (crewaMessage.Elements.Count != (poba.TotalCrewMembersOnBoardUponArrival ?? 0))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "POBA crew member count different from CREW count!", null, "Crew count mismatch", null, "CREW");
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "POBA crew member count different from CREW count!", null, "Crew count mismatch", null, "CREWA");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
if(pasaMessage.Elements.Count != poba.TotalPassengersOnBoardUponArrival)
if(pasaMessage.Elements.Count != (poba.TotalPassengersOnBoardUponArrival ?? 0))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "POBA passenger count different from PAS count!", null, "Passenger count mismatch", null, "PAS");
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "POBA passenger count different from PAS count!", null, "Passenger count mismatch", null, "PASA");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
POBD pobd = pobdMessage.Elements[0] as POBD;
if (crewdMessage.Elements.Count != (pobd.TotalCrewMembersOnBoardUponDeparture ?? 0))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "POBD crew member count different from CREW count!", null, "Crew count mismatch", null, "CREWD");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
if (pasdMessage.Elements.Count != (pobd.TotalPassengersOnBoardUponDeparture ?? 0))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "POBD passenger count different from PAS count!", null, "Passenger count mismatch", null, "PASD");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
}
#endregion
#region CREW/PAS Schengen Plausibility
// Wir können davon ausgehen, dass bei allen Unterelementen die Flags gleich gesetzt sind. Das wird im Import und BorderPoliceDetailControl sichergestellt.
// XXX : TODO auskommentiert bis CREWD/PASD kommt
/*
// Wir können davon ausgehen, dass bei allen Unterelementen die Flags gleich gesetzt sind. Das wird im Import und BorderPoliceDetailControl sichergestellt.
if(crewaMessage.Elements.Count > 0)
{
@ -766,19 +896,7 @@ namespace ENI2
bool crewaIsSchengen = crewaFirst.NotificationSchengen ?? false;
if (!((crewaFirst.NotificationPAX ?? false) || crewaIsSchengen)) // mindestens eins der beiden
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V181, "Wrong selection", null, "CREWA", null, "CREWA");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
foreach(CREW crewa in crewaMessage.Elements)
{
if(crewaIsSchengen && !crewa.HasSchengenDetails)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V182, "No Schengen details", null, "CREWA", crewa.Identifier, "CREWA");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWA")); ;
}
}
@ -790,19 +908,7 @@ namespace ENI2
bool crewdIsSchengen = crewdFirst.NotificationSchengen ?? false;
if (!((crewdFirst.NotificationPAX ?? false) || crewdIsSchengen)) // mindestens eins der beiden
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V181, "Wrong selection", null, "CREWD", null, "CREWD");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
foreach (CREWD crewd in crewdMessage.Elements)
{
if (crewdIsSchengen && !crewd.HasSchengenDetails)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V182, "No Schengen details", null, "CREWD", crewd.Identifier, "CREWD");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWD")); ;
}
}
}
@ -814,25 +920,7 @@ namespace ENI2
bool pasIsPAX = pasFirst.NotificationPAX ?? false;
if (!(pasIsPAX || pasIsSchengen)) // mindestens eins der beiden
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V201, "Wrong selection", null, "PASA", null, "PASA");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
foreach (PAS pasa in pasaMessage.Elements)
{
if (pasIsSchengen && !pasa.HasSchengenDetails)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V202, "No Schengen details", null, "PASA", pasa.Identifier, "PASA");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
if(pasIsPAX && !pasa.HasPAXDetails)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V203, "No PAX details", null, "PASA", pasa.Identifier, "PASA");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
vErrors.Add(RuleEngine.CreateError (ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASA"));
}
}
@ -845,38 +933,78 @@ namespace ENI2
bool pasdIsPAX = pasdFirst.NotificationPAX ?? false;
if (!(pasdIsPAX || pasdIsSchengen)) // mindestens eins der beiden
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V201, "Wrong selection", null, "PASD", null, "PASD");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
foreach (PASD pasd in pasdMessage.Elements)
{
if (pasdIsSchengen && !pasd.HasSchengenDetails)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V202, "No Schengen details", null, "PASD", pasd.Identifier, "PASD");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
if (pasdIsPAX && !pasd.HasPAXDetails)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V203, "No PAX details", null, "PASD", pasd.Identifier, "PASD");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
vErrors.Add(RuleEngine.CreateError(ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASD"));
}
}
}
*/
#endregion
#region 7.11.23 > 12 Passagiere in PASA oder PASD -> CREW* und PAS* muss NotificationPAX gesetzt haben
if ((pasaMessage != null) && (pasaMessage.Elements.Count > 12))
{
PAS firstPASA = pasaMessage.Elements[0] as PAS;
if(!(firstPASA.NotificationPAX ?? false))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASA > 12)", null, Properties.Resources.textOverview, null, "PASA");
vViolations.Add(mv);
}
if((crewaMessage != null) && (crewaMessage.Elements.Count > 0))
{
CREW firstCREW = crewaMessage.Elements[0] as CREW;
if(!(firstCREW.NotificationPAX ?? false))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASA > 12)", null, Properties.Resources.textOverview, null, "CREWA");
vViolations.Add(mv);
}
}
}
if((pasdMessage != null) && (pasdMessage.Elements.Count > 12))
{
PASD firstPASD = pasdMessage.Elements[0] as PASD;
if(!(firstPASD.NotificationPAX ?? false))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASD > 12)", null, Properties.Resources.textOverview, null, "PASD");
vViolations.Add(mv);
}
if ((crewdMessage != null) && (crewdMessage.Elements.Count > 0))
{
CREWD firstCREW = crewdMessage.Elements[0] as CREWD;
if(!(firstCREW.NotificationPAX ?? false))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASD > 12)", null, Properties.Resources.textOverview, null, "CREWD");
vViolations.Add(mv);
}
}
}
#endregion
#region 4.1.23 no CREW effects warning for DE
if (crewaMessage != null)
{
MessageViolation mv = crewaMessage.ViolationList.Find((x) => x.PropertyName.Equals("Effects") && (x.ViolationCode == (int)ValidationCode.TRUNCATE));
if ((mv != null) && !Core.IsDK)
crewaMessage.ViolationList.Remove(mv);
}
if(crewdMessage != null)
{
MessageViolation mvd = crewdMessage.ViolationList.Find((x) => x.PropertyName.Equals("Effects") && (x.ViolationCode == (int)ValidationCode.TRUNCATE));
if ((mvd != null) && !Core.IsDK)
crewdMessage.ViolationList.Remove(mvd);
}
#endregion
#region WAS_RCPT double numbers
Dictionary<string, string> identDict = new Dictionary<string, string>();
foreach (WAS_RCPT was_rcpt in was_rcptMessage.Elements)
foreach (WAS_RCPT was_rcpt in was_rcptMessage.Elements.Cast<WAS_RCPT>())
{
if (!was_rcpt.IdentificationNumber.IsNullOrEmpty())
{
@ -1010,7 +1138,7 @@ namespace ENI2
{
if (poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && !poc30d.PortOfCallLast30DaysLocode.IsNullOrEmpty())
{
if((poc30d.PortOfCallLast30DaysDateOfDeparture.Value.Date == l10c.PortFacilityDateOfDeparture.Value.Date) &&
if((poc30d.PortOfCallLast30DaysDateOfDeparture.Value.Date == l10c.PortFacilityDateOfDeparture.Value.Date) &&
poc30d.PortOfCallLast30DaysLocode.Equals(l10c.PortFacilityPortLoCode, StringComparison.OrdinalIgnoreCase))
{
matchIsFound = true;
@ -1054,6 +1182,36 @@ namespace ENI2
#endregion
#region SERV existence for DEHAM / DEBRE / DEBRV
if ((!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEHAM")) || this.Core.PoC.Equals("DEHAM") ||
(!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEBRE")) || this.Core.PoC.Equals("DEBRE") ||
(!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEBRV")) || this.Core.PoC.Equals("DEBRV"))
{
if (servMessage.Elements.Count == 0)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.LIST_EMPTY, "No entry for SERV found", null, "SERV service provider", null, "SERV");
mv.MessageGroupName = Properties.Resources.textPortNotification;
vViolations.Add(mv);
}
}
#endregion
#region Tanker validation STAT/PRE72H
if ((statMessage.Elements[0] is STAT stat) && (pre72hMessage.Elements[0] is PRE72H pre72h))
{
if((pre72h.Tanker ?? false) != (stat.IsTanker ?? false))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.LIST_EMPTY, "Tanker: Please check PRE72H / STAT", null, "PRE72H / STAT", null, "STAT");
mv.MessageGroupName = Properties.Resources.textPortNotification;
vViolations.Add(mv);
}
}
#endregion
#endregion
foreach (MessageError me in vErrors)
@ -1105,8 +1263,8 @@ namespace ENI2
this._errorListDialog.Loaded += (o, e) => this._errorListDialog.RefreshVisible = true;
this._errorListDialog.ErrorSelected += _errorListDialog_ErrorSelected;
this._errorListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
this._errorListDialog.Show();
}
this._errorListDialog.Show();
}
else
{
this._errorListDialog.BringUp();
@ -1118,19 +1276,19 @@ namespace ENI2
{
if(this._violationListDialog == null)
{
this._violationListDialog = new ViolationListDialog();
this._violationListDialog = new ViolationListDialog();
this._violationListDialog.Closed += (o, e) => this._violationListDialog = null;
this._violationListDialog.Loaded += (o, e) => this._violationListDialog.RefreshVisible = true;
this._violationListDialog.ViolationSelected += _errorListDialog_ErrorSelected;
this._violationListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
this._violationListDialog.Show();
this._violationListDialog.Show();
}
else
{
this._violationListDialog.BringUp();
}
_violationListDialog.Violations = vViolations;
}
}
if((vErrors.Count == 0) && (vViolations.Count == 0))
{
@ -1142,7 +1300,7 @@ namespace ENI2
private void _errorListDialog_RefreshClicked()
{
DetailControl_RequestValidate();
DetailControl_RequestValidate(true);
}
private void _errorListDialog_ErrorSelected(DatabaseEntity obj)
@ -1207,9 +1365,9 @@ namespace ENI2
case Message.NotificationClass.BKRA:
return Properties.Resources.textArrivalNotification;
case Message.NotificationClass.BPOL:
case Message.NotificationClass.CREW:
case Message.NotificationClass.CREWA:
case Message.NotificationClass.CREWD:
case Message.NotificationClass.PAS:
case Message.NotificationClass.PASA:
case Message.NotificationClass.PASD:
return Properties.Resources.textBorderPolice;
case Message.NotificationClass.HAZA:

View File

@ -71,8 +71,24 @@
AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerType}" Binding="{Binding BunkerFuelType}" IsReadOnly="True" Width="0.2*" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerQuantity}" Binding="{Binding BunkerFuelQuantity_TNE, Mode=TwoWay}" IsReadOnly="True" Width="0.8*" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerType}" Width="0.2*">
<DataGridTextColumn.Binding>
<Binding Path="BunkerFuelType" Mode="TwoWay">
<Binding.ValidationRules>
<util:StringValidationRule MaxLength="25" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerQuantity}" IsReadOnly="False" Width="0.8*">
<DataGridTextColumn.Binding>
<Binding Path="BunkerFuelQuantity_TNE" Mode="TwoWay">
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="10000"/>
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</GroupBox>

View File

@ -38,7 +38,8 @@ namespace ENI2.DetailViewControls
this.RegisterIntegerUpDownChange(this.integerUpDownCrewMemberOnBoard, Message.NotificationClass.POBA);
this.RegisterIntegerUpDownChange(this.integerUpDownPassengersOnBoard, Message.NotificationClass.POBA);
this.RegisterIntegerUpDownChange(this.integerUpDownPersonsOnBoard, Message.NotificationClass.POBA);
this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBA);
this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBA);
this.dataGridBKRA.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.BKRA); };
startupComplete = true;
}
@ -183,6 +184,8 @@ namespace ENI2.DetailViewControls
private void DataGridBKRA_CreateRequested()
{
this.dataGridBKRA.CancelEdit();
this.dataGridBKRA.CancelEdit();
EditBKRDialog ebd = new EditBKRDialog();
ebd.BRKA = new BRKA();
ebd.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
@ -215,6 +218,8 @@ namespace ENI2.DetailViewControls
{
if (obj is BRKA brka)
{
this.dataGridBKRA.CancelEdit();
this.dataGridBKRA.CancelEdit();
// are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(brka);
this._bkraMessage.Elements.Remove(brka);
@ -225,8 +230,12 @@ namespace ENI2.DetailViewControls
}
private void DataGridBKRA_EditRequested(DatabaseEntity obj)
{
{
// I am not shitting you: this has to be called TWICE(!) in a row in order to work
// see: https://stackoverflow.com/questions/20204592/wpf-datagrid-refresh-is-not-allowed-during-an-addnew-or-edititem-transaction-m
this.dataGridBKRA.CancelEdit(DataGridEditingUnit.Row);
this.dataGridBKRA.CommitEdit(DataGridEditingUnit.Row, true);
EditBKRDialog eld = new EditBKRDialog();
eld.IsDeparture = false;
eld.BRKA = obj as BRKA;
@ -236,7 +245,8 @@ namespace ENI2.DetailViewControls
eld.CopyValuesToEntity();
if(!_bkraMessage.Elements.Contains(eld.BRKA))
_bkraMessage.Elements.Add(eld.BRKA);
this.dataGridBKRA.Items.Refresh();
this.dataGridBKRA.ItemsSource = null;
this.dataGridBKRA.ItemsSource = this._bkraMessage.Elements;
eld.BRKA = new BRKA();
eld.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
eld.BRKA.MessageHeader = _bkraMessage;
@ -247,7 +257,8 @@ namespace ENI2.DetailViewControls
{
if (!_bkraMessage.Elements.Contains(eld.BRKA))
_bkraMessage.Elements.Add(eld.BRKA);
this.dataGridBKRA.Items.Refresh();
this.dataGridBKRA.ItemsSource = null;
this.dataGridBKRA.ItemsSource = this._bkraMessage.Elements;
this.SublistElementChanged(Message.NotificationClass.BKRA);
}
}
@ -277,18 +288,7 @@ namespace ENI2.DetailViewControls
if (this._tiefaMessage.HasViolations) this.tiefaGroupBox.BorderBrush = Brushes.Yellow;
}
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#endregion
#region special datetimepicker validation popup (OMG)

View File

@ -49,7 +49,7 @@
</ScrollViewer>
</GroupBox>
</TabItem>
<TabItem Header="{x:Static p:Resources.textCrew}" Name="tabCrewArrival">
<TabItem Header="{x:Static p:Resources.textCrewArrival}" Name="tabCrewArrival">
<GroupBox Name="groupBoxCrewList" Header="{x:Static p:Resources.textTabCrewList}">
<Grid>
<Grid.RowDefinitions>
@ -60,13 +60,14 @@
<Button Name="buttonImportExcelCrew" Content="{x:Static p:Resources.textImportFromExcel}" Margin="2" Width="120" HorizontalAlignment="Left" VerticalAlignment="Center" Background="Transparent" Click="buttonImportExcelCrew_Click" />
<TextBlock Margin="20, 0, 0, 0" Name="textBlockNumCrewEntries" FontWeight="Bold" Text="{Binding Elements.Count}" VerticalAlignment="Center"/>
<Label Name="labelCrewEntryCount" Content="{x:Static p:Resources.textEntries}" />
<!--
<CheckBox Name="checkBoxCrewNotificationSchengen" IsThreeState="False" VerticalAlignment="Center" Margin="10,0,0,0" Click="checkBoxCrewNotificationSchengen_Click"/>
<Label Name="labelCrewNotificationSchengen" Content="{x:Static p:Resources.textNotificationSchengen}" />
<CheckBox Name="checkBoxCrewNotificationPAX" IsThreeState="False" VerticalAlignment="Center" Margin="10,0,0,0" Click="checkBoxCrewNotificationPAX_Click"/>
<Label Name="labelCrewNotificationPAX" Content="{x:Static p:Resources.textNotificationPAX}" />
<Button Name="buttonDeleteAllCrewA" Margin="2" Content="{x:Static p:Resources.textDeleteAllEntries}" Background="Transparent" Click="buttonDeleteAllCrewA_Click"/>
<TextBlock Margin="30,0,0,0" FontWeight="Bold" FontSize="16" Text="CREWA" VerticalAlignment="Center" />
-->
</StackPanel>
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" x:Name="dataGridCrewList" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
AutoGenerateColumns="False" Margin="0,5,0,0">
@ -78,7 +79,7 @@
<DataGridTextColumn Header="{x:Static p:Resources.textCrewFunctionOnBoard}" Binding="{Binding CrewMemberDuty, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textNationality}" Binding="{Binding CrewMemberNationality, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textPlaceOfBirth}" Binding="{Binding CrewMemberPlaceOfBirth, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<!--<DataGridTextColumn Header="{x:Static p:Resources.textCountryOfBirth}" Binding="{Binding CrewMemberCountryOfBirth, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />--> <!-- XXX: TODO -->
<DataGridTextColumn Header="{x:Static p:Resources.textCountryOfBirth}" Binding="{Binding CrewMemberCountryOfBirth, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDateOfBirth}" Binding="{Binding CrewMemberDateOfBirth, Mode=TwoWay, StringFormat=\{0:dd.MM.yyyy\}}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textIdDocType}" Binding="{Binding CrewMemberIdentityDocumentTypeDisplay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textIdDocNumber}" Binding="{Binding CrewMemberIdentityDocumentId, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
@ -91,7 +92,7 @@
</Grid>
</GroupBox>
</TabItem>
<!-- XXX : TODO
<TabItem Header="{x:Static p:Resources.textCrewDeparture}" Name="tabCrewDeparture">
<GroupBox Name="groupBoxCrewListDeparture" Header="{x:Static p:Resources.textTabCrewList}">
<Grid>
@ -107,6 +108,7 @@
<Label Name="labelCrewNotificationSchengenDeparture" Content="{x:Static p:Resources.textNotificationSchengen}" />
<CheckBox Name="checkBoxCrewNotificationPAXDeparture" IsThreeState="False" VerticalAlignment="Center" Margin="10,0,0,0" Click="checkBoxCrewNotificationPAXDeparture_Click"/>
<Label Name="labelCrewNotificationPAXDeparture" Content="{x:Static p:Resources.textNotificationPAX}" />
<Button Name="buttonDeleteAllCrewD" Margin="2" Content="{x:Static p:Resources.textDeleteAllEntries}" Background="Transparent" Click="buttonDeleteAllCrewD_Click"/>
<TextBlock Margin="30,0,0,0" FontWeight="Bold" FontSize="16" Text="CREWD" VerticalAlignment="Center" />
</StackPanel>
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" x:Name="dataGridCrewListDeparture" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
@ -131,8 +133,8 @@
</Grid>
</GroupBox>
</TabItem>
-->
<TabItem Header="{x:Static p:Resources.textPas}" Name="tabPassengerList">
<TabItem Header="{x:Static p:Resources.textPasArrival}" Name="tabPassengerList">
<GroupBox Name="groupBoxPassengerList" Header="{x:Static p:Resources.textTabPassengerList}">
<Grid>
<Grid.RowDefinitions>
@ -143,13 +145,12 @@
<Button Name="buttonImportExcelPassenger" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textImportFromExcel}" Margin="2" Width="120" HorizontalAlignment="Left" VerticalAlignment="Center" Background="Transparent" Click="buttonImportExcelPassenger_Click" />
<TextBlock Margin="20, 0, 0, 0" Name="textBlockNumPasEntries" FontWeight="Bold" Text="{Binding Elements.Count}" VerticalAlignment="Center"/>
<Label Name="labelPasEntryCount" Content="{x:Static p:Resources.textEntries}" />
<!--
<CheckBox Name="checkBoxPasNotificationSchengen" IsThreeState="False" VerticalAlignment="Center" Margin="10,0,0,0" Click="checkBoxPasNotificationSchengen_Click"/>
<Label Name="labelPasNotificationSchengen" Content="{x:Static p:Resources.textNotificationSchengen}" />
<CheckBox Name="checkBoxPasNotificationPAX" IsThreeState="False" VerticalAlignment="Center" Margin="10,0,0,0" Click="checkBoxPasNotificationPAX_Click"/>
<Label Name="labelPasNotificationPAX" Content="{x:Static p:Resources.textNotificationPAX}" />
<TextBlock Margin="30,0,0,0" FontWeight="Bold" FontSize="16" Text="PASA" VerticalAlignment="Center" />
-->
<Button Name="buttonDeleteAllPasA" Margin="2" Content="{x:Static p:Resources.textDeleteAllEntries}" Background="Transparent" Click="buttonDeleteAllPasA_Click"/>
<TextBlock Margin="30,0,0,0" FontWeight="Bold" FontSize="16" Text="PASA" VerticalAlignment="Center" />
</StackPanel>
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridPassengerList" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
AutoGenerateColumns="False" Margin="0,5,0,0">
@ -163,22 +164,22 @@
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textTransitPassenger}" Binding="{Binding PassengerInTransit}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textNationality}" Binding="{Binding PassengerNationality}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textPlaceOfBirth}" Binding="{Binding PassengerPlaceOfBirth}" IsReadOnly="True" Width="0.1*" />
<!--<DataGridTextColumn Header="{x:Static p:Resources.textCountryOfBirth}" Binding="{Binding PassengerCountryOfBirth, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />-->
<DataGridTextColumn Header="{x:Static p:Resources.textCountryOfBirth}" Binding="{Binding PassengerCountryOfBirth, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDateOfBirth}" Binding="{Binding PassengerDateOfBirth, StringFormat=\{0:dd.MM.yyyy\}}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textIdDocType}" Binding="{Binding PassengerIdentityDocumentTypeDisplay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textIdDocNumber}" Binding="{Binding PassengerIdentityDocumentId}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDocumentIssuingState}" Binding="{Binding PassengerIdentityDocumentIssuingState}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDocumentExpiryDate}" Binding="{Binding PassengerIdentityDocumentExpiryDate, StringFormat=\{0:dd.MM.yyyy\}}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textVisaNumber}" Binding="{Binding PassengerVisaNumber}" IsReadOnly="True" Width="0.1*" />
<!--<DataGridTextColumn Header="{x:Static p:Resources.textEmergencyCare}" Binding="{Binding EmergencyCare, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />--> <!-- XXX : TODO -->
<!-- <DataGridTextColumn Header="{x:Static p:Resources.textEmergencyContactNumber}" Binding="{Binding EmergencyContactNumber, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" /> -->
<DataGridTextColumn Header="{x:Static p:Resources.textEmergencyCare}" Binding="{Binding EmergencyCare, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textEmergencyContactNumber}" Binding="{Binding EmergencyContactNumber, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</Grid>
</GroupBox>
</TabItem>
<!-- XXX : TODO
<TabItem Header="{x:Static p:Resources.textPasDeparture}" Name="tabPassengerListDeparture">
<GroupBox Name="groupBoxPassengerListDeparture" Header="{x:Static p:Resources.textTabPassengerList}">
<Grid>
@ -194,6 +195,7 @@
<Label Name="labelPasNotificationSchengenDeparture" Content="{x:Static p:Resources.textNotificationSchengen}" />
<CheckBox Name="checkBoxPasNotificationPAXDeparture" IsThreeState="False" VerticalAlignment="Center" Margin="10,0,0,0" Click="checkBoxPasNotificationPAXDeparture_Click"/>
<Label Name="labelPasNotificationPAXDeparture" Content="{x:Static p:Resources.textNotificationPAX}" />
<Button Name="buttonDeleteAllPasD" Margin="2" Content="{x:Static p:Resources.textDeleteAllEntries}" Background="Transparent" Click="buttonDeleteAllPasD_Click"/>
<TextBlock Margin="30,0,0,0" FontWeight="Bold" FontSize="16" Text="PASD" VerticalAlignment="Center" />
</StackPanel>
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridPassengerListDeparture" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
@ -222,7 +224,7 @@
</Grid>
</GroupBox>
</TabItem>
-->
</TabControl>
</src:DetailBaseControl>

View File

@ -13,6 +13,8 @@ using ENI2.Util;
using ENI2.Locode;
using ExcelDataReader;
using bsmd.database;
using System.Windows.Media.Imaging;
using System.Linq;
namespace ENI2.DetailViewControls
{
@ -50,8 +52,8 @@ namespace ENI2.DetailViewControls
foreach (Message aMessage in this.Messages)
{
if (aMessage.MessageNotificationClass == Message.NotificationClass.BPOL) { this._bpolMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.CREW) { this._crewMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.PAS) { this._pasMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.CREWA) { this._crewMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.PASA) { this._pasMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.CREWD) { this._crewdMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.PASD) { this._pasdMessage = aMessage; this.ControlMessages.Add(aMessage); }
@ -99,7 +101,7 @@ namespace ENI2.DetailViewControls
if (this._crewMessage == null)
{
this._crewMessage = this.Core.CreateMessage(Message.NotificationClass.CREW);
this._crewMessage = this.Core.CreateMessage(Message.NotificationClass.CREWA);
this.Messages.Add(this._crewMessage);
}
@ -112,19 +114,27 @@ namespace ENI2.DetailViewControls
this.dataGridCrewList.DeleteRequested += DataGridCrewList_DeleteRequested;
this.dataGridCrewList.CreateRequested += DataGridCrewList_CreateRequested;
this.dataGridCrewList.RefreshGrid += DataGridCrewList_RefreshGrid;
/* XXX : TODO
this.dataGridCrewList.MultiEditRequested += DataGridCrewList_MultiEditRequested;
if(this._crewMessage.Elements.Count > 0)
{
this.checkBoxCrewNotificationSchengen.IsChecked = ((CREW)this._crewMessage.Elements[0]).NotificationSchengen;
this.checkBoxCrewNotificationPAX.IsChecked = ((CREW)this._crewMessage.Elements[0]).NotificationPAX;
}
*/
// extra menu copy to CREWD
{
this.dataGridCrewList.ContextMenu.Items.Add(new Separator());
MenuItem copyCREWAItem = new MenuItem();
copyCREWAItem.Header = Properties.Resources.textCopyToCREWD;
copyCREWAItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
copyCREWAItem.Click += CopyCREWAItem_Click;
this.dataGridCrewList.ContextMenu.Items.Add(copyCREWAItem);
}
#endregion
#region init CREWD
/* XXX : TODO
#region init CREWD
if (this._crewdMessage == null)
{
@ -141,6 +151,7 @@ namespace ENI2.DetailViewControls
this.dataGridCrewListDeparture.DeleteRequested += DataGridCrewListDeparture_DeleteRequested;
this.dataGridCrewListDeparture.CreateRequested += DataGridCrewListDeparture_CreateRequested;
this.dataGridCrewListDeparture.RefreshGrid += DataGridCrewListDeparture_RefreshGrid;
this.dataGridCrewListDeparture.MultiEditRequested += DataGridCrewListDeparture_MultiEditRequested;
if (this._crewdMessage.Elements.Count > 0)
{
@ -148,7 +159,15 @@ namespace ENI2.DetailViewControls
this.checkBoxCrewNotificationPAXDeparture.IsChecked = ((CREWD)this._crewdMessage.Elements[0]).NotificationPAX;
}
*/
// extra menu copy to CREWA
{
this.dataGridCrewListDeparture.ContextMenu.Items.Add(new Separator());
MenuItem copyCREWDItem = new MenuItem();
copyCREWDItem.Header = Properties.Resources.textCopyToCREWA;
copyCREWDItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
copyCREWDItem.Click += CopyCREWDItem_Click;
this.dataGridCrewListDeparture.ContextMenu.Items.Add(copyCREWDItem);
}
#endregion
@ -156,7 +175,7 @@ namespace ENI2.DetailViewControls
if (this._pasMessage == null)
{
this._pasMessage = this.Core.CreateMessage(Message.NotificationClass.PAS);
this._pasMessage = this.Core.CreateMessage(Message.NotificationClass.PASA);
this.Messages.Add(this._pasMessage);
}
@ -169,8 +188,7 @@ namespace ENI2.DetailViewControls
this.dataGridPassengerList.DeleteRequested += DataGridPassengerList_DeleteRequested;
this.dataGridPassengerList.CreateRequested += DataGridPassengerList_CreateRequested;
this.dataGridPassengerList.RefreshGrid += DataGridPassengerList_RefreshGrid;
/* XXX : TODO
this.dataGridPassengerList.MultiEditRequested += DataGridPassengerList_MultiEditRequested;
if (this._pasMessage.Elements.Count > 0)
{
@ -178,13 +196,19 @@ namespace ENI2.DetailViewControls
this.checkBoxPasNotificationPAX.IsChecked = ((PAS)this._pasMessage.Elements[0]).NotificationPAX;
}
*/
// extra menu copy to PASD
{
this.dataGridPassengerList.ContextMenu.Items.Add(new Separator());
MenuItem copyPASAItem = new MenuItem();
copyPASAItem.Header = Properties.Resources.textCopyToPASD;
copyPASAItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
copyPASAItem.Click += CopyPASAItem_Click;
this.dataGridPassengerList.ContextMenu.Items.Add(copyPASAItem);
}
#endregion
#region init PASD
/* XXX : TODO
#region init PASD
if (this._pasdMessage == null)
{
@ -201,6 +225,7 @@ namespace ENI2.DetailViewControls
this.dataGridPassengerListDeparture.DeleteRequested += DataGridPassengerListDeparture_DeleteRequested;
this.dataGridPassengerListDeparture.CreateRequested += DataGridPassengerListDeparture_CreateRequested;
this.dataGridPassengerListDeparture.RefreshGrid += DataGridPassengerListDeparture_RefreshGrid;
this.dataGridPassengerListDeparture.MultiEditRequested += DataGridPassengerListDeparture_MultiEditRequested;
if (this._pasdMessage.Elements.Count > 0)
{
@ -208,11 +233,177 @@ namespace ENI2.DetailViewControls
this.checkBoxPasNotificationPAXDeparture.IsChecked = ((PASD)this._pasdMessage.Elements[0]).NotificationPAX;
}
*/
// extra menu copy to PASA
{
this.dataGridPassengerListDeparture.ContextMenu.Items.Add(new Separator());
MenuItem copyPASDItem = new MenuItem();
copyPASDItem.Header = Properties.Resources.textCopyToPASA;
copyPASDItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
copyPASDItem.Click += CopyPASDItem_Click;
this.dataGridPassengerListDeparture.ContextMenu.Items.Add(copyPASDItem);
}
#endregion
}
public override int SelectedTabIndex
{
get { return this.mainFrame.SelectedIndex; }
set { this.mainFrame.SelectedIndex = value; }
}
#region Grid copy handlers
private void CopyPASDItem_Click(object sender, RoutedEventArgs e)
{
if (this.dataGridPassengerListDeparture.SelectedItems != null)
{
foreach (PASD pasd in this.dataGridPassengerListDeparture.SelectedItems)
{
PAS pasa = new PAS();
pasa.MessageHeader = this._pasMessage;
pasa.CopyFromPAS(pasd);
pasa.IsDeparture = false;
pasa.Identifier = DatabaseEntity.GetNewIdentifier(this._pasMessage.Elements);
this._pasMessage.Elements.Add(pasa);
this.SublistElementChanged(Message.NotificationClass.PASA);
}
this.CheckPASA();
}
}
private void CopyPASAItem_Click(object sender, RoutedEventArgs e)
{
if (this.dataGridPassengerList.SelectedItems != null)
{
foreach (PAS pasa in this.dataGridPassengerList.SelectedItems)
{
PASD pasd = new PASD();
pasd.MessageHeader = this._pasdMessage;
pasd.CopyFromPAS(pasa);
pasd.IsDeparture = true;
pasd.Identifier = DatabaseEntity.GetNewIdentifier(this._pasdMessage.Elements);
this._pasdMessage.Elements.Add(pasd);
this.SublistElementChanged(Message.NotificationClass.PASD);
}
this.CheckPASD();
}
}
private void CopyCREWDItem_Click(object sender, RoutedEventArgs e)
{
if (this.dataGridCrewListDeparture.SelectedItems != null)
{
foreach (CREWD crewd in this.dataGridCrewListDeparture.SelectedItems)
{
CREW crewa = new CREW();
crewa.MessageHeader = this._crewMessage;
crewa.CopyFromCREW(crewd);
crewa.IsDeparture = false;
crewa.Identifier = DatabaseEntity.GetNewIdentifier(this._crewMessage.Elements);
this._crewMessage.Elements.Add(crewa);
this.SublistElementChanged(Message.NotificationClass.CREWA);
}
this.CheckCREWA();
}
}
private void CopyCREWAItem_Click(object sender, RoutedEventArgs e)
{
if(this.dataGridCrewList.SelectedItems != null)
{
foreach(CREW crewa in this.dataGridCrewList.SelectedItems)
{
CREWD crewd = new CREWD();
crewd.MessageHeader = this._crewdMessage;
crewd.CopyFromCREW(crewa);
crewd.IsDeparture = true;
crewd.Identifier = DatabaseEntity.GetNewIdentifier(this._crewdMessage.Elements);
this._crewdMessage.Elements.Add(crewd);
this.SublistElementChanged(Message.NotificationClass.CREWD);
}
this.CheckCREWD();
}
}
#endregion
#region Check Schengen / PAX flags and sync
private void CheckCREWA()
{
if (this._crewMessage.Elements.Count == 0) return;
CREW firstCREW = this._crewMessage.Elements[0] as CREW;
if (this._crewMessage.Elements.Count == 1)
{
firstCREW.NotificationSchengen = true;
this.checkBoxCrewNotificationSchengen.IsChecked = true;
}
else
{
for (int i = 1; i < this._crewMessage.Elements.Count; i++)
{
((CREW)this._crewMessage.Elements[i]).NotificationSchengen = firstCREW.NotificationSchengen;
}
}
}
private void CheckCREWD()
{
if (this._crewdMessage.Elements.Count == 0) return;
CREWD firstCREW = this._crewdMessage.Elements[0] as CREWD;
if (this._crewdMessage.Elements.Count == 1)
{
firstCREW.NotificationSchengen = true;
this.checkBoxCrewNotificationSchengenDeparture.IsChecked = true;
}
else
{
for (int i = 1; i < this._crewdMessage.Elements.Count; i++)
{
((CREWD)this._crewdMessage.Elements[i]).NotificationSchengen = firstCREW.NotificationSchengen;
}
}
}
private void CheckPASA()
{
if(this._pasMessage.Elements.Count == 0) return;
PAS firstPAS = this._pasMessage.Elements[0] as PAS;
if(this._pasMessage.Elements.Count == 1)
{
firstPAS.NotificationSchengen = true;
this.checkBoxPasNotificationSchengen.IsChecked = true;
}
else
{
for (int i = 1; i < this._pasMessage.Elements.Count; i++)
{
((PAS)this._pasMessage.Elements[i]).NotificationSchengen = firstPAS.NotificationSchengen;
}
}
}
private void CheckPASD()
{
if(this._pasdMessage.Elements.Count == 0) return;
PASD firstPAS = this._pasdMessage.Elements[0] as PASD;
if (this._pasdMessage.Elements.Count == 1)
{
firstPAS.NotificationSchengen = true;
this.checkBoxPasNotificationSchengenDeparture.IsChecked = true;
}
else
{
for (int i = 1; i < this._pasdMessage.Elements.Count; i++)
{
((PASD)this._pasdMessage.Elements[i]).NotificationSchengen = firstPAS.NotificationSchengen;
}
}
}
#endregion
#region SetEnabled
public override void SetEnabled(bool enabled)
@ -364,23 +555,29 @@ namespace ENI2.DetailViewControls
epd.AddClicked += () =>
{
epd.CopyValuesToEntity();
if(!this._pasMessage.Elements.Contains(epd.PAS))
if (!this._pasMessage.Elements.Contains(epd.PAS))
{
this._pasMessage.Elements.Add(epd.PAS);
this.CheckPASA();
}
this.dataGridPassengerList.Items.Refresh();
epd.PAS = new PAS
{
MessageHeader = this._pasMessage,
Identifier = PAS.GetNewIdentifier(_pasMessage.Elements)
};
this.SublistElementChanged(Message.NotificationClass.PAS);
this.SublistElementChanged(Message.NotificationClass.PASA);
};
if (epd.ShowDialog() ?? false)
{
if(!this._pasMessage.Elements.Contains(epd.PAS))
if (!this._pasMessage.Elements.Contains(epd.PAS))
{
_pasMessage.Elements.Add(epd.PAS);
this.CheckPASA();
}
this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PAS);
this.SublistElementChanged(Message.NotificationClass.PASA);
}
}
@ -397,7 +594,7 @@ namespace ENI2.DetailViewControls
private void DataGridPassengerList_RefreshGrid()
{
DatabaseEntity.ResetIdentifiers(_pasMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.PAS);
this.SublistElementChanged(Message.NotificationClass.PASA);
this.dataGridPassengerList.Items.Refresh();
}
@ -411,24 +608,30 @@ namespace ENI2.DetailViewControls
epd.AddClicked += () =>
{
epd.CopyValuesToEntity();
if(!_pasMessage.Elements.Contains(epd.PAS))
if (!_pasMessage.Elements.Contains(epd.PAS))
{
_pasMessage.Elements.Add(epd.PAS);
this.CheckPASA();
}
this.dataGridPassengerList.Items.Refresh();
epd.PAS = new PAS
{
Identifier = PAS.GetNewIdentifier(_pasMessage.Elements),
MessageHeader = _pasMessage
};
this.SublistElementChanged(Message.NotificationClass.PAS);
this.SublistElementChanged(Message.NotificationClass.PASA);
};
if (epd.ShowDialog() ?? false)
{
if (!_pasMessage.Elements.Contains(epd.PAS))
{
_pasMessage.Elements.Add(epd.PAS);
this.CheckPASA();
}
epd.PAS.IsDirty = true;
this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PAS);
this.SublistElementChanged(Message.NotificationClass.PASA);
}
}
@ -437,9 +640,29 @@ namespace ENI2.DetailViewControls
this.DataGridPassengerList_CreateRequested();
}
#endregion
private void DataGridPassengerList_MultiEditRequested(List<DatabaseEntity> databaseEntities)
{
List<PAS> pasList = new List<PAS>();
foreach (PAS apas in databaseEntities.Cast<PAS>())
pasList.Add(apas);
/* XXX : TODO
// write common values of all PAS entities to template entity
PAS pas = PAS.CreateCommon(pasList);
EditPASDialog dialog = new EditPASDialog();
dialog.PAS = pas;
dialog.AddVisible = false;
if (dialog.ShowDialog() ?? false)
{
// write back changed values from pas to all entities and mark them as changed
PAS.WriteTemplateToList(pas, pasList);
this.SublistElementChanged(Message.NotificationClass.PASA);
this.dataGridPassengerList.Items.Refresh();
}
}
#endregion
#region passenger grid departure
@ -457,8 +680,11 @@ namespace ENI2.DetailViewControls
{
epd.CopyValuesToEntity();
if (!this._pasdMessage.Elements.Contains(epd.PAS))
{
this._pasdMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh();
this.CheckPASD();
}
this.dataGridPassengerListDeparture.Items.Refresh();
epd.PAS = new PASD
{
IsDeparture = true,
@ -471,7 +697,10 @@ namespace ENI2.DetailViewControls
if (epd.ShowDialog() ?? false)
{
if (!this._pasdMessage.Elements.Contains(epd.PAS))
{
_pasdMessage.Elements.Add(epd.PAS);
this.CheckPASD();
}
this.dataGridPassengerListDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PASD);
}
@ -505,8 +734,11 @@ namespace ENI2.DetailViewControls
{
epd.CopyValuesToEntity();
if (!_pasMessage.Elements.Contains(epd.PAS))
{
_pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh();
this.CheckPASD();
}
this.dataGridPassengerListDeparture.Items.Refresh();
epd.PAS = new PASD
{
IsDeparture = true,
@ -519,7 +751,10 @@ namespace ENI2.DetailViewControls
if (epd.ShowDialog() ?? false)
{
if (!_pasdMessage.Elements.Contains(epd.PAS))
{
_pasdMessage.Elements.Add(epd.PAS);
this.CheckPASD();
}
epd.PAS.IsDirty = true;
this.dataGridPassengerListDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PASD);
@ -531,9 +766,29 @@ namespace ENI2.DetailViewControls
this.DataGridPassengerListDeparture_CreateRequested();
}
#endregion
private void DataGridPassengerListDeparture_MultiEditRequested(List<DatabaseEntity> databaseEntities)
{
List<PAS> pasList = new List<PAS>();
foreach (PAS apas in databaseEntities.Cast<PAS>())
pasList.Add(apas);
*/
// write common values of all PAS entities to template entity
PAS pas = PAS.CreateCommon(pasList);
EditPASDialog dialog = new EditPASDialog();
dialog.PAS = pas;
dialog.AddVisible = false;
if (dialog.ShowDialog() ?? false)
{
// write back changed values from pas to all entities and mark them as changed
PAS.WriteTemplateToList(pas, pasList);
this.SublistElementChanged(Message.NotificationClass.PASD);
this.dataGridPassengerListDeparture.Items.Refresh();
}
}
#endregion
#region crew grid arrival
@ -549,23 +804,29 @@ namespace ENI2.DetailViewControls
ecd.AddClicked += () =>
{
ecd.CopyValuesToEntity();
if(!this._crewMessage.Elements.Contains(ecd.CREW))
if (!this._crewMessage.Elements.Contains(ecd.CREW))
{
this._crewMessage.Elements.Add(ecd.CREW);
this.dataGridCrewList.Items.Refresh();
this.CheckCREWA();
}
this.dataGridCrewList.Items.Refresh();
ecd.CREW = new CREW
{
MessageHeader = this._crewMessage,
Identifier = CREW.GetNewIdentifier(_crewMessage.Elements)
};
this.SublistElementChanged(Message.NotificationClass.CREW);
this.SublistElementChanged(Message.NotificationClass.CREWA);
};
if (ecd.ShowDialog() ?? false)
{
if(!this._crewMessage.Elements.Contains(ecd.CREW))
_crewMessage.Elements.Add(ecd.CREW);
if (!this._crewMessage.Elements.Contains(ecd.CREW))
{
_crewMessage.Elements.Add(ecd.CREW);
this.CheckCREWA();
}
this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREW);
this.SublistElementChanged(Message.NotificationClass.CREWA);
}
}
@ -582,7 +843,7 @@ namespace ENI2.DetailViewControls
private void DataGridCrewList_RefreshGrid()
{
DatabaseEntity.ResetIdentifiers(_crewMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.CREW);
this.SublistElementChanged(Message.NotificationClass.CREWA);
this.dataGridCrewList.Items.Refresh();
}
@ -596,24 +857,30 @@ namespace ENI2.DetailViewControls
ecd.AddClicked += () =>
{
ecd.CopyValuesToEntity();
if(!_crewMessage.Elements.Contains(ecd.CREW))
if (!_crewMessage.Elements.Contains(ecd.CREW))
{
_crewMessage.Elements.Add(ecd.CREW);
this.CheckCREWA();
}
this.dataGridCrewList.Items.Refresh();
ecd.CREW = new CREW
{
Identifier = CREW.GetNewIdentifier(_crewMessage.Elements),
MessageHeader = _crewMessage
};
this.SublistElementChanged(Message.NotificationClass.CREW);
this.SublistElementChanged(Message.NotificationClass.CREWA);
};
if (ecd.ShowDialog() ?? false)
{
if (!_crewMessage.Elements.Contains(ecd.CREW))
{
_crewMessage.Elements.Add(ecd.CREW);
this.CheckCREWA();
}
ecd.CREW.IsDirty = true;
this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREW);
this.SublistElementChanged(Message.NotificationClass.CREWA);
}
}
@ -622,9 +889,29 @@ namespace ENI2.DetailViewControls
this.DataGridCrewList_CreateRequested();
}
#endregion
private void DataGridCrewList_MultiEditRequested(List<DatabaseEntity> databaseEntities)
{
List<CREW> crewList = new List<CREW>();
foreach (CREW acrew in databaseEntities.Cast<CREW>())
crewList.Add(acrew);
/* XXX : TODO
// write common values of all CREW entities to template entity
CREW crew = CREW.CreateCommon(crewList);
EditCREWDialog dialog = new EditCREWDialog();
dialog.CREW = crew;
dialog.AddVisible = false;
if(dialog.ShowDialog() ?? false)
{
// write back changed values from crew to all entities and mark them as changed
CREW.WriteTemplateToList(crew, crewList);
this.SublistElementChanged(Message.NotificationClass.CREWA);
this.dataGridCrewList.Items.Refresh();
}
}
#endregion
#region crew grid departure
@ -642,7 +929,10 @@ namespace ENI2.DetailViewControls
{
ecd.CopyValuesToEntity();
if (!this._crewdMessage.Elements.Contains(ecd.CREW))
{
this._crewdMessage.Elements.Add(ecd.CREW);
this.CheckCREWD();
}
this.dataGridCrewListDeparture.Items.Refresh();
ecd.CREW = new CREWD
{
@ -656,7 +946,10 @@ namespace ENI2.DetailViewControls
if (ecd.ShowDialog() ?? false)
{
if (!this._crewdMessage.Elements.Contains(ecd.CREW))
{
_crewdMessage.Elements.Add(ecd.CREW);
this.CheckCREWD();
}
this.dataGridCrewListDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREWD);
}
@ -667,7 +960,7 @@ namespace ENI2.DetailViewControls
if (obj is CREWD crewd)
{
// are you sure dialog is in base class
_crewMessage.Elements.Remove(crewd);
_crewdMessage.Elements.Remove(crewd);
DBManager.Instance.Delete(crewd);
}
}
@ -690,7 +983,10 @@ namespace ENI2.DetailViewControls
{
ecd.CopyValuesToEntity();
if (!_crewdMessage.Elements.Contains(ecd.CREW))
{
_crewdMessage.Elements.Add(ecd.CREW);
this.CheckCREWD();
}
this.dataGridCrewListDeparture.Items.Refresh();
ecd.CREW = new CREWD
{
@ -704,7 +1000,10 @@ namespace ENI2.DetailViewControls
if (ecd.ShowDialog() ?? false)
{
if (!_crewdMessage.Elements.Contains(ecd.CREW))
{
_crewdMessage.Elements.Add(ecd.CREW);
this.CheckCREWD();
}
ecd.CREW.IsDirty = true;
this.dataGridCrewListDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREWD);
@ -716,23 +1015,32 @@ namespace ENI2.DetailViewControls
this.DataGridCrewListDeparture_CreateRequested();
}
#endregion
*/
#region Excel import
private string getValueAsString(IExcelDataReader reader, int index)
private void DataGridCrewListDeparture_MultiEditRequested(List<DatabaseEntity> databaseEntities)
{
Type fieldType = reader.GetFieldType(index);
if (fieldType == null) return null;
if (fieldType == typeof(double))
return reader.GetDouble(index).ToString();
if (fieldType == typeof(int))
return reader.GetInt32(index).ToString();
return reader.GetString(index);
List<CREW> crewList = new List<CREW>();
foreach (CREW acrew in databaseEntities.Cast<CREW>())
crewList.Add(acrew);
// write common values of all CREW entities to template entity
CREW crew = CREW.CreateCommon(crewList);
EditCREWDialog dialog = new EditCREWDialog();
dialog.CREW = crew;
dialog.AddVisible = false;
if (dialog.ShowDialog() ?? false)
{
// write back changed values from crew to all entities and mark them as changed
CREW.WriteTemplateToList(crew, crewList);
this.SublistElementChanged(Message.NotificationClass.CREWD);
this.dataGridCrewListDeparture.Items.Refresh();
}
}
#endregion
#region Excel import
private void buttonImportExcelCrew_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog
@ -778,10 +1086,10 @@ namespace ENI2.DetailViewControls
if (!reader.IsDBNull(6)) crew.CrewMemberCountryOfBirth = reader.GetString(6).Substring(0, 2).ToUpper();
if (!reader.IsDBNull(7)) crew.CrewMemberDateOfBirth = reader.GetDateTime(7);
if (!reader.IsDBNull(8)) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(8));
if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = this.getValueAsString(reader, 9).Clean();
if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = reader.ReadAsString(9).Clean();
if (!reader.IsDBNull(10)) crew.CrewMemberIdentityDocumentIssuingState = reader.GetString(10).Substring(0, 2).ToUpper();
if (!reader.IsDBNull(11)) crew.CrewMemberIdentityDocumentExpiryDate = reader.GetDateTime(11);
if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = this.getValueAsString(reader, 12).Clean();
if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = reader.ReadAsString(12).Clean();
crew.MessageHeader = this._crewMessage;
crew.IsDirty = true;
@ -798,17 +1106,15 @@ namespace ENI2.DetailViewControls
if (importCrew.Count > 0)
{
this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREW);
this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREWA);
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
}
}
stream.Close();
}
}
/* XXX : TODO
}
private void buttonImportExcelCrewDeparture_Click(object sender, RoutedEventArgs e)
{
@ -851,18 +1157,18 @@ namespace ENI2.DetailViewControls
if (crew.CrewMemberLastName.Equals("Family Name") || (crew.CrewMemberLastName.Trim().Length == 0)) continue;
if (!reader.IsDBNull(1)) crew.CrewMemberFirstName = reader.GetString(1);
if (!reader.IsDBNull(2)) crew.CrewMemberGender = GlobalStructures.ParseGender(reader.GetString(2));
if (!reader.IsDBNull(3)) crew.CrewMemberDuty = reader.GetString(3);
if (!reader.IsDBNull(3)) crew.CrewMemberDuty = reader.GetString(3).Clean();
if (!reader.IsDBNull(4)) crew.CrewMemberNationality = reader.GetString(4).Substring(0, 2).ToUpper();
if (!reader.IsDBNull(5)) crew.CrewMemberPlaceOfBirth = reader.GetString(5);
if (!reader.IsDBNull(6)) crew.CrewMemberCountryOfBirth = reader.GetString(6).Substring(0, 2).ToUpper();
if (!reader.IsDBNull(7)) crew.CrewMemberDateOfBirth = reader.GetDateTime(7);
if (!reader.IsDBNull(8)) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(8));
if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = this.getValueAsString(reader, 9);
if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = reader.ReadAsString(9);
if (!reader.IsDBNull(10)) crew.CrewMemberIdentityDocumentIssuingState = reader.GetString(10).Substring(0, 2).ToUpper();
if (!reader.IsDBNull(11)) crew.CrewMemberIdentityDocumentExpiryDate = reader.GetDateTime(11);
if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = this.getValueAsString(reader, 12);
if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = reader.ReadAsString(12);
crew.MessageHeader = this._crewMessage;
crew.MessageHeader = this._crewdMessage;
crew.IsDirty = true;
crew.Identifier = CREWD.GetNewIdentifier(this._crewdMessage.Elements);
this._crewdMessage.Elements.Add(crew);
@ -885,9 +1191,7 @@ namespace ENI2.DetailViewControls
stream.Close();
}
}
*/
}
private void buttonImportExcelPassenger_Click(object sender, RoutedEventArgs e)
{
@ -941,12 +1245,12 @@ namespace ENI2.DetailViewControls
if (!reader.IsDBNull(8)) pas.PassengerCountryOfBirth = reader.GetString(8).Substring(0, 2).ToUpper().Clean();
if (!reader.IsDBNull(9)) pas.PassengerDateOfBirth = reader.GetDateTime(9);
if (!reader.IsDBNull(10)) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(10));
if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = this.getValueAsString(reader, 11).Clean();
if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = reader.ReadAsString(11).Clean();
if (!reader.IsDBNull(12)) pas.PassengerIdentityDocumentIssuingState = reader.GetString(12).Substring(0, 2).ToUpper();
if (!reader.IsDBNull(13)) pas.PassengerIdentityDocumentExpiryDate = reader.GetDateTime(13);
if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = this.getValueAsString(reader, 14).Clean();
if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = reader.ReadAsString(14).Clean();
if (!reader.IsDBNull(15)) pas.EmergencyCare = reader.GetString(15).Clean();
if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = this.getValueAsString(reader, 16).Clean();
if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = reader.ReadAsString(16).Clean();
pas.MessageHeader = this._pasMessage;
pas.IsDirty = true;
@ -964,15 +1268,13 @@ namespace ENI2.DetailViewControls
if (importPassenger.Count > 0)
{
this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PAS);
this.SublistElementChanged(Message.NotificationClass.PASA);
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
}
}
stream.Close();
}
}
/*
}
private void buttonImportExcelPassengerDeparture_Click(object sender, RoutedEventArgs e)
{
@ -1026,12 +1328,12 @@ namespace ENI2.DetailViewControls
if (!reader.IsDBNull(8)) pas.PassengerCountryOfBirth = reader.GetString(8).Substring(0, 2).ToUpper();
if (!reader.IsDBNull(9)) pas.PassengerDateOfBirth = reader.GetDateTime(9);
if (!reader.IsDBNull(10)) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(10));
if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = this.getValueAsString(reader, 11);
if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = reader.ReadAsString(11);
if (!reader.IsDBNull(12)) pas.PassengerIdentityDocumentIssuingState = reader.GetString(12).Substring(0, 2).ToUpper();
if (!reader.IsDBNull(13)) pas.PassengerIdentityDocumentExpiryDate = reader.GetDateTime(13);
if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = this.getValueAsString(reader, 14);
if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = reader.ReadAsString(14);
if (!reader.IsDBNull(15)) pas.EmergencyCare = reader.GetString(15);
if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = this.getValueAsString(reader, 16);
if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = reader.ReadAsString(16);
pas.MessageHeader = this._pasMessage;
pas.IsDirty = true;
@ -1055,9 +1357,7 @@ namespace ENI2.DetailViewControls
}
stream.Close();
}
}
*/
}
#endregion
@ -1083,45 +1383,32 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.groupBoxPassengerList, HighlightService.HighlightStyle.VIOLATION, this._pasMessage);
}
#endregion
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#region Schengen/PAX checkboxes changed event handler
/* XXX : TODO
#region Schengen/PAX checkboxes changed event handler
private void checkBoxCrewNotificationSchengen_Click(object sender, RoutedEventArgs e)
{
foreach(CREW crew in _crewMessage.Elements)
foreach(CREW crew in _crewMessage.Elements.Cast<CREW>())
{
crew.NotificationSchengen = checkBoxCrewNotificationSchengen.IsChecked;
}
this.SublistElementChanged(Message.NotificationClass.CREW);
this.SublistElementChanged(Message.NotificationClass.CREWA);
}
private void checkBoxCrewNotificationPAX_Click(object sender, RoutedEventArgs e)
{
foreach (CREW crew in _crewMessage.Elements)
foreach (CREW crew in _crewMessage.Elements.Cast<CREW>())
{
crew.NotificationPAX = checkBoxCrewNotificationPAX.IsChecked;
}
this.SublistElementChanged(Message.NotificationClass.CREW);
this.SublistElementChanged(Message.NotificationClass.CREWA);
}
private void checkBoxCrewNotificationSchengenDeparture_Click(object sender, RoutedEventArgs e)
{
foreach(CREWD crewd in _crewdMessage.Elements)
foreach(CREWD crewd in _crewdMessage.Elements.Cast<CREWD>())
{
crewd.NotificationSchengen = checkBoxCrewNotificationSchengenDeparture.IsChecked;
}
@ -1130,7 +1417,7 @@ namespace ENI2.DetailViewControls
private void checkBoxCrewNotificationPAXDeparture_Click(object sender, RoutedEventArgs e)
{
foreach (CREWD crewd in _crewdMessage.Elements)
foreach (CREWD crewd in _crewdMessage.Elements.Cast<CREWD>())
{
crewd.NotificationPAX = checkBoxCrewNotificationPAXDeparture.IsChecked;
}
@ -1139,25 +1426,25 @@ namespace ENI2.DetailViewControls
private void checkBoxPasNotificationSchengen_Click(object sender, RoutedEventArgs e)
{
foreach(PAS pas in _pasMessage.Elements)
foreach(PAS pas in _pasMessage.Elements.Cast<PAS>())
{
pas.NotificationSchengen = checkBoxPasNotificationSchengen.IsChecked;
}
this.SublistElementChanged(Message.NotificationClass.PAS);
this.SublistElementChanged(Message.NotificationClass.PASA);
}
private void checkBoxPasNotificationPAX_Click(object sender, RoutedEventArgs e)
{
foreach(PAS pas in _pasMessage.Elements)
foreach(PAS pas in _pasMessage.Elements.Cast<PAS>())
{
pas.NotificationPAX = checkBoxPasNotificationPAX.IsChecked;
}
this.SublistElementChanged(Message.NotificationClass.PAS);
this.SublistElementChanged(Message.NotificationClass.PASA);
}
private void checkBoxPasNotificationSchengenDeparture_Click(object sender, RoutedEventArgs e)
{
foreach(PASD pasd in _pasdMessage.Elements)
foreach(PASD pasd in _pasdMessage.Elements.Cast<PASD>())
{
pasd.NotificationSchengen = checkBoxPasNotificationSchengenDeparture.IsChecked;
}
@ -1166,14 +1453,72 @@ namespace ENI2.DetailViewControls
private void checkBoxPasNotificationPAXDeparture_Click(object sender, RoutedEventArgs e)
{
foreach(PASD pasd in _pasdMessage.Elements)
foreach(PASD pasd in _pasdMessage.Elements.Cast<PASD>())
{
pasd.NotificationPAX = checkBoxPasNotificationPAXDeparture.IsChecked;
}
this.SublistElementChanged(Message.NotificationClass.PASD);
}
*/
#endregion
#region Buttons to delete all entries from CREWA CREWD PASA PASD
private async void buttonDeleteAllCrewA_Click(object sender, RoutedEventArgs e)
{
if(MessageBox.Show(Properties.Resources.textConfimDeleteAllEntries, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
foreach(CREW crewa in this._crewMessage.Elements.Cast<CREW>())
{
await DBManagerAsync.DeleteAsync(crewa);
}
this._crewMessage.Elements.Clear();
this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREWA);
}
}
private async void buttonDeleteAllCrewD_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show(Properties.Resources.textConfimDeleteAllEntries, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
foreach (CREWD crewd in this._crewdMessage.Elements.Cast<CREWD>())
{
await DBManagerAsync.DeleteAsync(crewd);
}
this._crewdMessage.Elements.Clear();
this.dataGridCrewListDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREWD);
}
}
private async void buttonDeleteAllPasA_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show(Properties.Resources.textConfimDeleteAllEntries, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
foreach (PAS pasa in this._pasMessage.Elements.Cast<PAS>())
{
await DBManagerAsync.DeleteAsync(pasa);
}
this._pasMessage.Elements.Clear();
this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PASA);
}
}
private async void buttonDeleteAllPasD_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show(Properties.Resources.textConfimDeleteAllEntries, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
foreach (PASD pasd in this._pasdMessage.Elements.Cast<PASD>())
{
await DBManagerAsync.DeleteAsync(pasd);
}
this._pasdMessage.Elements.Clear();
this.dataGridPassengerListDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PASD);
}
}
#endregion

View File

@ -197,6 +197,12 @@ namespace ENI2.DetailViewControls
this._initialized = true;
}
public override int SelectedTabIndex
{
get { return this.tabControlPositions.SelectedIndex; }
set { this.tabControlPositions.SelectedIndex = value; }
}
#region SetEnabled
public override void SetEnabled(bool enabled)
@ -324,24 +330,7 @@ namespace ENI2.DetailViewControls
}
}
#endregion
/// <summary>
/// Beim Hinzufügen der allerersten Gefahrgutposition sollen die Flags vorbelegt werden
/// </summary>
void SetHAZGlobalFlags()
{
HAZ haz = this.IsDeparture ? this.hazd : this.haza;
int totalCount = haz.MARPOLPositions.Count + haz.IMDGPositions.Count + haz.IGCPositions.Count + haz.IBCPositions.Count + haz.IMSBCPositions.Count;
if(totalCount == 1)
{
if (!(this.checkBoxDangerousGoodsOnBoard.IsChecked ?? false)) this.checkBoxDangerousGoodsOnBoard.IsChecked = true;
if (this.checkBoxMoUBaltic.IsChecked ?? true) this.checkBoxMoUBaltic.IsChecked = false;
haz.NoDPGOnBoardOnArrival = false;
haz.MOUBaltic = false;
}
}
#endregion
#region MARPOL datagrid handlers
@ -898,5 +887,26 @@ namespace ENI2.DetailViewControls
#endregion
#region private methods
/// <summary>
/// Beim Hinzufügen der allerersten Gefahrgutposition sollen die Flags vorbelegt werden
/// </summary>
void SetHAZGlobalFlags()
{
HAZ haz = this.IsDeparture ? this.hazd : this.haza;
int totalCount = haz.MARPOLPositions.Count + haz.IMDGPositions.Count + haz.IGCPositions.Count + haz.IBCPositions.Count + haz.IMSBCPositions.Count;
if (totalCount == 1)
{
if (!(this.checkBoxDangerousGoodsOnBoard.IsChecked ?? false)) this.checkBoxDangerousGoodsOnBoard.IsChecked = true;
if (this.checkBoxMoUBaltic.IsChecked ?? true) this.checkBoxMoUBaltic.IsChecked = false;
haz.NoDPGOnBoardOnArrival = false;
haz.MOUBaltic = false;
}
}
#endregion
}
}

View File

@ -70,8 +70,24 @@
AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerType}" Binding="{Binding BunkerFuelType}" IsReadOnly="True" Width="0.2*" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerQuantity}" Binding="{Binding BunkerFuelQuantity_TNE, Mode=TwoWay}" IsReadOnly="True" Width="0.8*" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerType}" Width="0.2*">
<DataGridTextColumn.Binding>
<Binding Path="BunkerFuelType" Mode="TwoWay">
<Binding.ValidationRules>
<util:StringValidationRule MaxLength="25" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerQuantity}" IsReadOnly="False" Width="0.8*">
<DataGridTextColumn.Binding>
<Binding Path="BunkerFuelQuantity_TNE" Mode="TwoWay">
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="10000" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</GroupBox>

View File

@ -40,6 +40,7 @@ namespace ENI2.DetailViewControls
this.RegisterIntegerUpDownChange(this.integerUpDownPassengersOnBoard, Message.NotificationClass.POBD);
this.RegisterIntegerUpDownChange(this.integerUpDownPersonsOnBoard, Message.NotificationClass.POBD);
this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBD);
this.dataGridBKRD.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.BKRD); };
startupComplete = true;
}
@ -167,6 +168,8 @@ namespace ENI2.DetailViewControls
private void DataGridBKRD_CreateRequested()
{
this.dataGridBKRD.CancelEdit();
this.dataGridBKRD.CancelEdit();
EditBKRDialog ebd = new EditBKRDialog();
ebd.IsDeparture = true;
ebd.BRKD = new BRKD();
@ -199,6 +202,8 @@ namespace ENI2.DetailViewControls
{
if (obj is BRKD brkd)
{
this.dataGridBKRD.CancelEdit();
this.dataGridBKRD.CancelEdit();
// are you sure dialog is in base class
this._bkrdMessage.Elements.Remove(brkd);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(brkd);
@ -210,6 +215,8 @@ namespace ENI2.DetailViewControls
private void DataGridBKRD_EditRequested(DatabaseEntity obj)
{
this.dataGridBKRD.CancelEdit(DataGridEditingUnit.Row);
this.dataGridBKRD.CommitEdit(DataGridEditingUnit.Row, true);
EditBKRDialog eld = new EditBKRDialog();
eld.IsDeparture = true;
eld.BRKD = obj as BRKD;
@ -230,7 +237,8 @@ namespace ENI2.DetailViewControls
{
if (!_bkrdMessage.Elements.Contains(eld.BRKD))
_bkrdMessage.Elements.Add(eld.BRKD);
this.dataGridBKRD.Items.Refresh();
this.dataGridBKRD.ItemsSource = null;
this.dataGridBKRD.ItemsSource = this._bkrdMessage.Elements;
this.SublistElementChanged(Message.NotificationClass.BKRD);
}
}
@ -290,18 +298,7 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.bkrdGroupBox, HighlightService.HighlightStyle.VIOLATION, this._bkrdMessage);
}
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#endregion
#region special datetimepicker validation popup (OMG)

View File

@ -130,6 +130,12 @@ namespace ENI2.DetailViewControls
}
public override int SelectedTabIndex
{
get { return this.mainFrame.SelectedIndex; }
set { this.mainFrame.SelectedIndex = value; }
}
#region SetEnabled
public override void SetEnabled(bool enabled)
@ -601,18 +607,7 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.mdhGroupBox, HighlightService.HighlightStyle.VIOLATION, this._mdhMessage);
}
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#endregion
}
}

View File

@ -8,9 +8,10 @@
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:util="clr-namespace:ENI2.Util"
xmlns:data="clr-namespace:bsmd.database;assembly=bsmd.database"
xmlns:local="clr-namespace:ENI2.DetailViewControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="800">
d:DesignHeight="768" d:DesignWidth="1024">
<xctk:BusyIndicator Name="busyIndicator">
<xctk:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
@ -25,104 +26,144 @@
</StackPanel>
</xctk:BusyIndicator.BusyContent>
<GroupBox Name="visitTransitGroupBox" Header="{x:Static p:Resources.textVisitTransit}">
<GroupBox Name="visitTransitGroupBox" Header="{x:Static p:Resources.textOverview}">
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="4" />
<RowDefinition Height="32" />
<RowDefinition Height="32" />
<RowDefinition Height="4" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textPortCall}" Margin="0,0,10,0"/>
<enictrl:LocodeControl Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="0" Width="Auto" x:Name="locodePoC" LocodeValue="{Binding PoC, Mode=TwoWay}" IsEnabled="False" />
<!--Grid Grid.Column="1" Grid.Row="0" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<xctk:WatermarkComboBox Grid.Column="0" x:Name="comboBoxPoC" Margin="2" IsEditable="True" Watermark="Type for Locode.." TextBoxBase.TextChanged="ComboBox_TextChanged" ItemsSource="{Binding LocodePoCList, Mode=TwoWay}" SelectedItem="{Binding PoC, Mode=TwoWay}" />
<Image Name="imagePoCState" Grid.Column="1" Source="../Resources/bullet_ball_grey.png" />
</-->
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="3" Content="{x:Static p:Resources.textVisitTransitId}" Margin="0,0,10,0" />
<TextBox Name="textBoxDisplayId" Grid.Row="0" Grid.Column="4" Grid.ColumnSpan="2" IsReadOnly="True" Margin="2" VerticalContentAlignment="Center" />
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textIMO}" Margin="0,0,10,0" />
<TextBox Name="textBoxIMO" Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="1" Text="{Binding IMO, Mode=TwoWay, Converter={util:TrimStringConverter}}" Margin="2" IsReadOnly="True" VerticalContentAlignment="Center"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="3" Content="{x:Static p:Resources.textENI}" Margin="0,0,10,0" />
<TextBox Name="textBoxENI" Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2" Text="{Binding ENI, Mode=TwoWay, Converter={util:TrimStringConverter}}" Margin="2" IsReadOnly="True" VerticalContentAlignment="Center"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textETAPortOfCall}" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="3" Content="{x:Static p:Resources.textETDPortOfCall}" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textATAPortOfCall}" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="3" Content="{x:Static p:Resources.textATDPortOfCall}" Margin="0,0,10,0" />
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2" Value="{Binding ETAToPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePickerETA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" />
<xctk:DateTimePicker Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="2" Value="{Binding ETDFromPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePickerETD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00"/>
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="3" Value="{Binding ATAPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePickerATA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00"/>
<xctk:DateTimePicker Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="3" Value="{Binding ATDPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePickerATD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00"/>
<Label HorizontalAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textTicketNo}" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="3" Content="{x:Static p:Resources.textCreated}" Margin="0,0,10,0" />
<Label Name="labelCreated" Grid.Column="4" Grid.Row="4" Margin="2, 0, 0, 0" />
<Button Name="buttonFormblattNeu" Grid.Column="4" Grid.Row="7" Margin="2" Click="buttonFormblattNeu_Click" >
<StackPanel Orientation="Horizontal">
<TextBlock Text="Formblatt neu"></TextBlock>
<Image Source="../Resources/excel.png" Margin="10,0,5,0" Height="16"/>
</StackPanel>
</Button>
<TextBox Name="textBoxTicketNo" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2" Text="{Binding TicketNo, Mode=TwoWay, Converter={util:TrimStringConverter}}" Margin="2" VerticalContentAlignment="Center" MaxLength="50"/>
<Label Grid.Column="0" Grid.Row="6" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelBSMDStatusInternal" Content="{Binding BSMDStatusInternal, StringFormat={}{0}}" VerticalContentAlignment="Center" FontWeight="Bold" />
<Button IsEnabled="True" Name="buttonStorno" Grid.Column="1" Grid.Row="6" Margin="2" Click="buttonStorno_Click" Content="{x:Static p:Resources.textCancelDeclaration}" Background="Red"/>
<Button IsEnabled="True" Name="buttonCopy" Grid.Column="2" Grid.Row="6" Margin="2" Click="buttonCopy_Click" Content="{x:Static p:Resources.textCopyData}"/>
<Button IsEnabled="True" Name="buttonSendPDF" Grid.Column="3" Grid.Row="6" Margin="2" Click="buttonSendPDF_Click">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Static p:Resources.textCreatePDF}"></TextBlock>
<Image Source="../Resources/document_pdf.png" Margin="10,0,5,0" Height="16"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="4" />
<RowDefinition Height="36" />
<RowDefinition Height="4" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="4" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textVisitTransitId}" Margin="0,0,10,0" />
<TextBox Name="textBoxDisplayId" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" IsReadOnly="True" Margin="2" VerticalContentAlignment="Center" />
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortCall}" Margin="0,0,10,0"/>
<enictrl:LocodeControl Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Width="Auto" x:Name="locodePoC" LocodeValue="{Binding PoC, Mode=TwoWay}" IsEnabled="False" />
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textIMO}" Margin="0,0,10,0" />
<TextBox Name="textBoxIMO" Grid.Row="2" Grid.ColumnSpan="2" Grid.Column="1" Text="{Binding IMO, Mode=TwoWay, Converter={util:TrimStringConverter}}" Margin="2" IsReadOnly="True" VerticalContentAlignment="Center"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textENI}" Margin="0,0,10,0" />
<TextBox Name="textBoxENI" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding ENI, Mode=TwoWay, Converter={util:TrimStringConverter}}" Margin="2" IsReadOnly="True" VerticalContentAlignment="Center"/>
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textETAPortOfCall}" Margin="0,0,10,0" />
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="4" Value="{Binding ETAToPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePickerETA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" />
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textETDPortOfCall}" Margin="0,0,10,0" />
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="5" Value="{Binding ETDFromPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePickerETD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00"/>
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textATAPortOfCall}" Margin="0,0,10,0" />
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="6" Value="{Binding ATAPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePickerATA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00"/>
<Label HorizontalContentAlignment="Right" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textATDPortOfCall}" Margin="0,0,10,0" />
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="7" Value="{Binding ATDPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePickerATD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00"/>
<Label HorizontalAlignment="Right" Grid.Row="8" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" Margin="0,0,10,0" />
<TextBox Name="textBoxTicketNo" Grid.Column="1" Grid.Row="8" Grid.ColumnSpan="2" Text="{Binding TicketNo, Mode=TwoWay, Converter={util:TrimStringConverter}}" Margin="2" VerticalContentAlignment="Center" MaxLength="50"/>
<Label HorizontalContentAlignment="Right" Grid.Row="9" Grid.Column="0" Content="{x:Static p:Resources.textCreated}" Margin="0,0,10,0" />
<Label Name="labelCreated" Grid.Column="1" Grid.Row="9" Margin="2, 0, 0, 0" />
<Label Grid.Column="2" Grid.Row="9" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelBSMDStatusInternal" Content="{Binding BSMDStatusInternal, StringFormat={}{0}}" VerticalContentAlignment="Center" FontWeight="Bold" />
<StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="11">
<Button Name="buttonRefresh" Margin="2" Click="buttonRefresh_Click" BorderThickness="0" Background="Transparent" ToolTip="{x:Static p:Resources.textTooltipRefresh}">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/nav_refresh_blue.png" Margin="0,0,5,0" Height="24"/>
<!--TextBlock Text="{x:Static p:Resources.textRefresh}" VerticalAlignment="Center"/-->
</StackPanel>
</Button>
<Button Name="buttonInfoCore" Margin="2" Click="buttonInfoCore_Click" BorderThickness="0" Background="Transparent" ToolTip="{x:Static p:Resources.textTooltipDetails}">
<Image Source="../Resources/document_view.png" Margin="0,0,5,0" Height="24" />
</Button>
<Button Name="buttonValidate" Margin="2" Click="buttonValidate_Click" BorderThickness="0" Background="Transparent" ToolTip="{x:Static p:Resources.textTooltipValidation}">
<Image Source="../Resources/hand_point.png" Margin="0,0,5,0" Height="24" />
</Button>
<!--
<Button Name="buttonWarnings" Margin="2" Click="buttonWarnings_Click" BorderThickness="0" Background="Transparent" Visibility="Hidden">
<Image Source="../Resources/sign_warning.png" Margin="0,0,5,0" Height="24" />
</Button>
-->
</StackPanel>
</Button>
<Button Name="buttonQueryHIS" Grid.Column="4" Grid.Row="6" Margin="2" Click="buttonQueryHIS_Click" Content="{x:Static p:Resources.textQueryHIS}"/>
<StackPanel Orientation="Horizontal" Grid.Column="5" Grid.Row="6">
<Button Name="buttonRefresh" Margin="2" Click="buttonRefresh_Click" BorderThickness="0" Background="Transparent" ToolTip="{x:Static p:Resources.textTooltipRefresh}">
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="11" Visibility="Hidden" Name="stackPanelLock">
<Image Source="../Resources/lock.png" Margin="0,0,5,0" Height="24" />
<TextBlock Name="textBlockLockUserName" VerticalAlignment="Center" />
</StackPanel>
<Label Grid.Column="0" Grid.Row="13" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelHIS" VerticalContentAlignment="Center" Content="{x:Static p:Resources.textSendToHIS}" />
<ComboBox Grid.Column="1" Grid.Row="13" Margin="2" Name="comboBoxInitialHis" VerticalContentAlignment="Center" SelectedValuePath="Key" DisplayMemberPath="Value" SelectedValue="{Binding Path=InitialHIS}" />
<Button IsEnabled="True" Name="buttonSendAll" Grid.Column="1" Grid.Row="14" Content="{x:Static p:Resources.textSendAll}" Margin="2" Click="buttonSendAll_Click" />
<Button Grid.Column="1" Grid.Row="16" Margin="2" Name="buttonExcelImport" Click="buttonExcelImport_Click">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/nav_refresh_blue.png" Margin="0,0,5,0" Height="24"/>
<!--TextBlock Text="{x:Static p:Resources.textRefresh}" VerticalAlignment="Center"/-->
<TextBlock Text="{x:Static p:Resources.textExcelImport}"></TextBlock>
<Image Source="../Resources/excel.png" Margin="10,0,5,0" Height="16"/>
</StackPanel>
</Button>
<Button Name="buttonInfoCore" Margin="2" Click="buttonInfoCore_Click" BorderThickness="0" Background="Transparent" ToolTip="{x:Static p:Resources.textTooltipDetails}">
<Image Source="../Resources/document_view.png" Margin="0,0,5,0" Height="24" />
<Button IsEnabled="True" Name="buttonSendPDF" Grid.Column="1" Grid.Row="17" Margin="2" Click="buttonSendPDF_Click">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Static p:Resources.textCreatePDF}"></TextBlock>
<Image Source="../Resources/document_pdf.png" Margin="10,0,5,0" Height="16"/>
</StackPanel>
</Button>
<Button Name="buttonValidate" Margin="2" Click="buttonValidate_Click" BorderThickness="0" Background="Transparent" ToolTip="{x:Static p:Resources.textTooltipValidation}">
<Image Source="../Resources/hand_point.png" Margin="0,0,5,0" Height="24" />
<Button Name="buttonQueryHIS" Grid.Column="1" Grid.Row="18" Margin="2" Click="buttonQueryHIS_Click" Content="{x:Static p:Resources.textQueryHIS}"/>
<Button IsEnabled="True" Name="buttonCopy" Grid.Column="1" Grid.Row="19" Margin="2" Click="buttonCopy_Click" Content="{x:Static p:Resources.textCopyData}"/>
<Button Name="buttonFormblattNeu" Grid.Column="1" Grid.Row="20" Margin="2" Click="buttonFormblattNeu_Click" >
<StackPanel Orientation="Horizontal">
<TextBlock Text="Formblatt neu"></TextBlock>
<Image Source="../Resources/excel.png" Margin="10,0,5,0" Height="16"/>
</StackPanel>
</Button>
<Button IsEnabled="True" Name="buttonStorno" Grid.Column="1" Grid.Row="22" Margin="2" Click="buttonStorno_Click" Content="{x:Static p:Resources.textCancelDeclaration}" Background="Red"/>
<Label Grid.Column="2" Grid.Row="21" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelCancelled" VerticalContentAlignment="Center" FontWeight="Bold" />
<!--
<Button Name="buttonWarnings" Margin="2" Click="buttonWarnings_Click" BorderThickness="0" Background="Transparent" Visibility="Hidden">
<Image Source="../Resources/sign_warning.png" Margin="0,0,5,0" Height="24" />
</Button>
-->
</StackPanel>
<Label Grid.Column="0" Grid.Row="7" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelCancelled" VerticalContentAlignment="Center" FontWeight="Bold" />
<Label Grid.Column="1" Grid.Row="7" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelHIS" VerticalContentAlignment="Center" Content="{x:Static p:Resources.textSendToHIS}" />
<ComboBox Grid.Column="2" Grid.Row="7" Margin="2" Name="comboBoxInitialHis" VerticalContentAlignment="Center" SelectedValuePath="Key" DisplayMemberPath="Value" SelectedValue="{Binding Path=InitialHIS}" />
<Button Grid.Column="3" Grid.Row="7" Margin="2" Name="buttonExcelImport" Click="buttonExcelImport_Click">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Static p:Resources.textExcelImport}"></TextBlock>
<Image Source="../Resources/excel.png" Margin="10,0,5,0" Height="16"/>
</StackPanel>
</Button>
<!--
<Button Grid.Column="4" Grid.Row="7" Margin="2" Name="buttonExcelExport" Click="buttonExcelExport_Click">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Static p:Resources.textExcelExport}"></TextBlock>
@ -130,14 +171,64 @@
</StackPanel>
</Button>
-->
<StackPanel Orientation="Horizontal" Grid.Column="5" Grid.Row="4" Visibility="Hidden" Name="stackPanelLock">
<Image Source="../Resources/lock.png" Margin="0,0,5,0" Height="24" />
<TextBlock Name="textBlockLockUserName" VerticalAlignment="Center" />
</StackPanel>
</Grid>
<!-- Data Grid -->
<DataGrid Grid.Row="9" Grid.ColumnSpan="6" Margin="0,8,0,0" x:Name="dataGridMessages" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
SelectionMode="Extended" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown">
<DataGrid Grid.Row="0" Grid.ColumnSpan="1" Grid.Column="1" Margin="2" x:Name="dataGridMessages" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
SelectionMode="Extended" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown">
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridColumnHeadersPresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridColumnHeadersPresenter}">
<Grid Background="Transparent" Grid.IsSharedSizeScope="True">
<!-- 3 header rows: 0 = main title, 1 = group headers, 2 = real column headers -->
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- One ColumnDefinition per DataGridTextColumn (or sharedsize groups) -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Columns[0].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[1].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[2].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[3].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[4].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[5].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[6].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[7].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[8].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[9].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[10].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[11].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[12].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[13].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[14].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ColumnDefinition Width="{Binding Columns[15].ActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<!-- …add as many as you need… -->
</Grid.ColumnDefinitions>
<!-- Row0: A single big header across all columns -->
<!--TextBlock Grid.Row="0" Grid.ColumnSpan="4" Text="Main Application" HorizontalAlignment="Center" FontWeight="Bold"/ -->
<!-- Row1: your “banded” group headers -->
<TextBlock Grid.Row="0" Grid.Column="5" Grid.ColumnSpan="2" Text="{x:Static p:Resources.textENIStatus}" HorizontalAlignment="Stretch" TextAlignment="Center" Padding="0,2,0,4" Background="AntiqueWhite" />
<TextBlock Grid.Row="0" Grid.Column="7" Grid.ColumnSpan="9" Text="{x:Static p:Resources.textNSWStatus}" HorizontalAlignment="Stretch" TextAlignment="Center" Padding="0,2,0,4" Background="AliceBlue"/>
<!-- Row2: the real column headers -->
<!-- This invisible filler ensures the layout lines up -->
<DataGridColumnHeader x:Name="PART_FillerColumnHeader" Grid.Row="1" Grid.ColumnSpan="14" IsHitTestVisible="False"/>
<!-- And here the ItemsPresenter will place each DataGridColumnHeader -->
<ItemsPresenter Grid.Row="1" Grid.ColumnSpan="16"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.Resources>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
@ -147,25 +238,54 @@
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightYellow" />
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=Elements, Converter={util:CutoffConverter}, ConverterParameter=0}" Value="True" />
<Condition Binding="{Binding Path=MessageNotificationClass}" Value="{x:Static data:Message+NotificationClass.PASA}" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="Yellow" />
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=Elements, Converter={util:CutoffConverter}, ConverterParameter=0}" Value="True" />
<Condition Binding="{Binding Path=MessageNotificationClass}" Value="{x:Static data:Message+NotificationClass.PASD}" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="Yellow" />
</MultiDataTrigger>
<DataTrigger Binding="{Binding SendSuccess}" Value="True">
<Setter Property="Background" Value="#92F592"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding InternalStatus}" Value="UPDATED">
<Setter Property="Background" Value="#DFFDDF"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding InternalStatus}" Value="TOSEND">
<Setter Property="Background" Value="#BFFDBF"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding InternalStatus}" Value="SENT">
<Setter Property="Background" Value="#BFFDBF"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding HasSystemErrors}" Value="True">
<Setter Property="Background" Value="MistyRose"></Setter>
</DataTrigger>
<!--DataTrigger Binding="{Binding HasErrors}" Value="True">
<Setter Property="Background" Value="PaleVioletRed"></Setter>
</DataTrigger-->
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header=" " Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<!--Image Source="{Binding src:Util.ImageDict[ENINotificationDetailGroup]}" /-->
<!--Image Source="{Binding Source={x:Static src:Util.ImageDict}, Path=[ENINotificationDetailGroup]}"></-->
<Image Source="{Binding ENINotificationIconString, Converter={util:NullImageConverter}}" />
<Image Source="{Binding ENINotificationIconString, Converter={util:NullImageConverter}}" Height="24" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationGroup}" Binding="{Binding ENINotificationDetailGroup}" IsReadOnly="True" Width="0.25*" />
-->
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationClass}" Binding="{Binding MessageNotificationClassDisplay}"
IsReadOnly="True" Width="0.075*" FontWeight="Bold">
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationClass}" Binding="{Binding MessageNotificationClassDisplay}" IsReadOnly="True" Width="0.1*" FontWeight="Bold">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
@ -173,6 +293,75 @@
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textStatus}" Binding="{Binding BSMDStatusOverviewDisplay}" IsReadOnly="True" Width="0.1*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textChangedBy}" Binding="{Binding ChangedBy}" IsReadOnly="True" Width="0.2*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textChanged}" Binding="{Binding Changed}" IsReadOnly="True" Width="0.15*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textErrors}" IsReadOnly="True" Width="0.06*" Binding="{Binding ErrorCount}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="DemiBold" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textViolations}" IsReadOnly="True" Width="0.06*" Binding="{Binding ViolationCount}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="DemiBold" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="HIS" Binding="{Binding HISOverviewDisplay}" IsReadOnly="True" Width="0.06*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textReceivedAt}" Binding="{Binding ReceivedAt}" IsReadOnly="True" Width="0.15*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textSentBy}" Binding="{Binding SentBy}" IsReadOnly="True" Width="0.1*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
@ -210,29 +399,29 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image x:Name="imageHasUpdate"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=HasUpdates}" Value="True">
<Setter Property="Source" Value="/Resources/recycle.png" TargetName="imageHasUpdate"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</-->
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image x:Name="imageHasUpdate"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=HasUpdates}" Value="True">
<Setter Property="Source" Value="/Resources/recycle.png" TargetName="imageHasUpdate"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</-->
<!--DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image x:Name="imageHasReminder"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=HasReminder}" Value="True">
<Setter Property="Source" Value="/Resources/hand_point.png" TargetName="imageHasReminder"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</-->
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image x:Name="imageHasReminder"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=HasReminder}" Value="True">
<Setter Property="Source" Value="/Resources/hand_point.png" TargetName="imageHasReminder"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</-->
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
@ -245,6 +434,7 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
@ -257,41 +447,7 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textChanged}" Binding="{Binding Changed}" IsReadOnly="True" Width="0.15*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textReceivedAt}" Binding="{Binding ReceivedAt}" IsReadOnly="True" Width="0.15*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textStatus}" Binding="{Binding InternalStatus}" IsReadOnly="True" Width="0.1*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="HIS" Binding="{Binding HIS}" IsReadOnly="True" Width="0.1*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textSentBy}" Binding="{Binding SentBy}" IsReadOnly="True" Width="0.1*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textStatusInfo}" Binding="{Binding StatusInfo}" IsReadOnly="True" Width="0.2*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
@ -299,13 +455,7 @@
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textChangedBy}" Binding="{Binding ChangedBy}" IsReadOnly="True" Width="0.2*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>

View File

@ -19,6 +19,10 @@ using System.Collections.Generic;
using System.Windows.Media;
using Microsoft.Win32;
using System.Diagnostics;
using System.ComponentModel;
using static bsmd.database.Message;
using PdfSharp.Fonts;
using System.Linq;
namespace ENI2.DetailViewControls
{
@ -27,6 +31,9 @@ namespace ENI2.DetailViewControls
/// </summary>
public partial class OverViewDetailControl : DetailBaseControl
{
#region Fields
private Message _message = null;
private Message _ataMessage;
private Message _atdMessage;
@ -36,21 +43,29 @@ namespace ENI2.DetailViewControls
private readonly object _collectionLock = new object();
// private MessageSendStatusDialog mssd = null;
#endregion
#region Construction
public OverViewDetailControl()
{
InitializeComponent();
this.Loaded += OverViewDetailControl_Loaded;
}
#endregion
#region Initialize
private void OverViewDetailControl_Loaded(object sender, RoutedEventArgs e)
{
// die Controls nach Änderungen monitoren
// diese Einträge gehen auf core
this.RegisterTextboxChange(this.textBoxTicketNo, Message.NotificationClass.ATA);
this.RegisterTextboxChange(this.textBoxDisplayId, Message.NotificationClass.ATA);
this.RegisterTextboxChange(this.textBoxIMO, Message.NotificationClass.ATA);
this.RegisterTextboxChange(this.textBoxENI, Message.NotificationClass.ATA);
this.RegisterLocodeChange(this.locodePoC, Message.NotificationClass.ATA);
this.textBoxTicketNo.TextChanged += CoreTextBox_TextChanged;
this.textBoxDisplayId.TextChanged += CoreTextBox_TextChanged;
this.textBoxIMO.TextChanged += CoreTextBox_TextChanged;
this.textBoxENI.TextChanged += CoreTextBox_TextChanged;
this.locodePoC.PropertyChanged += CoreLocode_LocodeChanged;
this.RegisterDateTimePickerChange(this.dateTimePickerATA, Message.NotificationClass.ATA);
this.RegisterDateTimePickerChange(this.dateTimePickerATD, Message.NotificationClass.ATD);
@ -58,8 +73,6 @@ namespace ENI2.DetailViewControls
this.RegisterDateTimePickerChange(this.dateTimePickerETD, Message.NotificationClass.NOA_NOD);
}
#region Initialize
public override void Initialize()
{
bool iAmAdmin = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin;
@ -185,13 +198,7 @@ namespace ENI2.DetailViewControls
if (aMessage.MessageNotificationClass == Message.NotificationClass.PASD)
pasdMessage = aMessage;
}
// XXX : TODO remove this
this.Messages.Remove(crewdMessage);
this.Messages.Remove(pasdMessage);
#endregion
#region init ATA
@ -310,7 +317,9 @@ namespace ENI2.DetailViewControls
BindingOperations.EnableCollectionSynchronization(this.Messages, _collectionLock);
this.dataGridMessages.ItemsSource = this.Messages;
this.OnRequestValidate(false);
base.Initialize(); // wenn Meldeklassen erst bei der Init. erzeugt werden, fehlen die Handler, die hier erneut festgelegt werden
this._initialized = true;
}
@ -348,6 +357,9 @@ namespace ENI2.DetailViewControls
this.buttonExcelImport.IsEnabled = !this.Core.DisplayId.IsNullOrEmpty();
this.dataGridMessages.ItemsSource = null;
this.dataGridMessages.ItemsSource = this.Messages;
//MessageBox.Show(string.Format("Visit/Transit ID updated: {0}", this.Core.DisplayId));
//ShowIdDialog sid = new ShowIdDialog(this.Core)
//{
@ -417,52 +429,58 @@ namespace ENI2.DetailViewControls
mhd.MessageHistories = DBManager.Instance.GetMessageHistories(historyMessage.Id.Value);
mhd.RequestReload += () => this.OnRequestReload(this.Core.Id.Value);
mhd.Show();
}
}
}
private void contextSendMessage(object sender, RoutedEventArgs e)
{
{
MessageBoxResult result = MessageBox.Show(Properties.Resources.textConfirmSend, Properties.Resources.textConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
bool somethingsNotSaved = false;
foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
this.SendMessages(this.dataGridMessages.SelectedItems.Cast<Message>());
}
}
private void SendMessages(IEnumerable<Message> messages)
{
bool somethingsNotSaved = false;
foreach (Message selectedMessage in messages)
{
if (selectedMessage.IsDirty) somethingsNotSaved = true;
}
if (somethingsNotSaved)
{
if (MessageBox.Show(Properties.Resources.textUnsavedChangesSendAnyWay, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
return;
}
List<Message> watchList = new List<Message>();
foreach (Message selectedMessage in messages)
{
if (selectedMessage.Reset) selectedMessage.Reset = false; // "nochmal" Versenden ist möglich
selectedMessage.InternalStatus = Message.BSMDStatus.TOSEND;
string userName = "?";
if (App.UserId.HasValue && DBManager.Instance.GetReportingPartyDict().ContainsKey(App.UserId.Value))
{
if (selectedMessage.IsDirty) somethingsNotSaved = true;
userName = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].Logon;
}
selectedMessage.ChangedBy = string.Format("{0} at {1} (Send)", userName, DateTime.Now);
selectedMessage.StatusInfo = string.Format(Properties.Resources.textMessageSentAt, DateTime.Now);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
watchList.Add(selectedMessage);
}
if(somethingsNotSaved)
{
if (MessageBox.Show(Properties.Resources.textUnsavedChangesSendAnyWay, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
return;
}
// komplette Anmeldung auf "zu versenden" stellen
this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
this.Core.DefaultReportingPartyId = App.UserId;
List<Message> watchList = new List<Message>();
foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
{
if (selectedMessage.Reset) selectedMessage.Reset = false; // "nochmal" Versenden ist möglich
selectedMessage.InternalStatus = Message.BSMDStatus.TOSEND;
string userName = "?";
if (App.UserId.HasValue && DBManager.Instance.GetReportingPartyDict().ContainsKey(App.UserId.Value))
{
userName = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].Logon;
}
selectedMessage.ChangedBy = string.Format("{0} at {1} (Send)", userName, DateTime.Now);
selectedMessage.StatusInfo = string.Format(Properties.Resources.textMessageSentAt, DateTime.Now);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
watchList.Add(selectedMessage);
}
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core); // löst auch den Watchdog aus
this.OnRequestSendValidation();
this.dataGridMessages.Items.Refresh();
// komplette Anmeldung auf "zu versenden" stellen
this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
this.Core.DefaultReportingPartyId = App.UserId;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core); // löst auch den Watchdog aus
this.OnRequestSendValidation();
this.dataGridMessages.Items.Refresh();
/*
/*
if (this.mssd == null)
{
this.mssd = new MessageSendStatusDialog(this.Core);
@ -482,7 +500,6 @@ namespace ENI2.DetailViewControls
this.mssd.Activate(); // bring to foreground
this.mssd.AddMessages(watchList);
*/
}
}
private void contextResetMessage(object sender, RoutedEventArgs e)
@ -568,7 +585,13 @@ namespace ENI2.DetailViewControls
if (sfd.ShowDialog() ?? false)
{
Util.UIHelper.SetBusyState();
ReportManager rm = new ReportManager();
ReportManager rm = new ReportManager();
// TODO!!
// https://docs.pdfsharp.net/PDFsharp/Topics/Fonts/Font-Resolving.html
// https://docs.pdfsharp.net/MigraDoc/DOM/Document/MigraDocSettings.html
GlobalFontSettings.UseWindowsFontsUnderWindows = true;
GlobalFontSettings.UseWindowsFontsUnderWsl2 = true;
// create PDF from message classes
if (rm.Create(sfd.FileName, this.Core, sicd.SelectedClasses, out string importResultText))
@ -610,6 +633,16 @@ namespace ENI2.DetailViewControls
#region event handler
private void CoreLocode_LocodeChanged(object sender, PropertyChangedEventArgs e)
{
this.OnNotificationClassChanged(null);
}
private void CoreTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
this.OnNotificationClassChanged(null);
}
private void _checkStatusTimer_Elapsed(object sender, ElapsedEventArgs e)
{
bool? statusFlag = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreQueryStatusFlag(this.Core.Id.Value);
@ -718,7 +751,7 @@ namespace ENI2.DetailViewControls
private void buttonValidate_Click(object sender, RoutedEventArgs e)
{
this.OnRequestValidate();
this.OnRequestValidate(true);
}
/// <summary>
@ -748,7 +781,7 @@ namespace ENI2.DetailViewControls
this.OnRequestReload(this.Core.Id.Value);
// validate all selected import classes (Finger with "selection")
this.OnRequestValidate();
this.OnRequestValidate(true);
}
else
@ -787,7 +820,6 @@ namespace ENI2.DetailViewControls
if (sfd.ShowDialog() ?? false)
{
Util.UIHelper.SetBusyState();
ExcelManager em = new ExcelManager();
try
@ -803,18 +835,74 @@ namespace ENI2.DetailViewControls
}
}
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
private void buttonSendAll_Click(object sender, RoutedEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
SelectImportClassesDialog sicd = new SelectImportClassesDialog();
List<Message.NotificationClass> readyToSendMessages = new List<Message.NotificationClass>();
// Evaluate a number of criteria for messages that should not be preselected for sending
bool addToSend;
foreach (Message message in this.Messages)
{
addToSend = true;
// if ((message.ErrorCount ?? 0) > 0) continue; // skip selection if there are any errors left
switch(message.MessageNotificationClass)
{
case NotificationClass.HAZA:
addToSend = XtraSendLogic.ShouldSendMessage(message); break;
case NotificationClass.HAZD:
addToSend = XtraSendLogic.ShouldSendMessage(message); break;
case NotificationClass.BPOL:
if (message.Elements.Count > 0)
{
if (message.Elements[0] is BPOL bpol)
{
if (bpol.PortOfItineraries.Count == 0) addToSend = false;
}
}
break;
case NotificationClass.WAS_RCPT:
addToSend = false;
break;
case NotificationClass.INFO:
if (Core.PoC == "DEHAM") addToSend = false;
break;
default:
if(Message.IsListClass(message.MessageNotificationClass) && (message.Elements.Count == 0)) addToSend = false;
break;
}
if(addToSend)
readyToSendMessages.Add(message.MessageNotificationClass);
}
sicd.Messages = this.Messages;
sicd.PreselectedClasses.AddRange(readyToSendMessages);
sicd.IsTransit = this.Core.IsTransit;
sicd.IsImportMode = false;
if ((sicd.ShowDialog() ?? false) && (sicd.SelectedClasses.Count > 0))
{
// now send all selected messages
List<Message> toSendMessages = new List<Message>();
foreach(NotificationClass notificationClass in sicd.SelectedClasses)
{
Message selectedMessage = this.Messages.Find(x => x.MessageNotificationClass == notificationClass);
if (selectedMessage != null)
{
toSendMessages.Add(selectedMessage);
}
}
if (toSendMessages.Count > 0)
{
this.SendMessages(toSendMessages);
}
}
}
#endregion
}
}

View File

@ -18,13 +18,13 @@ namespace ENI2.DetailViewControls
private Message _pre72hMessage;
private static string[] hullConfiguration = {
private static readonly string[] hullConfiguration = {
Properties.Resources.textSingleHull,
Properties.Resources.textSingleHullBallast,
Properties.Resources.textDoubleHull
};
private static string[] conditionCargoTanks =
private static readonly string[] conditionCargoTanks =
{
Properties.Resources.textFull,
Properties.Resources.textEmpty,
@ -116,18 +116,7 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.groupBoxPre72H, HighlightService.HighlightStyle.VIOLATION, this._pre72hMessage);
}
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#endregion
}

View File

@ -12,7 +12,7 @@
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
<GroupBox Name="portCallGroupBox" Header="{x:Static p:Resources.textPortCall}">
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="300" />
@ -92,8 +92,9 @@
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textPhone}" Name="label_AgentPhone" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textEMail}" Name="label_AgentEMail" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textCity}" Name="label_AgentCity" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="2" Content="{x:Static p:Resources.textFirstName}" Name="label_AgentFirstName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="7" Grid.Column="2" Content="{x:Static p:Resources.textFax}" Name="label_AgentFax" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="2" Content="{x:Static p:Resources.textFirstName}" Name="label_AgentFirstName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="2" Content="{x:Static p:Resources.textFax}" Name="label_AgentFax" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="7" Grid.Column="2" Content="{x:Static p:Resources.textWasteDisposalServiceProvider}" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textCountry}" Name="label_AgentCountry" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textAgentTemplate}" Name="labelAgentTemplate" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textTitle}" Name="labelAgentTemplateTitle" Margin="0,0,10,0" Visibility="Hidden" />
@ -104,10 +105,11 @@
<TextBox Grid.Row="3" Grid.Column="3" Name="textBox_AgentCity" MaxLength="99" Margin="2" Text="{Binding AgentCity, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Name="textBox_AgentCountry" MaxLength="99" Margin="2" Text="{Binding AgentCountry, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="1" Name="textBox_AgentLastName" MaxLength="99" Margin="2" Text="{Binding AgentLastName, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="3" Name="textBox_AgentFirstName" MaxLength="99" Margin="2" Text="{Binding AgentFirstName, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="5" Grid.Column="3" Name="textBox_AgentFirstName" MaxLength="99" Margin="2" Text="{Binding AgentFirstName, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="1" Name="textBox_AgentPhone" MaxLength="99" Margin="2" Text="{Binding AgentPhone, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="3" Name="textBox_AgentFax" MaxLength="99" Margin="2" Text="{Binding AgentFax, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="3" Name="textBox_AgentFax" MaxLength="99" Margin="2" Text="{Binding AgentFax, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="1" Name="textBox_AgentEMail" MaxLength="99" Margin="2" Text="{Binding AgentEMail, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="3" Name="textBox_WasteDisposalServiceProvider" MaxLength="99" Margin="2" Text="{Binding WasteDisposalServiceProviderText, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<ComboBox Grid.Row="0" Grid.Column="3" Name="comboBox_AgentTemplate" Margin="2" SelectedValuePath="Id" DisplayMemberPath="AgentTitle" SelectionChanged="comboBox_AgentTemplate_SelectionChanged" />
<Grid Grid.Column="2" Grid.Row="1" HorizontalAlignment="Right">

View File

@ -25,6 +25,7 @@ namespace ENI2.DetailViewControls
private NOA_NOD _noa_nod;
private AGNT _agnt;
private WAS _was;
private static List<AGNT_Template> _agntTemplates = null;
private AGNT_Template _currentTemplate;
private AGNT_Template _undoTemplate;
@ -67,9 +68,15 @@ namespace ENI2.DetailViewControls
this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT);
// WAS
this.RegisterTextboxChange(this.textBox_WasteDisposalServiceProvider, Message.NotificationClass.WAS);
this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
}
public override void Initialize()
public async override void Initialize()
{
base.Initialize();
@ -92,6 +99,16 @@ namespace ENI2.DetailViewControls
_agnt = new AGNT();
this.ControlMessages.Add(aMessage);
}
if(aMessage.MessageNotificationClass == Message.NotificationClass.WAS)
{
if (aMessage.Elements.Count > 0)
_was = aMessage.Elements[0] as WAS;
else
_was = new WAS();
this.ControlMessages.Add(aMessage);
}
}
this.dateTimePicker_ETAToKielCanal.IsEnabled = this.Core.IsTransit;
@ -108,7 +125,7 @@ namespace ENI2.DetailViewControls
this.dataGridCallPurposes.EditRequested += DataGridCallPurposes_EditRequested;
this.dataGridCallPurposes.AddingNewItem += DataGridCallPurposes_AddingNewItem;
this.dataGridCallPurposes.CreateRequested += DataGridCallPurposes_CreateRequested;
this.dataGridCallPurposes.DeleteRequested += DataGridCallPurposes_DeleteRequested;
this.dataGridCallPurposes.DeleteRequested += DataGridCallPurposes_DeleteRequested;
this.agentGroupBox.DataContext = _agnt;
@ -120,11 +137,13 @@ namespace ENI2.DetailViewControls
this.dateTimePicker_ETDFromLastPort.DataContext = _noa_nod;
this.dateTimePicker_ETDFromPortOfCall.DataContext = _noa_nod;
this.textBox_WasteDisposalServiceProvider.DataContext = _was;
this.checkBox_IsAnchored.IsEnabled = this.Core.IsDK;
if(_agntTemplates == null)
{
_agntTemplates = DBManager.Instance.GetAGNTTemplates(); // inital full load
_agntTemplates = await DBManagerAsync.GetAGNTTemplatesAsync(); // inital full load
_agntTemplates.Sort();
Trace.WriteLine(string.Format("{0} agent templates loaded", _agntTemplates.Count));
}
@ -138,8 +157,7 @@ namespace ENI2.DetailViewControls
private void DataGridCallPurposes_DeleteRequested(DatabaseEntity obj)
{
CallPurpose cp = obj as CallPurpose;
if (cp != null)
if (obj is CallPurpose cp)
{
// are you sure dialog is in base class
_noa_nod.CallPurposes.Remove(cp);
@ -151,7 +169,7 @@ namespace ENI2.DetailViewControls
}
private void DataGridCallPurposes_CreateRequested()
{
{
EditCallPurposeDialog ecpd = new EditCallPurposeDialog();
ecpd.AddClicked += () =>
{
@ -240,32 +258,20 @@ namespace ENI2.DetailViewControls
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#region AGNT templates combo
private void comboBox_AgentTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Trace.WriteLine("combo selection changed");
AGNT_Template at = this.comboBox_AgentTemplate.SelectedItem as AGNT_Template;
if(at != null)
if (this.comboBox_AgentTemplate.SelectedItem is AGNT_Template at)
{
this.textBoxTemplateTitle.Text = at.AgentTitle;
this.buttonDeleteTemplate.IsEnabled = true;
this.buttonDeleteTemplate.IsEnabled = true;
this.buttonSetTemplate.IsEnabled = true;
this._currentTemplate = at;
}
}
}
private void buttonDeleteTemplate_Click(object sender, RoutedEventArgs e)
{
@ -278,7 +284,7 @@ namespace ENI2.DetailViewControls
DBManager.Instance.Delete(_currentTemplate);
_agntTemplates.Remove(_currentTemplate);
this.textBoxTemplateTitle.Text = null;
this.buttonDeleteTemplate.IsEnabled = false;
this.buttonDeleteTemplate.IsEnabled = false;
this.comboBox_AgentTemplate.ItemsSource = _agntTemplates;
this.buttonSetTemplate.IsEnabled = false;
}
@ -308,21 +314,21 @@ namespace ENI2.DetailViewControls
{
if (MessageBox.Show("A template with this name already exists, overwrite?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
return;
}
}
this._currentTemplate = createFromCurrentText(title, existingTemplate);
DBManager.Instance.Save(this._currentTemplate);
DBManager.Instance.Save(this._currentTemplate);
if(existingTemplate == null)
{
comboBox_AgentTemplate.ItemsSource = null;
_agntTemplates.Add(this._currentTemplate);
_agntTemplates.Sort();
comboBox_AgentTemplate.ItemsSource = _agntTemplates;
}
}
MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e)
{
@ -347,14 +353,23 @@ namespace ENI2.DetailViewControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._undoTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
}
}
private void buttonSetTemplate_Click(object sender, RoutedEventArgs e)
{
if (this._currentTemplate == null) return;
// confirm overwrite of waste disposal service provider
if (this.textBox_WasteDisposalServiceProvider.Text.Length > 0)
{
string message = string.Format(Properties.Resources.textConfirmWSDPOverwrite, this.textBox_WasteDisposalServiceProvider.Text, this._currentTemplate.WasteDisposalServiceProviderName);
if (MessageBox.Show(message, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No) { return; }
}
this._undoTemplate = createFromCurrentText(null, null);
this.textBox_AgentCity.Text = this._currentTemplate.AgentCity;
@ -366,7 +381,7 @@ namespace ENI2.DetailViewControls
this.textBox_AgentEMail.Text = this._currentTemplate.AgentEMail;
this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFax.Text = this._currentTemplate.AgentFax;
this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFax.GetBindingExpression (TextBox.TextProperty).UpdateSource();
this.textBox_AgentFirstName.Text = this._currentTemplate.AgentFirstName;
this.textBox_AgentFirstName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentLastName.Text = this._currentTemplate.AgentLastName;
@ -377,6 +392,11 @@ namespace ENI2.DetailViewControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
if ((this._currentTemplate.WasteDisposalServiceProviderName ?? "").Trim() != (this.textBox_WasteDisposalServiceProvider.Text ?? "").Trim())
{
this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
}
this.buttonUndoTemplate.IsEnabled = true;
this.buttonSetTemplate.IsEnabled = false;
@ -390,7 +410,7 @@ namespace ENI2.DetailViewControls
AGNT_Template at = new AGNT_Template();
if (existingTemplate != null)
at = existingTemplate;
at.AgentTitle = title;
at.AgentCity = this.textBox_AgentCity.Text;
at.AgentCompanyName = this.textBox_AgentCompanyName.Text;
@ -402,6 +422,7 @@ namespace ENI2.DetailViewControls
at.AgentPhone = this.textBox_AgentPhone.Text;
at.AgentPostalCode = this.textBox_AgentPostalCode.Text;
at.AgentStreetAndNumber = textBox_AgentStreetAndNumber.Text;
at.WasteDisposalServiceProviderName = textBox_WasteDisposalServiceProvider.Text;
return at;
}

View File

@ -19,14 +19,16 @@
<col:DictionaryEntry Key="SeaGo BHV" Value="2" />
<col:DictionaryEntry Key="SeaGo WHV" Value="4" />
<col:DictionaryEntry Key="Hoegh BHV" Value="8" />
<col:DictionaryEntry Key="Elbe Bulk" Value="16" />
<col:DictionaryEntry Key="Fct Junge" Value="32" />
</col:ArrayList>
</UserControl.Resources>
<GroupBox Name="portNotificationGroupBox" Header="{x:Static p:Resources.textPortNotification}">
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="220" />
<RowDefinition Height="194" />
<RowDefinition Height="200" />
<RowDefinition Height="200" />
</Grid.RowDefinitions>
@ -34,10 +36,12 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textNameMaster}" Name="label_nameMaster" Margin="0,0,10,0"/>
<TextBox Grid.Row="0" Grid.Column="1" Name="textBox_NameMaster" MaxLength="100" Margin="2" Text="{Binding NameOfMaster, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center" VerticalAlignment="Center"/>
<Button x:Name="buttonCopyNameFromCREWA" Grid.Row="0" Grid.Column="2" Margin="2" Content="{x:Static p:Resources.textCopyFromCREWA}" Click="buttonCopyNameFromCREWA_Click"/>
</Grid>
</GroupBox>
<GroupBox Name="infoGroupBox" Header="{x:Static p:Resources.textInfo}" Grid.Row="1" Margin="0,5,0,5">
@ -55,32 +59,84 @@
<RowDefinition Height="26" />
<RowDefinition Height="26" />
<RowDefinition Height="26" />
<RowDefinition Height="26" />
</Grid.RowDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textShippingArea}" Name="label_INFOShippingArea" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textMaerskSeago}" Name="label_MaerskSeaGo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortArea}" Name="label_INFOPortArea" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textRequestedPositionInPortOfCall}" Name="label_INFORequestedBerth" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textBowThrusterPower}" Name="label_INFOBowThrusterPower" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textSternThrusterPower}" Name="label_INFOSternThrusterPower" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textFumigatedBulkCargo}" Name="label_INFOFumigatedBulkCargo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textDeplacementSummerDraught}" Name="label_INFODeplacementSummerDraught" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="2" Content="{x:Static p:Resources.textSpecialRequirementsOfShipAtBerth}" Name="label_INFOSpecialRequirements" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="2" Content="{x:Static p:Resources.textConstructionCharacteristics}" Name="label_INFOConstructionCharacteristics" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textDeplacementSummerDraught}" Name="label_INFODeplacementSummerDraught" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textSpecialRequirementsOfShipAtBerth}" Name="label_INFOSpecialRequirements" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textConstructionCharacteristics}" Name="label_INFOConstructionCharacteristics" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="comboBoxShippingArea" Margin="2" SelectedIndex="{Binding ShippingArea, Converter={util:ByteConverter}}" ContextMenu="{DynamicResource ClearContextMenu}" />
<ComboBox Grid.Row="0" Grid.Column="3" x:Name="comboBoxGroup" Margin="0,2,4,2" ItemsSource="{StaticResource arrList}" DisplayMemberPath="Key" SelectedValuePath="Value" SelectionChanged="comboBoxGroup_SelectionChanged"/>
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxPortArea" Margin="2" SelectedValue="{Binding PortArea}" SelectedValuePath="Key" DisplayMemberPath="Value" ContextMenu="{DynamicResource ClearContextMenu}" />
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="110" />
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" Name="comboBoxPortArea" Margin="2" SelectedValue="{Binding PortArea}" SelectedValuePath="Key" DisplayMemberPath="Value" ContextMenu="{DynamicResource ClearContextMenu}" />
<Button Grid.Column="1" x:Name="buttonSearchPortArea" Margin="2" Content="Lookup port area" Click="buttonSearchPortArea_Click" />
</Grid>
<TextBox Grid.Row="2" Grid.Column="1" Name="textRequestedPostionInPortOfCall" Margin="2" Text="{Binding RequestedPositionInPortOfCall, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Name="textBowThrusterPower" Margin="2" Text="{Binding BowThrusterPower, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="1" Name="textSternThrusterPower" Margin="2" Text="{Binding SternThrusterPower, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<CheckBox Grid.Row="5" Grid.Column="1" Name="checkBoxFumigatedBulkCargo" VerticalContentAlignment="Center" IsChecked="{Binding FumigatedBulkCargoBool, Mode=TwoWay}" Margin="2"/>
<xctk:DoubleUpDown Grid.Row="6" Grid.Column="1" Name="doubleUpDownDisplacementSummerDraught" ShowButtonSpinner="False" ParsingNumberStyle="Any" Value="{Binding DeplacementSummerDraught_TNE}" Margin="4,2,0,2" FormatString="N1" TextAlignment="Left"/>
<TextBox Grid.Row="2" Grid.Column="3" Grid.RowSpan="2" Name="textSpecialRequirements" Margin="2" Text="{Binding SpecialRequirementsOfShipAtBerth, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="3" Grid.RowSpan="2" Name="textConstructionCharacteristics" Margin="2" Text="{Binding ConstructionCharacteristicsOfShip, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
<xctk:DoubleUpDown Grid.Row="0" Grid.Column="3" Name="doubleUpDownDisplacementSummerDraught" ShowButtonSpinner="False" ParsingNumberStyle="Any" Value="{Binding DeplacementSummerDraught_TNE}" Margin="4,2,0,2" FormatString="N1" TextAlignment="Left"/>
<TextBox Grid.Row="1" Grid.Column="3" Grid.RowSpan="2" Name="textSpecialRequirements" Margin="2" Text="{Binding SpecialRequirementsOfShipAtBerth, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Top" />
<TextBox Grid.Row="3" Grid.Column="3" Grid.RowSpan="2" Name="textConstructionCharacteristics" Margin="2" Text="{Binding ConstructionCharacteristicsOfShip, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Top"/>
</Grid>
</GroupBox>
<GroupBox Name="servGroupBox" Header="{x:Static p:Resources.textServ}" Grid.Row="2">
<enictrl:ENIDataGrid x:Name="dataGridSERV" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".1*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width=".2*" />
</Grid.ColumnDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textSERVTemplate}" Name="label_MaerskSeaGo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="comboBoxGroup" Margin="2,2,4,2" DisplayMemberPath="ServiceName"
SelectionChanged="comboBoxGroup_SelectionChanged" ContextMenu="{DynamicResource ClearContextMenu}" />
<Button Name="buttonSetTemplate" Margin="2" Click="buttonSetTemplate_Click" BorderThickness="0" Background="Transparent" Grid.Column="2"
ToolTip="Apply template" HorizontalContentAlignment="Right" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/check.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonEditTemplate" Grid.Column="4" Grid.Row="0" Margin="2" Click="buttonEditTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Edit template">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/pencil.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonNewTemplate" Grid.Column="5" Grid.Row="0" Margin="2" Click="buttonNewTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="New template">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/document_plain_new.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonDeleteTemplate" Grid.Column="6" Grid.Row="0" Margin="2" Click="buttonDeleteTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Delete template" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/delete.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
</Grid>
<enictrl:ENIDataGrid Grid.Row="1" x:Name="dataGridSERV" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
@ -89,7 +145,7 @@
<DataGridTextColumn Header="{x:Static p:Resources.textServiceInvoiceRecipient}" Binding="{Binding ServiceInvoiceRecipient, Mode=TwoWay}" IsReadOnly="True" Width="0.4*" />
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</Grid>
</GroupBox>
<GroupBox Name="ladgGroupBox" Header="{x:Static p:Resources.textLadg}" Grid.Row="3">
<enictrl:ENIDataGrid x:Name="dataGridLADG" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
@ -100,8 +156,27 @@
<DataGridTextColumn Header="{x:Static p:Resources.textLACodes}" Binding="{Binding CargoLACode, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoCodeNST}" Binding="{Binding CargoCodeNST, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoCodeNST3}" Binding="{Binding CargoCodeNST_3, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoNumberOfItems}" Binding="{Binding CargoNumberOfItems, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoGrossQuantity}" Binding="{Binding CargoGrossQuantity_TNE, Mode=TwoWay, StringFormat={}{0:N3}}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoNumberOfItems}" IsReadOnly="False" Width="0.15*">
<DataGridTextColumn.Binding>
<Binding Path="CargoNumberOfItems" Mode="TwoWay">
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="9999999" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textCargoGrossQuantity}" IsReadOnly="False" Width="0.15*">
<DataGridTextColumn.Binding>
<Binding Path="CargoGrossQuantity_TNE" Mode="TwoWay" StringFormat="N3">
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="1000000" MinValue="0" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textCargoPortOfLoading}" Binding="{Binding PortOfLoading, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoPortOfDischarge}" Binding="{Binding PortOfDischarge, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
</DataGrid.Columns>

View File

@ -1,4 +1,6 @@
// Copyright (c) 2017 schick Informatik
// Copyright (c) 2017- schick Informatik
// Description:
//
// Description: Detailansicht Gruppe Port Notification
//
@ -6,6 +8,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
@ -13,6 +16,8 @@ using ENI2.EditControls;
using ENI2.Util;
using bsmd.database;
using System.Threading.Tasks;
using System.Diagnostics;
namespace ENI2.DetailViewControls
{
@ -22,10 +27,18 @@ namespace ENI2.DetailViewControls
public partial class PortNotificationDetailControl : DetailBaseControl
{
#region Fields
private Message _nameMessage;
private Message _infoMessage;
private Message _servMessage;
private Message _ladgMessage;
private Message _crewaMessage;
private Dictionary<string, string> portAreas = null;
private static List<SERV_Template> _servTemplates = null;
private SERV_Template _currentTemplate;
#endregion
private static readonly string[] shippingAreas = {
Properties.Resources.textShippingAreaNORTHBALTIC,
@ -52,10 +65,10 @@ namespace ENI2.DetailViewControls
this.RegisterDoubleUpDownChange(this.doubleUpDownDisplacementSummerDraught, Message.NotificationClass.INFO);
this.RegisterTextboxChange(this.textSpecialRequirements, Message.NotificationClass.INFO);
this.RegisterTextboxChange(this.textConstructionCharacteristics, Message.NotificationClass.INFO);
this.dataGridLADG.CellEditEnding += (obj, ev) => { this.OnNotificationClassChanged(Message.NotificationClass.LADG); };
}
public override void Initialize()
public override async void Initialize()
{
base.Initialize();
@ -65,6 +78,7 @@ namespace ENI2.DetailViewControls
if (aMessage.MessageNotificationClass == Message.NotificationClass.INFO) { this._infoMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.SERV) { this._servMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.LADG) { this._ladgMessage = aMessage; this.ControlMessages.Add(aMessage); }
if(aMessage.MessageNotificationClass == Message.NotificationClass.CREWA) { this._crewaMessage = aMessage;}
}
#region init NAME
@ -109,11 +123,11 @@ namespace ENI2.DetailViewControls
_infoMessage.Elements.Add(info);
}
Dictionary<string, string> portAreas = LocalizedLookup.getPortAreasForLocode(this.Core.PoC);
portAreas = LocalizedLookup.getPortAreasForLocode(this.Core.PoC);
this.comboBoxPortArea.ItemsSource = portAreas;
this.comboBoxShippingArea.ItemsSource = shippingAreas;
this.infoGroupBox.DataContext = info;
this.infoGroupBox.DataContext = info;
@ -151,27 +165,38 @@ namespace ENI2.DetailViewControls
this.dataGridLADG.DeleteRequested += DataGridLADG_DeleteRequested;
this.dataGridLADG.CreateRequested += DataGridLADG_CreateRequested;
#endregion
#endregion
#region init helper Maersk / SeaGo Field
#region init SERV templates
if (this.Core.IsFlagSet(MessageCore.CoreFlags.MAERSK_BHV)) this.comboBoxGroup.SelectedIndex = 1;
if (this.Core.IsFlagSet(MessageCore.CoreFlags.SEAGO_BHV)) this.comboBoxGroup.SelectedIndex = 2;
if (this.Core.IsFlagSet(MessageCore.CoreFlags.SEAGO_WHV)) this.comboBoxGroup.SelectedIndex = 3;
if (this.Core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.comboBoxGroup.SelectedIndex = 4;
if(_servTemplates == null)
{
_servTemplates = await DBManagerAsync.GetSERVTemplatesAsync(); // initial load
_servTemplates.Sort();
Trace.WriteLine($"{_servTemplates.Count} SERV templates loaded");
}
this.comboBoxGroup.ItemsSource = _servTemplates;
this.buttonDeleteTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
this.buttonEditTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
this.buttonNewTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
#endregion
}
#region datagrid LADG
private void DataGridLADG_CreateRequested()
{
{
this.dataGridLADG.CancelEdit();
this.dataGridLADG.CancelEdit();
EditLADGDialog eld = new EditLADGDialog();
eld.LADG = new LADG();
eld.LADG.MessageHeader = _ladgMessage;
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
eld.Core = this.Core;
eld.Core = this.Core;
eld.AddClicked += () =>
{
@ -179,7 +204,7 @@ namespace ENI2.DetailViewControls
if (!this._ladgMessage.Elements.Contains(eld.LADG))
this._ladgMessage.Elements.Add(eld.LADG);
this.dataGridLADG.Items.Refresh();
eld.LADG = new LADG();
eld.LADG.MessageHeader = _ladgMessage;
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
@ -188,7 +213,7 @@ namespace ENI2.DetailViewControls
if (eld.ShowDialog() ?? false)
{
if(!_ladgMessage.Elements.Contains(eld.LADG))
if(!_ladgMessage.Elements.Contains(eld.LADG))
_ladgMessage.Elements.Add(eld.LADG);
this.dataGridLADG.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.LADG);
@ -199,6 +224,8 @@ namespace ENI2.DetailViewControls
{
if (obj is LADG ladg)
{
this.dataGridLADG.CancelEdit();
this.dataGridLADG.CancelEdit();
// are you sure dialog is in base class
this._ladgMessage.Elements.Remove(ladg);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ladg);
@ -210,6 +237,9 @@ namespace ENI2.DetailViewControls
private void DataGridLADG_EditRequested(DatabaseEntity obj)
{
this.dataGridLADG.CancelEdit();
this.dataGridLADG.CancelEdit();
LADG ladg = obj as LADG;
EditLADGDialog eld = new EditLADGDialog();
@ -224,7 +254,7 @@ namespace ENI2.DetailViewControls
this.dataGridLADG.Items.Refresh();
eld.LADG = new LADG();
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
eld.LADG.MessageHeader = _ladgMessage;
this.SublistElementChanged(Message.NotificationClass.LADG);
};
@ -249,7 +279,7 @@ namespace ENI2.DetailViewControls
#region datagrid SERV
private void DataGridSERV_CreateRequested()
{
{
EditSERVDialog esd = new EditSERVDialog();
esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
@ -259,7 +289,7 @@ namespace ENI2.DetailViewControls
{
esd.CopyValuesToEntity();
if(!_servMessage.Elements.Contains(esd.SERV))
_servMessage.Elements.Add(esd.SERV);
_servMessage.Elements.Add(esd.SERV);
this.dataGridSERV.Items.Refresh();
esd.SERV = new SERV();
esd.SERV.MessageHeader = _servMessage;
@ -290,7 +320,7 @@ namespace ENI2.DetailViewControls
}
private void DataGridSERV_EditRequested(DatabaseEntity obj)
{
{
EditSERVDialog esd = new EditSERVDialog();
esd.SERV = obj as SERV;
@ -302,7 +332,7 @@ namespace ENI2.DetailViewControls
this.dataGridSERV.Items.Refresh();
esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
esd.SERV.MessageHeader = _servMessage;
this.SublistElementChanged(Message.NotificationClass.SERV);
};
@ -327,7 +357,7 @@ namespace ENI2.DetailViewControls
public override void HighlightErrorMessageContainer()
{
if (this._nameMessage.HasErrors)
if (this._nameMessage.HasErrors)
HighlightService.HighlightControl(this.nameGroupBox, HighlightService.HighlightStyle.ERROR, this._nameMessage);
if (this._infoMessage.HasErrors)
HighlightService.HighlightControl(this.infoGroupBox, HighlightService.HighlightStyle.ERROR, this._infoMessage);
@ -349,114 +379,143 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.ladgGroupBox, HighlightService.HighlightStyle.VIOLATION, this._ladgMessage);
}
#endregion
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#region Spezialbalkon für die Gruppenauswahl im Core (Maersk BHV / Seago usw.)
#region SERV template event handler
private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// clear all
this.Core.SetFlag(false, MessageCore.CoreFlags.MAERSK_BHV);
this.Core.SetFlag(false, MessageCore.CoreFlags.SEAGO_BHV);
this.Core.SetFlag(false, MessageCore.CoreFlags.SEAGO_WHV);
this.Core.SetFlag(false, MessageCore.CoreFlags.HOEGH);
if(this.comboBoxGroup.SelectedItem is SERV_Template st)
{
this.buttonDeleteTemplate.IsEnabled = true;
this.buttonSetTemplate.IsEnabled = true;
this._currentTemplate = st;
}
}
DictionaryEntry selectedItem = (DictionaryEntry) this.comboBoxGroup.SelectedItem;
if(Int32.TryParse((string)selectedItem.Value, out int selectedValue))
private void buttonSetTemplate_Click(object sender, RoutedEventArgs e)
{
if (this.comboBoxGroup.SelectedItem is SERV_Template st)
{
if (selectedValue == (int)MessageCore.CoreFlags.MAERSK_BHV) CheckServiceEntryMaerskBHV();
if (selectedValue == (int)MessageCore.CoreFlags.SEAGO_BHV) CheckServiceEntrySeaGoBHV();
if (selectedValue == (int)MessageCore.CoreFlags.HOEGH) CheckServiceEntryHoegh();
this.Core.SetFlag(true, (MessageCore.CoreFlags)selectedValue);
DBManager.Instance.Save(this.Core);
}
bool found = false;
foreach (SERV serv in _servMessage.Elements.Cast<SERV>())
{
if (serv.ServiceName.Equals(st.ServiceName))
{
found = true; break;
}
}
if (!found)
{
SERV newServ = new SERV();
newServ.ServiceName = st.ServiceName;
newServ.ServiceBeneficiary = st.ServiceBeneficiary;
newServ.ServiceInvoiceRecipient = st.ServiceInvoiceRecipient;
newServ.MessageHeader = this._servMessage;
newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
this._servMessage.Elements.Add(newServ);
this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV);
}
}
}
private void buttonNewTemplate_Click(object sender, RoutedEventArgs e)
{
SERV_Template newTemplate = new SERV_Template();
EditSERVDialog esd = new EditSERVDialog();
esd.AddVisible = false;
esd.SERV_Template = newTemplate;
if(esd.ShowDialog() ?? false)
{
_ = DBManagerAsync.SaveAsync(esd.SERV_Template);
this.comboBoxGroup.ItemsSource = null;
_servTemplates.Add(newTemplate);
_servTemplates.Sort();
this.comboBoxGroup.ItemsSource = _servTemplates;
}
}
private void buttonEditTemplate_Click(object sender, RoutedEventArgs e)
{
if (this.comboBoxGroup.SelectedItem is SERV_Template st)
{
EditSERVDialog editSERVDialog = new EditSERVDialog();
editSERVDialog.AddVisible = false;
editSERVDialog.SERV_Template = st;
if (editSERVDialog.ShowDialog() ?? false)
{
_ = DBManagerAsync.SaveAsync(st);
this.comboBoxGroup.ItemsSource = null;
_servTemplates.Sort();
this.comboBoxGroup.ItemsSource = _servTemplates;
}
}
}
private void buttonDeleteTemplate_Click(object sender, RoutedEventArgs e)
{
if (_currentTemplate != null)
{
if (MessageBox.Show("Delete this template?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
this.comboBoxGroup.SelectedItem = null;
this.comboBoxGroup.ItemsSource = null;
_ = DBManagerAsync.DeleteAsync(_currentTemplate);
_servTemplates.Remove(_currentTemplate);
this.buttonDeleteTemplate.IsEnabled = false;
this.comboBoxGroup.ItemsSource = _servTemplates;
this.buttonSetTemplate.IsEnabled = false;
}
}
}
#endregion
#region special entry ship service check
#region other event handler
private void CheckServiceEntryMaerskBHV()
private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e)
{
bool found = false;
foreach(SERV serv in this._servMessage.Elements)
if (portAreas != null)
{
if (serv.ServiceBeneficiary.Equals("Maersk A/S, Esplanaden 50, DK-1263 Copenhagen K, VAT-ID: DK53139655"))
found = true;
}
if(!found)
{
SERV newServ = new SERV();
newServ.ServiceBeneficiary = "Maersk A/S, Esplanaden 50, DK-1263 Copenhagen K, VAT-ID: DK53139655";
newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co.KG, Ericusspitze 2-4, 20457 Hamburg";
newServ.ServiceName = "Maersk BHV";
newServ.MessageHeader = this._servMessage;
newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
this._servMessage.Elements.Add(newServ);
this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV);
}
}
private void CheckServiceEntrySeaGoBHV()
{
bool found = false;
foreach (SERV serv in this._servMessage.Elements)
{
if (serv.ServiceBeneficiary.Equals("Sealand Europe A/S, Dampfaergevej 10, 3.tv, DK- 2100 Copenhagen, VAT-ID: DK53139655"))
found = true;
}
if (!found)
{
SERV newServ = new SERV();
newServ.ServiceBeneficiary = "Sealand Europe A/S, Dampfaergevej 10, 3.tv, DK- 2100 Copenhagen, VAT-ID: DK53139655";
newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co. KG on behalf of Sealand Europe A/S, Ericusspitze 2-4, 20457 Hamburg";
newServ.ServiceName = "SeaGo BHV";
newServ.MessageHeader = this._servMessage;
newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
this._servMessage.Elements.Add(newServ);
this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV);
SelectPortAreaDialog spad = new SelectPortAreaDialog(this.Core.PoC);
if (spad.ShowDialog() ?? false)
{
if (spad.SelectedArea != null)
{
if (portAreas.ContainsKey(spad.SelectedArea))
{
var pair = portAreas.SingleOrDefault(p => p.Key == spad.SelectedArea);
this.comboBoxPortArea.SelectedItem = pair;
}
}
}
}
}
private void CheckServiceEntryHoegh()
private void buttonCopyNameFromCREWA_Click(object sender, RoutedEventArgs e)
{
bool found = false;
foreach (SERV serv in this._servMessage.Elements)
CREW crewA = null;
if (this._crewaMessage.Elements.Count > 0)
{
if (serv.ServiceBeneficiary.Equals("Höegh Autoliners AS, Oslo, Norway"))
found = true;
crewA = this._crewaMessage.Elements[0] as CREW;
}
if (!found)
SelectCrewMemberDialog scmd = new SelectCrewMemberDialog();
scmd.CREW = crewA;
scmd.AddVisible = false;
if (scmd.ShowDialog() ?? false)
{
SERV newServ = new SERV();
newServ.ServiceBeneficiary = "Höegh Autoliners AS, Oslo, Norway";
newServ.ServiceInvoiceRecipient = " PWL Port Services GmbH & Co. KG";
newServ.ServiceName = "HOEGH BHV";
newServ.MessageHeader = this._servMessage;
newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
this._servMessage.Elements.Add(newServ);
this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV);
this.textBox_NameMaster.Text = $"{crewA.CrewMemberFirstName} {crewA.CrewMemberLastName}";
this.SublistElementChanged(Message.NotificationClass.NAME);
var binding = textBox_NameMaster.GetBindingExpression(TextBox.TextProperty);
binding?.UpdateSource();
}
}
#endregion
}

View File

@ -116,6 +116,12 @@ namespace ENI2.DetailViewControls
}
public override int SelectedTabIndex
{
get { return this.mainFrame.SelectedIndex; }
set { this.mainFrame.SelectedIndex = value; }
}
#region SetEnabled
public override void SetEnabled(bool enabled)
@ -502,18 +508,7 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.secGroupBox, HighlightService.HighlightStyle.VIOLATION, this._secMessage);
}
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#endregion
}
}

View File

@ -12,7 +12,7 @@
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
<GroupBox Name="shipDataGroupBox" Header="{x:Static p:Resources.textShipData}" >
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="260" />
@ -104,6 +104,6 @@
</Grid>
</GroupBox>
</Grid>
</ScrollViewer>
</GroupBox>
</src:DetailBaseControl>

View File

@ -5,10 +5,8 @@
using System.Windows;
using bsmd.database;
using ENI2.EditControls;
using System.Windows.Media;
using ENI2.Util;
using System.Windows.Controls;
namespace ENI2.DetailViewControls
{
@ -104,18 +102,7 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.shipDataGroupBox, HighlightService.HighlightStyle.VIOLATION, this._statMessage);
}
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#endregion
}
}

View File

@ -71,7 +71,7 @@ namespace ENI2.DetailViewControls
private void copyItemToTOWA(object sender, RoutedEventArgs e)
{
// aus dem aktuell selektierten TOWA Element ein neues TOWD Element machen
// aus dem aktuell selektierten TOWD Element ein neues TOWA Element machen
if (this.dataGridTowageOnDeparture.SelectedItems != null)
{
foreach (TOWD selectedTOWD in this.dataGridTowageOnDeparture.SelectedItems)
@ -166,8 +166,7 @@ namespace ENI2.DetailViewControls
private void DataGridTowageOnDeparture_DeleteRequested(DatabaseEntity obj)
{
TOWD towd = obj as TOWD;
if (towd != null)
if (obj is TOWD towd)
{
// are you sure dialog is in base class
this._towdMessage.Elements.Remove(towd);
@ -245,8 +244,7 @@ namespace ENI2.DetailViewControls
private void DataGridTowageOnArrival_DeleteRequested(DatabaseEntity obj)
{
TOWA towa = obj as TOWA;
if (towa != null)
if (obj is TOWA towa)
{
// are you sure dialog is in base class
this._towaMessage.Elements.Remove(towa);
@ -310,18 +308,7 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.groupBoxTowageOnDeparture, HighlightService.HighlightStyle.VIOLATION, this._towdMessage);
}
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#endregion
}
}

View File

@ -45,7 +45,7 @@
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textValidExemption}" Name="label_ValidExemption" Margin="0,0,10,0"/>
<CheckBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Name="checkBoxAccurateCorrectDetails" IsChecked="{Binding ConfirmationOfCorrectness, Mode=TwoWay}" />
<CheckBox Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxValidExemption" IsChecked="{Binding WasteDisposalValidExemption, Mode=TwoWay}" />
<enictrl:LocodeControl Grid.Row="3" Grid.Column="1" x:Name="locodeCtrlNextWastePort" LocodeValue="{Binding NextWasteDisposalPort, Mode=TwoWay}" LocodeSource="SSN" />
<DatePicker Grid.Row="1" Grid.Column="1" Name="datePickerDateLastDisposal" Margin="2" SelectedDate="{Binding LastWasteDisposalDate, Mode=TwoWay}" DisplayDateStart="1/1/1800" DisplayDateEnd="12/31/2199" PreviewKeyUp="DateTimePicker_PreviewKeyUpDate">
<DatePicker.BlackoutDates>
<CalendarDateRange Start="1/1/0001" End="12/31/1799"/>
@ -53,7 +53,9 @@
</DatePicker.BlackoutDates>
</DatePicker>
<enictrl:LocodeControl Grid.Row="2" Grid.Column="1" x:Name="locodeCtrlLastWastePort" LocodeValue="{Binding LastWasteDisposalPort, Mode=TwoWay}" LocodeSource="SSN" />
<enictrl:LocodeControl Grid.Row="3" Grid.Column="1" x:Name="locodeCtrlNextWastePort" LocodeValue="{Binding NextWasteDisposalPort, Mode=TwoWay}" LocodeSource="SSN" />
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Grid.RowSpan="2" Name="textBoxWasteDisposalServiceProviders" Text="{Binding WasteDisposalServiceProviderText, Converter={util:TrimStringConverter}}" Margin="2" />
<Button Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="1" Name="buttonAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonAddMissingEntries_Click"/>
<Button Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="1" Name="buttonImportFromExcel" Content="{x:Static p:Resources.textImportFromExcel}" Margin="2" Click="buttonImportFromExcel_Click" />
</Grid>
@ -151,10 +153,12 @@
</enictrl:ENIDataGrid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Name="buttonWasteReceivedAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonWasteReceivedAddMissingEntries_Click"/>
<Button Grid.Row="0" Grid.Column="1" Name="buttonCopyFromWAS" Content="{x:Static p:Resources.textCopyFromWAS}" Margin="2" Click="buttonCopyFromWAS_Click"/>
</Grid>
<enictrl:ENIDataGrid x:Name="dataGridWasteReceived" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="2" CanUserAddRows="False">
@ -162,7 +166,7 @@
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding WasteTypeDisplayGrid}" IsReadOnly="True" Width="0.2*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDescription}" Binding="{Binding WasteDescription}" IsReadOnly="True" Width="0.3*" />
<DataGridTemplateColumn IsReadOnly="True" Width="0.15*">
<!--DataGridTemplateColumn IsReadOnly="True" Width="0.15*">
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<TextBlock TextWrapping="Wrap" Text="{x:Static p:Resources.textAmountWasteReceived_MTQ}" FontSize="10"/>
@ -173,7 +177,16 @@
<TextBlock TextAlignment="Center" Text="{Binding AmountWasteReceived_MTQ, StringFormat={}{0:N3}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGridTemplateColumn-->
<DataGridTextColumn Header="{x:Static p:Resources.textAmountWasteReceived_MTQ}" IsReadOnly="False" Width="0.15*">
<DataGridTextColumn.Binding>
<Binding Path="AmountWasteReceived_MTQ" Mode="TwoWay" StringFormat="N3" >
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="10000" MinValue="0" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
</DataGrid.Columns>
</enictrl:ENIDataGrid>

View File

@ -22,17 +22,14 @@ namespace ENI2.DetailViewControls
public partial class WasteDetailControl : DetailBaseControl
{
#region Fields
private Message _wasMessage;
private WAS _was;
private Message _wasRcptMessage;
private WAS_RCPT _selectedWAS_RCPT;
private static readonly string[] _wasteDeliveryList =
{
"ALL",
"SOME",
"NONE"
};
#endregion
public WasteDetailControl()
{
@ -47,9 +44,9 @@ namespace ENI2.DetailViewControls
this.RegisterLocodeChange(this.locodeCtrlNextWastePort, Message.NotificationClass.WAS);
this.RegisterCheckboxChange(this.checkBoxAccurateCorrectDetails, Message.NotificationClass.WAS);
this.RegisterCheckboxChange(this.checkBoxValidExemption, Message.NotificationClass.WAS);
this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS);
this.dataGridWasteReceived.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); };
}
private void CheckBoxValidExemption_Checked(object sender, RoutedEventArgs e)
@ -78,7 +75,7 @@ namespace ENI2.DetailViewControls
WasteCapacity_MTQ = 0,
WasteDescription = "",
WasteDisposalAmount_MTQ = 0,
WasteDisposalPort = "ZZUKN"
WasteDisposalPort = "ZZUKN"
};
this._was.Waste.Add(newWaste);
}
@ -124,7 +121,7 @@ namespace ENI2.DetailViewControls
was.MessageCore = this.Core;
was.MessageHeader = this._wasMessage;
_wasMessage.Elements.Add(was);
}
}
else
{
// remove "old" Waste Entries from display (not deleted in the DB!)
@ -132,14 +129,14 @@ namespace ENI2.DetailViewControls
{
if (was.Waste[i].WasteType > 999)
was.Waste.RemoveAt(i);
}
}
}
this.wasGroupBox.DataContext = was;
this._was = was;
this.dataGridWaste.Initialize();
this.dataGridWaste.ItemsSource = was.Waste;
this.dataGridWaste.ItemsSource = was.Waste;
this.dataGridWaste.AddingNewItem += DataGridWaste_AddingNewItem;
this.dataGridWaste.EditRequested += DataGridWaste_EditRequested;
this.dataGridWaste.DeleteRequested += DataGridWaste_DeleteRequested;
@ -180,6 +177,12 @@ namespace ENI2.DetailViewControls
}
public override int SelectedTabIndex
{
get { return this.mainFrame.SelectedIndex; }
set { this.mainFrame.SelectedIndex = value; }
}
#region Waste receipt grid event handler
private void DataGridWasteReceipt_CreateRequested()
@ -210,9 +213,11 @@ namespace ENI2.DetailViewControls
this.dataGridWasteReceipt.Items.Refresh();
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
this.dataGridWasteReceived.ItemsSource = null;
this.dataGridWasteReceived.ItemsSource = null;
dataGridWasteReceipt_SelectionChanged(this, null);
}
}
private void DataGridWasteReceipt_DeleteRequested(DatabaseEntity obj)
@ -254,10 +259,11 @@ namespace ENI2.DetailViewControls
if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
}
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.dataGridWasteReceipt.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
dataGridWasteReceipt_SelectionChanged(this, null);
}
private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e)
@ -282,7 +288,8 @@ namespace ENI2.DetailViewControls
{
if (obj is WasteReceived wasteReceived)
{
this.dataGridWasteReceived.CancelEdit();
this.dataGridWasteReceived.CancelEdit();
// are you sure dialog is in base class
_selectedWAS_RCPT.WasteReceived.Remove(wasteReceived);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(wasteReceived);
@ -294,6 +301,9 @@ namespace ENI2.DetailViewControls
private void DataGridWasteReceived_CreateRequested()
{
if (_selectedWAS_RCPT == null) return;
this.dataGridWasteReceived.CancelEdit();
this.dataGridWasteReceived.CancelEdit();
EditWasteReceivedDialog ewrd = new EditWasteReceivedDialog();
ewrd.WasteReceived = new WasteReceived();
ewrd.WasteReceived.WAS_RCPT = _selectedWAS_RCPT;
@ -302,7 +312,7 @@ namespace ENI2.DetailViewControls
ewrd.AddClicked += () =>
{
ewrd.CopyValuesToEntity();
if (!this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
if ((ewrd.WasteReceived.WasteCode != null) && !this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
{
this._selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
this.dataGridWasteReceived.Items.Refresh();
@ -315,7 +325,7 @@ namespace ENI2.DetailViewControls
if (ewrd.ShowDialog() ?? false)
{
if (!this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
if ((ewrd.WasteReceived.WasteCode != null) && !this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
{
this._selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
this.dataGridWasteReceived.Items.Refresh();
@ -327,13 +337,16 @@ namespace ENI2.DetailViewControls
private void DataGridWasteReceived_EditRequested(DatabaseEntity obj)
{
this.dataGridWasteReceived.CancelEdit();
this.dataGridWasteReceived.CancelEdit();
EditWasteReceivedDialog ewrd = new EditWasteReceivedDialog();
ewrd.WasteReceived = obj as WasteReceived;
ewrd.AddClicked += () =>
{
ewrd.CopyValuesToEntity();
if (!this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
if ((ewrd.WasteReceived.WasteCode != null) && !this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
{
_selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
this.dataGridWasteReceived.Items.Refresh();
@ -346,9 +359,9 @@ namespace ENI2.DetailViewControls
if (ewrd.ShowDialog() ?? false)
{
if (!_selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
if ((ewrd.WasteReceived.WasteCode != null) && !_selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
{
_selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
_selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
}
this.dataGridWasteReceived.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
@ -402,7 +415,7 @@ namespace ENI2.DetailViewControls
{
// are you sure dialog is in base class
_was.Waste.Remove(waste);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(waste);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(waste);
DatabaseEntity.ResetIdentifiers(new List<DatabaseEntity>(_was.Waste));
this.SublistElementChanged(Message.NotificationClass.WAS);
this.dataGridWaste.Items.Refresh();
@ -462,17 +475,6 @@ namespace ENI2.DetailViewControls
#endregion
#region mouse wheel
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
ScrollViewer scv = (ScrollViewer)sender;
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
e.Handled = true;
}
#endregion
#region Excel file import
private void buttonImportFromExcel_Click(object sender, RoutedEventArgs e)
@ -488,7 +490,7 @@ namespace ENI2.DetailViewControls
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
@ -515,7 +517,7 @@ namespace ENI2.DetailViewControls
if (reader.FieldCount < 9)
{
throw new InvalidDataException("Sheet must have 9 Columns of data");
}
}
if (!reader.IsDBNull(1)) o = reader.GetValue(1); else o = null;
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
@ -551,7 +553,7 @@ namespace ENI2.DetailViewControls
if (!reader.IsDBNull(8)) waste.WasteDisposalPort = reader.GetString(8).ToUpper();
if (!reader.IsDBNull(9)) o = reader.GetValue(9); else o = null;
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
importWasteList.Add(waste);
cnt++;
@ -578,8 +580,38 @@ namespace ENI2.DetailViewControls
}
}
#endregion
#region Copy WAS to WAS_RCPT handler
private void buttonCopyFromWAS_Click(object sender, RoutedEventArgs e)
{
if (_selectedWAS_RCPT == null) return;
if(MessageBox.Show(Properties.Resources.textCopyToWASConfirmation, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
foreach(Waste waste in _was.Waste)
{
if(waste.WasteDisposalAmount_MTQ.HasValue && waste.WasteDisposalAmount_MTQ > 0)
{
// find matching WAS_RCPT entry
foreach(WasteReceived wasteReceived in _selectedWAS_RCPT.WasteReceived)
{
if(wasteReceived.WasteCode.Equals(waste.WasteType.ToString()))
{
wasteReceived.AmountWasteReceived_MTQ = waste.WasteDisposalAmount_MTQ;
break;
}
}
}
}
this.dataGridWasteReceived.Items.Refresh();
}
}
#endregion
}
}

View File

@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ENI2</RootNamespace>
<AssemblyName>ENI2</AssemblyName>
<AssemblyName>ENI2Test</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>7.6.0.%2a</ApplicationVersion>
<ApplicationRevision>7</ApplicationRevision>
<ApplicationVersion>7.2.12.7</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
@ -62,7 +62,8 @@
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<WarningLevel>0</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject>ENI2.App</StartupObject>
@ -84,14 +85,13 @@
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<ManifestCertificateThumbprint>94D98790E3B6C4CC9F4B57C8FD305E3225894DF8</ManifestCertificateThumbprint>
<ManifestCertificateThumbprint>C5FD306818D481FBECE3B2E74D7A912F515191E0</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
<ManifestKeyFile>ENI2_7_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug 64|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
@ -134,43 +134,115 @@
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="ExcelDataReader, Version=3.6.0.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa, processorArchitecture=MSIL">
<HintPath>packages\ExcelDataReader.3.6.0\lib\net45\ExcelDataReader.dll</HintPath>
<Reference Include="ExcelDataReader, Version=3.8.0.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa, processorArchitecture=MSIL">
<HintPath>packages\ExcelDataReader.3.8.0\lib\net462\ExcelDataReader.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.9.0.9\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.Cryptography, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.Cryptography.9.0.9\lib\net462\Microsoft.Bcl.Cryptography.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.DependencyInjection.9.0.9\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.9\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Logging.9.0.9\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.9.0.9\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Options.9.0.9\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Primitives, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Primitives.9.0.9\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1000\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
<HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="MigraDoc.DocumentObjectModel-gdi, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc-gdi.1.50.5147\lib\net20\MigraDoc.DocumentObjectModel-gdi.dll</HintPath>
<Reference Include="MigraDoc.DocumentObjectModel, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc.6.2.2\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll</HintPath>
</Reference>
<Reference Include="MigraDoc.Rendering-gdi, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc-gdi.1.50.5147\lib\net20\MigraDoc.Rendering-gdi.dll</HintPath>
<Reference Include="MigraDoc.Rendering, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc.6.2.2\lib\netstandard2.0\MigraDoc.Rendering.dll</HintPath>
</Reference>
<Reference Include="MigraDoc.RtfRendering-gdi, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc-gdi.1.50.5147\lib\net20\MigraDoc.RtfRendering-gdi.dll</HintPath>
<Reference Include="MigraDoc.RtfRendering, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc.6.2.2\lib\netstandard2.0\MigraDoc.RtfRendering.dll</HintPath>
</Reference>
<Reference Include="PdfSharp-gdi, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc-gdi.1.50.5147\lib\net20\PdfSharp-gdi.dll</HintPath>
<Reference Include="PdfSharp, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.Charting-gdi, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp-MigraDoc-gdi.1.50.5147\lib\net20\PdfSharp.Charting-gdi.dll</HintPath>
<Reference Include="PdfSharp.BarCodes, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.BarCodes.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.Charting, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Charting.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.Cryptography, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Cryptography.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.Quality, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Quality.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.Shared, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Shared.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.Snippets, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Snippets.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.System, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.System.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.WPFonts, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.WPFonts.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.115.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\lib\net46\System.Data.SQLite.dll</HintPath>
<Reference Include="System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Diagnostics.DiagnosticSource.9.0.9\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Formats.Asn1, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Formats.Asn1.9.0.9\lib\net462\System.Formats.Asn1.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression" />
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Security.Cryptography.Pkcs, Version=9.0.0.9, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Security.Cryptography.Pkcs.9.0.9\lib\net462\System.Security.Cryptography.Pkcs.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
@ -185,20 +257,20 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Xceed.Wpf.AvalonDock, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
<Reference Include="Xceed.Wpf.AvalonDock, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.Toolkit, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
<Reference Include="Xceed.Wpf.Toolkit, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -218,16 +290,31 @@
<Compile Include="..\bsmd.ExcelReadService\LocodeDB.cs">
<Link>Locode\LocodeDB.cs</Link>
</Compile>
<Compile Include="Controls\BusyControl.xaml.cs">
<DependentUpon>BusyControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ClosableTabItem.cs" />
<Compile Include="Controls\ConditionGroupControl.xaml.cs">
<DependentUpon>ConditionGroupControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\EasyPeasyControl.xaml.cs">
<DependentUpon>EasyPeasyControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\EditWindowBase.cs" />
<Compile Include="Controls\ENIDataGrid.cs" />
<Compile Include="Controls\IHighlightControlContainer.cs" />
<Compile Include="Controls\LocodeControl.xaml.cs">
<DependentUpon>LocodeControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\MaerskOverviewControl.xaml.cs">
<DependentUpon>MaerskOverviewControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ValueMappingsControl.xaml.cs">
<DependentUpon>ValueMappingsControl.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\ChangePasswordDialog.xaml.cs">
<DependentUpon>ChangePasswordDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\CompareExcelDialog.xaml.cs">
<DependentUpon>CompareExcelDialog.xaml</DependentUpon>
</Compile>
@ -243,14 +330,21 @@
<Compile Include="EditControls\NewDGItemDialog.xaml.cs">
<DependentUpon>NewDGItemDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\SelectCrewMemberDialog.xaml.cs">
<DependentUpon>SelectCrewMemberDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\SelectPortAreaDialog.xaml.cs">
<DependentUpon>SelectPortAreaDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Excel\DakosyUtil.cs" />
<Compile Include="Excel\ExcelBase.cs" />
<Compile Include="Excel\ExcelComparer.cs" />
<Compile Include="Excel\ExcelManager.cs" />
<Compile Include="Excel\ExcelReader.cs" />
<Compile Include="Excel\ExcelSimpleWriter.cs" />
<Compile Include="Excel\ExcelUtil.cs" />
<Compile Include="Controls\POListControl.xaml.cs">
<DependentUpon>POListControl.xaml</DependentUpon>
<Compile Include="Controls\MaerskListControl.xaml.cs">
<DependentUpon>MaerskListControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ReportingPartyControl.xaml.cs">
<DependentUpon>ReportingPartyControl.xaml</DependentUpon>
@ -421,6 +515,42 @@
<DesignTime>True</DesignTime>
<DependentUpon>Reference.svcmap</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\ATAControl.xaml.cs">
<DependentUpon>ATAControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\CrewDepartureControl.xaml.cs">
<DependentUpon>CrewDepartureControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\CrewPreArrivalControl.xaml.cs">
<DependentUpon>CrewPreArrivalControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\DangerousCargoControl.xaml.cs">
<DependentUpon>DangerousCargoControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\PassengerDepartureControl.xaml.cs">
<DependentUpon>PassengerDepartureControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\PassengerPreArrivalControl.xaml.cs">
<DependentUpon>PassengerPreArrivalControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\PortControl.xaml.cs">
<DependentUpon>PortControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\PreArrivalControl.xaml.cs">
<DependentUpon>PreArrivalControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\PreDepartureControl.xaml.cs">
<DependentUpon>PreDepartureControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\ShipDataControl.xaml.cs">
<DependentUpon>ShipDataControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\VoyageControl.xaml.cs">
<DependentUpon>VoyageControl.xaml</DependentUpon>
</Compile>
<Compile Include="SheetDisplayControls\WasteReceiptsControl.xaml.cs">
<DependentUpon>WasteReceiptsControl.xaml</DependentUpon>
</Compile>
<Compile Include="SplashScreenWindow.xaml.cs">
<DependentUpon>SplashScreenWindow.xaml</DependentUpon>
</Compile>
@ -429,36 +559,51 @@
</Compile>
<Compile Include="Util\BoolToVisibilityConverter.cs" />
<Compile Include="Util\ByteConverter.cs" />
<Compile Include="Util\CutoffConverter.cs" />
<Compile Include="Util\DatabaseEntityWatchdog.cs" />
<Compile Include="Util\EasyPeasyState.cs" />
<Compile Include="Util\EnumHelper.cs" />
<Compile Include="Util\EnumToBooleanConverter.cs" />
<Compile Include="Util\EnumToCollectionConverter.cs" />
<Compile Include="Util\ExpandableListConverter.cs" />
<Compile Include="Util\Extensions.cs" />
<Compile Include="Util\GlobalStructures.cs" />
<Compile Include="Util\HighlightService.cs" />
<Compile Include="Util\InverseBooleanConverter.cs" />
<Compile Include="Util\NullImageConverter.cs" />
<Compile Include="Util\NumberValidationRule.cs" />
<Compile Include="Util\SettingBindingExtension.cs" />
<Compile Include="Util\StringValidationRule.cs" />
<Compile Include="Util\TrimStringConverter.cs" />
<Compile Include="Util\UIHelper.cs" />
<Compile Include="Util\UtcToLocalDateTimeConverter.cs" />
<Compile Include="Util\ValidationContext.cs" />
<Compile Include="VorgaengeControl.xaml.cs">
<DependentUpon>VorgaengeControl.xaml</DependentUpon>
</Compile>
<Compile Include="WindowPlacement.cs" />
<Page Include="AnmeldungenControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\BusyControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ConditionGroupControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\EasyPeasyControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\LocodeControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\POListControl.xaml">
<Page Include="Controls\MaerskOverviewControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\MaerskListControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@ -478,6 +623,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ValueMappingsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ControlTemplates.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -542,6 +691,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\ChangePasswordDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\CompareExcelDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -670,10 +823,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\SelectCrewMemberDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\SelectImportClassesDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\SelectPortAreaDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\ShowIdDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -709,6 +870,54 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="SheetDisplayControls\ATAControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\CrewDepartureControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\CrewPreArrivalControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\DangerousCargoControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\PassengerDepartureControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\PassengerPreArrivalControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\PortControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\PreArrivalControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\PreDepartureControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\ShipDataControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\VoyageControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SheetDisplayControls\WasteReceiptsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SplashScreenWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -721,10 +930,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="VorgaengeControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@ -740,10 +945,6 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Content Include="..\misc\Logo.gif">
<Link>Report\Logo.gif</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\misc\report.db">
<Link>report.db</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -761,6 +962,9 @@
<None Include="ENI2_3_TemporaryKey.pfx" />
<None Include="ENI2_4_TemporaryKey.pfx" />
<None Include="ENI2_5_TemporaryKey.pfx" />
<None Include="ENI2_6_TemporaryKey.pfx" />
<None Include="ENI2_7_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Service References\LockingServiceReference\ENI2.LockingServiceReference.CoreLock.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
@ -838,6 +1042,20 @@
<Resource Include="Resources\logo_eni.png" />
<Resource Include="Resources\import1.png" />
<Resource Include="Resources\import2.png" />
<Resource Include="Resources\about.png" />
<Resource Include="Resources\document_into.png" />
<Resource Include="Resources\document_plain_new.png" />
<Resource Include="Resources\exit.png" />
<Resource Include="Resources\document_exchange.png" />
<Resource Include="Resources\arrival_user.png" />
<Resource Include="Resources\arrival_worker.png" />
<Resource Include="Resources\departure_user.png" />
<Resource Include="Resources\departure_worker.png" />
<Resource Include="Resources\clock.png" />
<Content Include="Report\Logo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\pencil.png" />
<Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@ -864,7 +1082,6 @@
</Content>
<None Include="bsmdKey.snk" />
<None Include="ENI2.licenseheader" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -887,9 +1104,9 @@
<Resource Include="Resources\containership.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
@ -987,16 +1204,18 @@
<SignToolPath Condition="'$(SignToolPath)' == '' And '$(SignToolPathBase)' != ''">$(SignToolPathBase)$(Platform)\</SignToolPath>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>"$(SignToolPath)signtool.exe" sign /f $(ProjectDir)\..\misc\codesigning.pfx /p t5bj2dk9ifdIWBPhPra4U $(TargetPath)</PostBuildEvent>
<PostBuildEvent>"$(SignToolPath)signtool.exe" sign /f $(ProjectDir)\ENI2_7_TemporaryKey.pfx /p FgrMFUWsTVGQeb6L6i0e /fd SHA256 $(TargetPath)</PostBuildEvent>
</PropertyGroup>
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
<Error Condition="!Exists('packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<Import Project="packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets" Condition="Exists('packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.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>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,37 @@
<enictrl:EditWindowBase x:Class="ENI2.EditControls.ChangePasswordDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="Change password" Height="243" Width="400" Loaded="EditWindowBase_Loaded" Background="AliceBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".4*" />
<ColumnDefinition Width=".6*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Name" />
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textOldPassword}" />
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textNewPassword}" />
<Label Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textRepeatNewPassword}" />
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="textBlockName" VerticalAlignment="Center" FontWeight="DemiBold"/>
<PasswordBox Grid.Row="1" Grid.Column="1" x:Name="textBoxOldPassword" Margin="2" VerticalContentAlignment="Center" />
<PasswordBox Grid.Row="2" Grid.Column="1" x:Name="textBoxNew1Password" Margin="2" VerticalContentAlignment="Center" />
<PasswordBox Grid.Row="3" Grid.Column="1" x:Name="textBoxNew2Password" Margin="2" VerticalContentAlignment="Center" />
<Label Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textDefaultDisplay}" />
<ComboBox x:Name="comboBoxDefaultDisplay" Grid.Column="1" Grid.Row="4" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="False" />
<Button Grid.Row="5" Grid.Column="1" Content="Change" Name="buttonChangePassword" Margin="2" Width="80" HorizontalAlignment="Left" Click="buttonChangePassword_Click"/>
</Grid>
</enictrl:EditWindowBase>

View File

@ -0,0 +1,98 @@
// Copyright (c) 2017- schick Informatik
// Description: Users may change their password
//
using bsmd.database;
using ENI2.Controls;
using System;
using System.Windows;
using System.Windows.Controls;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for ChangePasswordDialog.xaml
/// </summary>
public partial class ChangePasswordDialog : EditWindowBase
{
#region Construction
public ChangePasswordDialog()
{
InitializeComponent();
}
#endregion
#region Properties
public ReportingParty CurrentUser { get; set; }
#endregion
#region event handler
private void buttonChangePassword_Click(object sender, RoutedEventArgs e)
{
bool success = false;
string message = "";
if (!textBoxOldPassword.Password.IsNullOrEmpty() || !textBoxNew1Password.Password.IsNullOrEmpty() || !textBoxNew2Password.Password.IsNullOrEmpty())
{
if (!textBoxOldPassword.Password.IsNullOrEmpty())
{
if (CurrentUser.GetHash(textBoxOldPassword.Password).Equals(CurrentUser.PasswordHash))
{
if (textBoxNew1Password.Password.IsNullOrEmpty() ||
textBoxNew2Password.Password.IsNullOrEmpty() ||
!textBoxNew1Password.Password.Equals(textBoxNew2Password.Password))
{
message = "New passwords are empty or do not match";
}
else
{
if (textBoxOldPassword.Password.Equals(textBoxNew1Password.Password))
{
message = "Old and new password are the same";
}
else
{
CurrentUser.SetPassword(textBoxNew1Password.Password);
success = true;
}
}
}
else
{
message = "Old password is not correct";
}
}
else
{
message = "Old password empty";
}
if (!success)
MessageBox.Show(message, "Changing password failed", MessageBoxButton.OK, MessageBoxImage.Error);
else
MessageBox.Show("Password successfully changed.", "Password changed", MessageBoxButton.OK, MessageBoxImage.Information);
}
// user may have changed combobox default display value so we are saving anyway here
this.CurrentUser.ShipcallDisplayMode = (ReportingParty.ShipcallDisplayModeEnum)Enum.Parse(typeof(ReportingParty.ShipcallDisplayModeEnum), (string)this.comboBoxDefaultDisplay.SelectedValue);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(CurrentUser);
}
private void EditWindowBase_Loaded(object sender, RoutedEventArgs e)
{
this.textBlockName.Text = CurrentUser.Logon;
this.AddVisible = false;
this.OkVisible = false;
var cancelButton = (Button)Template.FindName("buttonCancel", this);
cancelButton.Content = "Close";
this.comboBoxDefaultDisplay.ItemsSource = Util.EnumHelper.GetAllValuesAndDescription(typeof(ReportingParty.ShipcallDisplayModeEnum));
this.comboBoxDefaultDisplay.SelectedValue = this.CurrentUser.ShipcallDisplayMode;
}
#endregion
}
}

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textCompareExcel}" Height="260" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_grey.ico">
Title="{x:Static p:Resources.textCompareExcel}" Height="260" Width="600" Background="AliceBlue" Icon="/ENI2Test;component/Resources/bullet_ball_grey.ico">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32" />
@ -28,7 +28,7 @@
</AccessText>
</Label>
<Image x:Name="imageSource" Grid.Row="1" Grid.Column="1" Margin="4" Source="../Resources/import2.png" AllowDrop="True" Drop="imageSource_Drop" DragEnter="imageSource_DragEnter"/>
<TextBox TextWrapping="Wrap" x:Name="textBoxSource" Grid.Row="1" Grid.Column="2" IsReadOnly="True" Margin="2" Drop="imageSource_Drop" AllowDrop="True" DragEnter="imageSource_DragEnter" PreviewDragOver="textBoxSource_PreviewDragOver"/>
<TextBox TextWrapping="Wrap" x:Name="textBoxSource" Grid.Row="1" Grid.Column="2" IsReadOnly="True" Margin="2" Drop="imageSource_Drop" AllowDrop="True" DragEnter="imageSource_DragEnter" PreviewDragOver="textBoxSource_PreviewDragOver" PreviewMouseDown="textBoxSource_PreviewMouseDown"/>
<Label VerticalAlignment="Center" Grid.Row="2" Grid.Column="0">
<AccessText TextWrapping="Wrap">
@ -36,7 +36,7 @@
</AccessText>
</Label>
<Image x:Name="imageTarget" Grid.Row="2" Grid.Column="1" Margin="4" Source="../Resources/import1.png" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter"/>
<TextBox TextWrapping="Wrap" x:Name="textBoxTarget" Grid.Row="2" Grid.Column="2" IsReadOnly="True" Margin="2" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter" PreviewDragOver="textBoxSource_PreviewDragOver"/>
<TextBox TextWrapping="Wrap" x:Name="textBoxTarget" Grid.Row="2" Grid.Column="2" IsReadOnly="True" Margin="2" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter" PreviewDragOver="textBoxSource_PreviewDragOver" PreviewMouseDown="textBoxTarget_PreviewMouseDown"/>
<Button x:Name="buttonCompare" Margin="2" Grid.Row="3" Grid.Column="1" Content="Compare" IsEnabled="False" Click="buttonCompare_Click"/>
</Grid>

View File

@ -31,7 +31,7 @@ namespace ENI2.EditControls
#region Drag&Drop event handler
private async void imageSource_Drop(object sender, DragEventArgs e)
private void imageSource_Drop(object sender, DragEventArgs e)
{
string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop);
if (files != null)
@ -210,5 +210,37 @@ namespace ENI2.EditControls
#endregion
#region click on textboxes opens file selection
private void textBoxSource_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog
{
Filter = "Excel Files|*.xls;*.xlsx"
};
if (ofd.ShowDialog() ?? false)
{
textBoxSource.Text = ofd.FileName;
_sourcePath = ofd.FileName;
}
EnableCompareButton();
}
private void textBoxTarget_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog
{
Filter = "Excel Files|*.xls;*.xlsx"
};
if (ofd.ShowDialog() ?? false)
{
textBoxTarget.Text = ofd.FileName;
_targetPath = ofd.FileName;
}
EnableCompareButton();
}
#endregion
}
}

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textCopyDeclaration}" Height="326" Width="440" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_cards.ico">
Title="{x:Static p:Resources.textCopyDeclaration}" Height="326" Width="440" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2Test;component/Resources/id_cards.ico">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
@ -60,7 +60,7 @@
ButtonSpinnerLocation="Right"
ParsingNumberStyle="Integer"
Watermark="Enter ENI" ValueChanged="doubleUpDownENI_ValueChanged" TextAlignment="Left"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2" Width="Auto" x:Name="locodePoC" />
<enictrl:LocodeControl Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2" Width="Auto" x:Name="locodePoC" LocodeSource="OLD" />
<DatePicker Name="datePickerETA" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" SelectedDateChanged="datePickerETA_SelectedDateChanged" DisplayDateStart="1/1/1900" DisplayDateEnd="12/31/2199">
<DatePicker.BlackoutDates>
<CalendarDateRange Start="1/1/0001" End="12/31/1799"/>

View File

@ -57,7 +57,7 @@ namespace ENI2.EditControls
isComplete &= imo_OR_eni;
string locode = this.locodePoC.LocodeValue;
bool validLocode = (locode?.Length == 5) && (locode.StartsWith("DE") || locode.StartsWith("DK") || locode.Equals("ZZNOK"));
bool validLocode = (locode?.Length == 5) && (locode.StartsWith("DE") || locode.StartsWith("DK") || locode.Equals("ZZNOK") || locode.Equals("DEWHV"));
isComplete &= validLocode;
@ -74,10 +74,11 @@ namespace ENI2.EditControls
private void CopyDeclarationDialog_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
this.OKClicked += VisitIdDialog_OKClicked;
List<KeyValuePair<bsmd.database.Message.NSWProvider, string>> comboDataSource = new List<KeyValuePair<bsmd.database.Message.NSWProvider, string>>()
List<KeyValuePair<Message.NSWProvider, string>> comboDataSource = new List<KeyValuePair<Message.NSWProvider, string>>()
{
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DBH, "DBH" ),
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DUDR, "HIS-Nord" ),
new KeyValuePair<Message.NSWProvider, string>( Message.NSWProvider.DBH, "DBH" ),
new KeyValuePair<Message.NSWProvider, string>( Message.NSWProvider.DBH_MAERSK, "DBH / Maersk" ),
new KeyValuePair<Message.NSWProvider, string>( Message.NSWProvider.DUDR, "HIS-Nord" ),
};
this.comboBoxInitialHIS.ItemsSource = comboDataSource;
@ -96,6 +97,15 @@ namespace ENI2.EditControls
private void LocodePoC_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
this.CheckComplete();
string locode = this.locodePoC.LocodeValue;
if ((locode != null) && (locode.Equals("DEBRV") || locode.Equals("DEBRE")))
{
this.comboBoxInitialHIS.SelectedValue = Message.NSWProvider.DBH;
}
else
{
this.comboBoxInitialHIS.SelectedValue = Message.NSWProvider.DUDR;
}
}
private void doubleUpDownIMO_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<object> e)

View File

@ -8,7 +8,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textCoreStatus}" Height="436" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_grey.ico" >
Title="{x:Static p:Resources.textCoreStatus}" Height="436" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" Icon="/ENI2Test;component/Resources/bullet_ball_grey.ico" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*"/>

View File

@ -19,7 +19,7 @@
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<Label Content="{x:Static p:Resources.textBunkerType}" Grid.Row="0" Grid.Column="0" />
<TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxBunkerType" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxBunkerType" Margin="2" MaxLength="25" VerticalContentAlignment="Center"/>
<Label Content="{x:Static p:Resources.textBunkerQuantity}" Grid.Row="1" Grid.Column="0" />
<xctk:DoubleUpDown Grid.Row="1" Grid.Column="1" Name="doubleUpDownBunkerQuantity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N1" TextAlignment="Left" />
</Grid>

View File

@ -34,7 +34,7 @@
<Label Name="labelNationality" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textNationality}" />
<Label Name="labelDateOfBirth" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textDateOfBirth}" />
<Label Name="labelIdDocType" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textIdDocType}" />
<!--<Label Name="labelCountryOfBirth" Grid.Row="4" Grid.Column="1" Content="{x:Static p:Resources.textCountryOfBirth}" Grid.ColumnSpan="2" Margin="263,0,1,0" />--> <!-- XXX : TODO -->
<Label Name="labelCountryOfBirth" Grid.Row="4" Grid.Column="1" Content="{x:Static p:Resources.textCountryOfBirth}" Grid.ColumnSpan="2" Margin="263,0,1,0" />
<Label Name="labelIdDocNumber" Grid.Row="5" Grid.Column="2" Content="{x:Static p:Resources.textIdDocNumber}" />
<Label Name="labelVisaNumber" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textVisaNumber}" />
<Label Name="labelIssuingState" Grid.Row="6" Grid.Column="2" Content="{x:Static p:Resources.textDocumentIssuingState}" />
@ -42,27 +42,29 @@
<!--Label Name="labelEffects" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textEffects}" /-->
<TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxDuty" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Width="auto" Name="textBoxLastName" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="3" Width="auto" Name="textBoxFirstName" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<ComboBox Grid.Row="2" Grid.Column="1" Name="comboBoxGender" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" SelectedValuePath="Key" DisplayMemberPath="Value" ContextMenu="{DynamicResource ClearContextMenu}"/>
<TextBox Grid.Row="2" Grid.Column="3" Width="auto" Name="textBoxPlaceOfBirth" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<ComboBox Grid.Row="3" Grid.Column="1" Name="comboBoxNationality" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" ContextMenu="{DynamicResource ClearContextMenu}"/>
<DatePicker Grid.Row="3" Grid.Column="3" Name="datePickerDateOfBirth" Margin="2" DisplayDateStart="1/1/1900" DisplayDateEnd="12/31/2199" PreviewKeyUp="DateTimePicker_PreviewKeyUpDate">
<DatePicker.BlackoutDates>
<CalendarDateRange Start="1/1/0001" End="12/31/1899"/>
<CalendarDateRange Start="1/1/2199" End="1/1/9999"/>
</DatePicker.BlackoutDates>
</DatePicker>
<ComboBox Grid.Row="4" Grid.Column="1" Name="comboBoxIdDocType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" SelectedValuePath="Key" DisplayMemberPath="Value" ContextMenu="{DynamicResource ClearContextMenu}" />
<!-- <ComboBox Grid.Row="4" Grid.Column="3" Width="auto" Name="comboBoxCountryOfBirth" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" ContextMenu="{DynamicResource ClearContextMenu}"/>-->
<TextBox Grid.Row="5" Grid.Column="3" Width="auto" Name="textBoxIdDocNumber" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="1" Width="auto" Name="textBoxVisaNumber" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<ComboBox Grid.Row="6" Grid.Column="3" Width="auto" Name="comboBoxIssuingState" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" ContextMenu="{DynamicResource ClearContextMenu}"/>
<DatePicker Grid.Row="6" Grid.Column="1" Name="datePickerExpiryDate" Margin="2" DisplayDateStart="1/1/1900" DisplayDateEnd="12/31/2199" PreviewKeyUp="DateTimePicker_PreviewKeyUpDate">
<DatePicker.BlackoutDates>
<CalendarDateRange Start="1/1/0001" End="12/31/1899"/>
<CalendarDateRange Start="1/1/2199" End="1/1/9999"/>
</DatePicker.BlackoutDates>
</DatePicker>
<TextBox Grid.Row="1" Grid.Column="3" Width="auto" Name="textBoxFirstName" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="3" Width="auto" Name="textBoxPlaceOfBirth" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<DatePicker Grid.Row="3" Grid.Column="3" Name="datePickerDateOfBirth" Margin="2" DisplayDateStart="1/1/1900" DisplayDateEnd="12/31/2199" PreviewKeyUp="DateTimePicker_PreviewKeyUpDate">
<DatePicker.BlackoutDates>
<CalendarDateRange Start="1/1/0001" End="12/31/1899"/>
<CalendarDateRange Start="1/1/2199" End="1/1/9999"/>
</DatePicker.BlackoutDates>
</DatePicker>
<ComboBox Grid.Row="4" Grid.Column="3" Width="auto" Name="comboBoxCountryOfBirth" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" ContextMenu="{DynamicResource ClearContextMenu}"/>
<TextBox Grid.Row="5" Grid.Column="3" Width="auto" Name="textBoxIdDocNumber" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<ComboBox Grid.Row="6" Grid.Column="3" Width="auto" Name="comboBoxIssuingState" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" ContextMenu="{DynamicResource ClearContextMenu}"/>
<!--TextBox Grid.Row="7" Grid.Column="1" Width="auto" Name="textBoxEffects" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/-->
</Grid>
</enictrl:EditWindowBase>

View File

@ -2,6 +2,7 @@
// Description: CREW Bearbeitungsdialog
//
using System;
using System.Windows;
using bsmd.database;
@ -14,7 +15,8 @@ namespace ENI2.EditControls
/// Interaction logic for EditCREWDialog.xaml
/// </summary>
public partial class EditCREWDialog : EditWindowBase
{
{
public EditCREWDialog()
{
InitializeComponent();
@ -35,17 +37,39 @@ namespace ENI2.EditControls
this.textBoxPlaceOfBirth.Text = this.CREW.CrewMemberPlaceOfBirth;
this.comboBoxNationality.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxNationality.SelectedValue = this.CREW.CrewMemberNationality;
this.datePickerDateOfBirth.SelectedDate = this.CREW.CrewMemberDateOfBirth;
if (this.CREW.CrewMemberDateOfBirth > CREW.CLAMPMAXDATE)
{
this.datePickerDateOfBirth.SelectedDate = CREW.CLAMPMAXDATE;
}
else if (this.CREW.CrewMemberDateOfBirth < CREW.CLAMPMINDATE)
{
this.datePickerDateOfBirth.SelectedDate = CREW.CLAMPMINDATE;
}
else
{
this.datePickerDateOfBirth.SelectedDate = this.CREW.CrewMemberDateOfBirth;
}
this.comboBoxIdDocType.ItemsSource = GlobalStructures.IDDocTypeDict;
this.comboBoxIdDocType.SelectedValue = this.CREW.CrewMemberIdentityDocumentType?.ToString();
this.textBoxIdDocNumber.Text = this.CREW.CrewMemberIdentityDocumentId;
this.textBoxVisaNumber.Text = this.CREW.CrewMemberVisaNumber;
this.comboBoxIssuingState.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxIssuingState.SelectedValue = this.CREW.CrewMemberIdentityDocumentIssuingState;
if(this.CREW.CrewMemberIdentityDocumentExpiryDate.HasValue)
if (this.CREW.CrewMemberIdentityDocumentExpiryDate > CREW.CLAMPMAXDATE)
{
this.datePickerExpiryDate.SelectedDate = CREW.CLAMPMAXDATE;
}
else if(this.CREW.CrewMemberDateOfBirth < CREW.CLAMPMINDATE)
{
this.datePickerExpiryDate.SelectedDate = CREW.CLAMPMINDATE;
}
else
{
this.datePickerExpiryDate.SelectedDate = this.CREW.CrewMemberIdentityDocumentExpiryDate;
// this.comboBoxCountryOfBirth.ItemsSource = bsmd.database.CREW.NationalityDict; // XXX: TODO
// this.comboBoxCountryOfBirth.SelectedValue = this.CREW.CrewMemberCountryOfBirth;
}
this.comboBoxCountryOfBirth.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxCountryOfBirth.SelectedValue = this.CREW.CrewMemberCountryOfBirth;
// this.textBoxEffects.Text = this.CREW.Effects;
this.OKClicked += EditCREWDialog_OKClicked;
this.AddVisible = true;
@ -55,6 +79,7 @@ namespace ENI2.EditControls
{
// copy back
this.CREW.CrewMemberDuty = this.textBoxDuty.Text.Trim();
if (this.CREW.CrewMemberDuty.IsNullOrEmpty()) this.CREW.CrewMemberDuty = "unknown";
this.CREW.CrewMemberLastName = this.textBoxLastName.Text.Trim();
this.CREW.CrewMemberFirstName = this.textBoxFirstName.Text.Trim();
this.CREW.CrewMemberGender = (this.comboBoxGender.SelectedIndex == -1) ? null : (byte?) byte.Parse((string) this.comboBoxGender.SelectedValue);
@ -66,7 +91,7 @@ namespace ENI2.EditControls
this.CREW.CrewMemberVisaNumber = this.textBoxVisaNumber.Text.Trim();
this.CREW.CrewMemberIdentityDocumentIssuingState = (this.comboBoxIssuingState.SelectedValue == null) ? "" : (string) this.comboBoxIssuingState.SelectedValue;
this.CREW.CrewMemberIdentityDocumentExpiryDate = this.datePickerExpiryDate.SelectedDate;
// this.CREW.CrewMemberCountryOfBirth = (this.comboBoxCountryOfBirth.SelectedValue == null) ? "" : (string)this.comboBoxCountryOfBirth.SelectedValue;
this.CREW.CrewMemberCountryOfBirth = (this.comboBoxCountryOfBirth.SelectedValue == null) ? "" : (string)this.comboBoxCountryOfBirth.SelectedValue;
// this.CREW.Effects = this.textBoxEffects.Text.Trim();
}

View File

@ -46,7 +46,7 @@
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Name="textBoxBulkCargoShippingName" MaxLength="255" Margin="2" />
<CheckBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="2" Name="checkBoxMaterialHazardous" />
<TextBox Grid.Row="2" Grid.Column="4" Name="textBoxUNNumber" MaxLength="4" Margin="2" VerticalContentAlignment="Center" />
<TextBox Grid.Row="3" Grid.Column="1" Name="textBoxIMOClass" MaxLength="4" Margin="2" VerticalContentAlignment="Center" />
<TextBox Grid.Row="3" Grid.Column="1" Name="textBoxIMOClass" MaxLength="3" Margin="2" VerticalContentAlignment="Center" />
<xctk:DoubleUpDown Name="doubleUpDownQuantity" Grid.Row="3" Grid.Column="4" Margin="2" FormatString="N3" ShowButtonSpinner="False" TextAlignment="Left"/>
<Label Grid.Row="3" Grid.Column="5" Content="kg" />
<TextBox Grid.Row="4" Grid.Column="1" Name="textBoxStowagePosition" MaxLength="24" Margin="2" VerticalContentAlignment="Center" />

View File

@ -11,7 +11,7 @@ Copyright (c) 2017 schick Informatik
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textLadg}" Height="246" Width="900" WindowStyle="SingleBorderWindow" Background="AliceBlue">
Title="{x:Static p:Resources.textLadg}" Height="300" Width="900" WindowStyle="SingleBorderWindow" Background="AliceBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
@ -19,7 +19,7 @@ Copyright (c) 2017 schick Informatik
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
@ -35,6 +35,8 @@ Copyright (c) 2017 schick Informatik
<Label Name="labelPortOfLoading" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textCargoPortOfLoading}" />
<Label Name="labelPortOfDischarge" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textCargoPortOfDischarge}" />
<Label Name="labelCodeNST3" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textCargoCodeNST3}" />
<Label Name="labelSearchNST2007" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textSearchNST}" HorizontalAlignment="Right" />
<ComboBox Grid.Row="0" Grid.Column="1" Name="comboBoxHandlingType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/>
<ComboBox Grid.Row="0" Grid.Column="3" Name="comboBoxLACodes" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/>
@ -43,7 +45,26 @@ Copyright (c) 2017 schick Informatik
<xctk:IntegerUpDown Grid.Row="2" Grid.Column="1" Name="integerUpDownNumberOfItems" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownGrossQuantity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N3" TextAlignment="Left"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="4" Width="Auto" x:Name="locodeControl_PortOfLoading" />
<enictrl:LocodeControl Grid.Column="1" Grid.Row="5" Width="Auto" x:Name="locodeControl_PortOfDischarge" />
<enictrl:LocodeControl Grid.Column="1" Grid.Row="5" Width="Auto" x:Name="locodeControl_PortOfDischarge" Height="28" VerticalAlignment="Top"/>
<TextBox Grid.Row="3" Grid.Column="3" Margin="2" Name="textBoxSearchNSTList" TextChanged="textBoxSearchNSTList_TextChanged" VerticalContentAlignment="Center" />
<Grid Grid.Row="4" Grid.Column="3" Grid.RowSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="28" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ListBox Name="listBoxNST2007" Margin="2" Grid.RowSpan="2" DisplayMemberPath="Key" MouseDoubleClick="listBoxNST2007_MouseDoubleClick" />
<!--ComboBox Name="comboBoxSelectNST2007ListItem" Margin="2" DisplayMemberPath="Key" Grid.RowSpan="2" /-->
<Button Name="buttonSetTemplate" Margin="2" Click="buttonSetTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Apply template" HorizontalContentAlignment="Right" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/check.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
</Grid>
</Grid>
</enictrl:EditWindowBase>

View File

@ -2,13 +2,14 @@
// Description: LADG Bearbeitungsdialog
//
using System;
using System.Linq;
using System.Windows;
using System.Collections.Generic;
using bsmd.database;
using ENI2.Controls;
using System.Collections.ObjectModel;
using System.Windows.Data;
namespace ENI2.EditControls
{
@ -30,13 +31,17 @@ namespace ENI2.EditControls
Properties.Resources.textDischarge
};
private static List<KeyValuePair<string, string>> _nstList = null;
public EditLADGDialog()
{
InitializeComponent();
Loaded += EditLADGDialog_Loaded;
if (_nstList == null)
_nstList = LocalizedLookup.GetNST2007List();
}
public LADG LADG { get; set; }
public LADG LADG { get; set; }
public MessageCore Core { get; set; }
@ -55,16 +60,16 @@ namespace ENI2.EditControls
if (this.LADG.CargoHandlingType.HasValue)
this.comboBoxHandlingType.SelectedIndex = this.LADG.CargoHandlingType.Value;
this.comboBoxLACodes.ItemsSource = LADG.LACodes;
this.comboBoxLACodes.ItemsSource = LADG.LACodes;
this.comboBoxLACodes.SelectedValue = this.LADG.CargoLACode;
this.integerUpDownNumberOfItems.Value = this.LADG.CargoNumberOfItems;
this.doubleUpDownGrossQuantity.Value = this.LADG.CargoGrossQuantity_TNE;
this.locodeControl_PortOfLoading.LocodeValue = this.LADG.PortOfLoading;
this.locodeControl_PortOfDischarge.LocodeValue = this.LADG.PortOfDischarge;
this.comboBoxLACodes.SelectedValue = this.LADG.CargoLACode;
this.comboBoxLACodes.SelectedValue = this.LADG.CargoLACode;
this.comboBoxNSTCode.ItemsSource = LADG.CargoCodesNST;
this.comboBoxNSTCode.ItemsSource = LADG.CargoCodesNST;
this.comboBoxNSTCode.SelectedValue = this.LADG.CargoCodeNST;
this.comboBoxNSTCode.SelectionChanged += ComboBoxNSTCode_SelectionChanged;
this.comboBoxNST3Code.ItemsSource = LADG.CargoCodesNST3;
@ -93,7 +98,7 @@ namespace ENI2.EditControls
{
if (this.comboBoxNSTCode.SelectedItem == null) return;
// filter ItemsSource von NST3
KeyValuePair<string, string> selectedItem = (KeyValuePair < string, string> ) this.comboBoxNSTCode.SelectedItem;
KeyValuePair<string, string> selectedItem = (KeyValuePair < string, string> ) this.comboBoxNSTCode.SelectedItem;
string key = selectedItem.Key;
if (key.Length == 1) key = "0" + key;
List<KeyValuePair<string, string>> filteredItemsSource = new List<KeyValuePair<string, string>>();
@ -102,7 +107,7 @@ namespace ENI2.EditControls
if (aPair.Value.StartsWith(key))
filteredItemsSource.Add(aPair);
}
this.comboBoxNST3Code.ItemsSource = filteredItemsSource;
this.comboBoxNST3Code.ItemsSource = filteredItemsSource;
}
private void EditLADGDialog_OKClicked()
@ -110,7 +115,44 @@ namespace ENI2.EditControls
this.CopyValuesToEntity();
}
#endregion
#endregion
#region NST2007 list search/select event handler
private void textBoxSearchNSTList_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
if (textBoxSearchNSTList.Text.IsNullOrEmpty() || (textBoxSearchNSTList.Text.Length == 1))
{
this.listBoxNST2007.ItemsSource = null;
// this.comboBoxSelectNST2007ListItem.ItemsSource = null;
}
else
{
var result = _nstList.Where(kvp => kvp.Key.Contains(textBoxSearchNSTList.Text, StringComparison.OrdinalIgnoreCase));
this.listBoxNST2007.ItemsSource = result;
//this.comboBoxSelectNST2007ListItem.ItemsSource = result;
}
}
private void buttonSetTemplate_Click(object sender, RoutedEventArgs e)
{
if(this.listBoxNST2007.SelectedItem != null)
{
KeyValuePair<string, string> selectedTemplate = (KeyValuePair<string, string>) this.listBoxNST2007.SelectedItem;
if(selectedTemplate.Value.Length == 3)
{
this.comboBoxNSTCode.SelectedValue = selectedTemplate.Value.Substring(0, 2);
this.comboBoxNST3Code.SelectedValue = selectedTemplate.Value.Substring(2, 1);
}
}
}
private void listBoxNST2007_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
this.buttonSetTemplate_Click(null, null);
}
#endregion
}
}

View File

@ -52,7 +52,7 @@
</DatePicker.BlackoutDates>
</DatePicker>
<ComboBox Name="comboBoxShipSecurityLevel" Grid.Row="5" Grid.Column="1" Margin="2" />
<TextBox Name="textBoxGisisCode" Grid.Row="6" Grid.Column="1" Margin="2" MaxLength="4" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxGisisCode" Grid.Row="6" Grid.Column="1" Margin="2" MaxLength="4" VerticalContentAlignment="Center" PreviewTextInput="textBoxGisisCode_PreviewTextInput" PreviewKeyDown="textBoxGisisCode_PreviewKeyDown"/>
<TextBox Name="textBoxGisisDescription" Grid.Row="7" Grid.Column="1" Margin="2" IsEnabled="False"/>
<enictrl:LocodeControl x:Name="locodeGISIS" Grid.Row="8" Grid.Column="1" />
<TextBox Name="textBoxSecurityMatters" Grid.Row="9" Grid.Column="1" Margin="2" MaxLength="255" />

View File

@ -34,7 +34,7 @@ namespace ENI2.EditControls
this.comboBoxShipSecurityLevel.ItemsSource = GlobalStructures.ShipSecurityLevels;
if (this.LastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel.HasValue)
this.comboBoxShipSecurityLevel.SelectedIndex = (this.LastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel.Value - 1);
this.comboBoxShipSecurityLevel.SelectedIndex = this.LastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel.Value - 1;
else
this.comboBoxShipSecurityLevel.SelectedIndex = -1;
@ -48,23 +48,33 @@ namespace ENI2.EditControls
public void CopyValuesToEntity()
{
this.LastTenPortFacilitiesCalled.PortFacilityPortLoCode = this.locodePort.LocodeValue;
this.LastTenPortFacilitiesCalled.PortFacilityPortName = this.textBoxPortName.Text;
this.LastTenPortFacilitiesCalled.PortFacilityPortCountry = this.textBoxPortCountry.Text;
this.LastTenPortFacilitiesCalled.PortFacilityPortName = this.textBoxPortName.Text.Trim();
this.LastTenPortFacilitiesCalled.PortFacilityPortCountry = this.textBoxPortCountry.Text.Trim();
this.LastTenPortFacilitiesCalled.PortFacilityDateOfArrival = this.datePickerATA.SelectedDate;
this.LastTenPortFacilitiesCalled.PortFacilityDateOfDeparture = this.datePickerATD.SelectedDate;
this.LastTenPortFacilitiesCalled.PortFacilityGISISCode = this.textBoxGisisCode.Text;
this.LastTenPortFacilitiesCalled.PortFacilityGISISCode = this.textBoxGisisCode.Text.Trim();
if (this.comboBoxShipSecurityLevel.SelectedIndex == -1)
this.LastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel = null;
else
this.LastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel = (byte?) (this.comboBoxShipSecurityLevel.SelectedIndex + 1);
this.LastTenPortFacilitiesCalled.PortFacilityGISISCodeLocode = this.locodeGISIS.LocodeValue;
this.LastTenPortFacilitiesCalled.PortFacilitySecurityMattersToReport = this.textBoxSecurityMatters.Text;
this.LastTenPortFacilitiesCalled.PortFacilitySecurityMattersToReport = this.textBoxSecurityMatters.Text.Trim();
}
private void EditLast10PortFacilitiesDialog_OKClicked()
{
this.CopyValuesToEntity();
}
private void textBoxGisisCode_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
{
e.Handled = !e.Text.IsDigitsOnly();
}
private void textBoxGisisCode_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if(e.Key == System.Windows.Input.Key.Space) e.Handled = true;
}
}
}

View File

@ -34,7 +34,7 @@
<Label Name="labelNationality" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textNationality}" />
<Label Name="labelDateOfBirth" Grid.Row="2" Grid.Column="2" Content="{x:Static p:Resources.textDateOfBirth}" />
<Label Name="labelIdDocType" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textIdDocType}" />
<!--<Label Name="labelCountryOfBirth" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textCountryOfBirth}" />-->
<Label Name="labelCountryOfBirth" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textCountryOfBirth}" />
<Label Name="labelIdDocNumber" Grid.Row="4" Grid.Column="2" Content="{x:Static p:Resources.textIdDocNumber}" />
<Label Name="labelVisaNumber" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textVisaNumber}" />
<Label Name="labelPortOfEmbarkation" Grid.Row="5" Grid.Column="2" Content="{x:Static p:Resources.textPortOfEmbarkation}" />
@ -42,35 +42,37 @@
<Label Name="labelTransitPassenger" Grid.Row="6" Grid.Column="2" Content="{x:Static p:Resources.textTransitPassenger}" />
<Label Name="labelIssuingState" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textDocumentIssuingState}" />
<Label Name="labelExpiryDate" Grid.Row="7" Grid.Column="2" Content="{x:Static p:Resources.textDocumentExpiryDate}" />
<!--<Label Name="labelEmergencyCare" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textEmergencyCare}" />
<Label Name="labelEmergencyContactNumber" Grid.Row="8" Grid.Column="0" Content="{x:Static p:Resources.textEmergencyContactNumber}" />-->
<Label Name="labelEmergencyCare" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textEmergencyCare}" />
<Label Name="labelEmergencyContactNumber" Grid.Row="8" Grid.Column="0" Content="{x:Static p:Resources.textEmergencyContactNumber}" />
<TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxLastName" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<TextBox Grid.Row="0" Grid.Column="3" Width="auto" Name="textBoxFirstName" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxGender" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/>
<TextBox Grid.Row="1" Grid.Column="3" Width="auto" Name="textBoxPlaceOfBirth" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<ComboBox Grid.Row="2" Grid.Column="1" Name="comboBoxNationality" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<ComboBox Grid.Row="3" Grid.Column="1" Name="comboBoxIdDocType" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<TextBox Grid.Row="4" Grid.Column="1" Width="auto" Name="textBoxVisaNumber" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<enictrl:LocodeControl x:Name="locodePortOfDisembarkation" Grid.Row="5" Grid.Column="1" />
<ComboBox Grid.Row="6" Grid.Column="1" Name="comboBoxIssuingState" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<TextBox Grid.Row="7" Grid.Column="1" Width="auto" Name="textBoxEmergencyCare" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<TextBox Grid.Row="8" Grid.Column="1" Width="auto" Name="textBoxEmergencyContactNumber" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<TextBox Grid.Row="0" Grid.Column="3" Width="auto" Name="textBoxFirstName" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<TextBox Grid.Row="1" Grid.Column="3" Width="auto" Name="textBoxPlaceOfBirth" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<DatePicker Grid.Row="2" Grid.Column="3" Name="datePickerDateOfBirth" Margin="2" DisplayDateStart="1/1/1900" DisplayDateEnd="12/31/2199" PreviewKeyUp="DateTimePicker_PreviewKeyUpDate">
<DatePicker.BlackoutDates>
<CalendarDateRange Start="1/1/0001" End="12/31/1899"/>
<CalendarDateRange Start="1/1/2199" End="1/1/9999"/>
</DatePicker.BlackoutDates>
</DatePicker>
<ComboBox Grid.Row="3" Grid.Column="1" Name="comboBoxIdDocType" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<!--<ComboBox Grid.Row="3" Grid.Column="3" Name="comboBoxCountryOfBirth" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />-->
<ComboBox Grid.Row="3" Grid.Column="3" Name="comboBoxCountryOfBirth" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<TextBox Grid.Row="4" Grid.Column="3" Width="auto" Name="textBoxIdDocNumber" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<TextBox Grid.Row="4" Grid.Column="1" Width="auto" Name="textBoxVisaNumber" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<enictrl:LocodeControl x:Name="locodePortOfEmbarkation" Grid.Row="5" Grid.Column="3" />
<enictrl:LocodeControl x:Name="locodePortOfDisembarkation" Grid.Row="5" Grid.Column="1" />
<CheckBox Name="checkBoxTransitPassenger" Grid.Row="6" Grid.Column="3" VerticalAlignment="Center" Margin="2"/>
<ComboBox Grid.Row="6" Grid.Column="1" Name="comboBoxIssuingState" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<DatePicker Grid.Row="7" Grid.Column="3" Name="datePickerExpiryDate" Margin="2" DisplayDateStart="1/1/1900" DisplayDateEnd="12/31/2199" PreviewKeyUp="DateTimePicker_PreviewKeyUpDate">
<DatePicker.BlackoutDates>
<CalendarDateRange Start="1/1/0001" End="12/31/1899"/>
<CalendarDateRange Start="1/1/2199" End="1/1/9999"/>
</DatePicker.BlackoutDates>
</DatePicker>
<!--<TextBox Grid.Row="7" Grid.Column="1" Width="auto" Name="textBoxEmergencyCare" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<TextBox Grid.Row="8" Grid.Column="1" Width="auto" Name="textBoxEmergencyContactNumber" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />-->
</Grid>
</enictrl:EditWindowBase>

View File

@ -2,6 +2,7 @@
// Description: PAS Bearbeitungsdialog
//
using System;
using System.Windows;
using bsmd.database;
@ -14,7 +15,8 @@ namespace ENI2.EditControls
/// Interaction logic for EditPasDialog.xaml
/// </summary>
public partial class EditPASDialog : EditWindowBase
{
{
public EditPASDialog()
{
InitializeComponent();
@ -34,7 +36,18 @@ namespace ENI2.EditControls
this.textBoxPlaceOfBirth.Text = this.PAS.PassengerPlaceOfBirth;
this.comboBoxNationality.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxNationality.SelectedValue = this.PAS.PassengerNationality;
this.datePickerDateOfBirth.SelectedDate = this.PAS.PassengerDateOfBirth;
if (this.PAS.PassengerDateOfBirth > CREW.CLAMPMAXDATE)
{
this.datePickerDateOfBirth.SelectedDate = CREW.CLAMPMAXDATE;
}
else if (this.PAS.PassengerDateOfBirth < CREW.CLAMPMINDATE)
{
this.datePickerDateOfBirth.SelectedDate = CREW.CLAMPMINDATE;
}
else
{
this.datePickerDateOfBirth.SelectedDate = this.PAS.PassengerDateOfBirth;
}
this.comboBoxIdDocType.ItemsSource = GlobalStructures.IDDocTypeDict;
this.comboBoxIdDocType.SelectedValue = this.PAS.PassengerIdentityDocumentType?.ToString();
this.textBoxIdDocNumber.Text = this.PAS.PassengerIdentityDocumentId;
@ -44,13 +57,24 @@ namespace ENI2.EditControls
this.checkBoxTransitPassenger.IsChecked = this.PAS.PassengerInTransit;
this.comboBoxIssuingState.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxIssuingState.SelectedValue = this.PAS.PassengerIdentityDocumentIssuingState;
if(this.PAS.PassengerIdentityDocumentExpiryDate.HasValue)
if (this.PAS.PassengerIdentityDocumentExpiryDate > CREW.CLAMPMAXDATE)
{
this.datePickerExpiryDate.SelectedDate = CREW.CLAMPMAXDATE;
}
else if (this.PAS.PassengerIdentityDocumentExpiryDate < CREW.CLAMPMINDATE)
{
this.datePickerExpiryDate.SelectedDate = CREW.CLAMPMINDATE;
}
else
{
this.datePickerExpiryDate.SelectedDate = this.PAS.PassengerIdentityDocumentExpiryDate;
// XXX : TODO
//this.comboBoxCountryOfBirth.ItemsSource = bsmd.database.CREW.NationalityDict;
//this.comboBoxCountryOfBirth.SelectedValue = this.PAS.PassengerCountryOfBirth;
//this.textBoxEmergencyCare.Text = this.PAS.EmergencyCare;
//this.textBoxEmergencyContactNumber.Text = this.PAS.EmergencyContactNumber;
}
this.comboBoxCountryOfBirth.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxCountryOfBirth.SelectedValue = this.PAS.PassengerCountryOfBirth;
this.textBoxEmergencyCare.Text = this.PAS.EmergencyCare;
this.textBoxEmergencyContactNumber.Text = this.PAS.EmergencyContactNumber;
this.OKClicked += EditPasDialog_OKClicked;
this.AddVisible = true;
@ -73,10 +97,10 @@ namespace ENI2.EditControls
this.PAS.PassengerInTransit = this.checkBoxTransitPassenger.IsChecked;
this.PAS.PassengerIdentityDocumentIssuingState = (this.comboBoxIssuingState.SelectedValue == null) ? "" : (string)this.comboBoxIssuingState.SelectedValue;
this.PAS.PassengerIdentityDocumentExpiryDate = this.datePickerExpiryDate.SelectedDate;
// XXX : TODO
// this.PAS.PassengerCountryOfBirth = (this.comboBoxCountryOfBirth.SelectedValue == null) ? "" : (string)this.comboBoxCountryOfBirth.SelectedValue;
//this.PAS.EmergencyCare = this.textBoxEmergencyCare.Text.Trim();
//this.PAS.EmergencyContactNumber = this.textBoxEmergencyContactNumber.Text.Trim();
this.PAS.PassengerCountryOfBirth = (this.comboBoxCountryOfBirth.SelectedValue == null) ? "" : (string)this.comboBoxCountryOfBirth.SelectedValue;
this.PAS.EmergencyCare = this.textBoxEmergencyCare.Text.Trim();
this.PAS.EmergencyContactNumber = this.textBoxEmergencyContactNumber.Text.Trim();
}
private void EditPasDialog_OKClicked()

View File

@ -8,7 +8,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textReportingParty}" Height="350" Width="800" WindowStyle="SingleBorderWindow" Background="AliceBlue">
Title="{x:Static p:Resources.textReportingParty}" Height="378" Width="800" WindowStyle="SingleBorderWindow" Background="AliceBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
@ -21,6 +21,7 @@
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
@ -46,8 +47,10 @@
<Label Name="labelUserEMail" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textEMail}" HorizontalContentAlignment="Right" />
<Label Name="labelAdmin" Grid.Row="7" Grid.Column="2" Content="{x:Static p:Resources.textAdministrator}" HorizontalContentAlignment="Right" />
<Label Name="labelArchived" Grid.Row="8" Grid.Column="0" Content="{x:Static p:Resources.textArchived}" HorizontalContentAlignment="Right" />
<Label Name="labelCreated" Grid.Row="9" Grid.Column="0" Content="{x:Static p:Resources.textCreated}" HorizontalContentAlignment="Right" />
<Label Name="labelChanged" Grid.Row="9" Grid.Column="2" Content="{x:Static p:Resources.textChanged}" HorizontalContentAlignment="Right" />
<Label Name="labelEditor" Grid.Row="8" Grid.Column="2" Content="{x:Static p:Resources.textEditor}" HorizontalContentAlignment="Right" />
<Label Name="labelCreated" Grid.Row="10" Grid.Column="0" Content="{x:Static p:Resources.textCreated}" HorizontalContentAlignment="Right" />
<Label Name="labelChanged" Grid.Row="10" Grid.Column="2" Content="{x:Static p:Resources.textChanged}" HorizontalContentAlignment="Right" />
<TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxName" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<TextBox Grid.Row="0" Grid.Column="3" Width="auto" Name="textBoxEMail" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
@ -64,10 +67,10 @@
<PasswordBox Grid.Row="6" Grid.Column="3" Width="auto" Name="passwordBoxPassword" Margin="2" VerticalContentAlignment="Center" />
<TextBox Grid.Row="7" Grid.Column="1" Width="auto" Name="textBoxUserEMail" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
<CheckBox Grid.Row="7" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxAdministrator" Margin="2" />
<CheckBox Grid.Row="8" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxEditor" Margin="2" />
<CheckBox Grid.Row="8" Grid.Column="1" VerticalAlignment="Center" Name="checkBoxArchived" Margin="2" />
<Label Grid.Row="9" Grid.Column="1" Name="dateTimePickerCreated" FontStyle="Italic" />
<Label Grid.Row="9" Grid.Column="3" Name="dateTimePickerChanged" FontStyle="Italic" />
<Label Grid.Row="10" Grid.Column="1" Name="dateTimePickerCreated" FontStyle="Italic" />
<Label Grid.Row="10" Grid.Column="3" Name="dateTimePickerChanged" FontStyle="Italic" />
</Grid>
</enictrl:EditWindowBase>

View File

@ -2,6 +2,7 @@
// Description: Reporting party Bearbeitungsdialog
//
using System;
using System.Windows;
using bsmd.database;
@ -24,6 +25,7 @@ namespace ENI2.EditControls
private void EditReportingPartyDialog_Loaded(object sender, RoutedEventArgs e)
{
this.textBoxCity.Text = this.ReportingParty.City;
this.textBoxCountry.Text = this.ReportingParty.Country;
this.textBoxEMail.Text = this.ReportingParty.EMail;
@ -39,6 +41,8 @@ namespace ENI2.EditControls
this.checkBoxAdministrator.IsChecked = this.ReportingParty.IsAdmin;
this.checkBoxArchived.IsChecked = this.ReportingParty.IsArchived;
this.checkBoxEditor.IsChecked = this.ReportingParty.IsEditor;
this.dateTimePickerChanged.Content = this.ReportingParty.Changed.HasValue ? this.ReportingParty.Changed.ToString() : "";
this.dateTimePickerCreated.Content = this.ReportingParty.Created.HasValue ? this.ReportingParty.Created.ToString() : "";
@ -60,15 +64,16 @@ namespace ENI2.EditControls
this.ReportingParty.PostalCode = this.textBoxPostalCode.Text.Trim();
this.ReportingParty.StreetAndNumber = this.textBoxStreetNumber.Text.Trim();
this.ReportingParty.UserEMail = this.textBoxUserEMail.Text.Trim();
this.ReportingParty.Logon = this.textBoxUserLogon.Text.Trim();
this.ReportingParty.Logon = this.textBoxUserLogon.Text.Trim();
if(!this.passwordBoxPassword.Password.IsNullOrEmpty())
{
this.ReportingParty.SetPassword(this.passwordBoxPassword.Password);
}
this.ReportingParty.IsAdmin = this.checkBoxAdministrator.IsChecked ?? false;
this.ReportingParty.IsAdmin = this.checkBoxAdministrator.IsChecked ?? false;
this.ReportingParty.IsArchived = this.checkBoxArchived.IsChecked ?? false;
this.ReportingParty.IsEditor = this.checkBoxEditor.IsChecked ?? false;
// save value
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.ReportingParty);

View File

@ -9,7 +9,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textEditRules}" Height="402" Width="800" WindowStyle="SingleBorderWindow" Background="AliceBlue" Icon="/ENI2;component/Resources/mail_forward.png">
Title="{x:Static p:Resources.textEditRules}" Height="402" Width="800" WindowStyle="SingleBorderWindow" Background="AliceBlue" Icon="/ENI2Test;component/Resources/mail_forward.png">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32" />

View File

@ -1,5 +1,5 @@
// Copyright (c) 2017 schick Informatik
// Description:
// Description: Edit SERV and SERV_template entities
//
using System.Windows;
@ -14,36 +14,78 @@ namespace ENI2.EditControls
/// </summary>
public partial class EditSERVDialog : EditWindowBase
{
#region Construction
public EditSERVDialog()
{
InitializeComponent();
Loaded += EditSERVDialog_Loaded;
}
#endregion
#region Properties
public SERV SERV { get; set; }
public SERV_Template SERV_Template { get; set; }
#endregion
#region event handler
private void EditSERVDialog_Loaded(object sender, RoutedEventArgs e)
{
this.OKClicked += EditSERVDialog_OKClicked;
// copy into fields
this.textBoxServiceName.Text = this.SERV.ServiceName;
this.textBoxServiceBeneficiary.Text = this.SERV.ServiceBeneficiary;
this.textBoxServiceInvoiceRecipient.Text = this.SERV.ServiceInvoiceRecipient;
this.AddVisible = true;
if (this.SERV != null)
{
this.textBoxServiceName.Text = this.SERV.ServiceName;
this.textBoxServiceBeneficiary.Text = this.SERV.ServiceBeneficiary;
this.textBoxServiceInvoiceRecipient.Text = this.SERV.ServiceInvoiceRecipient;
this.AddVisible = true;
}
if (this.SERV_Template != null)
{
this.textBoxServiceName.Text = this.SERV_Template.ServiceName;
this.textBoxServiceBeneficiary.Text = this.SERV_Template.ServiceBeneficiary;
this.textBoxServiceInvoiceRecipient.Text = this.SERV_Template.ServiceInvoiceRecipient;
}
}
private void EditSERVDialog_OKClicked()
{
this.CopyValuesToEntity();
}
#endregion
#region public methods
public void CopyValuesToEntity()
{
// copy back
this.SERV.ServiceName = this.textBoxServiceName.Text.Trim();
this.SERV.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim();
this.SERV.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim();
if (this.SERV != null)
{
// copy back
this.SERV.ServiceName = this.textBoxServiceName.Text.Trim();
this.SERV.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim();
this.SERV.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim();
}
if (this.SERV_Template != null)
{
// copy back
this.SERV_Template.ServiceName = this.textBoxServiceName.Text.Trim();
this.SERV_Template.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim();
this.SERV_Template.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim();
}
}
private void EditSERVDialog_OKClicked()
{
this.CopyValuesToEntity();
}
public SERV SERV { get; set; }
#endregion
}
}

View File

@ -38,11 +38,11 @@
<Label Name="labelWasteCodeText" Grid.Row="0" Grid.Column="2" />
<TextBox Name="textBoxDescription" Grid.Row="1" Grid.Column="1" Margin="2" Grid.ColumnSpan="2" Width="auto" MaxLength="99" TextWrapping="Wrap" />
<xctk:DoubleUpDown Grid.Row="2" Grid.Column="1" Name="doubleUpDownAmountDisposed" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownMaxCapacity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="4" Grid.Column="1" Name="doubleUpDownAmountRetained" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="2" Grid.Column="1" Name="doubleUpDownAmountDisposed" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left" Maximum="9999.999" />
<xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownMaxCapacity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left" Maximum="9999.999"/>
<xctk:DoubleUpDown Grid.Row="4" Grid.Column="1" Name="doubleUpDownAmountRetained" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left" Maximum="9999.999"/>
<enictrl:LocodeControl Grid.Row="5" Grid.Column="1" x:Name="locodePortOfDeliveryRemainingWaste" LocodeSource="SSN" />
<xctk:DoubleUpDown Grid.Row="6" Grid.Column="1" Name="doubleUpDownAmountGeneratedTilNextPort" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="6" Grid.Column="1" Name="doubleUpDownAmountGeneratedTilNextPort" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left" Maximum="9999.999"/>
<Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "2" Grid.Column="2" />
<Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "3" Grid.Column="2" />

View File

@ -14,6 +14,7 @@
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="56" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
@ -30,16 +31,48 @@
<Label Name="labelIdentificationNumber" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textIdentificationNumber}" />
<Label Name="labelPortReceptionFacilityName" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityName}" />
<Label Name="labelPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityProviderName}" />
<Label Name="labelTreatmentFacilityProvider" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textTreatmentFacilityProviderDisplay}" />
<Label Name="labelWasteDeliveryDateFrom" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateFrom}" />
<Label Name="labelWasteDeliveryDateTo" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateTo}" />
<Label Name="labelTemplate" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textAgentTemplate}" />
<Label Name="labelTreatmentFacilityProvider" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textTreatmentFacilityProviderDisplay}" />
<Label Name="labelWasteDeliveryDateFrom" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateFrom}" />
<Label Name="labelWasteDeliveryDateTo" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateTo}" />
<TextBox Name="textIdentificationNumber" Grid.Row="0" Grid.Column="1" Width="auto" MaxLength="20" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxPortReceptionFacilityName" Grid.Row="1" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxTreatmentFacilityProvider" Grid.Row="3" Grid.Column="1" Height="56" VerticalContentAlignment="Top" Margin="2"/>
<xctk:DateTimePicker Grid.Row="4" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Row="5" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateTo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<Grid Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="1" Name="gridTemplateControls" Visibility="Visible">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*"/>
<ColumnDefinition Width=".5*"/>
<!-- Name -->
<ColumnDefinition Width="26"/>
<!-- Save button -->
<ColumnDefinition Width="26"/>
<!-- Delete button -->
<ColumnDefinition Width="52"/>
<!-- Undo button -->
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" Name="comboBox_WSDPTemplate" Margin="2" SelectedValuePath="Id" DisplayMemberPath="Remark" SelectionChanged="comboBox_WSDPTemplate_SelectionChanged" />
<TextBox Grid.Column="1" Margin="2" Name="textBoxTemplateTitle" VerticalContentAlignment="Center"/>
<Button Name="buttonSaveTemplate" Grid.Column="2" Grid.Row="0" Margin="2" Click="buttonSaveTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Save template">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/floppy_disk_blue.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonDeleteTemplate" Grid.Column="3" Grid.Row="0" Margin="2" Click="buttonDeleteTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Delete template" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/delete.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonUndoTemplate" Grid.Column="4" Grid.Row="0" Margin="22,2,2,2" Click="buttonUndoTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Undo last overwrite" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/undo.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
</Grid>
<TextBox Name="textBoxTreatmentFacilityProvider" Grid.Row="4" Grid.Column="1" Height="56" VerticalContentAlignment="Top" Margin="2"/>
<xctk:DateTimePicker Grid.Row="5" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Row="6" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateTo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<!--Button x:Name="buttonAddEntries" Grid.Column="1" Grid.Row="7" Margin="2" Click="buttonAddEntries_Click" Width="170" Content="Add waste received entries" HorizontalAlignment="Left"/-->

View File

@ -3,6 +3,8 @@
//
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using bsmd.database;
@ -15,6 +17,13 @@ namespace ENI2.EditControls
/// </summary>
public partial class EditWasteReceiptDialog : EditWindowBase
{
// TODO: "unstatic" the templates and take care they are synchronized between controls
private List<WasteDisposalServiceProvider_Template> _wsdpTemplates = null;
private WasteDisposalServiceProvider_Template _currentTemplate;
private string _undoTemplate;
public EditWasteReceiptDialog()
{
InitializeComponent();
@ -24,7 +33,7 @@ namespace ENI2.EditControls
public WAS_RCPT WAS_RCPT { get; set; }
private void EditWasteReceiptDialog_Loaded(object sender, RoutedEventArgs e)
private async void EditWasteReceiptDialog_Loaded(object sender, RoutedEventArgs e)
{
this.textIdentificationNumber.Text = this.WAS_RCPT.IdentificationNumber;
this.textBoxPortReceptionFacilityName.Text = this.WAS_RCPT.PortReceptionFacilityName;
@ -35,6 +44,12 @@ namespace ENI2.EditControls
OKClicked += EditWasteReceiptDialog_OKClicked;
this.AddVisible = true;
_wsdpTemplates = await DBManagerAsync.GetWasteDisposalServiceProviderTemplatesAsync();
_wsdpTemplates.Sort();
Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded");
this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
}
public void CopyValuesToEntity()
{
@ -52,10 +67,87 @@ namespace ENI2.EditControls
this.CopyValuesToEntity();
}
// private void buttonAddEntries_Click(object sender, RoutedEventArgs e)
// {
// this.WAS_RCPT.AddMissingWasteReceived();
// }
private void comboBox_WSDPTemplate_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
Trace.WriteLine("WSDP combo selection changed");
if (this.comboBox_WSDPTemplate.SelectedItem is WasteDisposalServiceProvider_Template wdsp_t)
{
this.textBoxTemplateTitle.Text = wdsp_t.Remark;
this.buttonDeleteTemplate.IsEnabled = true;
this._currentTemplate = wdsp_t;
this._undoTemplate = this.textBoxPortReceptionFacilityProviderName.Text.Trim();
this.buttonUndoTemplate.IsEnabled = this._undoTemplate.Length > 0;
this.textBoxPortReceptionFacilityProviderName.Text = wdsp_t.WasteDisposalServiceProviderName;
}
}
private async void buttonSaveTemplate_Click(object sender, RoutedEventArgs e)
{
string currentWSDPProviderName = this.textBoxPortReceptionFacilityProviderName.Text.Trim();
string currentRemark = this.textBoxTemplateTitle.Text.Trim();
if ((currentWSDPProviderName.Length == 0) || (currentRemark.Length == 0)) return;
WasteDisposalServiceProvider_Template existingTemplate = null;
foreach (WasteDisposalServiceProvider_Template wdsp_template in _wsdpTemplates)
{
// bei gefundenem Match wird ggf. der Remark überschrieben
if (wdsp_template.Remark.Equals(currentRemark))
{
existingTemplate = wdsp_template;
break;
}
}
if (existingTemplate != null)
{
if (MessageBox.Show("A template with this name already exists, overwrite?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
return;
existingTemplate.WasteDisposalServiceProviderName = currentWSDPProviderName;
await DBManagerAsync.SaveAsync(existingTemplate);
return;
}
WasteDisposalServiceProvider_Template newTemplate = new WasteDisposalServiceProvider_Template();
newTemplate.WasteDisposalServiceProviderName = currentWSDPProviderName;
newTemplate.Remark = currentRemark;
await DBManagerAsync.SaveAsync(newTemplate);
comboBox_WSDPTemplate.ItemsSource = null;
_wsdpTemplates.Add(newTemplate);
_wsdpTemplates.Sort();
comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information);
}
private void buttonDeleteTemplate_Click(object sender, RoutedEventArgs e)
{
if (_currentTemplate != null)
{
if (MessageBox.Show("Delete this template?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
this.comboBox_WSDPTemplate.SelectedItem = null;
this.comboBox_WSDPTemplate.ItemsSource = null;
DBManager.Instance.Delete(_currentTemplate);
_wsdpTemplates.Remove(_currentTemplate);
this.textBoxTemplateTitle.Text = null;
this.buttonDeleteTemplate.IsEnabled = false;
this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
}
}
}
private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e)
{
if (this._undoTemplate != null)
{
this.textBoxPortReceptionFacilityProviderName.Text = this._undoTemplate;
this.buttonUndoTemplate.IsEnabled = false;
this._undoTemplate = null;
this.comboBox_WSDPTemplate.SelectedItem = null;
}
}
}
}

View File

@ -26,7 +26,7 @@
<ComboBox Name="comboBoxWasteCode" Grid.Row="0" Grid.Column="1" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" />
<TextBox Name="textBoxDescription" Grid.Row="1" Margin="2" Grid.Column="1" Width="auto" MaxLength="99" TextWrapping="Wrap" />
<xctk:DoubleUpDown Grid.Row="2" Grid.Column="1" Name="doubleUpDownAmountReceived" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="2" Grid.Column="1" Name="doubleUpDownAmountReceived" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left" Maximum="9999.999"/>
</Grid>
</enictrl:EditWindowBase>

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textErrors}" Height="300" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_red.ico" Topmost="False">
Title="{x:Static p:Resources.textErrors}" Height="300" Width="600" Background="AliceBlue" Icon="/ENI2Test;component/Resources/bullet_ball_red.ico" Topmost="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />

View File

@ -7,7 +7,7 @@
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textMessageHistory}" Height="450" Width="800" Background="AliceBlue" Icon="/ENI2;component/Resources/clock_history.ico">
Title="{x:Static p:Resources.textMessageHistory}" Height="450" Width="800" Background="AliceBlue" Icon="/ENI2Test;component/Resources/clock_history.ico">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />

View File

@ -9,7 +9,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textNewDGItem}" Height="350" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="CanResize"
Icon="/ENI2;component/Resources/bullet_ball_yellow.ico" Loaded="EditWindowBase_Loaded">
Icon="/ENI2Test;component/Resources/bullet_ball_yellow.ico" Loaded="EditWindowBase_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />

View File

@ -18,7 +18,7 @@ namespace ENI2.EditControls
public partial class NewDGItemDialog : EditWindowBase
{
private List<HAZPosTemplate> _data = null;
private static object filterLock = new object();
private static readonly object filterLock = new object();
public NewDGItemDialog()
{

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textNewWithId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_card_add.ico">
Title="{x:Static p:Resources.textNewWithId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2Test;component/Resources/id_card_add.ico">
<Grid Margin="4">
<Grid.RowDefinitions>

View File

@ -31,11 +31,15 @@ namespace ENI2.EditControls
List<KeyValuePair<Message.NSWProvider, string>> comboDataSource = new List<KeyValuePair<Message.NSWProvider, string>>()
{
new KeyValuePair<Message.NSWProvider, string>( Message.NSWProvider.DUDR, "HIS-Nord" ),
new KeyValuePair<Message.NSWProvider, string>(Message.NSWProvider.DBH, "DBH")
new KeyValuePair<Message.NSWProvider, string>(Message.NSWProvider.DBH, "DBH"),
new KeyValuePair<Message.NSWProvider, string>(Message.NSWProvider.DBH_MAERSK, "DBH / Maersk")
};
this.comboBoxInitialHIS.ItemsSource = comboDataSource;
this.comboBoxInitialHIS.SelectedIndex = 0;
}
public bool ValidId { get; set; }
@ -53,6 +57,14 @@ namespace ENI2.EditControls
private void textBoxVisitTransitId_TextChanged(object sender, TextChangedEventArgs e)
{
this.CheckComplete();
if(textBoxVisitTransitId.Text.StartsWith("DEBRE") || textBoxVisitTransitId.Text.StartsWith("DEBRV"))
{
this.comboBoxInitialHIS.SelectedValue = Message.NSWProvider.DBH;
}
else
{
this.comboBoxInitialHIS.SelectedValue = Message.NSWProvider.DUDR;
}
}
private void CheckComplete()

View File

@ -0,0 +1,32 @@
<enictrl:EditWindowBase x:Class="ENI2.EditControls.SelectCrewMemberDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textSelectCrewMember}" Height="160" Width="400" Background="AliceBlue">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textLastName}" />
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textFirstName}" />
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textCrewFunctionOnBoard}" />
<TextBlock Text="{Binding CrewMemberLastName}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" />
<TextBlock Text="{Binding CrewMemberFirstName}" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" />
<TextBlock Text="{Binding CrewMemberDuty}" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" />
</Grid>
</enictrl:EditWindowBase>

View File

@ -0,0 +1,41 @@
// Copyright (c) 2017- schick Informatik
// Description:
//
using bsmd.database;
using ENI2.Controls;
using System.Windows;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for SelectCrewMemberDialog.xaml
/// </summary>
public partial class SelectCrewMemberDialog : EditWindowBase
{
public SelectCrewMemberDialog()
{
InitializeComponent();
Loaded += SelectCrewMemberDialog_Loaded;
}
#region Properties
public CREW CREW { get; set; }
#endregion
#region event handler
private void SelectCrewMemberDialog_Loaded(object sender, RoutedEventArgs e)
{
if (CREW != null)
{
this.DataContext = CREW;
}
}
#endregion
}
}

View File

@ -8,7 +8,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textSelectImportClasses}" Height="600" Width="250" Background="AliceBlue">
Title="{x:Static p:Resources.textSelectImportClasses}" Height="660" Width="250" Background="AliceBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />

View File

@ -1,14 +1,13 @@
// Copyright (c) 2017-today schick Informatik
// Description: Select classes for import
// Description: Select classes for import via Excel or for sending them once completed
// Returns: Array of selected classes as property
using bsmd.database;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
using bsmd.database;
namespace ENI2.EditControls
{
/// <summary>
@ -17,7 +16,8 @@ namespace ENI2.EditControls
public partial class SelectImportClassesDialog : ENI2.Controls.EditWindowBase
{
private readonly List<SelectClass> _selectClasses = new List<SelectClass>();
private readonly List<bsmd.database.Message.NotificationClass> _selectedClasses = new List<Message.NotificationClass>();
private readonly List<Message.NotificationClass> _selectedClasses = new List<Message.NotificationClass>();
private readonly List<Message.NotificationClass> _preselectedClasses = new List<Message.NotificationClass>();
public SelectImportClassesDialog()
{
@ -25,35 +25,61 @@ namespace ENI2.EditControls
this.Loaded += SelectImportClassesDialog_Loaded;
}
/// <summary>
/// List of all message classes that are available for selection
/// </summary>
public List<Message.NotificationClass> SelectedClasses
{
get { return _selectedClasses; }
}
/// <summary>
/// Classes that should be checked already when the dialog is opened (relevant for send mode)
/// </summary>
public List<Message.NotificationClass > PreselectedClasses
{
get { return _preselectedClasses; }
}
/// <summary>
/// These messages are needed to derive message classes from, already sorted in the right manner
/// </summary>
public List<Message> Messages { get; set; }
/// <summary>
/// Flag to reduce selection amount in case of transit
/// </summary>
public bool IsTransit { get; set; }
/// <summary>
/// Flag if dialog is used in import mode (default true). Set false for send all mode.
/// </summary>
public bool IsImportMode { get; set; } = true;
private void SelectImportClassesDialog_Loaded(object sender, RoutedEventArgs e)
{
foreach(Message aMessage in this.Messages)
foreach (Message aMessage in this.Messages)
{
// these are of no interest
if ((aMessage.MessageNotificationClass == Message.NotificationClass.VISIT) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.STO))
continue;
// these are neither imported nor sent by the Send all function
if ((aMessage.MessageNotificationClass == Message.NotificationClass.ATA) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.ATD))
continue;
// filter out messages not relevant for transit
if (IsTransit && (
(aMessage.MessageNotificationClass == Message.NotificationClass.ATA) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.ATD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.STO) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.CREWD) || // XXX : TODO remove
(aMessage.MessageNotificationClass == Message.NotificationClass.PASD)
) continue;
if (IsTransit &&
((aMessage.MessageNotificationClass == Message.NotificationClass.BKRD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.BPOL) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.BKRD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.INFO) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.LADG) ||
@ -64,15 +90,16 @@ namespace ENI2.EditControls
(aMessage.MessageNotificationClass == Message.NotificationClass.TOWD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.WAS) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.WAS_RCPT)
)) continue;
)) continue;
SelectClass sc = new SelectClass();
sc.Name = Enum.GetName(typeof(bsmd.database.Message.NotificationClass), aMessage.MessageNotificationClass);
sc.Name = Enum.GetName(typeof(Message.NotificationClass), aMessage.MessageNotificationClass);
sc.Class = aMessage.MessageNotificationClass;
sc.IsSelected = false;
sc.IsSelected = this._preselectedClasses.Contains(sc.Class);
_selectClasses.Add(sc);
}
this.checkListBoxClasses.ItemsSource = _selectClasses;
this.OKClicked += SelectImportClassesDialog_OKClicked;
}
@ -99,7 +126,7 @@ namespace ENI2.EditControls
OnPropertyChanged("IsSelected");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{

View File

@ -0,0 +1,53 @@
<enictrl:EditWindowBase x:Class="ENI2.EditControls.SelectPortAreaDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="Search port area" Height="400" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="CanResize" Icon="/ENI2Test;component/Resources/bullet_ball_yellow.ico" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="84" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="90" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="1" Content="Select" />
<Label Grid.Row="0" x:Name="labelLocode" Content="ZZUKN" />
<ListBox Name="listBoxAreas" Grid.Column="1" Grid.Row="1" Margin="2" SelectionChanged="comboBoxType_SelectionChanged" />
<xctk:WatermarkTextBox Margin="2" Watermark="{x:Static p:Resources.textSearch}" Name="textBoxSearchDescription" Grid.Row="0" Grid.Column="1" TextChanged="textBoxSearchDescription_TextChanged" />
<Label Grid.Row="2" Content="Agency" />
<Label Grid.Row="3" Content="Ships" />
<Label Grid.Row="4" Content="Berth" />
<Label Grid.Row="5" Content="PortArea" />
<Label Grid.Row="6" Content="Remark" />
<Border BorderThickness="1" Grid.Column="1" Grid.Row="2" Grid.RowSpan="1" BorderBrush="Black" Margin="2">
<TextBlock Name="textBlockAgency" Margin="2,1,2,3" Background="LightGray" TextWrapping="Wrap"/>
</Border>
<Border BorderThickness="1" Grid.Column="1" Grid.Row="3" Grid.RowSpan="1" BorderBrush="Black" Margin="2">
<TextBlock Name="textBlockShips" Margin="2,1,2,3" Background="LightGray" TextWrapping="Wrap"/>
</Border>
<Border BorderThickness="1" Grid.Column="1" Grid.Row="4" Grid.RowSpan="1" BorderBrush="Black" Margin="2">
<TextBlock Name="textBlockBerth" Margin="2,1,2,3" Background="LightGray" TextWrapping="Wrap"/>
</Border>
<Border BorderThickness="1" Grid.Column="1" Grid.Row="5" Grid.RowSpan="1" BorderBrush="Black" Margin="2">
<TextBlock Name="textBlockPortArea" Margin="2,1,2,3" Background="LightGray" TextWrapping="Wrap"/>
</Border>
<Border BorderThickness="1" Grid.Column="1" Grid.Row="6" Grid.RowSpan="1" BorderBrush="Black" Margin="2">
<TextBlock Name="textBlockRemarks" Margin="2,1,2,3" Background="LightGray" TextWrapping="Wrap"/>
</Border>
</Grid>
</enictrl:EditWindowBase>

View File

@ -0,0 +1,86 @@
// Copyright (c) 2023- schick Informatik
// Description: Helper search window to
//
using bsmd.database;
using ENI2.Controls;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for SelectPortAreaDialog.xaml
/// </summary>
public partial class SelectPortAreaDialog : EditWindowBase
{
#region Fields
private readonly string _poc = null;
private List<PortAreaInfo> _portAreas;
private static readonly object filterLock = new object();
#endregion
#region Construction
public SelectPortAreaDialog(string poc)
{
InitializeComponent();
_poc = poc;
}
#endregion
#region Properties
public string SelectedArea { get; private set; }
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if(LocalizedLookup.getPortAreaInfos().ContainsKey(this._poc))
_portAreas = LocalizedLookup.getPortAreaInfos()[this._poc];
this.labelLocode.Content = this._poc;
}
private void comboBoxType_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
if (this.listBoxAreas.SelectedItem is PortAreaInfo pai)
{
this.textBlockAgency.Text = pai.Agency;
this.textBlockBerth.Text = pai.Berth;
this.textBlockPortArea.Text = pai.PortArea;
this.textBlockShips.Text = pai.Ships;
this.textBlockRemarks.Text = pai.Remark;
this.SelectedArea = pai.PortAreaCode;
}
}
private void textBoxSearchDescription_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
string searchText = this.textBoxSearchDescription.Text.Trim();
if (_portAreas == null) return;
lock (filterLock)
{
IEnumerable<PortAreaInfo> filtered = _portAreas;
if (searchText.Length > 0)
{
filtered = _portAreas.Where(elem => (elem.Remark != null && elem.Remark.ToUpperInvariant().Contains(searchText.ToUpperInvariant())) ||
(elem.Agency != null && elem.Agency.ToUpperInvariant().Contains(searchText.ToUpperInvariant())) ||
(elem.Berth != null && elem.Berth.ToUpperInvariant().Contains(searchText.ToUpperInvariant())) ||
(elem.PortArea != null && elem.PortArea.ToUpperInvariant().Contains(searchText.ToUpperInvariant())));
}
this.listBoxAreas.ItemsSource = filtered;
}
}
#endregion
}
}

View File

@ -29,7 +29,7 @@
<Label Name="labelIMO" Grid.Column="1" Grid.Row="2"/>
<Label Name="statusLabel" HorizontalAlignment="Center" Content="{x:Static p:Resources.textWaitForId}" Background="LemonChiffon" Grid.Row="3" Grid.ColumnSpan="2"/>
<TextBox IsReadOnly="True" Name="textBoxId" MouseDown="textBoxId_MouseDown" FontWeight="Bold" HorizontalAlignment="Center" VerticalContentAlignment="Center" Margin="2" Grid.Row="4" Grid.ColumnSpan="2"/>
<Label Name="clickToCopyLabel" Content=" -> click to copy" HorizontalAlignment="Center" Grid.Row="5" Grid.ColumnSpan="2" MouseDown="textBoxId_MouseDown" Visibility="Hidden"/>
<Button Name="clickToCopyButton" Content=" -&gt; click to copy &lt;- " HorizontalAlignment="Center" Grid.Row="5" Grid.ColumnSpan="2" Click="clickToCopyButton_Click" Visibility="Hidden" Margin="2"/>
<Button Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" Content="Close and open Id" Margin="2" Width="100" Click="Button_Click_1" />
<Button Grid.Row="6" Grid.Column="1" HorizontalAlignment="Right" Content="Close" Margin="2" Width="100" Click="Button_Click" />
</Grid>

View File

@ -38,15 +38,10 @@ namespace ENI2.EditControls
this.DisplayId = id;
this.statusLabel.Content = Properties.Resources.textIdReceived;
this.statusLabel.Background = Brushes.LightGreen;
this.clickToCopyLabel.Visibility = Visibility.Visible;
this.clickToCopyButton.Visibility = Visibility.Visible;
}));
}
private void textBoxId_MouseDown(object sender, MouseButtonEventArgs e)
{
Clipboard.SetText(this.textBoxId.Text);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
@ -67,5 +62,16 @@ namespace ENI2.EditControls
this.labelIMO.Content = this.Core.IMO.IsNullOrEmpty() ? this.Core.ENI : this.Core.IMO;
}
}
private void clickToCopyButton_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(this.textBoxId.Text);
this.clickToCopyButton.Background = Brushes.LightGreen;
}
private void textBoxId_MouseDown(object sender, MouseButtonEventArgs e)
{
Clipboard.SetText(this.textBoxId.Text);
}
}
}

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textViolations}" Height="300" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_yellow.ico" Topmost="False">
Title="{x:Static p:Resources.textViolations}" Height="300" Width="600" Background="AliceBlue" Icon="/ENI2Test;component/Resources/bullet_ball_yellow.ico" Topmost="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textNewVisitTransitId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_card_new.ico">
Title="{x:Static p:Resources.textNewVisitTransitId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2Test;component/Resources/id_card_new.ico">
<Grid Margin="4">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
@ -52,7 +52,7 @@
ButtonSpinnerLocation="Right"
ParsingNumberStyle="Integer"
Watermark="Enter ENI" ValueChanged="doubleUpDownENI_ValueChanged" TextAlignment="Left"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="2" Width="Auto" x:Name="locodePoC" LocodeValue="{Binding PoC, Mode=TwoWay}" />
<enictrl:LocodeControl Grid.Column="1" Grid.Row="2" Width="Auto" x:Name="locodePoC" LocodeValue="{Binding PoC, Mode=TwoWay}" LocodeSource="OLD" />
<DatePicker Name="datePickerETA" Grid.Row="3" Grid.Column="1" Margin="2" SelectedDateChanged="datePickerETA_SelectedDateChanged" DisplayDateStart="1/1/1900" DisplayDateEnd="12/31/2199" PreviewKeyUp="DateTimePicker_PreviewKeyUpDate">
<DatePicker.BlackoutDates>
<CalendarDateRange Start="1/1/0001" End="12/31/1799"/>

View File

@ -25,16 +25,17 @@ namespace ENI2.EditControls
}
private void VisitIdDialog_Loaded(object sender, RoutedEventArgs e)
{
{
this.OKClicked += VisitIdDialog_OKClicked;
List<KeyValuePair<bsmd.database.Message.NSWProvider, string>> comboDataSource = new List<KeyValuePair<bsmd.database.Message.NSWProvider, string>>()
List<KeyValuePair<Message.NSWProvider, string>> comboDataSource = new List<KeyValuePair<Message.NSWProvider, string>>()
{
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DBH, "DBH" ),
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DUDR, "HIS-Nord" ),
new KeyValuePair<Message.NSWProvider, string>( Message.NSWProvider.DUDR, "HIS-Nord" ),
new KeyValuePair<Message.NSWProvider, string>( Message.NSWProvider.DBH, "DBH" ),
new KeyValuePair<Message.NSWProvider, string>(Message.NSWProvider.DBH_MAERSK, "DBH / Maersk")
};
this.comboBoxInitialHIS.ItemsSource = comboDataSource;
this.comboBoxInitialHIS.SelectedIndex = 1;
this.comboBoxInitialHIS.SelectedIndex = 0;
this.EnableOK(false);
this.locodePoC.PropertyChanged += LocodePoC_PropertyChanged;
@ -46,7 +47,7 @@ namespace ENI2.EditControls
if(this.locodePoC.LocodeValue == "ZZNOK")
{
this.Core.IsTransit = true;
this.Core.IsTransit = true;
this.Core.ETAKielCanal = this.datePickerETA.SelectedDate;
}
@ -77,7 +78,7 @@ namespace ENI2.EditControls
private void doubleUpDownIMO_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
bool hasValue = (doubleUpDownIMO.Value.HasValue && doubleUpDownIMO.Value > 0);
bool hasValue = doubleUpDownIMO.Value.HasValue && doubleUpDownIMO.Value > 0;
doubleUpDownENI.IsReadOnly = hasValue;
this.CheckComplete();
@ -87,7 +88,7 @@ namespace ENI2.EditControls
private void doubleUpDownENI_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
bool hasValue = (doubleUpDownENI.Value.HasValue && doubleUpDownENI.Value > 0);
bool hasValue = doubleUpDownENI.Value.HasValue && doubleUpDownENI.Value > 0;
doubleUpDownIMO.IsReadOnly = hasValue;
this.CheckComplete();
}
@ -95,6 +96,15 @@ namespace ENI2.EditControls
private void LocodePoC_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
this.CheckComplete();
string locode = this.locodePoC.LocodeValue;
if((locode != null) && (locode.Equals("DEBRV") || locode.Equals("DEBRE")))
{
this.comboBoxInitialHIS.SelectedValue = Message.NSWProvider.DBH;
}
else
{
this.comboBoxInitialHIS.SelectedValue = Message.NSWProvider.DUDR;
}
}
private void datePickerETA_SelectedDateChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
@ -117,17 +127,17 @@ namespace ENI2.EditControls
isComplete &= this.datePickerETA.SelectedDate.HasValue; // ETA
bool imo_OR_eni = ((doubleUpDownIMO.Value.HasValue) && (doubleUpDownIMO.Value >= 1000000) && (doubleUpDownIMO.Value <= 9999999)) ||
((doubleUpDownENI.Value.HasValue) && (doubleUpDownENI.Value >= 100000) && (doubleUpDownENI.Value <= 99999999));
bool imo_OR_eni = (doubleUpDownIMO.Value.HasValue && (doubleUpDownIMO.Value >= 1000000) && (doubleUpDownIMO.Value <= 9999999)) ||
(doubleUpDownENI.Value.HasValue && (doubleUpDownENI.Value >= 100000) && (doubleUpDownENI.Value <= 99999999));
isComplete &= imo_OR_eni;
string locode = this.locodePoC.LocodeValue;
bool validLocode = (locode != null) && (locode.Length == 5) && (locode.StartsWith("DE") || locode.StartsWith("DK") || locode.Equals("ZZNOK"));
bool validLocode = (locode != null) && (locode.Length == 5) && (locode.StartsWith("DE") || locode.StartsWith("DK") || locode.Equals("ZZNOK") || locode.Equals("DEWHV"));
isComplete &= validLocode;
isComplete &= (comboBoxInitialHIS.SelectedValue != null);
isComplete &= comboBoxInitialHIS.SelectedValue != null;
this.EnableOK(isComplete);
}

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using bsmd.database;
namespace ENI2.Excel
@ -74,7 +74,7 @@ namespace ENI2.Excel
{ if (ScanBKRD(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.BPOL) && notificationClasses.Contains(Message.NotificationClass.BPOL))
{ if (ScanBPOL(message, reader)) ExcelReader.SaveMessage(message); }
if ((message.MessageNotificationClass == Message.NotificationClass.CREW) && notificationClasses.Contains(Message.NotificationClass.CREW))
if ((message.MessageNotificationClass == Message.NotificationClass.CREWA) && notificationClasses.Contains(Message.NotificationClass.CREWA))
{ if (ScanCREW(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.CREWD) && notificationClasses.Contains(Message.NotificationClass.CREWD))
{ if (ScanCREWD(message, reader)) ExcelReader.SaveMessage(message); continue; }
@ -83,7 +83,7 @@ namespace ENI2.Excel
if ((message.MessageNotificationClass == Message.NotificationClass.HAZD) && notificationClasses.Contains(Message.NotificationClass.HAZD))
{ if (ScanHAZD(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.INFO) && notificationClasses.Contains(Message.NotificationClass.INFO))
{ if (ScanINFO(message, reader)) ExcelReader.SaveMessage(message); continue; }
{ if (ScanINFO(message, messageCore, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.LADG) && notificationClasses.Contains(Message.NotificationClass.LADG))
{ if (ScanLADG(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.MDH) && notificationClasses.Contains(Message.NotificationClass.MDH))
@ -92,8 +92,8 @@ namespace ENI2.Excel
{ if (ScanNAME(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.NOA_NOD) && notificationClasses.Contains(Message.NotificationClass.NOA_NOD))
{ if (ScanNOA_NOD(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.PAS) && notificationClasses.Contains(Message.NotificationClass.PAS))
{ if (ScanPAS(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.PASA) && notificationClasses.Contains(Message.NotificationClass.PASA))
{ if (ScanPASA(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.PASD) && notificationClasses.Contains(Message.NotificationClass.PASD))
{ if (ScanPASD(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.POBA) && notificationClasses.Contains(Message.NotificationClass.POBA))
@ -726,48 +726,61 @@ namespace ENI2.Excel
pas = new PASD();
pas.Identifier = (i + 1).ToString();
pas.MessageHeader = pasdMessage;
pas.IsDeparture = true;
pasdMessage.Elements.Add(pas);
}
pas.NotificationSchengen = reader.ReadCellAsBool("passenger departure", "C10");
pas.NotificationPAX = reader.ReadCellAsBool("passenger departure", "C11");
// these two are not working, since the lookup field is a combobox where reading text always yields empty string
// if there is time we should do the solution suggested in this question
// https://stackoverflow.com/questions/46752911/how-to-read-comboboxes-value-from-excel-using-c-sharp
pas.NotificationSchengen = true;
pas.NotificationPAX = reader.ReadCellAsBool("passenger departure", "C11") ?? false;
pas.PassengerLastName = lastName;
pas.PassengerFirstName = reader.ReadCellAsText("passenger departure", string.Format("C{0}", i + 16));
pas.PassengerPlaceOfBirth = reader.ReadCellAsText("passenger departure", string.Format("D{0}", i + 16));
pas.PassengerCountryOfBirth = reader.ReadCellAsText("passenger departure", string.Format("E{0}", i + 16));
pas.PassengerCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger departure", string.Format("E{0}", i + 16)), out bool canceled, false);
if (canceled) return false;
pas.PassengerDateOfBirth = reader.ReadCellAsDateTime("passenger departure", string.Format("F{0}", i + 16));
pas.PassengerGender = ParseGender(reader.ReadCellAsText("passenger departure", string.Format("G{0}", i + 16)));
pas.PassengerNationality = reader.ReadCellAsText("passenger departure", string.Format("H{0}", i + 16));
pas.PassengerIdentityDocumentIssuingState = reader.ReadCellAsText("passenger departure", string.Format("O{0}", i + 16));
pas.PassengerNationality = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger departure", string.Format("H{0}", i + 16)), out canceled);
if (canceled) return false;
pas.PassengerIdentityDocumentIssuingState = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger departure", string.Format("O{0}", i + 16)), out canceled);
if (canceled) return false;
pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger departure", string.Format("P{0}", i + 16));
if (pas.NotificationPAX ?? false)
{
pas.EmergencyCare = reader.ReadCellAsText("passenger departure", string.Format("Q{0}", i + 16));
pas.EmergencyContactNumber = reader.ReadCellAsText("passenger departure", string.Format("R{0}", i + 16));
}
pas.EmergencyCare = reader.ReadCellAsText("passenger departure", string.Format("Q{0}", i + 16));
pas.EmergencyContactNumber = reader.ReadCellAsText("passenger departure", string.Format("R{0}", i + 16));
pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger departure", string.Format("I{0}", i + 16)));
pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger departure", string.Format("J{0}", i + 16));
pas.PassengerVisaNumber = reader.ReadCellAsText("passenger departure", string.Format("K{0}", i + 16));
pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger departure", string.Format("L{0}", i + 16));
pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger departure", string.Format("M{0}", i + 16));
pas.PassengerInTransit = reader.ReadCellAsBool("passenger departure", string.Format("N{0}", i + 16));
if (pas.NotificationSchengen ?? false)
{
pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger departure", string.Format("I{0}", i + 16)));
pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger departure", string.Format("J{0}", i + 16));
pas.PassengerVisaNumber = reader.ReadCellAsText("passenger departure", string.Format("K{0}", i + 16));
pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger departure", string.Format("L{0}", i + 16));
pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger departure", string.Format("M{0}", i + 16));
pas.PassengerInTransit = reader.ReadCellAsBool("passenger departure", string.Format("N{0}", i + 16));
}
// if (pas.HasSchengenDetails) pas.NotificationSchengen = true;
// if (pas.HasPAXDetails) pas.NotificationPAX = true;
result = true;
}
bool mustPAX = pasdMessage.Elements.Count >= 12;
if (mustPAX)
{
foreach (PASD pasd in pasdMessage.Elements.Cast<PASD>())
pasd.NotificationPAX = mustPAX;
}
return result;
}
#endregion
#region PAS
#region PASA
private static bool ScanPAS(Message pasMessage, ExcelReader reader)
private static bool ScanPASA(Message pasMessage, ExcelReader reader)
{
bool result = false;
for (int i = 0; i < 1000; i++)
@ -783,37 +796,46 @@ namespace ENI2.Excel
pasMessage.Elements.Add(pas);
}
pas.NotificationSchengen = reader.ReadCellAsBool("passenger arrival", "C10");
pas.NotificationPAX = reader.ReadCellAsBool("passenger arrival", "C11");
pas.NotificationSchengen = true;
pas.NotificationPAX = reader.ReadCellAsBool("passenger arrival", "C11") ?? false;
pas.PassengerLastName = lastName;
pas.PassengerFirstName = reader.ReadCellAsText("passenger arrival", string.Format("C{0}", i + 16));
pas.PassengerPlaceOfBirth = reader.ReadCellAsText("passenger arrival", string.Format("D{0}", i + 16));
pas.PassengerCountryOfBirth = reader.ReadCellAsText("passenger arrival", string.Format("E{0}", i + 16));
pas.PassengerCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger arrival", string.Format("E{0}", i + 16)), out bool canceled, false);
if (canceled) return false;
pas.PassengerDateOfBirth = reader.ReadCellAsDateTime("passenger arrival", string.Format("F{0}", i + 16));
pas.PassengerGender = ParseGender(reader.ReadCellAsText("passenger arrival", string.Format("G{0}", i + 16)));
pas.PassengerNationality = reader.ReadCellAsText("passenger arrival", string.Format("H{0}", i + 16));
pas.PassengerIdentityDocumentIssuingState = reader.ReadCellAsText("passenger arrival", string.Format("O{0}", i + 16));
pas.PassengerNationality = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger arrival", string.Format("H{0}", i + 16)), out canceled);
if(canceled) return false;
pas.PassengerIdentityDocumentIssuingState = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger arrival", string.Format("O{0}", i + 16)), out canceled);
if (canceled) return false;
pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger arrival", string.Format("P{0}", i + 16));
pas.EmergencyCare = reader.ReadCellAsText("passenger arrival", string.Format("Q{0}", i + 16));
pas.EmergencyContactNumber = reader.ReadCellAsText("passenger arrival", string.Format("R{0}", i + 16));
pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger arrival", string.Format("I{0}", i + 16)));
pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger arrival", string.Format("J{0}", i + 16));
pas.PassengerVisaNumber = reader.ReadCellAsText("passenger arrival", string.Format("K{0}", i + 16));
pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger arrival", string.Format("L{0}", i + 16));
pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger arrival", string.Format("M{0}", i + 16));
pas.PassengerInTransit = reader.ReadCellAsBool("passenger arrival", string.Format("N{0}", i + 16));
//if(pas.NotificationPAX ?? false)
//{
pas.EmergencyCare = reader.ReadCellAsText("passenger arrival", string.Format("Q{0}", i + 16));
pas.EmergencyContactNumber = reader.ReadCellAsText("passenger arrival", string.Format("R{0}", i + 16));
//}
//if(pas.NotificationSchengen ?? false)
//{
pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger arrival", string.Format("I{0}", i + 16)));
pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger arrival", string.Format("J{0}", i + 16));
pas.PassengerVisaNumber = reader.ReadCellAsText("passenger arrival", string.Format("K{0}", i + 16));
pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger arrival", string.Format("L{0}", i + 16));
pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger arrival", string.Format("M{0}", i + 16));
pas.PassengerInTransit = reader.ReadCellAsBool("passenger arrival", string.Format("N{0}", i + 16));
//}
// if (pas.HasSchengenDetails) pas.NotificationSchengen = true;
// if (pas.HasPAXDetails) pas.NotificationPAX = true;
result = true;
}
bool mustPAX = pasMessage.Elements.Count >= 12;
if (mustPAX)
{
foreach (PAS pasa in pasMessage.Elements.Cast<PAS>())
pasa.NotificationPAX = mustPAX;
}
return result;
}
@ -1095,7 +1117,7 @@ namespace ENI2.Excel
#region INFO
private static bool ScanINFO(Message infoMessage, ExcelReader reader)
private static bool ScanINFO(Message infoMessage, MessageCore core, ExcelReader reader)
{
if (infoMessage.Elements.Count == 0)
{
@ -1120,7 +1142,26 @@ namespace ENI2.Excel
if (!portArea.IsNullOrEmpty() && DBManager.Instance.GetPortAreaDict().ContainsKey(portArea))
info.PortArea = portArea;
else
info.PortArea = "";
info.PortArea = "";
// März 2024: Spezialfall für Abrechnungsabteilung Bremenports: Feld wird markiert (falls genügend Platz)
// falls das Schiff nach DEBRE oder DEBHV geht:
if (core.PoC.Equals("DEBRE") || core.PoC.Equals("DEBRV"))
{
if (info.SpecialRequirementsOfShipAtBerth == null)
{
info.SpecialRequirementsOfShipAtBerth = "NSW by BSMD";
}
else if (info.SpecialRequirementsOfShipAtBerth.Length <= 241) // we have enough space
{
if (info.SpecialRequirementsOfShipAtBerth.Length > 0) // if there is text already add a separator
{
info.SpecialRequirementsOfShipAtBerth += " | ";
}
info.SpecialRequirementsOfShipAtBerth += "NSW by BSMD";
}
}
return true;
}
@ -1156,32 +1197,34 @@ namespace ENI2.Excel
crew = new CREWD();
crew.Identifier = (i + 1).ToString();
crew.MessageHeader = crewMessage;
crew.IsDeparture = true;
crewMessage.Elements.Add(crew);
}
crew.NotificationSchengen = reader.ReadCellAsBool("crew departure", "C10");
crew.NotificationSchengen = true;
crew.NotificationPAX = reader.ReadCellAsBool("crew departure", "C11");
crew.CrewMemberLastName = lastName;
crew.CrewMemberFirstName = reader.ReadCellAsText("crew departure", string.Format("C{0}", i + 15));
crew.CrewMemberPlaceOfBirth = reader.ReadCellAsText("crew departure", string.Format("D{0}", i + 15));
crew.CrewMemberCountryOfBirth = reader.ReadCellAsText("crew departure", string.Format("E{0}", i + 15));
crew.CrewMemberCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew departure", string.Format("E{0}", i + 15)), out bool canceled, false);
if (canceled) return false;
crew.CrewMemberDateOfBirth = reader.ReadCellAsDateTime("crew departure", string.Format("F{0}", i + 15));
string gender = reader.ReadCellAsText("crew departure", string.Format("G{0}", i + 15));
crew.CrewMemberGender = ParseGender(gender);
crew.CrewMemberNationality = reader.ReadCellAsText("crew departure", string.Format("H{0}", i + 15));
if (crew.NotificationSchengen ?? false)
{
string idDocType = reader.ReadCellAsText("crew departure", string.Format("I{0}", i + 15));
crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType);
crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew departure", string.Format("J{0}", i + 15));
crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew departure", string.Format("K{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = reader.ReadCellAsText("crew departure", string.Format("M{0}", i + 15));
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew departure", string.Format("N{0}", i + 15));
}
crew.CrewMemberNationality = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew departure", string.Format("H{0}", i + 15)), out canceled);
if (canceled) return false;
string idDocType = reader.ReadCellAsText("crew departure", string.Format("I{0}", i + 15));
crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType);
crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew departure", string.Format("J{0}", i + 15));
crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew departure", string.Format("K{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew departure", string.Format("M{0}", i + 15)), out canceled);
if (canceled) return false;
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew departure", string.Format("N{0}", i + 15));
crew.CrewMemberDuty = reader.ReadCellAsText("crew departure", string.Format("L{0}", i + 15));
if (crew.CrewMemberDuty.IsNullOrEmpty()) crew.CrewMemberDuty = "unknown";
result = true;
}
@ -1190,7 +1233,7 @@ namespace ENI2.Excel
#endregion
#region CREW
#region CREWA
private static bool ScanCREW(Message crewMessage, ExcelReader reader)
{
@ -1208,29 +1251,30 @@ namespace ENI2.Excel
crewMessage.Elements.Add(crew);
}
crew.NotificationSchengen = reader.ReadCellAsBool("crew arrival", "C10");
crew.NotificationPAX = reader.ReadCellAsBool("crew arrival", "C11");
crew.NotificationSchengen = true;
crew.NotificationPAX = reader.ReadCellAsBool("crew arrival", "C11") ?? false;
crew.CrewMemberLastName = lastName;
crew.CrewMemberFirstName = reader.ReadCellAsText("crew arrival", string.Format("C{0}", i + 15));
crew.CrewMemberPlaceOfBirth = reader.ReadCellAsText("crew arrival", string.Format("D{0}", i + 15));
crew.CrewMemberCountryOfBirth = reader.ReadCellAsText("crew arrival", string.Format("E{0}", i + 15));
crew.CrewMemberCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew arrival", string.Format("E{0}", i + 15)), out bool canceled, false);
if (canceled) return false;
crew.CrewMemberDateOfBirth = reader.ReadCellAsDateTime("crew arrival", string.Format("F{0}", i + 15));
string gender = reader.ReadCellAsText("crew arrival", string.Format("G{0}", i + 15));
crew.CrewMemberGender = ParseGender(gender);
crew.CrewMemberNationality = reader.ReadCellAsText("crew arrival", string.Format("H{0}", i + 15));
crew.CrewMemberNationality = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew arrival", string.Format("H{0}", i + 15)), out canceled);
if (canceled) return false;
//if(crew.NotificationSchengen ?? false)
//{
string idDocType = reader.ReadCellAsText("crew arrival", string.Format("I{0}", i + 15));
crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType);
crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew arrival", string.Format("J{0}", i + 15));
crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew arrival", string.Format("K{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = reader.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15));
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew arrival", string.Format("N{0}", i + 15));
//}
string idDocType = reader.ReadCellAsText("crew arrival", string.Format("I{0}", i + 15));
crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType);
crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew arrival", string.Format("J{0}", i + 15));
crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew arrival", string.Format("K{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15)), out canceled);
if (canceled) return false;
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew arrival", string.Format("N{0}", i + 15));
crew.CrewMemberDuty = reader.ReadCellAsText("crew arrival", string.Format("L{0}", i + 15));
if (crew.CrewMemberDuty.IsNullOrEmpty()) crew.CrewMemberDuty = "unknown";
result = true;
}

View File

@ -7,6 +7,7 @@ using Microsoft.Office.Interop.Excel;
using System.Runtime.InteropServices;
using log4net;
using System.Globalization;
using System.Text.RegularExpressions;
namespace ENI2.Excel
{
@ -105,6 +106,20 @@ namespace ENI2.Excel
}
}
private static double? ParseAnyDouble(string val)
{
double? result = null;
if (double.TryParse(val, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite,
CultureInfo.InvariantCulture, out double tmpDouble))
result = tmpDouble;
if (result == null)
{
if (double.TryParse(val, out tmpDouble)) // current language style (==GER, mit , statt .)
result = tmpDouble;
}
return result;
}
internal double? ReadNumber(string lookup)
{
double? result = null;
@ -114,15 +129,17 @@ namespace ENI2.Excel
{
var val = _nameDict[lookup].RefersToRange.Value;
if (val is double) result = val;
if (val is string)
if ((val is string) && (val.Length > 0))
{
if (double.TryParse(val, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite,
CultureInfo.InvariantCulture, out double tmpDouble))
result = tmpDouble;
if (result == null)
{
if (double.TryParse(val, out tmpDouble)) // current language style (==GER, mit , statt .)
result = tmpDouble;
result = ParseAnyDouble(val);
if(result == null)
{
Match m = Regex.Match(val, "([0-9\\.\\,]+)([a-zA-Z]*)");
if (m.Success)
{
result = ParseAnyDouble(m.Groups[1].Value);
}
}
}

View File

@ -80,11 +80,16 @@ namespace ENI2.Excel
resultMessage = "";
// Create ExcelWriter
using (ExcelWriter ew = new ExcelWriter(fileName, isRefSheet))
using (ExcelWriter ew = new ExcelWriter(isRefSheet))
{
ew.WriteData(messages, core, out resultMessage, isRefSheet);
ew.Save(fileName);
}
}
internal void ExportMaersk(List<MaerskData> exportList, string fileName)
{
ExcelSimpleWriter.WriteMaerskList(fileName, exportList);
}
}
}

View File

@ -7,27 +7,25 @@
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using log4net;
using bsmd.database;
using ENI2.Locode;
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
using ENI2.Locode;
using bsmd.database;
using System.Text.RegularExpressions;
namespace ENI2.Excel
{
internal class ExcelReader : ExcelBase
{
internal enum ReadState
{ NONE, OK, WARN, FAIL };
internal enum ReadState { NONE, OK, WARN, FAIL };
internal enum SheetTypeEnum { BSMD, DAKOSY };
internal enum SheetTypeEnum
{ BSMD, DAKOSY };
private readonly SheetTypeEnum _sheetType = SheetTypeEnum.BSMD;
@ -36,23 +34,29 @@ namespace ENI2.Excel
public ExcelReader(string filePath, bool openReadonly = true, bool createNameFields = true)
{
this._workBook = _excelWorkbooks.Open(filePath, 0, openReadonly, 5, "", "", false, XlPlatform.xlWindows, "", false, false, 0, false, false, false);
if(createNameFields)
if (createNameFields)
this.InitNameFields();
// Determine if this is a Dakosy or BSMD Sheet
if(createNameFields)
if (createNameFields)
_sheetType = (_nameDict.Count > 10) ? SheetTypeEnum.BSMD : SheetTypeEnum.DAKOSY;
}
public SheetTypeEnum SheetType { get { return _sheetType; } }
public SheetTypeEnum SheetType
{ get { return _sheetType; } }
internal static void SaveMessage(Message message)
{
message.CreatedBy = "EXCEL";
if (message.MessageNotificationClass == Message.NotificationClass.STO)
{
message.InternalStatus = Message.BSMDStatus.PREPARE;
}
else
{
message.InternalStatus = Message.BSMDStatus.EXCEL;
message.ChangedBy = ReportingParty.CurrentReportingParty?.Logon;
}
message.UnsentMessageWarningShown = false;
DBManager.Instance.Save(message);
message.SaveElements();
@ -80,7 +84,7 @@ namespace ENI2.Excel
if (result != null)
{
result = result.Trim();
if(result.Length > 0)
if (result.Length > 0)
{
result = result.Clean();
}
@ -120,11 +124,11 @@ namespace ENI2.Excel
if (!val.IsNullOrEmpty())
{
val = val.ToUpper();
string portName = LocodeDB.SSNPortNameFromLocode(val);
string portName = LocodeDB.SSNPortNameFromLocode(val);
if (portName.IsNullOrEmpty())
{
_log.WarnFormat("unknown Locode {0}", val);
val = "";
val = null;
}
}
return val;
@ -135,7 +139,7 @@ namespace ENI2.Excel
string val = ReadText(lookup);
if (val.IsNullOrEmpty()) return null;
if(int.TryParse(val, out int result))
if (int.TryParse(val, out int result))
{
if ((result < 10) || (result > 99))
_log.WarnFormat("invalid cargo LA code {0}", result);
@ -154,16 +158,17 @@ namespace ENI2.Excel
string val = this.ReadText(lookup);
if (val != null)
{
if (val.Equals("m", StringComparison.CurrentCultureIgnoreCase) || val.Equals("male", StringComparison.CurrentCultureIgnoreCase)) {
if (val.Equals("m", StringComparison.CurrentCultureIgnoreCase) || val.Equals("male", StringComparison.CurrentCultureIgnoreCase))
{
result = 1;
}
else if (val.Equals("f", StringComparison.CurrentCultureIgnoreCase) || val.Equals("female", StringComparison.CurrentCultureIgnoreCase))
{
result = 2;
}
else if (val.Equals("n", StringComparison.CurrentCultureIgnoreCase) ||
val.Equals("not applicable", StringComparison.CurrentCultureIgnoreCase) ||
val.Equals("d", StringComparison.CurrentCultureIgnoreCase) ||
else if (val.Equals("n", StringComparison.CurrentCultureIgnoreCase) ||
val.Equals("not applicable", StringComparison.CurrentCultureIgnoreCase) ||
val.Equals("d", StringComparison.CurrentCultureIgnoreCase) ||
val.Equals("diverse", StringComparison.CurrentCultureIgnoreCase))
{
result = 9;
@ -173,7 +178,7 @@ namespace ENI2.Excel
result = 0;
}
}
if(result == null)
if (result == null)
{
_log.ErrorFormat("error reading gender on {0}", lookup);
}
@ -192,7 +197,7 @@ namespace ENI2.Excel
if (val.Equals("picture_id", StringComparison.CurrentCultureIgnoreCase) || val.Equals("picture id", StringComparison.CurrentCultureIgnoreCase) || val.Equals("4")) result = 3;
if (val.Equals("residental_permit", StringComparison.CurrentCultureIgnoreCase) || val.Equals("residental permit", StringComparison.CurrentCultureIgnoreCase) || val.Equals("5")) result = 4;
if (val.Equals("other_legal_identity_document", StringComparison.CurrentCultureIgnoreCase) || val.Equals("other legal identity document", StringComparison.CurrentCultureIgnoreCase) || val.Equals("6")) result = 5;
if (val.Equals("ic", StringComparison.CurrentCultureIgnoreCase)) result = 0;
if (val.Equals("ic", StringComparison.CurrentCultureIgnoreCase)) result = 0;
}
if (!result.HasValue)
@ -243,11 +248,11 @@ namespace ENI2.Excel
string val = this.ReadText(lookup);
byte? result = null;
if(val != null)
if (val != null)
{
if ((val.IndexOf("load", StringComparison.OrdinalIgnoreCase) >= 0) || val.Equals("1")) result = 0;
if ((val.IndexOf("discharge", StringComparison.OrdinalIgnoreCase) >= 0) || val.Equals("2")) result = 1;
if ((val.IndexOf("transit", StringComparison.OrdinalIgnoreCase) >= 0) || val.Equals("3")) result = 2;
if ((val.IndexOf("transit", StringComparison.OrdinalIgnoreCase) >= 0) || val.Equals("3")) result = 2;
}
if (!result.HasValue)
@ -275,10 +280,10 @@ namespace ENI2.Excel
_log.ErrorFormat("Wrong ISO code {0}", val);
val = "";
}
}
}
}
return val;
}
}
internal byte? ReadHullConfiguration(string lookup)
{
@ -289,6 +294,15 @@ namespace ENI2.Excel
if (val.IndexOf("sbt", StringComparison.OrdinalIgnoreCase) >= 0) result = 1;
if (val.IndexOf("single", StringComparison.OrdinalIgnoreCase) >= 0) result = 0;
if (val.IndexOf("double", StringComparison.OrdinalIgnoreCase) >= 0) result = 2;
if (!result.HasValue)
{
if (int.TryParse(val, out int parsed))
{
if ((parsed < 4) && (parsed > 0))
result = (byte)(parsed - 1);
}
}
}
if (!result.HasValue)
@ -302,7 +316,7 @@ namespace ENI2.Excel
string val = this.ReadText(lookup);
byte? result = null;
if(val!= null)
if (val != null)
{
if (val == "I") result = 0;
if (val == "1") result = 0;
@ -310,7 +324,7 @@ namespace ENI2.Excel
if (val == "2") result = 1;
if (val == "III") result = 2;
if (val == "3") result = 2;
if (val.Equals("NONE", StringComparison.OrdinalIgnoreCase)) result = 0;
if (val.Equals("NONE", StringComparison.OrdinalIgnoreCase)) result = 0;
}
if (!result.HasValue)
@ -323,7 +337,7 @@ namespace ENI2.Excel
{
string val = this.ReadText(lookup);
bool isValid = false;
if(!val.IsNullOrEmpty())
if (!val.IsNullOrEmpty())
{
if (int.TryParse(val, out int typeVal))
{
@ -347,6 +361,15 @@ namespace ENI2.Excel
if (val.IndexOf("full", StringComparison.OrdinalIgnoreCase) >= 0) result = 0;
if (val.IndexOf("empty", StringComparison.OrdinalIgnoreCase) >= 0) result = 1;
if (val.IndexOf("inerted", StringComparison.OrdinalIgnoreCase) >= 0) result = 2;
if (!result.HasValue)
{
if (int.TryParse(val, out int parsed))
{
if ((parsed < 4) && (parsed > 0))
result = (byte)(parsed - 1);
}
}
}
if (!result.HasValue)
@ -371,13 +394,13 @@ namespace ENI2.Excel
_log.ErrorFormat("cannot read delivery {0}", lookup);
return result;
}
}
internal byte? ReadHazards(string lookup)
{
string val = this.ReadText(lookup);
byte? result = null;
if(val != null)
if (val != null)
{
if (val.Equals("p", StringComparison.OrdinalIgnoreCase)) return 0;
if (val.Equals("s", StringComparison.OrdinalIgnoreCase)) return 1;
@ -390,7 +413,7 @@ namespace ENI2.Excel
{
string val = this.ReadText(lookup);
byte? result = null;
if(val != null)
if (val != null)
{
if (val.Equals("a", StringComparison.OrdinalIgnoreCase)) return 0;
if (val.Equals("b", StringComparison.OrdinalIgnoreCase)) return 1;
@ -401,8 +424,8 @@ namespace ENI2.Excel
internal DateTime? ReadBirthDate(string lookup)
{
DateTime? result = this.ReadDate(lookup);
if(result.HasValue)
DateTime? result = this.ReadDate(lookup);
if (result.HasValue)
{
if (result.Value > DateTime.Now)
_log.WarnFormat("Birth date implausible for {0} : {1}", lookup, result);
@ -420,7 +443,7 @@ namespace ENI2.Excel
{
var val = _nameDict[lookup].RefersToRange.Value;
if (val is DateTime)
{
{
date = val;
}
else if (val is double)
@ -430,7 +453,7 @@ namespace ENI2.Excel
date = DateTime.FromOADate(val);
}
catch (ArgumentException) { /* .. */ }
if(date == null)
if (date == null)
{
CultureInfo provider = CultureInfo.InvariantCulture;
string dateString = val.ToString();
@ -446,22 +469,37 @@ namespace ENI2.Excel
date = tmpDate;
}
if (date == null)
{
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
if (DateTime.TryParseExact(val, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate))
date = tmpDate;
}
if (date == null)
{
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
if (DateTime.TryParseExact(val, formats, en, DateTimeStyles.None, out DateTime tmpDate))
return tmpDate;
}
if (date != null)
{
if ((date.Value < new DateTime(1899, 1, 1)) || (date.Value > new DateTime(2130, 1, 1)))
{
date = null; // this can't be right
}
date = null; // this can't be right
}
}
}
return date;
}
catch (Exception)
{
{
_log.WarnFormat("error parsing datetime for lookup {0}", lookup);
return null;
}
}
}
internal DateTime? ReadDateTime(string dateField, string timeField)
@ -470,26 +508,26 @@ namespace ENI2.Excel
DateTime? etaDate = this.ReadDate(dateField);
DateTime? etaTime = this.ReadTime(timeField);
if (etaDate != null)
{
{
if (etaTime != null)
{
result = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day, etaTime.Value.Hour, etaTime.Value.Minute, etaTime.Value.Second, DateTimeKind.Local);
result = result.Value.ToUniversalTime();
}
}
else
{
result = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day, 0, 0, 0, DateTimeKind.Local);
result = result.Value.ToUniversalTime();
}
}
return result;
}
internal DateTime? ReadTime(string lookup)
{
DateTime? result = null;
try
{
if (_nameDict.ContainsKey(lookup))
@ -505,7 +543,7 @@ namespace ENI2.Excel
{
result = DateTime.FromOADate(val);
}
catch(ArgumentException) { }
catch (ArgumentException) { }
if (result == null)
{
@ -520,11 +558,12 @@ namespace ENI2.Excel
}
}
if (val is string) {
if (((string)val).EndsWith("lt", StringComparison.OrdinalIgnoreCase))
val = ((string)val).Substring(0, ((string)val).Length - 2).Trim();
if (val is string @string)
{
if (@string.EndsWith("lt", StringComparison.OrdinalIgnoreCase))
val = @string.Substring(0, @string.Length - 2).Trim();
else
val = ((string)val).Trim();
val = @string.Trim();
}
if (result == null)
@ -549,21 +588,21 @@ namespace ENI2.Excel
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
result = tmpDate;
}
}
}
}
}
catch (Exception)
{
_log.WarnFormat("error reading time for lookup {0}", lookup);
{
_log.WarnFormat("error reading time for lookup {0}", lookup);
}
return result;
}
}
internal double ReadNumberDefaultZero(string lookup)
{
double? result = this.ReadNumber(lookup);
if(!result.HasValue)
if (!result.HasValue)
{
result = 0;
}
@ -573,9 +612,9 @@ namespace ENI2.Excel
internal bool? ReadBoolean(string lookup)
{
string val = this.ReadText(lookup);
if (val == null)
if (val == null)
return null;
if ((val == "y") || (val == "Y") || val.Equals("yes", StringComparison.OrdinalIgnoreCase) || (val == "1") || (val == "x") || (val == "X"))
return true;
@ -584,17 +623,36 @@ namespace ENI2.Excel
#region Dakosy-specific functions
internal string ReadCellAsText(string sheetName, string range)
internal bool HasWorksheetNamed(string sheetName)
{
try
{
Worksheet workSheet = (Worksheet) _workBook.Worksheets[sheetName];
Worksheet theWorkSheet = _workBook.Worksheets[sheetName];
return theWorkSheet != null;
}
catch (Exception)
{
return false;
}
}
internal string ReadCellAsText(string sheetName, string range, int? maxLength = null)
{
try
{
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName];
string result = workSheet.Range[range].Text.ToString();
if (!result.IsNullOrEmpty())
{
result = result.Trim().Clean();
if(maxLength.HasValue && result.Length > maxLength.Value)
{
result = result.Substring(0, maxLength.Value);
}
}
return result;
}
catch(Exception e)
catch (Exception e)
{
_log.Warn(e.Message);
}
@ -627,7 +685,6 @@ namespace ENI2.Excel
Range aRange = workSheet.Range[range];
if (aRange != null)
{
}
}
catch (Exception e)
@ -690,23 +747,19 @@ namespace ENI2.Excel
string dateString = ReadCellAsText(sheetName, range);
if (dateString != null)
{
CultureInfo provider = CultureInfo.InvariantCulture;
const string dateTimeFormat = "yyyy/MM/dd HH:mm";
if (DateTime.TryParseExact(dateString, dateTimeFormat, provider, DateTimeStyles.None, out DateTime tmpDate))
return tmpDate.ToUniversalTime();
const string dateFormat = "yyyy/MM/dd";
if (DateTime.TryParseExact(dateString, dateFormat, provider, DateTimeStyles.None, out DateTime tmpDate2))
string[] formats = { "yyyy/MM/dd HH:mm", "yyyy/MM/dd", "dd.MM.yyyy", "dd-MM-yyyy", "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d" };
if (DateTime.TryParseExact(dateString, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate))
return tmpDate;
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
if (DateTime.TryParseExact(dateString, formats, en, DateTimeStyles.None, out DateTime tmpDate2))
return tmpDate2;
const string dateFormat2 = "dd.MM.yyyy";
if (DateTime.TryParseExact(dateString, dateFormat2, provider, DateTimeStyles.None, out DateTime tmpDate3))
return tmpDate3;
return null;
}
else return null;
else
return null;
}
#endregion
#endregion Dakosy-specific functions
}
}
}

View File

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;
using System.Runtime.InteropServices;
using bsmd.database;
namespace ENI2.Excel
{
static class ExcelSimpleWriter
{
public static void WriteMaerskList(string filename, List<MaerskData> data)
{
data.Sort();
Application excelApp = new Application();
excelApp.DisplayAlerts = false;
excelApp.Visible = false;
Workbook wb = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
Worksheet ws = wb.Worksheets[1];
// Überschriften erste Zeile
ws.Cells[1, 1] = "ETA";
ws.Cells[1, 2] = "ETD";
ws.Cells[1, 3] = "Rotation name";
ws.Cells[1, 4] = "Vessel code";
ws.Cells[1, 5] = "Vessel name";
ws.Cells[1, 6] = "IMO";
ws.Cells[1, 7] = "Arr voy";
ws.Cells[1, 8] = "Dep voy";
ws.Cells[1, 9] = "Terminal name";
ws.Cells[1, 10] = "Operator code";
ws.Cells[1, 11] = "Pro arr";
ws.Cells[1, 12] = "Pro dep";
ws.Cells[1, 13] = "ID";
ws.Cells[1, 14] = "Remark";
for (int i = 0; i < data.Count; i++)
{
MaerskData md = data[i];
ws.Cells[i + 2, 1].NumberFormat = "TT/hh:mm";
ws.Cells[i + 2, 1] = md.ColA;
ws.Cells[i + 2, 2].NumberFormat = "TT/hh:mm";
ws.Cells[i + 2, 2] = md.ColB;
ws.Cells[i + 2, 3] = md.ColC;
ws.Cells[i + 2, 4] = md.ColD;
ws.Cells[i + 2, 5] = md.ColE;
ws.Cells[i + 2, 6] = md.ColF;
ws.Cells[i + 2, 7] = md.ColG;
ws.Cells[i + 2, 8] = md.ColH;
ws.Cells[i + 2, 9] = md.ColI;
ws.Cells[i + 2, 10] = md.ColJ;
ws.Cells[i + 2, 11] = md.ColK;
ws.Cells[i + 2, 12] = md.ColL;
ws.Cells[i + 2, 13] = md.ColM ;
ws.Cells[i + 2, 14] = md.Remark;
if((md.MessageCore != null) && (md.MessageCore.Cancelled ?? false))
{
ws.Rows[i + 2].Font.Strikethrough = true;
}
}
wb.SaveAs(filename, XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
wb.Saved = true;
wb.Close(0);
Marshal.ReleaseComObject(ws);
Marshal.ReleaseComObject(wb);
excelApp.Quit();
Marshal.ReleaseComObject(excelApp);
}
}
}

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