Compare commits

...

No commits in common. "main" and "v1.6.0.4_test" have entirely different histories.

299 changed files with 42358 additions and 2 deletions

291
.gitignore vendored Normal file
View File

@ -0,0 +1,291 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# Click-Once directory
publish/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
# SQL Server files
*.mdf
*.ldf
*.ndf
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Visual Studio History (VSHistory) files
.vshistory/
# VS Code files for those working on multiple tools
.vscode/
#!.vscode/settings.json
#!.vscode/tasks.json
#!.vscode/launch.json
#!.vscode/extensions.json
#*.code-workspace
# Local History for Visual Studio Code
.history/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
src/notebooks_metz/
src/server/editable_requirements.txt

26
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "src/server/BreCal",
"FLASK_DEBUG": "1",
"SECRET_KEY" : "zdiTz8P3jXOc7jztIQAoelK4zztyuCpJ" // https://randomkeygen.com/
},
"args": [
"run",
// "--no-debugger",
"--no-reload"
],
"jinja": true,
"justMyCode": true
}
]
}

View File

@ -1,2 +1,23 @@
# brecal
Bremen calling
# Bremen Calling
___
Projekt zur verbesserten Kommunikation der maritimen Partner bei Schiffsanläufen in Bremen.
## Anforderungen
## Architektur
Die Architektur besteht aus einer Datenbank und einem in Python implementierten Backend, das eine API zu Verfügung stellt. Diese API ist als OpenAPI 3.0 spezifiziert.
Die Anwendung selbst kommuniziert nur über diese API mit der Datenbank. Es sind damit unterschiedliche Anwendungsplattformen denkbar, etwa eine Web-, Mobile- oder Windows Desktop Anwendung.
In dieser [Folie](docs/Architektur.pptx) ist ein Bild / Überblick enthalten.
Ein erster Gedanke des Datenbank-Layouts sieht folgendermaßen aus:
![image](docs/datenbank.jpeg)
## Entwicklung
### Postman
Zum Debuggen der Flask App verwende ich dieses Tutorial:
https://code.visualstudio.com/docs/python/tutorial-flask#_create-a-project-environment-for-the-flask-tutorial

Binary file not shown.

BIN
docs/AMPELKONZEPT_V1.docx Normal file

Binary file not shown.

BIN
docs/Ablaufplan.pptx Normal file

Binary file not shown.

237
docs/ApiValidationRules.md Normal file
View File

@ -0,0 +1,237 @@
# Rest-API validation rules for the backend
___
* Rules defined here only apply to calls that change data (POST / PUT /DELETE requests)
* Violation of these rules should result in 400 bad request
* These are not high-level rules that change color of a data entry in the app
## Change history
|Date|Edit|Author|
|--|--|--|
| 2.2.24 | Document created, first draft | Daniel Schick |
| 25.7.24 | Update for BC 1.4 and other changes | Daniel Schick |
## Global constants and definitions
### Participant type
The participant type is a bit flag that encodes which user groups a participant belongs to. Note: A participant may belong to **multiple** groups so this flag has to be bitwise evaluated.
|Value|Group|
|-----|-----|
| 1 | BSMD |
| 2 | Terminal |
| 4 | Pilot |
| 8 | Agency |
| 16 | Mooring |
| 32 | Port authority |
| 64 | Tug |
### Participant flag
The participant data record contains a field called "flag" which is also bitwise encoded. The purpose of this flag is to allow user authorization on a finer level. Currently the following flag(s) are defined:
| Value | Significance |
| ------|--------------|
| 1 | If this flag is set on a shipcall record with participant type Agency (8), all participants of type BSMD (1) may edit the record.
### Shipcall type
The shipcall type which is set in the shipcall record may have the following values
| Value | Meaning |
|-------|---------|
| 1 | Incoming |
| 2 | Outgoing |
| 3 | Shifting (changing berths) |
## All queries
### Token evaluation
The identity of the caller can be retrieved from the token. This contains an id (="user id") and more importantly, the "participant_id". Every call is only allow if the user is properly authorized to perform the call or modify the dataset.
At this time, authorization is performed on a participant level. This means that all users that belong to a particular participant have the same rights.
### Modifying unknown entities
PUT / DELETE calls referencing entities that are not found in the database will receive an 404 reply. This is already implemented in the underlying code and therefore not mentioned in this document. This evaluation should precede the API validation so in this document we assume the entities are existing.
### Return value
If a validation rule fails the call should return 400 (Bad request) including an error message in the following format:
```json
{
"error_field" : "A reference to the respective field(s) which have caused the error",
"error_description" : "Reason why this call failed"
}
```
### Time values
Date and date+time values are specified as text formatted in [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339#section-5.6), e.g.
```json
{
"created" : "2024-01-27T18:00:21Z"
}
```
Usually the "Z" is missing at the end indicating local time.
Generally, times may not be updated to a value in the past. There are exception (see SHIPCALL PUT below).
Times should also not be set to a value more than 1 year in the future. The reasoning is to prevent shipcalls to stick to the top of the list by implausible (or for the workings of Bremen calling irrelevant) values too far in the future.
## /shipcall POST
1. The call may only be performed by a user belonging to participant group type BSMD.
2. Reference checking: The dataset includes multiple fields referring other tables. The validation must make sure the referenced entities exist. This includes the following fields:
| Field | Referenced table | Notes |
|-------|------------------| ----- |
| ship_id | ship | |
| arrival_berth_id | berth | required if type is "arrival" (1) |
| departure_berth_id | berth | required if type is "departure" or "shifting" (2 or 3) |
| participants | participant | This is a list containing participant_id and type pairs with the following rules: 1. participant_id values may appear more once 2. types may only appear once, therefore there are a maximum of 7 elements in this list. |
3. Check for reasonable values for the following fields:
| Field | Validation |
|-------|------------|
| eta | value must be in the future |
| type | value must be one of the values defined above |
| voyage | if set must be <= 16 chars and no special characters |
| etd | must be in the future |
| flags | must be a combination of the flags defined above |
| draft | 0 <= value <= 20 |
| tidal_window_from | value must be in the future |
| tidal_window_to | value must be in the future, value must be > tidal_window_from |
| recommended_tugs | 0 < value < 10 |
| canceled | optional on POST |
| evaluation | may not be set |
| evaluation_message | may not be set |
| created / modified | may not be set |
#### Required fields
* eta / etd (depending on value of type: 1: eta, 2: etd, 3: etd)
* type
* ship_id
* arrival_berth_id / departure_berth_id (depending on type, see above)
* assigned participant for agency
## /shipcall PUT
1. The call may only be performed by a user belonging to participant group type BSMD.
2. If a agency is selected via the shipcall_participant_map entry, users of this agency may also edit the shipcall. Care has to be taken: The agency must have been set _before_ a member of the group may edit the record.
In other words: no setting the agency and editing the record by a member of the agency within the same call.
3. See value rules in /shipcall POST.
Exceptions:
a) Canceled may be set but only if not already set.
b) ETA/ETD may be in the past. This can happen if an agency has entered an ETA/ETD (times) in the future but
wants to edit fields of the shipcall record (e.g. the draft) but the shipcall was originally created with an ETA/ETD in the past
4. A cancelled shipcall may not be changed (is logical delete)
#### Required fields
The id field is required, missing fields will not be updated.
## /times POST
1. A new dataset may only be created by a user _not_ belonging to participant group BSMD.
2. A new dataset may only be created if a dataset of this type is not already present for the participant type.
3. A new dataset may only be created if the user belongs to the participant group assigned to the shipcall with the appropriate type (see shipcall_participant_map). This actually trumps rule #1 but may return a different error message.
4. Reference checking: The dataset includes multiple fields referring other tables. The validation must make sure the referenced entities exist. This includes the following fields:
| Field | Referenced table |
|-------|------------------|
| shipcall_id | shipcall |
| participant_id | participant |
| berth_id | berth |
5. Check for reasonable values for the following fields:
| Field | Validation |
|-------|------------|
| eta_berth, etd_berth, lock_time, zone_entry, operations_start, operations_end | if set these values must be in the future|
| eta_interval_end, etd_interval_end | if set these values must be in the future. They must be larger than their ETA/ETD counterparts. |
| remarks, berth_info | must be <= 512 chars |
| participant_type | must not be BSMD |
#### Required fields
This depends on the shipcall and participant type:
##### Incoming
AGENCY, PILOT, PORT_AUTHORITY, MOORING, TUG:
shipcall_id, participant_id, participant_type
TERMINAL:
shipcall_id, participant_id, participant_type
##### Outgoing
AGENCY, PILOT, PORT_AUTHORITY, MOORING, TUG:
shipcall_id, participant_id, participant_type
TERMINAL:
shipcall_id, participant_id, participant_type
##### Shifting
AGENCY, PILOT, PORT_AUTHORITY, MOORING, TUG:
shipcall_id, participant_id, participant_type
TERMINAL:
shipcall_id, participant_id, participant_type
## /times PUT
1. A dataset may only be changed by a user belonging to the same participant as the times dataset is referring to.
2. See reference and value checking as specified in /times POST.
3. The shipcall type may not be changed.
#### Required fields
The id field is required, missing fields will not be updated
## /times DELETE
1. A dataset may only be changed by a user belonging to the same participant as the times dataset is referring to.
2. The dataset may not be deleted already.
## /ship POST
1. The call may only be performed by a user belonging to participant group type BSMD.
2. A ship may only be added if there is no other ship with the same IMO number already present in the database.
3. Check for reasonable values for the following fields:
| Field | Validation |
|-------|------------|
| name | Length < 64, no special characters |
| IMO | 7-digit number. See [here](https://de.wikipedia.org/wiki/IMO-Nummer) for clarification. |
| callsign | Length <= 8, no special characters |
| Length | 0 < value < 1000 |
| Width | 0 < value < 100 |
| bollard_pull | 0 < value < 500, only allowed if is_tug = 1 |
## /ship PUT
1. The call may only be performed by a user belonging to participant group type BSMD.
2. The IMO number field may not be changed since it serves the purpose of a primary (matching) key.
3. See value rules in /ship POST
4. The id field is required, missing fields will not be updated
## /ship DELETE
1. The call may only be performed by a user belonging to participant group type BSMD.
2. The dataset may not be deleted already.

BIN
docs/Arbeitspakete.xlsx Normal file

Binary file not shown.

BIN
docs/Architektur.pptx Normal file

Binary file not shown.

BIN
docs/BremenCalling.pptx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/Gesamtansicht.pptx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/UserStories.xlsx Normal file

Binary file not shown.

BIN
docs/Usertreffen.pptx Normal file

Binary file not shown.

BIN
docs/datenbank.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

46
misc/Ampelfunktion.md Normal file
View File

@ -0,0 +1,46 @@
<img style="float: right;" src="logo_bremen_calling.png" />
# Ampelfunktion Bremen Calling
## Einleitung
## Regeln
[Zurück](../README.md)
___
| Ampelfunktionen | Beschreibung | Definition | Bemerkungen |
|-----------------|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| | | | |
| 0001 | Nicht alle Zeiten sind zugeordnet | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur, Festmacher usw.)<br/> - Zugeordnete Zeit ist leer | |
| 0001 - A | Agentur / einkommend | times_agency:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>___zum Zeitpunkt 20 Std vor___<br/> shipcall:<br/> - eta | gelb |
| 0001 - B | Agentur / ausgehend + Verholung | times_agency:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>___zum Zeitpunkt 20 Std vor___<br/> shipcall:<br/> - etd | gelb |
| 0001 - C | Festmacher / einkommend | times_mooring:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETA Berth | gelb |
| 0001 - D | Festmacher / ausgehend + Verholung | times_mooring:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETD Berth | gelb |
| 0001 - F | Hafenamt / einkommend | times_portauthority:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETA Berth | gelb |
| 0001 - G | Hafenamt / ausgehend + Verholung | times_portauthority:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETD Berth | gelb |
| 0001 - H | Lotsen / einkommend | times_pilot:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>______<br/> times_agency:<br/> - ETA Berth < 16 Stunden entfernt | gelb |
| 0001 - I | Lotsen / ausgehend + Verholung | times_pilot:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>______<br/> times_agency:<br/> - ETD Berth < 16 Stunden entfernt | gelb |
| 0001 - J | Schlepper / einkommend | times_tug:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>______<br/> times_agency:<br/> - ETA Berth < 16 Stunden entfernt | gelb |
| 0001 - K | Schlepper / ausgehend + Verholung | times_tug:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETD Berth | gelb |
| 0001 - L | Terminal / einkommend | times_terminal:<br/> - participant_id = ausgefüllt<br/> - Operation Start = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETA Berth | gelb, aktuell __deaktiviert__! |
| 0001 - M | Terminal / ausgehend + Verholung | times_terminal:<br/> - participant_id = ausgefüllt<br/> - Operation Ende = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETD Berth | gelb, aktuell __deaktiviert__! |
| 0002 | Zeiten für einen Eintrag weichen voneinander ab | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur, Festmacher usw. - außer BSMD-Spalte)<br/> - Zeiten ungleich (leere Einträge nicht berücksichtigen => 0001) | |
| 0002 - A | Agentur + Festmacher + Hafenamt + Lotsen + Schlepper / einkommend | Schnittmenge aus:<br/>times_agency:<br/> - ETA Berth <br/>____und____<br/>times_mooring:<br/> - ETA Berth <br/>____und____<br/>times_portauthority:<br/>- ETA Berth <br/>____und____<br/>times_pilot:<br/> - ETA Berth <br/>____und____<br/>times_tug:<br/> - ETA Berth | rot |
| 0002 - B | Agentur + Festmacher + Hafenamt + Lotsen + Schlepper / ausgehend | Schnittmenge aus:<br/>times_agency:<br/> - ETD Berth <br/>____und____<br/>times_mooring:<br/> - ETD Berth <br/>____und____<br/>times_portauthority:<br/>- ETD Berth <br/>____und____<br/>times_pilot:<br/> - ETD Berth <br/>____und____<br/>times_tug:<br/> - ETD Berth | rot |
| 0002 - C | Agentur + Festmacher + Hafenamt + Lotsen + Schlepper / Verholung | Schnittmenge aus:<br/>times_agency:<br/> - ETD Berth <br/>____und____<br/>times_mooring:<br/> - ETD Berth <br/>____und____<br/>times_portauthority:<br/>- ETD Berth <br/>____und____<br/>times_pilot:<br/> - ETD Berth <br/>____und____<br/>times_tug:<br/> - ETD Berth | rot |
| 0003 | Arbeitszeit überschneidet sich mit Fahrtzeit | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Terminal)<br/> - Zeiten passt nicht zu Ankunft / Abfahrt (leere Einträge nicht berücksichtigen => 0001) | |
| 0003 - A | Terminal / einkommend | times_terminal:<br/> - Operation Start<br/>___vor (kleiner als)____<br/> times_agency:<br/> - ETA Berth | rot, aktuell __deaktiviert__! |
| 0003 - B | Terminal / ausgehend + Verholung | times_terminal:<br/> - Operation Ende<br/>___nach (größer als)____<br/> times_agency:<br/> - ETD Berth | rot, aktuell __deaktiviert__! |
| 0004 | Tidezeiten passen nicht zu Fahrzeiten | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur)<br/> - Tidezeit ausgefüllt | |
| 0004 - A | Agentur / einkommend | times_agency:<br/> - ETA Berth <br/>___vor (kleiner als)____<br/> times_agency:<br/> - Tidefenster von <br/>___und/oder___nach (größer als)____<br/> times_agency:<br/> - Tidefenster bis | rot |
| 0004 - B | Agentur / ausgehend + Verholung | times_agency:<br/> - ETD Berth <br/>___vor (kleiner als)____<br/> times_agency:<br/> - Tidefenster von <br/>___und/oder___nach (größer als)____<br/> times_agency:<br/> - Tidefenster bis | rot |
| 0005 | Zu viele Schiffe mit gleicher Fahrtzeit | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur)<br/>- Übergreifend über die Einträge | |
| 0005 - A | Agentur / einkommend + ausgehend + Verholung | ____Zählen wenn gleich:____<br/> times_agency:<br/> - ETA Berth <br/>___und____<br/> times_agency:<br/> - ETD Berth<br/>___mehr als 3____<br/> | gelb |
| 0006 | Agentur und Terminal planen mit unterschiedlichen Liegeplätzen | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur / Terminal)<br/>- LP jeweils ausgefüllt | |
| 0006 - A | Agentur + Terminal (Liegeplatz) / einkommend + ausgehend + Verholung | times_agency:<br/> - Liegeplatz<br/>____ungleich____<br/>times_terminal:<br/> - Liegeplatz | gelb |
| 0006 - B | Agentur + Terminal (Anlegeseite) / einkommend + ausgehend + Verholung | times_agency:<br/> - Anlegeseite<br/>____ungleich____<br/>times_terminal:<br/> - Anlegeseite | gelb |

View File

@ -0,0 +1,585 @@
{
"info": {
"_postman_id": "9242b2d1-196b-4b2e-af57-c0e9eb141dba",
"name": "BreCal",
"description": "Bremen Calling relevant API calls",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "10427908"
},
"item": [
{
"name": "Login user",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let responseData = pm.response.json();\r",
"pm.environment.set(\"LOGON_TOKEN\", responseData.token)\r",
"console.log(\"Id: \" + responseData.id)"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\" : \"Londo\",\r\n \"password\" : \"Hallowach\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/login",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"login"
]
}
},
"response": []
},
{
"name": "Participant GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/participants",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"participants"
]
}
},
"response": []
},
{
"name": "History GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/history?shipcall_id=79",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"history"
],
"query": [
{
"key": "shipcall_id",
"value": "79"
}
]
}
},
"response": []
},
{
"name": "Shipcalls GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/shipcalls",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"shipcalls"
]
}
},
"response": []
},
{
"name": "Shipcalls POST",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"anchored\": null,\r\n \"arrival_berth_id\": 144,\r\n \"bunkering\": null,\r\n \"canceled\": false,\r\n \"created\": \"0001-01-01T00:00:00\",\r\n \"departure_berth_id\": null,\r\n \"draft\": null,\r\n \"eta\": \"2024-04-10T12:29:09.174\",\r\n \"etd\": null,\r\n \"evaluation\": null,\r\n \"evaluation_message\": null,\r\n \"flags\": null,\r\n \"id\": 0,\r\n \"modified\": null,\r\n \"moored_lock\": null,\r\n \"participants\": [\r\n {\r\n \"participant_id\": 136,\r\n \"type\": 8\r\n },\r\n {\r\n \"participant_id\": 11,\r\n \"type\": 32\r\n },\r\n {\r\n \"participant_id\": 1,\r\n \"type\": 1\r\n }\r\n ],\r\n \"pier_side\": null,\r\n \"pilot_required\": null,\r\n \"rain_sensitive_cargo\": null,\r\n \"recommended_tugs\": null,\r\n \"replenishing_lock\": null,\r\n \"replenishing_terminal\": null,\r\n \"ship_id\": 14,\r\n \"tidal_window_from\": null,\r\n \"tidal_window_to\": null,\r\n \"time_ref_point\": 0,\r\n \"tug_required\": null,\r\n \"type\": \"arrival\",\r\n \"voyage\": null\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/shipcalls",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"shipcalls"
]
}
},
"response": []
},
{
"name": "Shipcalls PUT",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"type\": \"shifting\", \"evaluation\": \"green\", \"id\": 33, \"ship_id\": 2, \"eta\": \"2024-01-27T18:00:21\", \"etd\": \"2024-01-25T17:00:45\", \"arrival_berth_id\": 168, \"departure_berth_id\": 184, \"rain_sensitive_cargo\": \"False\", \"time_ref_point\": 1, \"participants\": [{\"participant_id\": 6, \"type\": 8}, {\"participant_id\": 11, \"type\": 32}, {\"participant_id\": 9, \"type\": 64}, {\"participant_id\": 1, \"type\": 1}], \"created\": \"2023-10-24T11:41:16\", \"modified\": \"2024-02-23T14:50:07\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/shipcalls",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"shipcalls"
]
}
},
"response": []
},
{
"name": "Berths GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/berths",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"berths"
]
}
},
"response": []
},
{
"name": "Notifications GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/notifications?shipcall_id=4",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"notifications"
],
"query": [
{
"key": "shipcall_id",
"value": "4"
}
]
}
},
"response": []
},
{
"name": "Ships GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/ships",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"ships"
]
}
},
"response": []
},
{
"name": "Ships PUT",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 17,\r\n \"name\": \"Testschiff 1\",\r\n \"imo\": 1231231,\r\n \"callsign\": \"TEST1\",\r\n \"participant_id\": null,\r\n \"length\": 202.0,\r\n \"width\": 25.0,\r\n \"is_tug\": 0,\r\n \"bollard_pull\": null,\r\n \"eni\": null,\r\n \"created\": \"2024-04-03T07:49:29\",\r\n \"modified\": null,\r\n \"deleted\": 0\r\n}"
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/ships",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"ships"
]
}
},
"response": []
},
{
"name": "Ships POST",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\": \"Testschiff 02\",\r\n \"imo\": 9999992,\r\n \"length\": 100.2,\r\n \"width\": 16.5,\r\n \"is_tug\": 0,\r\n \"bollard_pull\": 42,\r\n \"callsign\": \"9992\",\r\n \"participant_id\": null,\r\n \"eni\": 1\r\n }"
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/ships",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"ships"
]
}
},
"response": []
},
{
"name": "Ships DELETE",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 15,\r\n \"name\": \"Testschiff 01\",\r\n \"imo\": 9999991\r\n }"
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/ships",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"ships"
]
}
},
"response": []
},
{
"name": "Times GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/times?shipcall_id=112",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"times"
],
"query": [
{
"key": "shipcall_id",
"value": "112"
}
]
}
},
"response": []
},
{
"name": "Times POST",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"start_planned\" : \"2023-04-18T07:18:19\",\r\n \"end_planned\" : \"2023-04-18T09:18:19\", \r\n \"shipcall_id\" : 1,\r\n \"participant_id\" : 1\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/times",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"times"
]
}
},
"response": []
},
{
"name": "Times PUT",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"etd_berth\" : \"2023-01-09T05:00:39\", \r\n \"id\" : 11,\r\n \"participant_id\": 2,\r\n \"remarks\": \"test 23\",\r\n \"shipcall_id\" : 4,\r\n \"pier_side\" : 0\r\n \r\n}\r\n\r\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/times",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"times"
]
}
},
"response": []
},
{
"name": "Times DELETE",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/times?id=118",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"times"
],
"query": [
{
"key": "id",
"value": "118"
}
]
}
},
"response": []
},
{
"name": "User PUT",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 2, \r\n \"old_password\" : \"Gurkensalat\",\r\n \"new_password\" : \"Hallowach\"\r\n}"
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/user",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"user"
]
}
},
"response": []
}
],
"auth": {
"type": "bearer"
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
}

8600
misc/BreCalApi.cs Normal file

File diff suppressed because it is too large Load Diff

1978
misc/BreCalApi.yaml Normal file

File diff suppressed because it is too large Load Diff

126
misc/Deployment.md Normal file
View File

@ -0,0 +1,126 @@
# System deployment
___
## Prerequisites
## Client
Deployment of the productive client:
- create a branch release/pub_<version> from test release branch
- remove all text references to 'test' (changing target url in the process)
- rename application in settings
- change BG_COLOR in settings to #203864
- user deployment publish xml
## Database
## Backend / Flask app
In order to not have complicated and error-prone copying manoevers a direct deployment from the repo is used using git.
### File structure
### Installation steps
1) Created a ssh-key for the user that does the installation on the server following the Github [instructions](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
2) Deploy generated key to the Github user account.
3) In the shell, activate ssh-agent and add the key. For example:
```bash
eval ($ssh-agent)
ssh-add ~/.ssh/od_ed25519
```
4) Change to deployment folder
e.g.
```bash
cd /var/www/brecal_test
```
5) Perform sparse checkout on the Flask server subtree
```bash
git clone -n git@github.com:puls200/brecal.git <target_folder>
cd <target_folder>
git sparse-checkout set --no-cone src/server
git checkout
```
6) Database credentials are stored outside the web root, we are using /var/www/secure. Here the file ```connection_data.json``` is placed, a different named copy for each instance.
### Changing Devel / Test / Prod Environment
Please note that in the "develop" branch the environment and paths are set to the "devel" setting. If a deployment is made (to testing or to the production) the scripts ```copytest.sh``` and ```copyprod.sh``` have to be run. These scripts will change the environment and paths to the respective settings.
There is also a script called ```bump-version.sh``` which can be used to upgrade all version entries in the repository.
### Installing Requirements
Python 3.11 & Pip3.11 installation (linux), virtualenv package
Optional, Step 0: Python source installation
Windows (untested):
Python 3.11: https://www.geeksforgeeks.org/download-and-install-python-3-latest-version/
PIP package manager (in command window): py -m ensurepip --upgrade
Virtual Environment 'virtualenv': https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html
Linux:
Python 3.11 & the PIP package manager: https://tecadmin.net/how-to-install-python-3-11-on-ubuntu-22-04/
Virtual Environment 'virtualenv'
### Building the Virtual Environment
Create a virtualenv called '.venv' with a specified python version, such as python3.11
All python packages will be installed in the virtual environment. Upon running the application,
make sure to activate the virtual environment before starting it.
Windows: # on windows, provide the full path, as obtained by "where python"
1.) Relocate to the 'brecal' directory
cd brecal
2.) create a virtual environment with the name '.venv'
where python
virtualenv --python {python_path} .venv
3.) activate the virtual environment and install
.venv\Scripts\activate
cd ./src/server
pip install -r requirements.txt
Linux:
1.) Relocate to the 'brecal' directory
cd brecal
2.) create a virtual environment with the name '.venv'
virtualenv --python python311 .venv
3.) activate the virtual environment and install
source .venv/bin/activate
cd ./src/server
pip install -r requirements.txt
### Testing (using 'pytest')
All tests in the directory brecal/src/server/tests can be run automatically with the 'pytest' module It recognizes any function within these
scripts, as these use 'test_'-prefixes. The module can be used to run the tests or even to create coverage reports, which show, what portions
of the directory are still untested. When the pytest module is installed, one can use a single line of code to run all tests.
1.) Relocate to the application's directory
cd brecal/src/server
2.) activate the virtual environment
Windows:
source .venv\Scripts\activate
Linux:
source .venv\bin\activate
3.) run the tests
option1: run pytest as a standalone
pytest tests/
option2: run pytest & coverage report (inspects coverage for the folder 'BreCal' by running each test in 'tests/'
this creates a folder with the name 'coverage_reports', where .html files are created and can be observed by a developer.
the coverage files are typically ignored by .gitignore
pytest --cov BreCal tests/

50
misc/Readme.md Normal file
View File

@ -0,0 +1,50 @@
# Database Bremen Calling
## Server
mariadb v 10
## Getting started
- Execute 'create_schema.sql' and import 'sample_data.sql'
If the database is updated or changed, please update these files.
To avoid errors, it is best to drop the entire database, edit the create script and re-import the sample data.
## Creating the dump file
```bash
mysqldump -u [username] -p --no-create-info --complete-insert bremen_calling > sample_data.sql
```
## Removing existing tables
We want only to remove the tables in order to preserve user privileges
```sql
SELECT concat('DROP TABLE IF EXISTS `', table_name, '`;')
FROM information_schema.tables
WHERE table_schema = 'bremen_calling';
```
outputs complete drop statements
```sql
SET FOREIGN_KEY_CHECKS = 0;
-- Your semicolon separated list of DROP statements here
DROP TABLE IF EXISTS `notification`;
DROP TABLE IF EXISTS `role`;
DROP TABLE IF EXISTS `ship`;
DROP TABLE IF EXISTS `participant`;
DROP TABLE IF EXISTS `times`;
DROP TABLE IF EXISTS `role_securable_map`;
DROP TABLE IF EXISTS `user_role_map`;
DROP TABLE IF EXISTS `user`;
DROP TABLE IF EXISTS `securable`;
DROP TABLE IF EXISTS `shipcall_participant_map`;
DROP TABLE IF EXISTS `berth`;
DROP TABLE IF EXISTS `shipcall`;
SET FOREIGN_KEY_CHECKS = 1;
```

19
misc/Readme_yaml.md Normal file
View File

@ -0,0 +1,19 @@
# Bremen Calling Open API spec
## Infos zur Generierung der CS Wrapper / Mapping Datei aus YAML
Verwendung von "OpenAPIGenerator" aus dem [Rest API Client Code Generator 2022](https://marketplace.visualstudio.com/items?itemName=ChristianResmaHelle.ApiClientCodeGenerator2022).
Die automatisch generierte Datei muss leider noch nachgearbeitet werden:
1) #pragma warning disable CS8073 (direkt nach der NS declaration).
2) #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' (am Schluss vor der schließenden Klammer des NS)
3) Für readOnly Properties wird bei einem Enum kein korrekter Code emittiert. Daher muss aktuell folgende Funktion ergänzt werden, damit beim Speichern das "evaluation" Flag nicht mitgesendet wird:
```C++
public bool ShouldSerializeEvaluation()
{
return false;
}
```
Witziger(!)weise funktioniert es für das Property EvaluationMessage korrekt.

0
misc/ReleaseNotes.md Normal file
View File

View File

@ -0,0 +1,27 @@
{
"id": "a3b2b291-6ec7-4af8-9ba6-57448547f71b",
"name": "Remote BreCal EMSWE",
"values": [
{
"key": "PATH",
"value": "brecal.bsmd-emswe.eu/",
"type": "default",
"enabled": true
},
{
"key": "LOGON_TOKEN",
"value": "",
"type": "any",
"enabled": true
},
{
"key": "SCHEMA",
"value": "https://",
"type": "default",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2023-06-27T09:33:59.460Z",
"_postman_exported_using": "Postman/10.15.4"
}

32
misc/add_user.py Normal file
View File

@ -0,0 +1,32 @@
import mysql.connector
import os
import json
import bcrypt
config_path = '../src/server/BreCal/connection_data.json'
print (os.getcwd())
if not os.path.exists(config_path):
print ('cannot find ' + config_path)
exit(1)
f = open(config_path);
connection_data = json.load(f)
mydb = mysql.connector.connect(host=connection_data["host"], user=connection_data["user"],
password = connection_data["password"], database=connection_data["database"])
print(mydb)
# insert a new user
participant_id = 1
first_name = "Londo"
last_name = "Mollari"
user_name = "Londo"
user_email = "l.mollari@centauri.gov"
user_phone = "+01 555 324 2313"
password = "Hallowach"
password_hash = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt( 12 )).decode('utf8')
query = "INSERT INTO user (participant_id, first_name, last_name, user_name, user_email, user_phone, password_hash) VALUES (" + str(participant_id) + ",\"" + first_name + "\",\"" + last_name + "\",\"" + user_name + "\",\"" + user_email + "\",\"" + user_phone + "\",\"" + password_hash + "\")"
with mydb.cursor() as cursor:
cursor.execute(query)
mydb.commit()

BIN
misc/brecal.snk Normal file

Binary file not shown.

25
misc/bump-version.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
CURRENT_VERSION=$(cat version.txt)
NEW_VERSION="${1}"
if [ -z "${NEW_VERSION}" ]; then
echo "No new version given"
exit 1
fi
echo "Bumping version ${CURRENT_VERSION} to ${NEW_VERSION}"
CURRENT_VERSION=$(printf '%s\n' "$CURRENT_VERSION" | sed -e 's/[\/&]/\\&/g')
NEW_VERSION=$(printf '%s\n' "$NEW_VERSION" | sed -e 's/[\/&]/\\&/g')
echo "Found the following matching version strings:"
git grep -I "${CURRENT_VERSION}"
echo "Proceed? [N/y]"
read proceed
if [ "${proceed}" = "y" ]; then
git grep -Il "${CURRENT_VERSION}" | xargs sed --in-place -e "s/${CURRENT_VERSION}/${NEW_VERSION}/g"
git add $(git grep -Il "${NEW_VERSION}")
fi

View File

@ -0,0 +1,23 @@
DELETE FROM times WHERE
times.shipcall_id IN
(
SELECT s.id FROM shipcall s
JOIN shipcall_participant_map spm ON s.id = spm.shipcall_id
JOIN participant p ON spm.participant_id = p.id
WHERE p.id = 10
);
DELETE `history` FROM `history`
JOIN shipcall s on `history`.shipcall_id = s.id
JOIN shipcall_participant_map spm ON s.id = spm.shipcall_id
WHERE spm.participant_id = 10;
-- damit das hier funktioniert muss der FK in shipcall_participant_map von "RESTRICT" auf "SET NULL"
-- geändert werden
DELETE shipcall FROM shipcall
INNER JOIN shipcall_participant_map spm ON shipcall.id = spm.shipcall_id
JOIN participant p ON spm.participant_id = p.id
WHERE p.id = 10;
DELETE FROM shipcall_participant_map WHERE participant_id = 10;

42
misc/copyprod.sh Normal file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# This script replaces all references to the development version with the test version
# 1) Database references and paths
git grep -I "connection_data_test.json" -- '..' ':(exclude)*.sh'
git grep -I "/var/www/brecal_test/" -- '..' ':(exclude)*.sh'
# 2) Color references
# Bar colors in client: (BG_COLOR)
# Devel: #1D751F
# Test: #751D1F
# Prod: #203864
git grep -I "#751D1F" -- '..' ':(exclude)*.sh'
# 3) Assembly name references
git grep -I "BreCalTestClient" -- '..' ':(exclude)*.sh'
echo "Proceed? [N/y]"
read proceed
# for color
if [ "${proceed}" = "y" ]; then
# 1. for database references and paths
git grep -I "connection_data_test.json" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/connection_data_test.json/connection_data_prod.json/g"
git add $(git grep -Il "connection_data_prod.json" -- '..' ':(exclude)*.sh')
git grep -I "/var/www/brecal_test/" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/\/var\/www\/brecal_test\//\/var\/www\/brecal\//g"
git add $(git grep -Il "/var/www/brecal/" -- '..' ':(exclude)*.sh')
# 2. for color
git grep -Il "#751D1F" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/#751D1F/#203864/g"
git add $(git grep -Il "#203864" -- '..' ':(exclude)*.sh')
# 3. for assembly name
git grep -I "BreCalTestClient" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/BreCalTestClient/BreCalClient/g"
git add $(git grep -Il "BreCalClient" -- '..' ':(exclude)*.sh')
fi

42
misc/copytest.sh Normal file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# This script replaces all references to the development version with the test version
# 1) Database references and paths
git grep -I "connection_data_devel.json" -- '..' ':(exclude)*.sh'
git grep -I "/var/www/brecal_devel/" -- '..' ':(exclude)*.sh'
# 2) Color references
# Bar colors in client: (BG_COLOR)
# Devel: #1D751F
# Test: #751D1F
# Prod: #203864
git grep -I "#1D751F" -- '..' ':(exclude)*.sh'
# 3) Assembly name references
git grep -I "BreCalDevelClient" -- '..' ':(exclude)*.sh'
echo "Proceed? [N/y]"
read proceed
# for color
if [ "${proceed}" = "y" ]; then
# 1. for database references and paths
git grep -Il "connection_data_devel.json" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/connection_data_devel.json/connection_data_test.json/g"
git add $(git grep -Il "connection_data_test.json" -- '..' ':(exclude)*.sh')
git grep -Il "/var/www/brecal_devel/" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/\/var\/www\/brecal_devel\//\/var\/www\/brecal_test\//g"
git add $(git grep -Il "/var/www/brecal_test/" -- '..' ':(exclude)*.sh')
# 2. for color
git grep -Il "#1D751F" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/#1D751F/#751D1F/g"
git add $(git grep -Il "#751D1F" -- '..' ':(exclude)*.sh')
# 3. for assembly name
git grep -Il "BreCalDevelClient" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/BreCalDevelClient/BreCalTestClient/g"
git add $(git grep -Il "BreCalTestClient" -- '..' ':(exclude)*.sh')
fi

352
misc/create_schema.sql Normal file
View File

@ -0,0 +1,352 @@
-- MySQL dump 10.13 Distrib 8.0.33, for Win64 (x86_64)
--
-- Host: localhost Database: bremen_calling_test
-- ------------------------------------------------------
-- Server version 8.0.34-0ubuntu0.22.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `berth`
--
DROP TABLE IF EXISTS `berth`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `berth` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) DEFAULT NULL COMMENT 'Descriptive name',
`lock` bit(1) DEFAULT NULL COMMENT 'The lock must be used',
`owner_id` int unsigned DEFAULT NULL,
`authority_id` int unsigned DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`),
KEY `FK_OWNER_PART_idx` (`owner_id`),
KEY `FK_AUTHORITY_PART_idx` (`authority_id`),
CONSTRAINT `FK_AUTHORITY_PART` FOREIGN KEY (`authority_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_OWNER_PART` FOREIGN KEY (`owner_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=195 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Berth of ship for a ship call';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `notification`
--
DROP TABLE IF EXISTS `notification`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `notification` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`times_id` int unsigned NOT NULL COMMENT 'times record that caused the notification',
`participant_id` int unsigned NOT NULL COMMENT 'participant ref',
`acknowledged` bit(1) DEFAULT b'0' COMMENT 'true if UI acknowledged',
`level` tinyint DEFAULT NULL COMMENT 'severity of the notification',
`type` tinyint DEFAULT NULL COMMENT 'Email/UI/Other',
`message` varchar(256) DEFAULT NULL COMMENT 'individual message',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_NOT_TIMES` (`times_id`),
KEY `FK_NOT_PART` (`participant_id`),
CONSTRAINT `FK_NOT_PART` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_NOT_TIMES` FOREIGN KEY (`times_id`) REFERENCES `times` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='An entry corresponds to an alarm given by a violated rule during times update';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `participant`
--
DROP TABLE IF EXISTS `participant`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `participant` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) DEFAULT NULL,
`street` varchar(128) DEFAULT NULL,
`postal_code` varchar(5) DEFAULT NULL,
`city` varchar(64) DEFAULT NULL,
`type` int DEFAULT NULL,
`flags` int unsigned DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='An organization taking part';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role`
--
DROP TABLE IF EXISTS `role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `role` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '0' COMMENT 'unique role name',
`description` varchar(255) DEFAULT '0' COMMENT 'role description',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='logical group of securables for one or more user';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role_securable_map`
--
DROP TABLE IF EXISTS `role_securable_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `role_securable_map` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`role_id` int unsigned NOT NULL,
`securable_id` int unsigned NOT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_ROLE_SECURABLE` (`role_id`),
KEY `FK_SECURABLE_ROLE` (`securable_id`),
CONSTRAINT `FK_ROLE_SECURABLE` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
CONSTRAINT `FK_SECURABLE_ROLE` FOREIGN KEY (`securable_id`) REFERENCES `securable` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Assigns securables to roles';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `securable`
--
DROP TABLE IF EXISTS `securable`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `securable` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Actual permission on a single(!) feature or operation';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ship`
--
DROP TABLE IF EXISTS `ship`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ship` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL,
`imo` int DEFAULT NULL,
`callsign` varchar(8) DEFAULT NULL,
`participant_id` int unsigned DEFAULT NULL,
`length` float DEFAULT NULL,
`width` float DEFAULT NULL,
`is_tug` bit(1) DEFAULT b'0',
`bollard_pull` int DEFAULT NULL,
`eni` int DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`),
KEY `FK_SHIP_PARTICIPANT` (`participant_id`),
CONSTRAINT `FK_SHIP_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `shipcall`
--
DROP TABLE IF EXISTS `shipcall`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `shipcall` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`ship_id` int unsigned DEFAULT NULL,
`type` tinyint DEFAULT NULL,
`eta` datetime DEFAULT NULL,
`voyage` varchar(16) DEFAULT NULL,
`etd` datetime DEFAULT NULL,
`arrival_berth_id` int unsigned DEFAULT NULL,
`departure_berth_id` int unsigned DEFAULT NULL,
`tug_required` bit(1) DEFAULT NULL,
`pilot_required` bit(1) DEFAULT NULL,
`flags` int unsigned DEFAULT '0',
`pier_side` bit(1) DEFAULT NULL,
`bunkering` bit(1) DEFAULT NULL,
`replenishing_terminal` bit(1) DEFAULT NULL,
`replenishing_lock` bit(1) DEFAULT NULL,
`draft` float DEFAULT NULL,
`tidal_window_from` datetime DEFAULT NULL,
`tidal_window_to` datetime DEFAULT NULL,
`rain_sensitive_cargo` bit(1) DEFAULT b'0',
`recommended_tugs` int DEFAULT '0',
`anchored` bit(1) DEFAULT NULL,
`moored_lock` bit(1) DEFAULT NULL,
`canceled` bit(1) DEFAULT NULL,
`evaluation` int unsigned DEFAULT NULL,
`evaluation_message` varchar(512) DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_SHIPCALL_SHIP` (`ship_id`),
KEY `FK_SHIPCALL_BERTH_ARRIVAL` (`arrival_berth_id`),
KEY `FK_SHIPCALL_BERTH_DEPARTURE` (`departure_berth_id`),
CONSTRAINT `FK_SHIPCALL_BERTH_ARRIVAL` FOREIGN KEY (`arrival_berth_id`) REFERENCES `berth` (`id`),
CONSTRAINT `FK_SHIPCALL_BERTH_DEPARTURE` FOREIGN KEY (`departure_berth_id`) REFERENCES `berth` (`id`),
CONSTRAINT `FK_SHIPCALL_SHIP` FOREIGN KEY (`ship_id`) REFERENCES `ship` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Incoming, outgoing or moving to another berth';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `shipcall_participant_map`
--
DROP TABLE IF EXISTS `shipcall_participant_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `shipcall_participant_map` (
`id` int NOT NULL AUTO_INCREMENT,
`shipcall_id` int unsigned DEFAULT NULL,
`participant_id` int unsigned DEFAULT NULL,
`type` int unsigned DEFAULT NULL COMMENT 'Type of participant role',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_MAP_PARTICIPANT_SHIPCALL` (`shipcall_id`),
KEY `FK_MAP_SHIPCALL_PARTICIPANT` (`participant_id`),
CONSTRAINT `FK_MAP_PARTICIPANT_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`),
CONSTRAINT `FK_MAP_SHIPCALL_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=128 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Associates a participant with a shipcall';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `shipcall_tug_map`
--
DROP TABLE IF EXISTS `shipcall_tug_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `shipcall_tug_map` (
`id` int NOT NULL AUTO_INCREMENT,
`shipcall_id` int unsigned NOT NULL COMMENT 'Ref to ship call',
`ship_id` int unsigned NOT NULL COMMENT 'Ref to ship (that is a tug)',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_SCT_SHIP` (`ship_id`),
KEY `FK_SCT_SHIPCALL` (`shipcall_id`),
CONSTRAINT `FK_SCT_SHIP` FOREIGN KEY (`ship_id`) REFERENCES `ship` (`id`),
CONSTRAINT `FK_SCT_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Mapping table that assigns tugs to a ship call';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `times`
--
DROP TABLE IF EXISTS `times`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `times` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`eta_berth` datetime DEFAULT NULL,
`eta_berth_fixed` bit(1) DEFAULT NULL,
`etd_berth` datetime DEFAULT NULL,
`etd_berth_fixed` bit(1) DEFAULT NULL,
`lock_time` datetime DEFAULT NULL,
`lock_time_fixed` bit(1) DEFAULT NULL,
`zone_entry` datetime DEFAULT NULL,
`zone_entry_fixed` bit(1) DEFAULT NULL,
`operations_start` datetime DEFAULT NULL,
`operations_end` datetime DEFAULT NULL,
`remarks` varchar(512) DEFAULT NULL,
`shipcall_id` int unsigned NOT NULL,
`participant_id` int unsigned NOT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`berth_id` int unsigned DEFAULT NULL,
`berth_info` varchar(512) DEFAULT NULL,
`pier_side` bit(1) DEFAULT NULL,
`participant_type` int unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_TIME_SHIPCALL` (`shipcall_id`),
KEY `FK_TIME_PART` (`participant_id`) /*!80000 INVISIBLE */,
KEY `FK_TIME_BERTH` (`berth_id`) /*!80000 INVISIBLE */,
CONSTRAINT `FK_TIME_BERTH` FOREIGN KEY (`berth_id`) REFERENCES `berth` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `FK_TIME_PART` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='the planned time for the participants work';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`participant_id` int unsigned DEFAULT NULL,
`first_name` varchar(45) DEFAULT NULL,
`last_name` varchar(45) DEFAULT NULL,
`user_name` varchar(45) DEFAULT NULL,
`user_email` varchar(128) DEFAULT NULL,
`user_phone` varchar(128) DEFAULT NULL,
`password_hash` varchar(128) DEFAULT NULL,
`api_key` varchar(256) DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_USER_PART` (`participant_id`),
CONSTRAINT `FK_USER_PART` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='member of a participant';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_role_map`
--
DROP TABLE IF EXISTS `user_role_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_role_map` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL DEFAULT '0',
`role_id` int unsigned NOT NULL DEFAULT '0',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_USER_ROLE` (`user_id`),
KEY `FK_ROLE_USER` (`role_id`),
CONSTRAINT `FK_ROLE_USER` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
CONSTRAINT `FK_USER_ROLE` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Assigns a user to a role';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2023-10-06 14:52:04

67
misc/disclaimer.html Normal file
View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="de">
<head>
<title>Information gemäß Art. 13 und Art. 14 DSGVO für Auftraggeber Software BremenCalling</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Information gemäß Art. 13 und Art. 14 DSGVO für Auftraggeber
Software BremenCalling</h1>
<hr />
Hier erhalten Sie Informationen gem. Art. 13 DSGVO über unseren Umgang mit Ihren Daten, wenn Sie die von uns betriebene Software „Bremen Calling“ nutzen.
<p>
<span style="text-decoration:underline;">Verantwortlicher:</span>
</p>
<p>
BREMER SCHIFFSMELDEDIENST Kapt. P. Langbein e.K.<br />
Vertreten durch die Geschäftsführer Bastian Güttner und Benjamin Wiese<br />
Hafenkopf II / Überseetor 20, 28217 Bremen / Germany<br />
Tel. +49 (0) 421 38 48 27<br />
E-Mail : report@bsmd.de<br />
</p>
<h2>Zweck der Datenverarbeitung:</h2>
<ul>
<li>Bereitstellung der Software „Bremen Calling“ zur Nutzung für Kunden und Auftraggeber</li>
</ul>
<h2>Rechtsgrundlage für die Datenverarbeitung:</h2>
Art. 6 Abs. 1 lit. b DSGVO (Vertrag, vorvertragliche Maßnahmen auf Anfrage der betroffenen Person)
<h2>Berechtigte Interesse des Verantwortlichen:</h2>
Hier nicht einschlägig.
<h3>Wozu benötigen wir Ihre Daten? („Hintergründe für die Bereitstellung der Daten“):</h3>
Wenn Sie unsere Software nutzen möchten, müssen wir Sie als Benutzer einrichten. Dies geschieht auf der Grundlage Ihrer (firmenbezogenen) E-Mail-Adresse und Ihres Namens.
<h3>Holen wir bei anderen Stellen außer bei Ihnen selber Informationen über Sie ein?</h3>
Nein.
<h3>Empfänger der Daten:</h3>
Wir verarbeiten Ihre Daten nur innerhalb des BSMD.
<h3>Übermittlung in Drittländer:</h3>
Eine Übermittlung Ihrer Daten in Staaten außerhalb der EU findet nicht statt.
<h3>Dauer der Speicherung:</h3>
Wir speichern Ihre Daten, solange wie Ihr Vertrag zur Nutzung unserer Software mit Ihnen besteht. Nach dem Ende unserer Geschäftsbeziehung stellen wir Ihre Benutzerdaten inaktiv und löschen sie nach sechs Monaten. Wir erarbeiten derzeit ein Löschkonzept, das ein systematisches Löschen von personenbezogenen Daten ermöglicht.
<h3>Ihre Rechte in Bezug auf Ihre Daten:</h3>
<p>
Sie können von uns Auskunft verlangen ob wir persönliche Daten von Ihnen speichern, und wenn ja, welche das sind und was wir damit tun (Art. 15 DSGVO).
</p>
<p>
Sollten wir unrichtige oder unvollständige Daten von Ihnen haben, können Sie die Berichtigung dieser Daten verlangen (Art. 16 DSGVO).
</p>
<p>
Sie können auch die Löschung Ihrer Daten verlangen (Art. 17 DSGVO). Es kann jedoch Gründe geben, aus denen wir Ihre Daten trotz Ihres Wunsches nicht löschen dürfen oder löschen müssen. Diese Gründe bestimmt das Gesetz. Wenn Sie von uns die Löschung Ihrer Daten verlangen, werden wir prüfen, ob möglicherweise solche Gründe vorliegen. Wenn nicht, löschen wir Ihre Daten. Die Alternative zur Löschung Ihrer Daten ist in bestimmten Fällen die Einschränkung der Verarbeitung Ihrer personenbezogenen Daten (Art. 18 DSGVO). Auch dabei gilt: lassen Sie uns wissen, wie Sie verfahren wollen, dann prüfen wir die gesetzlichen Vorgaben und finden einen Weg, der Ihre und unsere Interessen ausgleicht.
</p>
<p>
Art. 20 DSGVO sieht vor, dass wir Ihnen in bestimmten Fällen Ihre persönlichen Daten in einem strukturierten, gängigen und maschinenlesbaren Format zur Verfügung stellen müssen, wenn Sie es wünschen.
</p>
<p>
Möchten Sie von Ihren hier beschriebenen Rechten Gebrauch machen, genügt eine E-Mail an bremencalling@bsmd.de.
</p>
<p>
Wenn Sie der Meinung sind, dass wir die Datenschutzvorgaben für die Verarbeitung Ihrer Daten auf diesen Webseiten nicht einhalten, können Sie sich bei einer Datenschutz-Aufsichtsbehörde beschweren. Eine Liste der in Deutschland zuständigen Datenschutz-Aufsichtsbehörden finden Sie hier:
<a href="https://www.bfdi.bund.de/DE/Infothek/Anschriften_Links/anschriften_links-node.html">https://www.bfdi.bund.de/DE/Infothek/Anschriften_Links/anschriften_links-node.html</a>.
</p>
<hr />
<h4>
Stand dieser Datenschutzinformationen: April 2024
</h4>
</body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

14
misc/product_codes.txt Normal file
View File

@ -0,0 +1,14 @@
Bremen calling Installer Upgrade Codes:
======================================
Test: 1C7FA3E4-BAB9-4911-9348-73094357FC7C
Prod: 81A329F1-C663-48DA-9E15-DAF19F99B5AE
Product codes v1.2.2.3:
Test: 6F89CBAA-2189-456F-A347-0C0158325B61
Prod: 0ED342DD-DC00-4CE4-8348-96BB3AB726B1
Note:
If you want the MSI to "upgrade" from one version to the other, the
upgrade code must stay the same and the product code must change.

37
misc/requirements.txt Normal file
View File

@ -0,0 +1,37 @@
bcrypt==4.2.0
blinker==1.8.2
cached-property==1.5.2
click==8.1.7
coro-context-manager==0.2.0
coverage==7.6.1
dsnparse==0.1.15
Flask==3.0.3
Flask-JWT-Extended==4.6.0
iniconfig==2.0.0
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==2.1.5
marshmallow==3.22.0
marshmallow-enum==1.5.1
marshmallow_dataclass==8.7.1
mypy-extensions==1.0.0
mysql-connector-python==9.0.0
numpy==2.1.1
packaging==24.1
pandas==2.2.3
pluggy==1.5.0
pydapper==0.10.0
PyJWT==2.9.0
pytest==8.3.3
pytest-cov==5.0.0
python-dateutil==2.9.0.post0
pytz==2024.2
schedule==1.2.2
six==1.16.0
tqdm==4.66.5
typeguard==4.3.0
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.1
webargs==8.6.0
Werkzeug==3.0.4

153
misc/sample_data.sql Normal file

File diff suppressed because one or more lines are too long

192
misc/sample_static_data.sql Normal file
View File

@ -0,0 +1,192 @@
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server Version: 8.0.34-0ubuntu0.22.04.1 - (Ubuntu)
-- Server Betriebssystem: Linux
-- HeidiSQL Version: 10.2.0.5599
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Exportiere Daten aus Tabelle bremen_calling_test.berth: ~59 rows (ungefähr)
/*!40000 ALTER TABLE `berth` DISABLE KEYS */;
INSERT INTO `berth` (`id`, `name`, `lock`, `owner_id`, `authority_id`, `created`, `modified`, `deleted`) VALUES
(1, 'Roland Mühle', NULL, NULL, 11, '2023-06-26 14:01:40', '2023-10-06 15:04:08', b'1'),
(2, 'Stahlwerk', NULL, NULL, 11, '2023-06-26 14:01:40', '2023-10-06 15:04:08', b'1'),
(3, 'Kellogs', NULL, NULL, 11, '2023-06-26 14:01:40', '2023-10-06 15:04:08', b'1'),
(139, 'Avangard Dalben', NULL, 110, 136, '2023-08-21 08:23:35', '2023-10-06 16:06:01', b'0'),
(140, 'Avangard Kaje', NULL, 110, 11, '2023-08-21 08:23:35', '2023-10-06 15:04:08', b'0'),
(141, 'Baustelle 2', NULL, 111, 11, '2023-08-21 08:23:35', '2023-10-06 15:04:08', b'0'),
(142, 'BHW', NULL, 112, 11, '2023-08-21 08:23:36', '2023-10-06 15:04:08', b'0'),
(143, 'Dalben 2', NULL, 111, 11, '2023-08-21 08:23:36', '2023-10-06 15:04:08', b'0'),
(144, 'Dalben 3', NULL, 111, 11, '2023-08-21 08:23:36', '2023-10-06 15:04:08', b'0'),
(145, 'Egerland Kaje', NULL, 113, 11, '2023-08-21 08:23:36', '2023-10-06 15:04:08', b'0'),
(146, 'Getreideanlage Pier A', NULL, 114, 11, '2023-08-21 08:23:37', '2023-10-06 15:04:08', b'0'),
(147, 'Getreideanlage Pier D', NULL, 114, 11, '2023-08-21 08:23:37', '2023-10-06 15:04:08', b'0'),
(148, 'Griepe, Bnp Paribas', NULL, 115, 11, '2023-08-21 08:23:37', '2023-10-06 15:04:08', b'0'),
(149, 'Hafen F', NULL, 116, 11, '2023-08-21 08:23:37', '2023-10-06 15:04:08', b'0'),
(150, 'Hansa Landhandel', NULL, 117, 11, '2023-08-21 08:23:38', '2023-10-06 15:04:08', b'0'),
(151, 'Hansa Melasse', NULL, 118, 11, '2023-08-21 08:23:38', '2023-10-06 15:04:08', b'0'),
(152, 'Hansa-Mühle', NULL, 119, 11, '2023-08-21 08:23:38', '2023-10-06 15:04:08', b'0'),
(153, 'Heidelberger Sand', NULL, 120, 11, '2023-08-21 08:23:38', '2023-10-06 15:04:08', b'0'),
(154, 'HGM Bunkerstation', NULL, 121, 11, '2023-08-21 08:23:39', '2023-10-06 15:04:08', b'0'),
(155, 'HGM Tanklager', NULL, 121, 11, '2023-08-21 08:23:39', '2023-10-06 15:04:08', b'0'),
(156, 'Kap Horn Innen', NULL, 122, 11, '2023-08-21 08:23:39', '2023-10-06 15:04:08', b'0'),
(157, 'Kap Horn Weser', NULL, 122, 11, '2023-08-21 08:23:39', '2023-10-06 15:04:08', b'0'),
(158, 'Kap Horn Weser Bremer Recycling', NULL, 123, 11, '2023-08-21 08:23:40', '2023-10-06 15:04:08', b'0'),
(159, 'Kap Horn Weser -GHK-', NULL, 124, 11, '2023-08-21 08:23:40', '2023-10-06 15:04:08', b'0'),
(160, 'Kohlenhafen 2', NULL, 111, 11, '2023-08-21 08:23:40', '2023-10-06 15:04:08', b'0'),
(161, 'Kraftwerk Farge', NULL, 125, 11, '2023-08-21 08:23:40', '2023-10-06 15:04:08', b'0'),
(162, 'Kraftwerk Industriehafen', NULL, 126, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(163, 'Lankenau B', NULL, 111, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(164, 'Mibau, Bnp Paribas', NULL, 127, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(165, 'Müller Weser', NULL, 114, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(166, 'Osterort 5 Aussen', NULL, 111, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(167, 'Pier 2 Anleger', NULL, 128, 11, '2023-08-21 08:23:42', '2023-10-06 15:04:08', b'0'),
(168, 'Pier III', NULL, 129, 11, '2023-08-21 08:23:42', '2023-10-06 15:04:08', b'0'),
(169, 'Plump', NULL, 130, 11, '2023-08-21 08:23:42', '2023-10-06 15:04:08', b'0'),
(170, 'Rolandmühle', NULL, 131, 11, '2023-08-21 08:23:42', '2023-10-06 15:04:08', b'0'),
(171, 'Schleusenvorhafen Nord', NULL, 111, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(172, 'Schrägpier', NULL, 4, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(173, 'Schuppen 19', NULL, 132, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(174, 'Schuppen 20', NULL, 4, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(175, 'Schuppen 21', NULL, 4, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(176, 'Schuppen 22', NULL, 4, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(177, 'Schuppen 23', NULL, 4, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(178, 'Schuppen 24', NULL, 4, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(179, 'Seedalben Dlg-Seite', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(180, 'Seedalben Kw-Seite', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(181, 'Seehausen Spüler', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(182, 'Tankschiffliegeplatz 1', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(183, 'Tankschiffliegeplatz 2', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(184, 'Terminal 1', NULL, 10, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(185, 'Terminal 2', NULL, 10, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(186, 'Terminal 3', NULL, 10, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(187, 'Terminal 4', NULL, 10, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(188, 'TSR Recycling', NULL, 133, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(189, 'Viehbrücke', NULL, 111, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(190, 'Vulkan Industriegebiet', NULL, 120, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0'),
(191, 'Weserbahnhof', NULL, 132, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0'),
(192, 'Weser-Petrol Holzhafen', NULL, 134, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0'),
(193, 'Weser-Petrol Kalihafen', NULL, 134, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0'),
(194, 'Wesertanking', NULL, 135, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0');
/*!40000 ALTER TABLE `berth` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.participant: ~40 rows (ungefähr)
/*!40000 ALTER TABLE `participant` DISABLE KEYS */;
INSERT INTO `participant` (`id`, `name`, `street`, `postal_code`, `city`, `type`, `flags`, `created`, `modified`, `deleted`) VALUES
(1, 'Schick Informatik', 'Gottlieb-Daimler-Str. 8', '73614', 'Schorndorf', 1, 42, '2023-04-17 07:18:19', '2023-08-24 07:07:02', b'0'),
(2, 'Lotsenbrüderschaft Weser 1', '', '', '', 4, 0, '2023-08-10 07:07:41', NULL, b'0'),
(3, 'Bremer Schiffsmeldedienst', 'Hafenkopf II / Überseetor 20', '28217', 'Bremen', 1, 0, '2023-08-10 07:11:10', NULL, b'0'),
(4, 'BLG Cargo Logistics GmbH', '', '', '', 2, 0, '2023-08-10 07:14:40', NULL, b'0'),
(5, 'Schiffsmakler-Verband für Küsten und Seeschiffsbefrachter e.V.', '', '', '', 8, 0, '2023-08-10 07:15:56', NULL, b'0'),
(6, 'RMS Rhenus Maritime Services GmbH', '', '', '', 8, 1, '2023-08-10 07:19:29', '2023-09-06 09:02:53', b'0'),
(7, 'J.MÜLLER Weser GmbH & Co. KG', '', '', '', 10, 0, '2023-08-10 07:21:43', '2023-08-10 08:47:59', b'0'),
(8, 'Schiffahrtskontor Detra GmbH & Co.KG', '', '', '', 8, 0, '2023-08-10 07:23:04', NULL, b'0'),
(9, 'Boluda Deutschland GmbH', '', '', '', 64, 0, '2023-08-10 07:24:18', NULL, b'0'),
(10, 'Weserport GmbH', '', '', '', 10, 0, '2023-08-10 07:26:42', '2023-08-10 08:48:19', b'0'),
(11, 'Port Authority Bremen', '', '', '', 32, 0, '2023-08-10 07:28:11', NULL, b'0'),
(12, 'Nordenia Frachtkontor GmbH', '', '', '', 8, 0, '2023-08-21 06:52:04', NULL, b'0'),
(15, 'Extern', '', '', '', 0, 0, '2023-08-21 06:55:18', NULL, b'0'),
(16, 'FESTMA Vertäugesellschaft mbH', '', '', '', 16, 0, '2023-08-21 06:57:23', NULL, b'0'),
(110, 'Avangard', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:35', '2023-08-21 10:04:21', b'0'),
(111, 'Bremenports', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:35', '2023-08-21 10:04:21', b'0'),
(112, 'Bremer Holzwerke', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:36', '2023-08-21 10:04:21', b'0'),
(113, 'Egerland', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:36', '2023-08-21 10:04:21', b'0'),
(114, 'Müller J. Bremen', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:37', '2023-08-21 10:04:21', b'0'),
(115, 'Griepe', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:37', '2023-08-21 10:04:21', b'0'),
(116, 'Mseven Real Estate', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:37', '2023-08-21 10:04:21', b'0'),
(117, 'Hansa Landhandel', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:38', '2023-08-21 10:04:21', b'0'),
(118, 'Hansa Melasse', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:38', '2023-08-21 10:04:21', b'0'),
(119, 'Hansa-Mühle', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:38', '2023-08-21 10:04:21', b'0'),
(120, 'Heidelberger Sand Und Kies Gmbh', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:38', '2023-08-21 10:04:21', b'0'),
(121, 'HGM', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:39', '2023-08-21 10:04:21', b'0'),
(122, 'Kap-Horn Logistics Gmbh', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:39', '2023-08-21 10:04:21', b'0'),
(123, 'Bremer Recycling Kontor', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:39', '2023-08-21 10:04:21', b'0'),
(124, 'GHK', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:40', '2023-08-21 10:04:21', b'0'),
(125, 'Kraftwerk Farge Engie Gmbh & Co. KG', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:40', '2023-08-21 10:04:21', b'0'),
(126, 'Swb Erzeugung', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:40', '2023-08-21 10:04:21', b'0'),
(127, 'Mibau', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:41', '2023-08-21 10:04:21', b'0'),
(128, 'SWG', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:41', '2023-08-21 10:04:21', b'0'),
(129, 'Umweltschutz Nord Ganderkesee', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:42', '2023-08-21 10:04:21', b'0'),
(130, 'Nehlsen Industrieservice Gmbh & Co. KG', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:42', '2023-08-21 10:04:21', b'0'),
(131, 'Rolandmühle', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:42', '2023-08-21 10:04:21', b'0'),
(132, 'Wfb', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:43', '2023-08-21 10:04:21', b'0'),
(133, 'TSR', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:45', '2023-08-21 10:04:21', b'0'),
(134, 'Weser-Petrol', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:46', '2023-08-21 10:04:21', b'0'),
(135, 'Wesertanking', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:46', '2023-08-21 10:04:21', b'0'),
(136, 'TEST_BSMD', 'Überseetor 20', '28217', 'Bremen', 127, 1, '2023-10-04 11:54:36', '2023-10-13 11:37:51', b'0');
/*!40000 ALTER TABLE `participant` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.role: ~2 rows (ungefähr)
/*!40000 ALTER TABLE `role` DISABLE KEYS */;
INSERT INTO `role` (`id`, `name`, `description`, `created`, `modified`) VALUES
(1, 'My first role', 'A very good description', '2023-04-17 07:31:57', NULL),
(2, 'Another role', 'This role is very nice as well', '2023-04-17 07:32:12', NULL);
/*!40000 ALTER TABLE `role` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.securable: ~2 rows (ungefähr)
/*!40000 ALTER TABLE `securable` DISABLE KEYS */;
INSERT INTO `securable` (`id`, `name`, `created`, `modified`) VALUES
(1, 'First secure thing', '2023-04-17 07:38:12', NULL),
(2, 'Another secure thing', '2023-04-17 07:38:22', NULL);
/*!40000 ALTER TABLE `securable` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.ship: ~12 rows (ungefähr)
/*!40000 ALTER TABLE `ship` DISABLE KEYS */;
INSERT INTO `ship` (`id`, `name`, `imo`, `callsign`, `participant_id`, `length`, `width`, `is_tug`, `bollard_pull`, `eni`, `created`, `modified`, `deleted`) VALUES
(1, 'Dicke Berta', 1234567, 'DEBE', 1, 100, 20, b'0', NULL, NULL, '2023-06-27 10:43:02', NULL, b'0'),
(2, 'Maersk Neston', 9632167, '9V3532', 1, 210.07, 30.2, b'0', NULL, NULL, '2023-07-27 12:34:13', NULL, b'0'),
(3, 'AFRICAN HALCYON', 9343613, NULL, NULL, 177.13, 28.4, b'0', NULL, NULL, '2023-08-24 10:41:56', NULL, b'0'),
(4, 'AMIKO', 9125669, NULL, NULL, 99.98, 16.5, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(5, 'ARKLOW BEACON', 9638795, NULL, NULL, 119.49, 14.99, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(6, 'FWN ATLANTIDE', 9535620, NULL, NULL, 145.65, 18.25, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(7, 'IONIAN SPIRIT', 9747235, NULL, NULL, 179.9, 30, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(8, 'IRMA', 9180396, NULL, NULL, 199.9, 23.6, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(9, 'JANA', 9330185, NULL, NULL, 69.34, 12, b'0', NULL, NULL, '2023-08-24 10:42:18', NULL, b'0'),
(10, 'MEDI PERTH', 9804552, NULL, NULL, 199.99, 32.24, b'0', NULL, NULL, '2023-08-24 10:42:18', NULL, b'0'),
(11, 'S NEPTUNE', 9634892, NULL, NULL, 169.99, 27, b'0', NULL, NULL, '2023-08-24 10:42:18', NULL, b'0'),
(12, 'WESER STAHL', 9186687, NULL, NULL, 192, 32.26, b'0', NULL, NULL, '2023-08-24 10:42:18', NULL, b'0'),
(13, 'BOTHNIABORG', 9267728, 'PBIO', NULL, 153.05, 21.8, b'0', NULL, NULL, '2023-10-04 11:52:32', NULL, b'0');
/*!40000 ALTER TABLE `ship` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.user: ~27 rows (ungefähr)
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` (`id`, `participant_id`, `first_name`, `last_name`, `user_name`, `user_email`, `user_phone`, `password_hash`, `api_key`, `created`, `modified`) VALUES
(1, 1, 'Daniel', 'Schick', 'dani', NULL, NULL, '$2b$12$qfjw4b3XvGuu0t6HR8OYGOzF5b8gmC6PyIIBNbIXMXEayJunEEKmi', '0815', '2023-04-17 07:15:41', '2023-08-11 11:11:34'),
(2, 1, 'Londo', 'Mollari', 'Londo', 'l.mollari@centauri.gov', '+01 555 324 2314', '$2b$12$8r1oGQiWdiuQNoGbzm.z.OoCOc8.4YACN93k7ge7YDWKjQ8tPuTrm', NULL, '2023-06-27 08:34:55', '2023-10-28 12:04:54'),
(3, 2, 'Maik', 'Baudeck', 'maikb', NULL, NULL, '$2b$12$4SxGRlinOrpEVvqDZcE.wOusMZYsepdc6vj1vDpNhbPtApxU8VGPi', '', '2023-08-10 07:09:35', '2023-08-11 11:11:55'),
(4, 3, 'Christin', 'Hollmann', 'christinh', NULL, NULL, '$2b$12$evGJop3j19bNTkdg2GHrIeRedC7LG5SIHm8.hKhdUSrlXsp6sXBDG', '', '2023-08-10 07:12:05', '2023-10-04 11:48:13'),
(5, 3, 'Bastian', 'Güttner', 'bastiang', NULL, NULL, '$2b$12$0oCX3c2WyMykmxMoLqmpNubke713xhYlEEQgnxBV6Fj/TaUn.3/U6', '', '2023-08-10 07:12:26', '2023-08-11 11:11:13'),
(6, 3, 'Benjamin', 'Wiese', 'benjaminw', NULL, NULL, '$2b$12$RRj32KdLIf3D7z7cVWFqa.yZM5.ODOS0HqU3rdCuFrJS8HJ/rtqwy', '', '2023-08-10 07:13:01', '2023-08-11 11:11:16'),
(7, 1, 'Sladjan', 'Veselinovic', 'sladjanv', NULL, NULL, '$2b$12$4DctoCbZwxTvE39lXNRzneQ2kb/lXlJ5wEZ1CGbbw.rGM3nuAYjpa', '', '2023-08-10 07:13:39', '2023-08-11 11:11:45'),
(8, 1, 'Kersten', 'Gevers', 'kersteng', NULL, NULL, '$2b$12$zKX8iLPnXRmp5wD1Yp8P7e..U9R0A4ytbiMjd.l.IGkMzahcHPNWq', '', '2023-08-10 07:13:59', '2023-08-11 11:11:49'),
(9, 4, 'Dirk', 'Brunnert', 'dirkb', NULL, NULL, '$2b$12$HTeq/Fdfse6oElk7DLsQae5dtvWJloee.VtBH.THsj2kdcxxBkCDW', '', '2023-08-10 07:15:01', '2023-08-11 11:12:01'),
(10, 5, 'Thorsten', 'Fischer', 'thorstenf', NULL, NULL, '$2b$12$NHEpTNHuKU4ruPRIfd9yc.yv5faHGemFfRI3TISniqM7QNqHiyZpK', '', '2023-08-10 07:16:20', '2023-08-11 11:12:07'),
(11, 6, 'Lisa', 'Friedhoff', 'lisaf', NULL, NULL, '$2b$12$DJKJHGrQwfY9pwzgFfPds.DHGsygHyV3KDs38Hq4AUHPPs3jBPH3y', '', '2023-08-10 07:19:52', '2023-08-11 11:12:12'),
(12, 6, 'Dario', 'Fritschi', 'dariof', NULL, NULL, '$2b$12$MwCVTMQkN6zCAzCsE572Ye.M0nRDQNld4AgorLVyWq.DcQEmAy5lu', '', '2023-08-10 07:20:11', '2023-08-11 11:12:15'),
(13, 7, 'Hergen', 'Hanke', 'hergenh', NULL, NULL, '$2b$12$MKb6BDRrTbNd0qg5BdAS.upzlqxcWOgU/VEafJKSuzE9JLIWCimq6', '', '2023-08-10 07:22:09', '2023-08-11 11:12:24'),
(14, 8, 'Hardy', 'Paasch', 'hardyp', NULL, NULL, '$2b$12$l1lE/UqnYnOvci.N4j3zBOz6HC0z87ovnO0n6BIZYO7VN8gj.qGey', '', '2023-08-10 07:23:25', '2023-08-11 11:12:28'),
(15, 8, 'Marc', 'Pagel', 'marcp', NULL, NULL, '$2b$12$UCVJKzqX92Z8xZJ4kK0BRuFXMRdqcaXaGmBrqnYWARdKlPvZvLUZq', '', '2023-08-10 07:23:41', '2023-08-11 11:12:30'),
(16, 9, 'Andreas', 'Peukert', 'andreasp', NULL, NULL, '$2b$12$jNmciJAVR6p0IflvAthmk.j0SoOBvFHwDiEDKUHfwJq7baRsKg/LG', '', '2023-08-10 07:24:37', '2023-08-11 11:12:45'),
(17, 8, 'Christina', 'Rachiele', 'christinar', NULL, NULL, '$2b$12$BCsVgPRuIWPuuor07lprF.klQxvF901O3AXUhRrBJoEvYIjNQ.HKS', '', '2023-08-10 07:25:05', '2023-08-11 11:12:33'),
(18, 9, 'Sonia', 'Rekawek', 'soniar', NULL, NULL, '$2b$12$uHCkH6gu13yqllXBibLFIOWOpvctMC7NmojtXqDd6xsLq7bmvNOMu', '', '2023-08-10 07:25:27', '2023-08-11 11:12:48'),
(19, 6, 'Frank', 'Roelfs', 'frankr', NULL, NULL, '$2b$12$cEQAhUe9VJV6uTkfOY6/R.oAVfmFZQ4vS5G6BqoNEyaVHtFRDtB56', '', '2023-08-10 07:26:04', '2023-08-11 11:12:19'),
(20, 10, 'Vera', 'Schliedermann', 'veras', NULL, NULL, '$2b$12$FKcitW6W1HPwd.cdkZLGLeTFuzjsEIrbiKInysAKN.RibZ4gVLZHi', '', '2023-08-10 07:27:01', '2023-08-11 11:12:54'),
(21, 8, 'Michael', 'Strudthoff', 'michaels', NULL, NULL, '$2b$12$doTiywWpkso1UWB5eiAW1eoACP6rN4UDVt7qFFdRFvhhWUXikCmS2', '', '2023-08-10 07:27:27', '2023-08-11 11:12:37'),
(22, 4, 'Volker', 'Viohl', 'volkerv', NULL, NULL, '$2b$12$.YavQbWNE4eJDQA.ZNSKROYvMPWifBXyMX0IL0H2z50M720fpfTJW', '', '2023-08-10 07:27:50', '2023-08-11 11:12:04'),
(23, 11, 'Frauke', 'Zabel', 'fraukez', NULL, NULL, '$2b$12$rawQg6Cjl1yECGm9DOG8degdWdD.nZjEgGp8eXO98nh11QV1sEEEO', '', '2023-08-10 07:28:33', '2023-08-11 11:12:58'),
(24, 8, 'Jan', 'Zierow', 'janz', NULL, NULL, '$2b$12$CbnjUT42cf0mkIAqAURg3OksP9G3brmsE2GQTECTZ4.cVuhPn5D2G', '', '2023-08-10 07:28:55', '2023-08-11 11:12:39'),
(25, 12, 'Berit', 'Güstrau', 'beritg', NULL, NULL, '$2b$12$g8WJTEWwsrtMyqpVW/GFVuzyRjB2/n0YJJyvBx.3l51YiVEUjEQYy', '', '2023-08-21 06:52:35', NULL),
(26, 15, 'Ilknur', 'Colmorn', 'ilknurc', NULL, NULL, '$2b$12$tpEb0JQ8Li4YkPH28FeYk.1Jt2vK.TFn9SyhBKJ08gn7S5d8WYRlO', '', '2023-08-21 06:56:42', NULL),
(27, 16, 'Horst', 'Imgram', 'horsti', NULL, NULL, '$2b$12$05NFPSaP78puAa8pL39KrOKTafs/TzWwr4YfV4/Vrdu90assvNFZa', '', '2023-08-21 06:57:58', NULL),
(28, 136, 'Christin', 'Hollmann', 'chollmann', NULL, NULL, '$2b$12$pb1bWJ7hxOplFoqT/nIhyuRD39dxOpQ9t0LwZUI8CNOkTkE.eXiSO', '', '2023-10-04 11:55:05', NULL),
(29, 1, 'Max', 'Metz', 'maxm', NULL, NULL, '$2b$12$gm4EwjCF44Ls20vDHnlG/ew/cZ.DK4gcYed.OHER5J4OzZrA.9Jt.', '', '2023-10-06 13:02:56', '2023-10-13 11:53:35');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

View File

@ -0,0 +1,95 @@
-- add notification handling columns to shipcall
-- evaluation_time: Time when the "traffic light" was last changed
-- evaluation_notifications_sent: Flag to indicate if notifications were sent for the current evaluation
ALTER TABLE `bremen_calling_devel`.`shipcall`
ADD COLUMN `evaluation_time` DATETIME NULL DEFAULT NULL AFTER `evaluation_message`,
ADD COLUMN `evaluation_notifications_sent` BIT NULL AFTER `evaluation_time`,
ADD COLUMN `time_ref_point` INT NULL DEFAULT 0 COMMENT 'Index of a location which is the reference point for all time value entries, e.g. berth or Geeste' AFTER `modified`;
-- prepare notification table for historic notification data
-- removed reference to participant and times and dropped unnecessary columns
-- added reference to shipcall
ALTER TABLE `bremen_calling_devel`.`notification`
DROP FOREIGN KEY `FK_NOT_TIMES`,
DROP FOREIGN KEY `FK_NOT_PART`;
ALTER TABLE `bremen_calling_devel`.`notification`
DROP COLUMN `deleted`,
DROP COLUMN `acknowledged`,
DROP COLUMN `participant_id`,
DROP COLUMN `times_id`,
ADD COLUMN `shipcall_id` INT UNSIGNED NULL AFTER `id`,
ADD INDEX `FK_NOTIFICATION_SHIPCALL_idx` (`shipcall_id` ASC) VISIBLE,
DROP INDEX `FK_NOT_PART` ,
DROP INDEX `FK_NOT_TIMES` ;
;
ALTER TABLE `bremen_calling_devel`.`notification`
ADD CONSTRAINT `FK_NOTIFICATION_SHIPCALL`
FOREIGN KEY (`shipcall_id`)
REFERENCES `bremen_calling_devel`.`shipcall` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
-- added notification flags
-- participant reference is now mandatory
ALTER TABLE `bremen_calling_devel`.`user`
DROP FOREIGN KEY `FK_USER_PART`;
ALTER TABLE `bremen_calling_devel`.`user`
ADD COLUMN `notify_email` BIT NULL DEFAULT NULL AFTER `api_key`,
ADD COLUMN `notify_whatsapp` BIT NULL DEFAULT NULL AFTER `notify_email`,
ADD COLUMN `notify_signal` BIT NULL DEFAULT NULL AFTER `notify_whatsapp`,
ADD COLUMN `notify_popup` BIT NULL DEFAULT NULL AFTER `notify_signal`,
CHANGE COLUMN `participant_id` `participant_id` INT UNSIGNED NOT NULL ;
ALTER TABLE `bremen_calling_devel`.`user`
ADD CONSTRAINT `FK_USER_PART`
FOREIGN KEY (`participant_id`)
REFERENCES `bremen_calling_devel`.`participant` (`id`);
-- History table for change tracking
CREATE TABLE `bremen_calling_devel`.`history` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`participant_id` INT UNSIGNED NOT NULL,
`user_id` INT UNSIGNED NOT NULL,
`shipcall_id` INT UNSIGNED NOT NULL,
`timestamp` DATETIME NOT NULL COMMENT 'Time of saving',
`eta` DATETIME NULL COMMENT 'Current ETA / ETD value (depends if shipcall or times were saved)',
`type` INT NOT NULL COMMENT 'shipcall or times',
`operation` INT NOT NULL COMMENT 'insert, update or delete',
PRIMARY KEY (`id`))
COMMENT = 'This table stores a history of changes made to shipcalls so that everyone can see who changed what and when';
-- and foreign keys
ALTER TABLE `bremen_calling_devel`.`history`
ADD INDEX `FK_HISTORY_PARTICIPANT_idx` (`participant_id` ASC) VISIBLE,
ADD INDEX `FK_HISTORY_SHIPCALL_idx` (`shipcall_id` ASC) VISIBLE;
;
ALTER TABLE `bremen_calling_devel`.`history`
ADD CONSTRAINT `FK_HISTORY_PARTICIPANT`
FOREIGN KEY (`participant_id`)
REFERENCES `bremen_calling_devel`.`participant` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD CONSTRAINT `FK_HISTORY_SHIPCALL`
FOREIGN KEY (`shipcall_id`)
REFERENCES `bremen_calling_devel`.`shipcall` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD CONSTRAINT `FK_HISTORY_USER`
FOREIGN KEY (`user_id`)
REFERENCES `bremen_calling_devel`.`user` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
-- add additional fields to times
ALTER TABLE `bremen_calling_devel`.`times`
ADD COLUMN `ata` DATETIME NULL DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATA' AFTER `participant_type`,
ADD COLUMN `atd` DATETIME NULL DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATD' AFTER `ata`,
ADD COLUMN `eta_interval_end` DATETIME NULL DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.' AFTER `atd`;
ADD COLUMN `etd_interval_end` DATETIME NULL DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.' AFTER `eta_interval_end`;

View File

@ -0,0 +1,57 @@
CREATE TABLE `port` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL COMMENT 'Name of port',
`locode` char(5) DEFAULT NULL COMMENT 'UNECE locode',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Port as reference for shipcalls and berths';
-- Add default port to table
INSERT INTO port (id, name, locode) VALUES (1, 'Bremen', 'DEBRE');
-- Adding new ref column to berth
ALTER TABLE `berth`
ADD COLUMN `port_id` INT UNSIGNED DEFAULT NULL AFTER `authority_id`;
ALTER TABLE `berth` ALTER INDEX `FK_AUTHORITY_PART_idx` INVISIBLE;
-- adding a foreign key berth.port_id -> port.id
ALTER TABLE `berth`
ADD INDEX `FK_PORT_PART_idx` (`port_id` ASC) VISIBLE;
ALTER TABLE `berth`
ADD CONSTRAINT `FK_PORT`
FOREIGN KEY (`port_id`)
REFERENCES `port` (`id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
-- adding new ref column to shipcall incl. foreign key
ALTER TABLE `shipcall`
ADD COLUMN `port_id` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Selected port for this shipcall' AFTER `evaluation_notifications_sent`,
CHANGE COLUMN `time_ref_point` `time_ref_point` INT NULL DEFAULT '0' COMMENT 'Index of a location which is the reference point for all time value entries, e.g. berth or Geeste' AFTER `port_id`,
ADD INDEX `FK_SHIPCALL_PORT_idx` (`port_id` ASC) VISIBLE;
;
ALTER TABLE `shipcall`
ADD CONSTRAINT `FK_SHIPCALL_PORT`
FOREIGN KEY (`port_id`)
REFERENCES `port` (`id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
CREATE TABLE `participant_port_map` (
`id` int NOT NULL AUTO_INCREMENT,
`participant_id` int unsigned NOT NULL COMMENT 'Ref to participant',
`port_id` int unsigned NOT NULL COMMENT 'Ref to port',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_PP_PARTICIPANT` (`participant_id`),
KEY `FK_PP_PORT` (`port_id`),
CONSTRAINT `FK_PP_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_PP_PORT` FOREIGN KEY (`port_id`) REFERENCES `port` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Mapping table that assigns participants to a port';
-- all existing berths shall default to "bremen"
UPDATE berth SET port_id = 1 where port_id is null;

1
misc/version.txt Normal file
View File

@ -0,0 +1 @@
1.6.0.4

View File

@ -0,0 +1,135 @@
[*.cs]
# CS8073: The result of the expression is always the same since a value of this type is never equal to 'null'
dotnet_diagnostic.CS8073.severity = none
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_indent_labels = one_less_than_current
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_space_around_binary_operators = before_and_after
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_static_local_function = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent
csharp_style_var_elsewhere = false:silent
# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = none
[*.{cs,vb}]
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_readonly_field = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
dotnet_code_quality_unused_parameters = all:suggestion
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent

View File

@ -0,0 +1,62 @@
<Window x:Class="BreCalClient.AboutDialog"
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:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="Help" Height="374" Width="500" Loaded="Window_Loaded">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="Projektleitung" HorizontalContentAlignment="Right"/>
<Label Grid.Column="0" Grid.Row="1" Content="Softwareentwicklung" HorizontalContentAlignment="Right"/>
<TextBlock Grid.Column="1" Grid.Row="0" VerticalAlignment="Center">
<Hyperlink NavigateUri="https://www.bsmd.de" RequestNavigate="Hyperlink_RequestNavigate">
Bremer Schiffsmeldedienst
</Hyperlink>
</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" VerticalAlignment="Center">
<Hyperlink NavigateUri="http://www.textbausteine.net/" RequestNavigate="Hyperlink_RequestNavigate">
Informatikbüro Daniel Schick
</Hyperlink>
</TextBlock>
<Label FontWeight="DemiBold" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textChangeContactInfo}" HorizontalContentAlignment="Right"/>
<Label Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textEmail}" HorizontalContentAlignment="Right" />
<Label Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textPhone}" HorizontalContentAlignment="Right" />
<TextBox Name="textBoxUserEmail" Grid.Column="1" Grid.Row="4" Margin="2" VerticalContentAlignment="Center" />
<TextBox Name="textBoxUserPhone" Grid.Column="1" Grid.Row="5" Margin="2" VerticalContentAlignment="Center" />
<Label FontWeight="DemiBold" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textChangePassword}" HorizontalContentAlignment="Right"/>
<xctk:WatermarkPasswordBox Watermark="{x:Static p:Resources.textOldPassword}" Grid.Column="1" Grid.Row="7" Margin="2" x:Name="wpBoxOldPassword" TextChanged="wpBoxOldPassword_TextChanged"/>
<xctk:WatermarkPasswordBox Watermark="{x:Static p:Resources.textNewPassword}" Grid.Column="1" Grid.Row="8" Margin="2" x:Name="wpBoxNewPassword" TextChanged="wpBoxOldPassword_TextChanged"/>
<xctk:WatermarkPasswordBox Watermark="{x:Static p:Resources.textRepeatNewPassword}" Grid.Column="1" Grid.Row="9" Margin="2" x:Name="wpBoxNewPasswordRepeat" TextChanged="wpBoxOldPassword_TextChanged"/>
<Button x:Name="buttonChangePassword" Click="buttonChangePassword_Click" Grid.Column="1" Grid.Row="10" Margin="2" Content="{x:Static p:Resources.textChange}" Width="80" HorizontalAlignment="Left" IsEnabled="True" />
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Column="1" Grid.Row="12" HorizontalAlignment="Right" />
</Grid>
</Window>

View File

@ -0,0 +1,85 @@
// Copyright (c) 2023 schick Informatik
// Description: Show about info and allow user detail editing
//
using BreCalClient.misc.Model;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for AboutDialog.xaml
/// </summary>
public partial class AboutDialog : Window
{
#region Construction
public AboutDialog()
{
InitializeComponent();
}
#endregion
#region Properties
public LoginResult? LoginResult { get; set; }
#endregion
#region events
public event Action<string, string>? ChangePasswordRequested;
#endregion
#region event handler
private void buttonClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void buttonChangePassword_Click(object sender, RoutedEventArgs e)
{
if (this.LoginResult != null)
{
this.LoginResult.UserPhone = this.textBoxUserPhone.Text.Trim();
this.LoginResult.UserEmail = this.textBoxUserEmail.Text.Trim();
}
this.ChangePasswordRequested?.Invoke(this.wpBoxOldPassword.Password, this.wpBoxNewPassword.Password);
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
e.Handled = true;
}
private void wpBoxOldPassword_TextChanged(object sender, TextChangedEventArgs e)
{
this.buttonChangePassword.IsEnabled =
(this.wpBoxOldPassword.Password.Length > 0) &&
(this.wpBoxNewPassword.Password.Length > 0) &&
(this.wpBoxNewPasswordRepeat.Password.Length > 0) &&
this.wpBoxNewPassword.Password.Equals(this.wpBoxNewPasswordRepeat.Password) &&
(!this.wpBoxNewPassword.Password.Equals(this.wpBoxOldPassword.Password));
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if(LoginResult != null)
{
this.textBoxUserEmail.Text = LoginResult.UserEmail;
this.textBoxUserPhone.Text = LoginResult.UserPhone;
}
}
#endregion
}
}

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="BreCalClient.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="BreCalClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<log4net>
<root>
<level value="DEBUG"/>
<appender-ref ref="LogFileAppender"/>
</root>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="log-BreCalClient.txt"/>
<param name="AppendToFile" value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="10MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%date [%thread] %-5level [%logger] - %message%newline"/>
</layout>
</appender>
</log4net>
<applicationSettings>
<BreCalClient.Properties.Settings>
<setting name="BG_COLOR" serializeAs="String">
<value>#751D1F</value>
</setting>
<setting name="APP_TITLE" serializeAs="String">
<value>!!Bremen calling Testversion!!</value>
</setting>
<setting name="LOGO_IMAGE_URL" serializeAs="String">
<value>https://www.textbausteine.net/</value>
</setting>
<setting name="API_URL" serializeAs="String">
<value>https://brecaltest.bsmd-emswe.eu</value>
</setting>
</BreCalClient.Properties.Settings>
</applicationSettings>
<userSettings>
<BreCalClient.Properties.Settings>
<setting name="FilterCriteria" serializeAs="String">
<value />
</setting>
<setting name="Width" serializeAs="String">
<value>800</value>
</setting>
<setting name="Height" serializeAs="String">
<value>450</value>
</setting>
<setting name="Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="Top" serializeAs="String">
<value>0</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>
<setting name="W4Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="W4Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="FilterCriteriaMap" serializeAs="String">
<value />
</setting>
</BreCalClient.Properties.Settings>
</userSettings>
</configuration>

20
src/BreCalClient/App.xaml Normal file
View File

@ -0,0 +1,20 @@
<Application x:Class="BreCalClient.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BreCalClient"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
StartupUri="MainWindow.xaml" Exit="Application_Exit" Startup="Application_Startup" >
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources\StringResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
<sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">10</sys:Double>
<sys:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarHeightKey}">10</sys:Double>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -0,0 +1,34 @@
using BreCalClient.misc.Model;
using BreCalClient.Properties;
using System.Windows;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public static Participant Participant { get; set; } = new Participant();
private void Application_Exit(object sender, ExitEventArgs e)
{
BreCalClient.Properties.Settings.Default.Save();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
// Window size sanity check
if(Settings.Default.Width == 0)
{
Settings.Default.Width = 800;
Settings.Default.Save();
}
if(Settings.Default.Height == 0)
{
Settings.Default.Height = 450;
Settings.Default.Save();
}
}
}
}

View File

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@ -0,0 +1,23 @@
// Copyright (c) 2023 schick Informatik
// Description: Helper for combobox binding of bool to combobox
//
using System;
using System.Globalization;
using System.Windows.Data;
namespace BreCalClient
{
public class BoolToIndexConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((bool) value == true) ? 0 : 1;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((int)value == 0);
}
}
}

View File

@ -0,0 +1,154 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<SignAssembly>True</SignAssembly>
<StartupObject>BreCalClient.App</StartupObject>
<AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.6.0.4</AssemblyVersion>
<FileVersion>1.6.0.4</FileVersion>
<Title>Bremen calling client</Title>
<Description>A Windows WPF client for the Bremen calling API.</Description>
<ApplicationIcon>containership.ico</ApplicationIcon>
<AssemblyName>BreCalTestClient</AssemblyName>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\24hours.png" />
<None Remove="Resources\add.png" />
<None Remove="Resources\arrow_down_green.png" />
<None Remove="Resources\arrow_down_red.png" />
<None Remove="Resources\arrow_right_blue.png" />
<None Remove="Resources\arrow_right_green.png" />
<None Remove="Resources\arrow_up_blue.png" />
<None Remove="Resources\arrow_up_green.png" />
<None Remove="Resources\arrow_up_red.png" />
<None Remove="Resources\check.png" />
<None Remove="Resources\clipboard.png" />
<None Remove="Resources\clock.png" />
<None Remove="Resources\containership.ico" />
<None Remove="Resources\containership.png" />
<None Remove="Resources\delete.png" />
<None Remove="Resources\delete2.png" />
<None Remove="Resources\edit.png" />
<None Remove="Resources\emergency_stop_button.png" />
<None Remove="Resources\lock.png" />
<None Remove="Resources\lock_open.png" />
<None Remove="Resources\logo_bremen_calling.png" />
<None Remove="Resources\nav_refresh_green.png" />
<None Remove="Resources\nav_undo_red.png" />
<None Remove="Resources\ship2.png" />
<None Remove="Resources\sign_warning.png" />
<None Remove="Resources\trafficlight_green.png" />
<None Remove="Resources\trafficlight_off.png" />
<None Remove="Resources\trafficlight_on.png" />
<None Remove="Resources\trafficlight_red.png" />
<None Remove="Resources\trafficlight_red_yellow.png" />
<None Remove="Resources\trafficlight_yellow.png" />
<None Remove="Resources\umbrella_closed.png" />
<None Remove="Resources\umbrella_open.png" />
<None Remove="Resources\worker2.png" />
</ItemGroup>
<ItemGroup>
<Page Remove="Resources\StringResources.xaml" />
<Page Remove="StringResources.de.xaml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\misc\BreCalApi.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>BreCalApi.yaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="containership.ico" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\misc\BreCalApi.yaml" Link="BreCalApi.yaml">
<Generator>OpenApiCodeGenerator</Generator>
<LastGenOutput>BreCalApi.cs</LastGenOutput>
</None>
<Resource Include="Resources\24hours.png" />
<Resource Include="Resources\add.png" />
<Resource Include="Resources\arrow_down_green.png" />
<Resource Include="Resources\arrow_down_red.png" />
<Resource Include="Resources\arrow_right_blue.png" />
<Resource Include="Resources\arrow_right_green.png" />
<Resource Include="Resources\arrow_up_blue.png" />
<Resource Include="Resources\arrow_up_green.png" />
<Resource Include="Resources\arrow_up_red.png" />
<Resource Include="Resources\check.png" />
<Resource Include="Resources\clipboard.png" />
<Resource Include="Resources\clock.png" />
<Resource Include="Resources\containership.ico" />
<Resource Include="Resources\containership.png" />
<Resource Include="Resources\delete.png" />
<Resource Include="Resources\delete2.png" />
<Resource Include="Resources\edit.png" />
<Resource Include="Resources\emergency_stop_button.png" />
<Resource Include="Resources\lock.png" />
<Resource Include="Resources\lock_open.png" />
<Resource Include="Resources\logo_bremen_calling.png" />
<Resource Include="Resources\nav_refresh_green.png" />
<Resource Include="Resources\nav_undo_red.png" />
<Resource Include="Resources\ship2.png" />
<Resource Include="Resources\sign_warning.png" />
<Resource Include="Resources\StringResources.de.xaml">
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Resources\StringResources.xaml" />
<Resource Include="Resources\trafficlight_green.png" />
<Resource Include="Resources\trafficlight_off.png" />
<Resource Include="Resources\trafficlight_on.png" />
<Resource Include="Resources\trafficlight_red.png" />
<Resource Include="Resources\trafficlight_red_yellow.png" />
<Resource Include="Resources\trafficlight_yellow.png" />
<Resource Include="Resources\umbrella_closed.png" />
<Resource Include="Resources\umbrella_open.png" />
<Resource Include="Resources\worker2.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.1" />
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
<PackageReference Include="log4net" Version="2.0.17" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.4.1" />
<PackageReference Include="RestSharp" Version="112.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Update="Resources\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,16 @@
extensions: designer.cs generated.cs
extensions: .cs .cpp .h
// Copyright (c) 2024- schick Informatik
// Description:
//
extensions: .aspx .ascx
<%--
Copyright (c) 2024- schick Informatik
--%>
extensions: .vb
'Sample license text.
extensions: .xml .config .xsd
<!--
Sample license text.
-->

View File

@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33627.172
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BreCalClient", "BreCalClient.csproj", "{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EE0DC107-4A84-442F-89B2-2FF2557F761A}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Setup", "..\Setup\Setup.vdproj", "{CDC1EC53-8D75-4F8B-B627-A76B126380D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Release|Any CPU.Build.0 = Release|Any CPU
{CDC1EC53-8D75-4F8B-B627-A76B126380D4}.Debug|Any CPU.ActiveCfg = Debug
{CDC1EC53-8D75-4F8B-B627-A76B126380D4}.Release|Any CPU.ActiveCfg = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CBF797A4-0CAF-4F01-B0D5-708702165337}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,227 @@
// Copyright (c) 2023 schick Informatik
// Description: Static lists used everywhere
//
using BreCalClient.misc.Model;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace BreCalClient
{
public static class BreCalLists
{
#region Fields
private static readonly List<Participant> aList = new();
private static readonly List<Participant> mList = new();
private static readonly List<Participant> pList = new();
private static readonly List<Participant> tList = new();
private static readonly List<Participant> terList = new();
private static readonly List<Berth> _berths = new();
private static List<Berth> _allBerths = new();
private static List<Participant> _participants = new();
private static readonly List<ShipModel> _ships = new();
private static readonly List<ShipModel> _allShips = new();
private static readonly List<Port> _ports = new();
private static readonly List<Port> _allPorts = new();
private readonly static ConcurrentDictionary<int, ShipModel> _shipLookupDict = new();
private readonly static ConcurrentDictionary<int, Berth> _berthLookupDict = new();
private readonly static Dictionary<int, Participant> _participantLookupDict = new();
private readonly static ConcurrentDictionary<int, Port> _portLookupDict = new();
/// <summary>
/// List of TimeRef points
/// </summary>
// TODO: To make this portable the list of texts should come from a configuration file
private readonly static List<string> _timeRefs = new()
{
"ETB",
"Geeste",
"TN-Weser"
};
#endregion
#region Properties
/// <summary>
/// fast ship lookup
/// </summary>
public static ConcurrentDictionary<int, ShipModel> ShipLookupDict { get { return _shipLookupDict; } }
/// <summary>
/// fast port lookup
/// </summary>
public static ConcurrentDictionary<int, Berth> BerthLookupDict { get { return _berthLookupDict; } }
/// <summary>
/// fast participant lookup
/// </summary>
public static Dictionary<int, Participant> ParticipantLookupDict { get { return _participantLookupDict; } }
/// <summary>
/// fast port lookup
/// </summary>
public static ConcurrentDictionary<int, Port> PortLookupDict { get { return _portLookupDict; } }
/// <summary>
/// Participants that are agents
/// </summary>
public static List<Participant> Participants_Agent { get { return aList; } }
/// <summary>
/// Participants that are mooring companies
/// </summary>
public static List<Participant> Participants_Mooring { get { return mList; } }
/// <summary>
/// Participants that are pilots
/// </summary>
public static List<Participant> Participants_Pilot { get { return pList; } }
/// <summary>
/// Participants that are tug shipping companies
/// </summary>
public static List<Participant> Participants_Tug { get { return tList; } }
/// <summary>
/// Participants that are terminals
/// </summary>
public static List<Participant> Participants_Terminal { get { return terList; } }
/// <summary>
/// All participants
/// </summary>
public static List<Participant> Participants { get { return _participants; } }
/// <summary>
/// All active berths
/// </summary>
public static List<Berth> Berths { get { return _berths; } }
/// <summary>
/// All berths including deleted berths
/// </summary>
public static List<Berth> AllBerths { get { return _allBerths; } }
/// <summary>
/// All active ports
/// </summary>
public static List<Port> Ports { get { return _ports; } }
/// <summary>
/// All ports including deleted ports
/// </summary>
public static List<Port> AllPorts { get { return _allPorts; } }
/// <summary>
/// All active ships
/// </summary>
public static List<ShipModel> Ships { get { return _ships; } }
/// <summary>
/// All ships including deleted ships
/// </summary>
public static List<ShipModel> AllShips { get { return _allShips; } }
/// <summary>
/// List of display values for TimeRef points
/// </summary>
public static List<string> TimeRefs { get { return _timeRefs; } }
#endregion
#region public static methods
public static List<Berth> GetBerthsByPort(int port)
{
List<Berth> berths = new();
foreach(Berth berth in _berths)
{
if(berth.PortId == port)
berths.Add(berth);
}
return berths;
}
public static List<Participant> GetParticipants(int port, Extensions.ParticipantType type)
{
List<Participant> participants = new();
foreach(Participant participant in _participants)
{
if(participant.IsTypeFlagSet(type) && participant.Ports.Contains(port))
participants.Add(participant);
}
return participants;
}
#endregion
#region Internal initializer methods
internal static void InitializeParticipants(List<Participant> participants)
{
_participants = participants;
aList.Clear();
mList.Clear();
pList.Clear();
tList.Clear();
terList.Clear();
foreach (Participant p in participants)
{
_participantLookupDict[p.Id] = p;
if (p.IsTypeFlagSet(Extensions.ParticipantType.AGENCY)) aList.Add(p);
if (p.IsTypeFlagSet(Extensions.ParticipantType.MOORING)) mList.Add(p);
if (p.IsTypeFlagSet(Extensions.ParticipantType.PILOT)) pList.Add(p);
if (p.IsTypeFlagSet(Extensions.ParticipantType.TUG)) tList.Add(p);
if (p.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL)) terList.Add(p);
}
}
internal static void InitializeBerths(List<Berth> berths)
{
foreach (var berth in berths)
{
_berthLookupDict[berth.Id] = berth;
if(!berth.Deleted)
_berths.Add(berth);
}
_allBerths = berths;
}
internal static void InitializeShips(List<Ship> ships)
{
_ships.Clear();
_allShips.Clear();
foreach (var ship in ships)
{
ShipModel sm = new(ship);
_shipLookupDict[ship.Id] = sm;
if (!ship.Deleted)
_ships.Add(sm);
_allShips.Add(sm);
}
}
internal static void InitializePorts(List<Port> ports)
{
foreach(var port in ports)
{
_portLookupDict[port.Id] = port;
if(!port.Deleted)
_ports.Add(port);
_allPorts.Add(port);
}
}
#endregion
}
}

View File

@ -0,0 +1,41 @@
using System.Text.RegularExpressions;
using System.Windows.Input;
using Xceed.Wpf.Toolkit;
namespace BreCalClient
{
public class DateTimePickerExt : DateTimePicker
{
protected override void OnPreviewTextInput(TextCompositionEventArgs e)
{
base.OnPreviewTextInput(e);
if (this.Template.FindName("PART_TextBox", this) is not WatermarkTextBox tb) return;
// strip input after caret
string subText = (tb.CaretIndex > 0) ? this.Text[..tb.CaretIndex] : tb.Text; // Range operator instead of Substring(0, tb.CaretIndex)
string text = subText + e.Text;
// System.Diagnostics.Debug.WriteLine("C:" + this.Text + " E: " + e.Text + " Caret: " + tb.CaretIndex + " Subt: " + subText);
// 10 char eingabe "am Stück"
if (Regex.IsMatch(text, @"^\d{10}"))
{
e.Handled = true;
tb.Text = Regex.Replace(text, @"(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})", "$1.$2.20$3 $4:$5");
tb.CaretIndex = tb.Text.Length;
tb.SelectedText = "";
}
// nur die Zeit wird markiert und mit 4 Zahlen befüllt, diese Regel setzt den Doppelpunkt
else if (Regex.IsMatch(text, @"^(\d{2}\.\d{2}\. \d{4} \d{3})"))
{
e.Handled = true;
tb.Text = Regex.Replace(text, @"(\d{2}\.\d{2}\. \d{4} \d{2})(\d)(.*)", "$1:$2");
// System.Diagnostics.Trace.WriteLine("Replaced: " + tb.Text);
tb.CaretIndex = tb.Text.Length;
tb.Select(tb.Text.Length, 0);
}
}
}
}

View File

@ -0,0 +1,257 @@
// Copyright (c) 2017 schick Informatik
// Description: DataGrid mit etwas "verbesserten" Funktionen
//
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Controls.Primitives;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
namespace BreCalClient
{
/// <summary>
/// Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
///
/// Step 1a) Using this custom control in a XAML file that exists in the current project.
/// Add this XmlNamespace attribute to the root element of the markup file where it is
/// to be used:
///
/// xmlns:enictrl="clr-namespace:ENI2.Controls"
///
///
/// Step 1b) Using this custom control in a XAML file that exists in a different project.
/// Add this XmlNamespace attribute to the root element of the markup file where it is
/// to be used:
///
/// xmlns:enictrl="clr-namespace:ENI2.Controls;assembly=ENI2.Controls"
///
/// You will also need to add a project reference from the project where the XAML file lives
/// to this project and Rebuild to avoid compilation errors:
///
/// Right click on the target project in the Solution Explorer and
/// "Add Reference"->"Projects"->[Browse to and select this project]
///
///
/// Step 2)
/// Go ahead and use your control in the XAML file.
///
/// <MyNamespace:ENIDataGrid/>
///
/// </summary>
public class ENIDataGrid : DataGrid
{
public event Action<object>? EditRequested;
public event Action<object>? DeleteRequested;
public event Action? CreateRequested;
public event Action? RefreshGrid;
public event Action<object>? PrintRequested;
public event Action<object>? ExportRequested;
public event Action<object>? ShowTextRequested;
public void Initialize()
{
this.MouseDoubleClick += dataGrid_MouseDoubleClick;
this.PreviewKeyDown += ENIDataGrid_PreviewKeyDown;
this.ContextMenu = new ContextMenu();
this.CanUserAddRows = false;
this.IsReadOnly = false;
MenuItem addItem = new MenuItem();
addItem.Header = BreCalClient.Resources.Resources.textAdd;
addItem.Icon = new Image { Source = Util.LoadImage(BreCalClient.Resources.Resources.add) };
addItem.Click += new RoutedEventHandler(this.addItem);
this.ContextMenu.Items.Add(addItem);
MenuItem deleteItem = new MenuItem();
deleteItem.Header = BreCalClient.Resources.Resources.textDelete;
deleteItem.Icon = new Image { Source = Util.LoadImage(BreCalClient.Resources.Resources.delete) };
deleteItem.Click += this.deleteItem;
this.ContextMenu.Items.Add(deleteItem);
MenuItem editItem = new MenuItem();
editItem.Header = BreCalClient.Resources.Resources.textEdit;
editItem.Icon = new Image { Source = Util.LoadImage(BreCalClient.Resources.Resources.edit) };
editItem.Click += this.editItem;
this.ContextMenu.Items.Add(editItem);
}
private void ENIDataGrid_PreviewKeyDown(object sender, KeyEventArgs e)
{
if(sender is ENIDataGrid)
{
var grid = sender as ENIDataGrid;
if (Key.Delete == e.Key)
this.deleteItem(null, null);
}
}
#region public
public DataGridRow GetRow(int index)
{
DataGridRow row = (DataGridRow)this.ItemContainerGenerator.ContainerFromIndex(index);
if(row == null)
{
this.UpdateLayout();
this.ScrollIntoView(this.Items[index]);
row = (DataGridRow)this.ItemContainerGenerator.ContainerFromIndex(index);
}
return row;
}
public DataGridCell? GetCell(DataGridRow row, int column)
{
if (row != null)
{
DataGridCellsPresenter? presenter = GetVisualChild<DataGridCellsPresenter>(row);
if (presenter == null)
{
this.ScrollIntoView(row, this.Columns[column]);
presenter = GetVisualChild<DataGridCellsPresenter>(row);
}
DataGridCell? cell = (DataGridCell?)presenter?.ItemContainerGenerator.ContainerFromIndex(column);
return cell;
}
return null;
}
public DataGridCell? GetCell(int rowIndex, int columnIndex)
{
DataGridRow row = this.GetRow(rowIndex);
return this.GetCell(row, columnIndex);
}
#endregion
#region protected
protected void addItem(object sender, RoutedEventArgs e)
{
if (!this.IsReadOnly)
{
this.CreateRequested?.Invoke();
}
e.Handled = true;
}
protected void deleteItem(object? sender, RoutedEventArgs? e)
{
if((this.SelectedItems != null) && (this.SelectedItems.Count > 0) && !this.IsReadOnly)
{
MessageBoxResult result = MessageBox.Show("Are your sure?", "Please confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
List<object> deleteList = new List<object>();
foreach (object deleteItem in this.SelectedItems)
deleteList.Add(deleteItem);
foreach (object deleteItem in deleteList)
{
if (deleteItem != null)
{
this.DeleteRequested?.Invoke(deleteItem);
}
}
this.RefreshGrid?.Invoke();
}
}
}
protected void editItem(object sender, RoutedEventArgs e)
{
if((this.SelectedItems != null) && (this.SelectedItems.Count == 1) && !this.IsReadOnly)
{
if (this.SelectedItems[0] is object selectedEntity)
this.EditRequested?.Invoke(selectedEntity);
}
}
protected void printItem(object sender, RoutedEventArgs e)
{
if ((this.SelectedItems != null) && (this.SelectedItems.Count == 1) )
{
if (this.SelectedItems[0] is object selectedEntity)
this.PrintRequested?.Invoke(selectedEntity);
}
}
protected void exportItem(object sender, RoutedEventArgs e)
{
if ((this.SelectedItems != null) && (this.SelectedItems.Count == 1))
{
if (this.SelectedItems[0] is object selectedEntity)
this.ExportRequested?.Invoke(selectedEntity);
}
}
protected void showTextItem(object sender, RoutedEventArgs e)
{
if ((this.SelectedItems != null) && (this.SelectedItems.Count == 1))
{
if (this.SelectedItems[0] is object selectedEntity)
this.ShowTextRequested?.Invoke(selectedEntity);
}
}
#endregion
#region private
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender != null)
{
if ((sender is DataGrid grid) && (grid.SelectedItems != null) && (grid.SelectedItems.Count == 1) && !this.IsReadOnly)
{
DataGridRow? dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;
if (grid.SelectedItem is object selectedEntity)
this.EditRequested?.Invoke(selectedEntity);
}
}
}
#endregion
#region private static
private static T? GetVisualChild<T>(Visual parent) where T : Visual
{
T? child = default;
int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
for (int i = 0; i < numVisuals; i++)
{
Visual? v = (Visual)VisualTreeHelper.GetChild(parent, i);
child = v as T;
if (child == null)
{
child = GetVisualChild<T>(v);
}
if (child != null)
{
break;
}
}
return child;
}
#endregion
}
}

View File

@ -0,0 +1,54 @@
<Window x:Class="BreCalClient.EditShipDialog"
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:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Left="{local:SettingBinding W3Left}" Top="{local:SettingBinding W3Top}"
Title="{x:Static p:Resources.textEditShip}" Height="250" Width="500" Loaded="Window_Loaded" ResizeMode="NoResize">
<Grid x:Name="shipGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".3*" />
<ColumnDefinition Width=".6*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Label Content="Name" HorizontalAlignment="Right" />
<TextBox x:Name="textBoxName" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" Text="{Binding Name, Mode=OneWay}" TextChanged="textBoxName_TextChanged" MaxLength="64"/>
<Label Content="{x:Static p:Resources.textTugCompany}" HorizontalAlignment="Right" Grid.Row="1" />
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="28" />
</Grid.ColumnDefinitions>
<ComboBox x:Name="comboBoxParticipants" Margin="2" DisplayMemberPath="Name" />
<Button x:Name="buttonResetParticipant" Grid.Column="1" Margin="2" Click="buttonResetParticipant_Click">
<Image Source="./Resources/delete2.png"/>
</Button>
</Grid>
<Label Content="IMO" HorizontalAlignment="Right" Grid.Row="2" />
<xctk:IntegerUpDown Name="integerUpDownIMO" Grid.Column="1" Grid.Row="2" Value="{Binding Imo, Mode=OneWay}" Margin="2" Minimum="1000000" Maximum="9999999" ShowButtonSpinner="False" ValueChanged="integerUpDownIMO_ValueChanged"/>
<Label Content="{x:Static p:Resources.textCallsign}" HorizontalAlignment="Right" Grid.Row="3" />
<TextBox x:Name="textBoxCallsign" Grid.Column="1" Grid.Row="3" Margin="2" VerticalContentAlignment="Center" Text="{Binding Callsign, Mode=OneWay}" MaxLength="8"/>
<Label Content="{x:Static p:Resources.textLength}" HorizontalAlignment="Right" Grid.Row="4" />
<xctk:DoubleUpDown Name="doubleUpDownLength" Grid.Row="4" Grid.Column="1" Value="{Binding Length, Mode=OneWay}" Margin="2" Minimum="0" />
<Label Content="{x:Static p:Resources.textWidth}" HorizontalAlignment="Right" Grid.Row="5" />
<xctk:DoubleUpDown Name="doubleUpDownWidth" Grid.Row="5" Grid.Column="1" Value="{Binding Width, Mode=OneWay}" Margin="2" Minimum="0"/>
<StackPanel Grid.Column="1" Grid.Row="7" Orientation="Horizontal" FlowDirection="RightToLeft">
<Button x:Name="buttonCancel" Width="80" Content="{x:Static p:Resources.textCancel}" Margin="2" Click="buttonCancel_Click" />
<Button x:Name="buttonOK" Width="80" Content="OK" Margin="2" Click="buttonOK_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,87 @@
using BreCalClient.misc.Model;
using System.Collections.Generic;
using System.Windows;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditShipDialog.xaml
/// </summary>
public partial class EditShipDialog : Window
{
public EditShipDialog()
{
InitializeComponent();
}
public Ship Ship { get; set; } = new();
public List<Participant> Participants { get; } = new List<Participant>();
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
this.Ship.Name = this.textBoxName.Text.ToUpper().Trim();
if (this.comboBoxParticipants.SelectedItem != null)
{
this.Ship.ParticipantId = ((Participant)this.comboBoxParticipants.SelectedItem).Id;
this.Ship.IsTug = true;
}
else
{
this.Ship.IsTug = false;
}
this.Ship.Imo = this.integerUpDownIMO.Value;
this.Ship.Callsign = this.textBoxCallsign.Text.ToUpper().Trim();
this.Ship.Length = this.doubleUpDownLength.Value;
this.Ship.Width = this.doubleUpDownWidth.Value;
this.DialogResult = true;
this.Close();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = this.Ship;
this.comboBoxParticipants.ItemsSource = this.Participants;
if(this.Ship.ParticipantId != null)
{
foreach(Participant p in this.Participants)
{
if(this.Ship.ParticipantId == p.Id)
this.comboBoxParticipants.SelectedItem = p;
}
}
this.EnableOK();
}
private void buttonResetParticipant_Click(object sender, RoutedEventArgs e)
{
this.comboBoxParticipants.SelectedItem = null;
}
private void textBoxName_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
this.EnableOK();
}
private void integerUpDownIMO_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.EnableOK();
}
private void EnableOK()
{
this.buttonOK.IsEnabled = (this.textBoxName.Text.Length > 2) && (this.integerUpDownIMO.Value.HasValue);
}
}
}

View File

@ -0,0 +1,97 @@
<Window x:Class="BreCalClient.EditShipcallControl"
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:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:api="clr-namespace:BreCalClient.misc.Model"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditShipcall}" Height="298" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
<Window.Resources>
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
<local:EnumToStringConverter x:Key="enumToStringConverter" />
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".35*" />
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".35*" />
</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" />
</Grid.RowDefinitions>
<Label Content="{x:Static p:Resources.textShip}" Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="Right"/>
<ComboBox x:Name="comboBoxShip" Margin="2" Grid.Column="1" Grid.Row="0" SelectionChanged="comboBoxShip_SelectionChanged" SelectedValuePath="Ship.Id" IsEditable="True" IsTextSearchEnabled="True" IsTextSearchCaseSensitive="False" />
<Label Content="IMO" Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right"/>
<xctk:IntegerUpDown x:Name="integerUpDownIMO" IsReadOnly="True" Margin="2" Grid.Column="1" Grid.Row="1" ShowButtonSpinner="False" IsEnabled="False"/>
<Label Content="{x:Static p:Resources.textCallsign}" Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right"/>
<TextBox x:Name="textBoxCallsign" IsReadOnly="True" Grid.Column="1" Grid.Row="2" Margin="2" IsEnabled="False"/>
<Label Content="{x:Static p:Resources.textLength}" Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right"/>
<xctk:DoubleUpDown x:Name="doubleUpDownLength" Margin="2" Grid.Column="1" Grid.Row="3" FormatString="N2" IsReadOnly="True" IsEnabled="False" ShowButtonSpinner="False"/>
<Label Content="{x:Static p:Resources.textWidth}" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right"/>
<xctk:DoubleUpDown x:Name="doubleUpDownWidth" Margin="2" Grid.Column="1" Grid.Row="4" FormatString="N2" IsReadOnly="True" IsEnabled="False" ShowButtonSpinner="False"/>
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="5" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxCancelled" Grid.Column="1" Grid.Row="5" Margin="2" VerticalContentAlignment="Center" />
<Label Content="{x:Static p:Resources.textHarbour}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right" />
<ComboBox x:Name="comboBoxHarbour" Grid.Column="1" Margin="2" Grid.Row="6" DisplayMemberPath="Name" SelectedValuePath="Id" />
<Button x:Name="buttonEditShips" Grid.Column="1" Grid.Row="7" Margin="2" Content="{x:Static p:Resources.textEditShips}" Click="buttonEditShips_Click" Visibility="Hidden" />
<Label Content="{x:Static p:Resources.textType}" Grid.Column="2" Grid.Row="0" HorizontalContentAlignment="Right" />
<ComboBox ItemsSource="{local:Enumerate {x:Type api:ShipcallType}}" Grid.Column="3" Margin="2" Grid.Row="0" SelectionChanged="comboBoxCategories_SelectionChanged" x:Name="comboBoxCategories" />
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
<Grid Grid.Row="1" Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="0" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxArrivalBerth_SelectionChanged"/>
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxDepartureBerth_SelectionChanged"/>
</Grid>
<Label Content="Zeit Ref." Grid.Column="2" Grid.Row="2" HorizontalContentAlignment="Right" />
<Label Content="ETA" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right" Margin="0,2,0,26" Grid.RowSpan="2" x:Name="labelETA"/>
<Label Content="ETD" Grid.Column="2" Grid.Row="3" HorizontalContentAlignment="Right" x:Name="labelETD"/>
<ComboBox x:Name="comboBoxTimeRef" Grid.Column="3" Margin="2" Grid.Row="2" />
<local:DateTimePickerExt x:Name="datePickerETD" Grid.Column="3" Grid.Row="3" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" ValueChanged="datePickerETD_ValueChanged"/>
<local:DateTimePickerExt x:Name="datePickerETA" Grid.Column="3" Grid.Row="4" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" ValueChanged="datePickerETA_ValueChanged"/>
<Label Content="{x:Static p:Resources.textAgency}" Grid.Column="2" Grid.Row="5" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxAgency" Grid.Column="3" Grid.Row="5" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxAgency_SelectionChanged">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearAgency" Click="contextMenuItemClearAgency_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label x:Name="labelBSMDGranted" Grid.Row="7" Grid.Column="3" Grid.ColumnSpan="1" Content="{x:Static p:Resources.textBSMDGranted}" Visibility="Hidden" FontWeight="DemiBold" />
<Label x:Name="labelShiftingCount" Grid.Row="6" Grid.Column="2" HorizontalAlignment="Right" Content="{x:Static p:Resources.textShiftingSequence}" />
<xctk:IntegerUpDown x:Name="integerUpDownShiftingCount" Grid.Row="6" Grid.Column="3" Margin="2" Minimum="0" Maximum="127" />
<StackPanel Grid.Row="8" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,461 @@
// Copyright (c) 2023 schick Informatik
// Description: Windows dialog to create / edit ship calls
//
using BreCalClient.misc.Api;
using BreCalClient.misc.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using static BreCalClient.Extensions;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditShipcallControl.xaml
/// </summary>
public partial class EditShipcallControl : Window
{
public EditShipcallControl()
{
InitializeComponent();
}
#region Properties
public ShipcallControlModel ShipcallModel { get; set; } = new ();
public Ship? SelectedShip {
get
{
return this.comboBoxShip.SelectedItem as Ship;
}
}
public bool ShipEditingEnabled
{
get { return this.buttonEditShips.Visibility == Visibility.Visible; }
set { this.buttonEditShips.Visibility = value ? Visibility.Visible : Visibility.Hidden; }
}
public ShipApi? ShipApi { get; set; }
#endregion
#region Event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent;
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
Array types = Enum.GetValues(typeof(ShipcallType));
List<ShipcallType> shipcallTypes = new();
bool first = true;
foreach(ShipcallType shipcallType in types)
{
if (!first) shipcallTypes.Add(shipcallType);
else first = false;
}
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs;
this.comboBoxHarbour.ItemsSource = BreCalLists.Ports.Where(x => App.Participant.Ports.Contains(x.Id));
this.integerUpDownShiftingCount.Value = this.ShipcallModel.ShiftSequence;
if (this.ShipcallModel.Shipcall == null) this.ShipcallModel.Shipcall = new();
this.CopyToControls();
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult= false;
this.Close();
}
private void comboBoxShip_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (this.comboBoxShip.SelectedItem != null)
{
ShipModel? ship = this.comboBoxShip.SelectedItem as ShipModel;
this.integerUpDownIMO.Value = ship?.Ship.Imo;
this.textBoxCallsign.Text = ship?.Ship.Callsign;
this.doubleUpDownLength.Value = ship?.Ship.Length;
this.doubleUpDownWidth.Value = ship?.Ship.Width;
}
else
{
this.integerUpDownIMO.Value = null;
this.textBoxCallsign.Text = string.Empty;
this.doubleUpDownLength.Value = null;
this.doubleUpDownWidth.Value = null;
}
this.CheckForCompletion();
}
private void comboBoxAgency_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.EnableControls();
this.CheckForCompletion();
}
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
{
ShipcallType? type = GetShipcallTypeFromCombobox();
if (type != null)
{
switch (type)
{
case ShipcallType.Arrival:
this.datePickerETD.Visibility = Visibility.Hidden;
this.labelETD.Visibility = Visibility.Hidden;
this.datePickerETA.Visibility = Visibility.Visible;
this.labelETA.Visibility = Visibility.Visible;
Grid.SetRow(datePickerETA, 3);
Grid.SetRow(labelETA, 3);
this.datePickerETD.Value = null;
this.comboBoxDepartureBerth.SelectedIndex = -1;
this.comboBoxDepartureBerth.IsEnabled = false;
this.comboBoxArrivalBerth.IsEnabled = true;
this.comboBoxTimeRef.IsEnabled = true;
this.labelShiftingCount.Visibility = Visibility.Hidden;
this.integerUpDownShiftingCount.Visibility = Visibility.Hidden;
break;
case ShipcallType.Departure:
this.datePickerETD.Visibility = Visibility.Visible;
this.labelETD.Visibility = Visibility.Visible;
this.datePickerETA.Visibility = Visibility.Hidden;
this.labelETA.Visibility = Visibility.Hidden;
this.datePickerETA.Value = null;
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.comboBoxArrivalBerth.IsEnabled = false;
this.comboBoxDepartureBerth.IsEnabled = true;
this.comboBoxTimeRef.IsEnabled = false;
this.comboBoxTimeRef.SelectedIndex = 0;
this.labelShiftingCount.Visibility = Visibility.Hidden;
this.integerUpDownShiftingCount.Visibility = Visibility.Hidden;
break;
case ShipcallType.Shifting:
Grid.SetRow(datePickerETA, 4);
Grid.SetRow(labelETA, 4);
this.datePickerETA.Visibility = Visibility.Visible;
this.labelETA.Visibility = Visibility.Visible;
this.datePickerETD.Visibility = Visibility.Visible;
this.labelETD.Visibility = Visibility.Visible;
this.comboBoxArrivalBerth.IsEnabled = true;
this.comboBoxDepartureBerth.IsEnabled = true;
this.comboBoxTimeRef.IsEnabled = false;
this.comboBoxTimeRef.SelectedIndex = 0;
this.labelShiftingCount.Visibility = Visibility.Visible;
this.integerUpDownShiftingCount.Visibility = Visibility.Visible;
break;
}
}
this.CheckForCompletion();
}
#endregion
#region Context menu handlers
private void contextMenuItemClearAgency_Click(object sender, RoutedEventArgs e)
{
this.comboBoxAgency.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.AGENCY);
}
#endregion
#region private methods
ShipcallType? GetShipcallTypeFromCombobox()
{
EnumToStringConverter enumToStringConverter = new();
return (ShipcallType?)enumToStringConverter.ConvertBack(this.comboBoxCategories.SelectedItem, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
}
void CheckForCompletion()
{
bool isEnabled = true;
isEnabled &= this.comboBoxShip.SelectedItem != null;
isEnabled &= this.comboBoxCategories.SelectedItem != null;
isEnabled &= this.comboBoxHarbour.SelectedItem != null;
if (comboBoxCategories.SelectedItem == null)
{
isEnabled = false;
}
else
{
ShipcallType callType = GetShipcallTypeFromCombobox() ?? ShipcallType.Undefined;
switch (callType)
{
case ShipcallType.Departure:
isEnabled &= this.comboBoxDepartureBerth.SelectedItem != null;
isEnabled &= this.datePickerETD.Value.HasValue;
isEnabled &= !(this.datePickerETD.Value.IsTooOld() && this.datePickerETD.Value != this.ShipcallModel.Shipcall?.Etd);
isEnabled &= !this.datePickerETD.Value.IsTooFar();
break;
case ShipcallType.Arrival:
isEnabled &= this.comboBoxArrivalBerth.SelectedItem != null;
isEnabled &= this.datePickerETA.Value.HasValue;
isEnabled &= !(this.datePickerETA.Value.IsTooOld() && this.datePickerETA.Value != this.ShipcallModel.Shipcall?.Eta);
isEnabled &= !this.datePickerETA.Value.IsTooFar();
break;
case ShipcallType.Shifting:
isEnabled &= ((this.comboBoxDepartureBerth.SelectedItem != null) && (this.comboBoxArrivalBerth.SelectedItem != null));
isEnabled &= this.datePickerETD.Value.HasValue;
isEnabled &= this.datePickerETA.Value.HasValue;
isEnabled &= !(this.datePickerETD.Value.IsTooOld() && this.datePickerETD.Value != this.ShipcallModel.Shipcall?.Etd);
isEnabled &= !(this.datePickerETA.Value.IsTooOld() && this.datePickerETA.Value != this.ShipcallModel.Shipcall?.Eta);
if (this.datePickerETA.Value.HasValue && this.datePickerETD.Value.HasValue)
isEnabled &= (this.datePickerETA.Value.Value > this.datePickerETD.Value.Value);
isEnabled &= !this.datePickerETD.Value.IsTooFar();
isEnabled &= !this.datePickerETA.Value.IsTooFar();
break;
}
}
isEnabled &= this.comboBoxAgency.SelectedItem != null;
this.buttonOK.IsEnabled = isEnabled;
}
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
{
this.ShipcallModel.Shipcall.Type = GetShipcallTypeFromCombobox() ?? ShipcallType.Undefined;
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value;
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value;
this.ShipcallModel.Shipcall.ShipId = ((ShipModel)this.comboBoxShip.SelectedItem).Ship.Id;
this.ShipcallModel.Ship = ((ShipModel)this.comboBoxShip.SelectedItem).Ship;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCancelled.IsChecked;
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
{
this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
}
else // shifting
{
this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
this.ShipcallModel.ShiftSequence = (byte?) this.integerUpDownShiftingCount.Value;
}
Participant? participant;
participant = (Participant?)this.comboBoxAgency.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.AGENCY
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = pa;
}
else
{
// AGENCY was set before and now is set to nothing
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
this.ShipcallModel.AssignedParticipants.Remove(ParticipantType.AGENCY);
}
// BSMD and port authority are always added
// get port authority from berth
int? berthId = this.ShipcallModel.Shipcall.ArrivalBerthId;
berthId ??= this.ShipcallModel.Shipcall.DepartureBerthId;
if (berthId != null)
{
Berth? selectedBerth = BreCalLists.Berths.Find((x) => x.Id == berthId);
if (selectedBerth?.AuthorityId != null)
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(selectedBerth.AuthorityId.Value))
{
ParticipantAssignment pab = new()
{
ParticipantId = selectedBerth.AuthorityId.Value,
Type = (int)ParticipantType.PORT_ADMINISTRATION
};
this.ShipcallModel.AssignedParticipants[ParticipantType.PORT_ADMINISTRATION] = pab;
}
}
ParticipantAssignment pa = new()
{
ParticipantId = App.Participant.Id,
Type = (int)ParticipantType.BSMD
};
this.ShipcallModel.AssignedParticipants[ParticipantType.BSMD] = pa;
}
// set the time reference value (which point do all times refer to?)
this.ShipcallModel.Shipcall.TimeRefPoint = this.comboBoxTimeRef.SelectedIndex;
this.ShipcallModel.Shipcall.PortId = ((Port) this.comboBoxHarbour.SelectedItem).Id;
}
}
private void CopyToControls()
{
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
this.comboBoxTimeRef.SelectedIndex = this.ShipcallModel.Shipcall.TimeRefPoint ?? 1;
this.comboBoxCategories.SelectedItem = new EnumToStringConverter().Convert(this.ShipcallModel.Shipcall.Type, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
// this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage;
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
if (BreCalLists.Ships.Find(x => x.Ship.Id == this.ShipcallModel.Shipcall.ShipId) != null)
{
this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId;
} else
{
this.comboBoxShip.IsEnabled = false;
}
this.checkBoxCancelled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
{
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
}
else // shifting
{
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
}
if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();
if(this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId))
{
this.comboBoxAgency.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId;
}
}
if (BreCalLists.PortLookupDict.ContainsKey(this.ShipcallModel.Shipcall.PortId))
this.comboBoxHarbour.SelectedValue = this.ShipcallModel.Shipcall.PortId;
this.comboBoxHarbour.SelectionChanged += this.comboBoxHarbour_SelectionChanged;
this.comboBoxHarbour.IsEnabled = this.ShipcallModel.AllowPortChange;
}
}
private void EnableControls()
{
bool isBsmd = App.Participant.IsTypeFlagSet(ParticipantType.BSMD);
bool isAgency = App.Participant.IsTypeFlagSet(ParticipantType.AGENCY);
bool editRightGrantedForBSMD = false;
// Special case: Selected Agency allows BSMD to edit their fields
if (this.comboBoxAgency.SelectedIndex >= 0)
{
int agencyParticipantId = (int)this.comboBoxAgency.SelectedValue;
Participant? p = BreCalLists.Participants.Find(x => x.Id == agencyParticipantId);
if (p != null)
{
if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD) && isBsmd)
isAgency = true;
if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD))
editRightGrantedForBSMD = true;
}
}
this.comboBoxAgency.IsEnabled = isBsmd;
this.comboBoxArrivalBerth.IsEnabled = isBsmd || isAgency;
this.comboBoxCategories.IsEnabled = isBsmd;
this.comboBoxDepartureBerth.IsEnabled = isBsmd || isAgency;
this.comboBoxShip.IsEnabled = isBsmd;
this.datePickerETA.IsEnabled = isAgency || isBsmd;
this.datePickerETD.IsEnabled = isAgency || isBsmd;
this.labelBSMDGranted.Visibility = editRightGrantedForBSMD ? Visibility.Visible : Visibility.Hidden;
this.comboBoxCategories_SelectionChanged(null, null);
}
#endregion
#region control event handlers
private void datePickerETA_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckForCompletion();
}
private void datePickerETD_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckForCompletion();
}
private void comboBoxArrivalBerth_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.CheckForCompletion();
}
private void comboBoxDepartureBerth_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.CheckForCompletion();
}
private void buttonEditShips_Click(object sender, RoutedEventArgs e)
{
ShipListDialog shipListDialog = new()
{
ShipApi = this.ShipApi
};
shipListDialog.ShowDialog();
// reload combobox
this.comboBoxShip.ItemsSource = null;
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
}
private void comboBoxHarbour_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Port port = (Port)this.comboBoxHarbour.SelectedItem;
if (port == null) return;
// Filter berth selection combobox by port
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(port.Id);
this.comboBoxArrivalBerth.ItemsSource = null;
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
this.comboBoxDepartureBerth.ItemsSource = null;
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
// Filter agency combobox by port
List<Participant> availableAgencies = BreCalLists.GetParticipants(port.Id, ParticipantType.AGENCY);
this.comboBoxAgency.ItemsSource = null;
this.comboBoxAgency.ItemsSource = availableAgencies;
}
#endregion
}
}

View File

@ -0,0 +1,136 @@
<Window x:Class="BreCalClient.EditTimesAgencyIncomingControl"
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:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditShipcall}" Height="403" Width="900" Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip" Icon="Resources/containership.ico">
<Window.Resources>
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.18*"/>
<ColumnDefinition Width=".4*" />
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".3*" />
</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="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{x:Static p:Resources.textIncoming}" FontWeight="DemiBold"/>
<Image Margin="2" Grid.Column="1" Source="Resources/arrow_down_red.png" />
</Grid>
<Label Content="ETA" x:Name="labelETA" Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<Grid Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt x:Name="datePickerETA" Grid.Column="0" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETA_ValueChanged"/>
<local:DateTimePickerExt x:Name="datePickerETA_End" Grid.Column="1" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETA_End_ValueChanged"/>
</Grid>
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="1" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxArrivalBerth_SelectionChanged">
</ComboBox>
<Label Content="{x:Static p:Resources.textPierside}" Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="3" Margin="2" >
<ComboBoxItem Content="{x:Static p:Resources.textPort}" />
<ComboBoxItem Content="{x:Static p:Resources.textStarboard}" />
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPierside" Click="contextMenuItemClearPierside_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBerthRemarks}" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxBerthRemarks" Grid.Column="1" Grid.Row="4" Margin="2" Grid.RowSpan="2" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"/>
<Label Content="{x:Static p:Resources.textDraft}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right" FontWeight="Bold" />
<xctk:DoubleUpDown x:Name="doubleUpDownDraft" Grid.Column="1" Grid.Row="6" Margin="2" FormatString="N2" Minimum="0" Maximum="50" MaxLength="5" ValueChanged="doubleUpDownDraft_ValueChanged"/>
<Label Content="{x:Static p:Resources.textTidalWindow}" FontWeight="DemiBold" Grid.Column="0" Grid.Row="7" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textFrom}" Grid.Column="0" Grid.Row="8" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textTo}" Grid.Column="0" Grid.Row="9" HorizontalContentAlignment="Right"/>
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="1" Grid.Row="8" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="1" Grid.Row="9" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="10" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxCanceled" Grid.Column="1" Grid.Row="10" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textAnchored}" Grid.Column="2" Grid.Row="0" HorizontalContentAlignment="Right"/>
<CheckBox x:Name="checkBoxAnchored" Grid.Column="3" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" />
<Label Content="{x:Static p:Resources.textTugRequired}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTug" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTug" Click="contextMenuItemClearTug_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textRecommendedTugs}" Grid.Column="2" Grid.Row="2" HorizontalContentAlignment="Right"/>
<xctk:IntegerUpDown x:Name="integerUpDownRecommendedTugs" Grid.Column="3" Grid.Row="2" Minimum="0" Margin="2" Maximum="10"/>
<Label Content="{x:Static p:Resources.textPilotRequired}" Grid.Column="2" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox Name="comboBoxPilot" Grid.Column="3" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPilot" Click="contextMenuItemClearPilot_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooring}" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxMooring" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearMooring" Click="contextMenuItemClearMooring_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="2" Grid.Row="5" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxMooredLock" Grid.Column="3" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textTerminal}" Grid.Column="2" Grid.Row="6" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTerminal" Grid.Column="3" Grid.Row="6" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTerminal" Click="contextMenuItemClearTerminal_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBunkering}" Grid.Column="3" Grid.Row="7" />
<Label Content="{x:Static p:Resources.textReplenishingTerminal}" Grid.Column="3" Grid.Row="8" />
<Label Content="{x:Static p:Resources.textReplenishingLock}" Grid.Column="3" Grid.Row="9" />
<CheckBox x:Name="checkBoxBunkering" Grid.Column="2" Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
<CheckBox x:Name="checkBoxReplenishingTerminal" Grid.Column="2" Grid.Row="8" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
<CheckBox x:Name="checkBoxReplenishingLock" Grid.Column="2" Grid.Row="9" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textRemarks}" Grid.Row="10" Grid.Column="2" HorizontalAlignment="Right"/>
<TextBox x:Name="textBoxRemarks" Grid.Column="3" Grid.Row="10" Margin="2" Grid.RowSpan="2" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"/>
<StackPanel Grid.Row="14" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,434 @@
// Copyright (c) 2023 schick Informatik
// Description: Input control for incoming shipcalls
//
using BreCalClient.misc.Model;
using System;
using System.Windows;
using static BreCalClient.Extensions;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesAgencyIncomingControl.xaml
/// </summary>
public partial class EditTimesAgencyIncomingControl : Window, IEditTimesControl
{
#region Fields
bool _editing = false;
#endregion
#region Construction
public EditTimesAgencyIncomingControl()
{
InitializeComponent();
}
#endregion
#region Properties
public ShipcallControlModel ShipcallModel { get; set; } = new();
public Times Times { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
{
int portId = this.ShipcallModel.Shipcall.PortId;
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.GetBerthsByPort(portId);
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
}
this.CopyToControls();
this.Title = this.ShipcallModel?.Title;
Participant? p = null;
if (this.ShipcallModel != null)
{
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false;
if (p != null)
{
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
}
_editing = (this.Times.ParticipantId == App.Participant.Id) ||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if ((this.datePickerETA.Value != this.Times.EtaBerth) || (this.datePickerETA_End.Value != this.Times.EtaIntervalEnd)) // something has changed
{
if (datePickerETA.Value.IsTooOld() || datePickerETA_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
if (this.datePickerETA.Value.HasValue && this.datePickerETA_End.Value.HasValue && this.datePickerETA.Value > this.datePickerETA_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
}
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo)) // something has changed
{
if(datePickerTidalWindowTo.Value.IsTooOld() || this.datePickerTidalWindowFrom.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textTidalBothValues;
return false;
}
}
if(this.datePickerETA.Value.IsTooFar() || this.datePickerETA_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerETA_End.Value.HasValue && !this.datePickerETA.Value.HasValue) ||
(this.datePickerTidalWindowTo.Value.HasValue && !this.datePickerTidalWindowFrom.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
{
this.Times.EtaBerth = this.datePickerETA.Value;
this.Times.EtaIntervalEnd = this.datePickerETA_End.Value;
if (this.comboBoxPierside.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0);
}
else
{
this.ShipcallModel.Shipcall.PierSide = null;
}
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
this.ShipcallModel.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
this.ShipcallModel.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
this.ShipcallModel.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
if (!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new() {
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.MOORING
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment;
}
participant = (Participant?)this.comboBoxPilot.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.PILOT
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment;
}
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TERMINAL
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment;
}
participant = (Participant?)this.comboBoxTug.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TUG
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment;
}
}
}
private void CopyToControls()
{
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
if(this.Times.EtaBerth.HasValue)
{
this.datePickerETA.Value = this.Times.EtaBerth.Value;
}
else
{
// if not set through times use value of BSMD entry
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
}
this.datePickerETA_End.Value = this.Times.EtaIntervalEnd;
if (Times.BerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = Times.BerthId;
else if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
{
if (this.ShipcallModel.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
else this.comboBoxPierside.SelectedIndex = 1;
}
this.textBoxBerthRemarks.Text = this.Times.BerthInfo;
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored ?? false;
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering ?? false;
this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock ?? false;
this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal ?? false;
if ((this.ShipcallModel.Shipcall.TimeRefPoint ?? 0) == 0)
this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth;
else
this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
if(!string.IsNullOrEmpty(this.Times.Remarks))
this.textBoxRemarks.Text = this.Times.Remarks;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
{
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
{
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
{
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
{
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
}
}
}
}
private void EnableControls()
{
this.datePickerETA.IsEnabled = _editing;
this.datePickerETA_End.IsEnabled = _editing;
this.comboBoxArrivalBerth.IsEnabled = _editing;
this.comboBoxPierside.IsEnabled = _editing;
this.textBoxBerthRemarks.IsReadOnly = !_editing;
this.doubleUpDownDraft.IsEnabled = _editing;
this.datePickerTidalWindowFrom.IsEnabled = _editing;
this.datePickerTidalWindowTo.IsEnabled = _editing;
this.checkBoxCanceled.IsEnabled = _editing;
this.checkBoxAnchored.IsEnabled = _editing;
this.comboBoxTug.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.comboBoxPilot.IsEnabled = _editing;
this.comboBoxMooring.IsEnabled = _editing;
this.checkBoxMooredLock.IsEnabled = _editing;
this.comboBoxTerminal.IsEnabled = _editing;
this.checkBoxBunkering.IsEnabled = _editing;
this.checkBoxReplenishingTerminal.IsEnabled = _editing;
this.checkBoxReplenishingLock.IsEnabled = _editing;
this.textBoxRemarks.IsReadOnly = !_editing;
CheckOKButton();
}
private bool RequiredFieldsSet()
{
bool areSet = this.datePickerETA.Value.HasValue &&
this.doubleUpDownDraft.Value.HasValue &&
this.comboBoxArrivalBerth.SelectedIndex >= 0;
if (areSet && this.datePickerETA_End.Value.HasValue)
areSet &= (this.datePickerETA.Value < this.datePickerETA_End.Value);
return areSet;
}
private void CheckOKButton()
{
this.buttonOK.IsEnabled = _editing && RequiredFieldsSet();
}
#endregion
#region event handlers
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTug.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TUG);
}
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPilot.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.PILOT);
}
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
{
this.comboBoxMooring.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.MOORING);
}
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTerminal.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPierside.SelectedIndex = -1;
}
private void doubleUpDownDraft_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
private void datePickerETA_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
private void comboBoxArrivalBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
this.CheckOKButton();
}
private void datePickerETA_End_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
#endregion
}
}

View File

@ -0,0 +1,125 @@
<Window x:Class="BreCalClient.EditTimesAgencyOutgoingControl"
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:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditShipcall}" Height="375" Width="900" Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip" Icon="Resources/containership.ico">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.18*"/>
<ColumnDefinition Width=".4*" />
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".3*" />
</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="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{x:Static p:Resources.textOutgoing}" FontWeight="DemiBold"/>
<Image Margin="2" Grid.Column="1" Source="Resources/arrow_up_blue.png" />
</Grid>
<Label Content="ETD" x:Name="labelETD" Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<Grid Grid.Row="1" Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt x:Name="datePickerETD" Grid.Column="0" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETD_ValueChanged" AllowTextInput="True" />
<local:DateTimePickerExt x:Name="datePickerETD_End" Grid.Column="1" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETD_ValueChanged"/>
</Grid>
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxDepartureBerth_SelectionChanged" />
<Label Content="{x:Static p:Resources.textPierside}" Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="3" Margin="2" >
<ComboBoxItem Content="{x:Static p:Resources.textPort}" />
<ComboBoxItem Content="{x:Static p:Resources.textStarboard}" />
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPierside" Click="contextMenuItemClearPierside_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBerthRemarks}" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxBerthRemarks" Grid.Column="1" Grid.Row="4" Margin="2" Grid.RowSpan="2" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512"/>
<Label Content="{x:Static p:Resources.textDraft}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<xctk:DoubleUpDown x:Name="doubleUpDownDraft" Grid.Column="1" Grid.Row="6" Margin="2" FormatString="N2" Minimum="0" Maximum="50" MaxLength="5" ValueChanged="doubleUpDownDraft_ValueChanged"/>
<Label Content="{x:Static p:Resources.textTidalWindow}" FontWeight="DemiBold" Grid.Column="0" Grid.Row="7" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textFrom}" Grid.Column="0" Grid.Row="8" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textTo}" Grid.Column="0" Grid.Row="9" HorizontalContentAlignment="Right"/>
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="1" Grid.Row="8" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="1" Grid.Row="9" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="10" HorizontalContentAlignment="Right" VerticalAlignment="Center" />
<CheckBox x:Name="checkBoxCanceled" Grid.Column="1" Grid.Row="10" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textTugRequired}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTug" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTug" Click="contextMenuItemClearTug_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textRecommendedTugs}" Grid.Column="2" Grid.Row="2" HorizontalContentAlignment="Right"/>
<xctk:IntegerUpDown x:Name="integerUpDownRecommendedTugs" Grid.Column="3" Grid.Row="2" Minimum="0" Margin="2" Maximum="10"/>
<Label Content="{x:Static p:Resources.textPilotRequired}" Grid.Column="2" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox Name="comboBoxPilot" Grid.Column="3" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPilot" Click="contextMenuItemClearPilot_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooring}" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxMooring" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearMooring" Click="contextMenuItemClearMooring_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="2" Grid.Row="5" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxMooredLock" Grid.Column="3" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textTerminal}" Grid.Column="2" Grid.Row="6" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTerminal" Grid.Column="3" Grid.Row="6" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTerminal" Click="contextMenuItemClearTerminal_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textRainSensitiveCargo}" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="7" HorizontalAlignment="Right" />
<CheckBox x:Name="checkBoxRainsensitiveCargo" Grid.Column="3" Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textRemarks}" Grid.Column="2" Grid.Row="8" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxRemarks" Grid.Column="3" Grid.Row="8" Margin="2" Grid.RowSpan="4" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512"/>
<StackPanel Grid.Row="12" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,419 @@
// Copyright (c) 2023 schick Informatik
// Description: Input control for outgoing shipcalls
//
using BreCalClient.misc.Model;
using System;
using System.Windows;
using static BreCalClient.Extensions;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesAgencyOutgoingControl.xaml
/// </summary>
public partial class EditTimesAgencyOutgoingControl : Window, IEditTimesControl
{
#region Fields
bool _editing = false;
#endregion
#region Construction
public EditTimesAgencyOutgoingControl()
{
InitializeComponent();
}
#endregion
#region Properties
public ShipcallControlModel ShipcallModel { get; set; } = new();
public Times Times { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
{
int portId = this.ShipcallModel.Shipcall.PortId;
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.GetBerthsByPort(portId);
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
}
this.CopyToControls();
this.Title = this.ShipcallModel?.Title;
Participant? p = null;
if (this.ShipcallModel != null)
{
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false;
if (p != null)
{
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
}
_editing = (this.Times.ParticipantId == App.Participant.Id) ||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
System.Windows.MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if((this.datePickerETD.Value != this.Times.EtdBerth) || (this.datePickerETD_End.Value != this.Times.EtdIntervalEnd))
{
if (datePickerETD.Value.IsTooOld() || datePickerETD_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETD.Value.HasValue && this.datePickerETD_End.Value.HasValue && this.datePickerETD.Value > this.datePickerETD_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
if (this.datePickerTidalWindowTo.Value.IsTooOld() || this.datePickerTidalWindowFrom.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textTidalBothValues;
return false;
}
if (this.datePickerETD.Value.IsTooFar() || this.datePickerETD_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerETD_End.Value.HasValue && !this.datePickerETD.Value.HasValue) ||
(this.datePickerTidalWindowTo.Value.HasValue && !this.datePickerTidalWindowFrom.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
{
this.Times.EtdBerth = this.datePickerETD.Value;
this.Times.EtdIntervalEnd = this.datePickerETD_End.Value;
if (this.comboBoxPierside.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0);
}
else
{
this.ShipcallModel.Shipcall.PierSide = null;
}
this.Times.BerthId = (int?)this.comboBoxDepartureBerth.SelectedValue;
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
if(!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.MOORING
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment;
}
participant = (Participant?)this.comboBoxPilot.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.PILOT
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment;
}
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TERMINAL
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment;
}
participant = (Participant?)this.comboBoxTug.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TUG
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment;
}
}
}
private void CopyToControls()
{
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
if (this.Times.EtdBerth.HasValue)
{
this.datePickerETD.Value = this.Times.EtdBerth.Value;
}
else
{
// if not set through times use value of BSMD entry
if (this.ShipcallModel.Shipcall.Etd != DateTime.MinValue)
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
}
this.datePickerETD_End.Value = this.Times.EtdIntervalEnd;
if (this.Times.BerthId.HasValue)
this.comboBoxDepartureBerth.SelectedValue = this.Times.BerthId;
else if (this.ShipcallModel.Shipcall.DepartureBerthId.HasValue)
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
{
if (this.ShipcallModel.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
else this.comboBoxPierside.SelectedIndex = 1;
}
this.textBoxBerthRemarks.Text = this.Times.BerthInfo;
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
if ((this.ShipcallModel.Shipcall.TimeRefPoint ?? 0) == 0)
this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth;
else
this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
if (!string.IsNullOrEmpty(this.Times.Remarks))
this.textBoxRemarks.Text = this.Times.Remarks;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
{
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
{
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
{
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
{
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
}
}
}
}
private void EnableControls()
{
this.datePickerETD.IsEnabled = _editing;
this.datePickerETD_End.IsEnabled = _editing;
this.comboBoxDepartureBerth.IsEnabled = _editing;
this.comboBoxPierside.IsEnabled = _editing;
this.textBoxBerthRemarks.IsReadOnly = !_editing;
this.doubleUpDownDraft.IsEnabled = _editing;
this.datePickerTidalWindowFrom.IsEnabled = _editing;
this.datePickerTidalWindowTo.IsEnabled = _editing;
this.checkBoxCanceled.IsEnabled = _editing;
this.comboBoxTug.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.comboBoxPilot.IsEnabled = _editing;
this.comboBoxMooring.IsEnabled = _editing;
this.checkBoxMooredLock.IsEnabled = _editing;
this.comboBoxTerminal.IsEnabled = _editing;
this.checkBoxRainsensitiveCargo.IsEnabled = _editing;
this.textBoxRemarks.IsReadOnly = !_editing;
CheckOKButton();
}
private bool RequiredFieldsSet()
{
bool areSet = this.datePickerETD.Value.HasValue &&
this.doubleUpDownDraft.Value.HasValue &&
this.comboBoxDepartureBerth.SelectedIndex >= 0;
if (areSet && this.datePickerETD_End.Value.HasValue)
areSet &= (this.datePickerETD_End.Value > this.datePickerETD.Value);
return areSet;
}
private void CheckOKButton()
{
this.buttonOK.IsEnabled = _editing && RequiredFieldsSet();
}
#endregion
#region event handlers
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTug.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TUG);
}
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPilot.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.PILOT);
}
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
{
this.comboBoxMooring.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.MOORING);
}
private void contextMenuItemDepartureBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxDepartureBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTerminal.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPierside.SelectedIndex = -1;
}
private void datePickerETD_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void comboBoxDepartureBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
CheckOKButton();
}
private void doubleUpDownDraft_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
#endregion
}
}

View File

@ -0,0 +1,156 @@
<Window x:Class="BreCalClient.EditTimesAgencyShiftingControl"
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:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditShipcall}" Height="490" Width="900" Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip" Icon="Resources/containership.ico">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.18*"/>
<ColumnDefinition Width=".4*" />
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".3*" />
</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="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{x:Static p:Resources.textShiftingFrom}" FontWeight="DemiBold"/>
<Image Margin="2" Grid.Column="1" Source="Resources/arrow_right_green.png" />
</Grid>
<Label Content="{x:Static p:Resources.textETDBerth}" Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<Grid Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt x:Name="datePickerETD" Grid.Column="0" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETD_ValueChanged"/>
<local:DateTimePickerExt x:Name="datePickerETD_End" Grid.Column="1" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETD_ValueChanged"/>
</Grid>
<Label Content="{x:Static p:Resources.textTerminal}" Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTerminal" Grid.Column="1" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTerminal" Click="contextMenuItemClearTerminal_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxDepartureBerth_SelectionChanged">
</ComboBox>
<Label Content="{x:Static p:Resources.textDraft}" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<xctk:DoubleUpDown x:Name="doubleUpDownDraft" Grid.Column="1" Grid.Row="4" Margin="2" FormatString="N2" Minimum="0" Maximum="50" MaxLength="5" ValueChanged="doubleUpDownDraft_ValueChanged"/>
<Label Content="{x:Static p:Resources.textTidalWindow}" FontWeight="DemiBold" Grid.Column="0" Grid.Row="5" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textFrom}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textTo}" Grid.Column="0" Grid.Row="7" HorizontalContentAlignment="Right"/>
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="1" Grid.Row="6" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="1" Grid.Row="7" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<Grid Grid.Row="8" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{x:Static p:Resources.textShiftingTo}" FontWeight="DemiBold"/>
<Image Margin="2" Grid.Column="1" Source="Resources/arrow_right_green.png" />
</Grid>
<Label Content="{x:Static p:Resources.textETABerth}" Grid.Column="0" Grid.Row="9" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<Grid Grid.Column="1" Grid.Row="9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt x:Name="datePickerETA" Grid.Column="0" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETA_ValueChanged"/>
<local:DateTimePickerExt x:Name="datePickerETA_End" Grid.Column="1" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETA_ValueChanged"/>
</Grid>
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="0" Grid.Row="10" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="1" Grid.Row="10" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxArrivalBerth_SelectionChanged" />
<Label Content="{x:Static p:Resources.textPierside}" Grid.Column="0" Grid.Row="11" HorizontalContentAlignment="Right" />
<ComboBox x:Name="comboBoxPiersideArrival" Grid.Column="1" Grid.Row="11" Margin="2" >
<ComboBoxItem Content="{x:Static p:Resources.textPort}" />
<ComboBoxItem Content="{x:Static p:Resources.textStarboard}" />
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPierside" Click="contextMenuItemClearPierside_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBerthRemarks}" Grid.Column="0" Grid.Row="12" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxBerthRemarksArrival" Grid.Column="1" Grid.Row="12" Margin="2,1,2,3" Grid.RowSpan="2" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512"/>
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="14" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxCanceled" Grid.Column="1" Grid.Row="14" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textTugRequired}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTug" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTug" Click="contextMenuItemClearTug_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textRecommendedTugs}" Grid.Column="2" Grid.Row="2" HorizontalContentAlignment="Right"/>
<xctk:IntegerUpDown x:Name="integerUpDownRecommendedTugs" Grid.Column="3" Grid.Row="2" Minimum="0" Margin="2" Maximum="10"/>
<Label Content="{x:Static p:Resources.textPilotRequired}" Grid.Column="2" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox Name="comboBoxPilot" Grid.Column="3" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPilot" Click="contextMenuItemClearPilot_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooring}" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxMooring" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearMooring" Click="contextMenuItemClearMooring_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="2" Grid.Row="5" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxMooredLock" Grid.Column="3" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textRainSensitiveCargo}" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="6" HorizontalAlignment="Right" />
<CheckBox x:Name="checkBoxRainsensitiveCargo" Grid.Column="3" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textRemarks}" Grid.Column="2" Grid.Row="7" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxRemarks" Grid.Column="3" Grid.Row="7" Margin="2,1,2,3" Grid.RowSpan="7" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512"/>
<StackPanel Grid.Row="15" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False"/>
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,473 @@
// Copyright (c) 2023 schick Informatik
// Description: Input control for shifting operations
//
using BreCalClient.misc.Model;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
using static BreCalClient.Extensions;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesAgencyShiftingControl.xaml
/// </summary>
public partial class EditTimesAgencyShiftingControl : Window, IEditTimesControl
{
#region Fields
bool _editing = false;
#endregion
#region Construction
public EditTimesAgencyShiftingControl()
{
InitializeComponent();
}
#endregion
#region Properties
public ShipcallControlModel ShipcallModel { get; set; } = new();
public Times Times { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
{
int portId = this.ShipcallModel.Shipcall.PortId;
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(portId);
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
}
this.CopyToControls();
Participant? p = null;
if (this.ShipcallModel != null)
{
this.Title = this.ShipcallModel.Title;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false;
if (p != null)
{
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
}
_editing = (this.Times.ParticipantId == App.Participant.Id) ||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
System.Windows.MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if((this.datePickerETA.Value != this.Times.EtaBerth) || (this.datePickerETA_End.Value != this.Times.EtaIntervalEnd))
{
if (this.datePickerETA.Value.IsTooOld() && this.datePickerETA_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
}
if (this.datePickerETA.Value.HasValue && this.datePickerETA_End.Value.HasValue && this.datePickerETA.Value > this.datePickerETA_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if((this.datePickerETD.Value != this.Times.EtdBerth) || (this.datePickerETD_End.Value != this.Times.EtdIntervalEnd))
{
if (this.datePickerETD.Value.IsTooOld() || this.datePickerETD_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETD.Value.HasValue && this.datePickerETD_End.Value.HasValue && this.datePickerETD.Value > this.datePickerETD_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
if (this.datePickerTidalWindowFrom.Value.IsTooOld() && this.datePickerTidalWindowTo.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textTidalBothValues;
return false;
}
if (this.datePickerETA.Value.IsTooFar() || this.datePickerETA_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar() ||
this.datePickerETD.Value.IsTooFar() || this.datePickerETD_End.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerETA_End.Value.HasValue && !this.datePickerETA.Value.HasValue) ||
(this.datePickerETD_End.Value.HasValue && !this.datePickerETD.Value.HasValue) ||
(this.datePickerTidalWindowTo.Value.HasValue && !this.datePickerTidalWindowFrom.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
{
this.Times.EtdBerth = this.datePickerETD.Value;
this.Times.EtaBerth = this.datePickerETA.Value;
this.Times.EtaIntervalEnd = this.datePickerETA_End.Value;
this.Times.EtdIntervalEnd = this.datePickerETD_End.Value;
this.ShipcallModel.Shipcall.DepartureBerthId = (int)this.comboBoxDepartureBerth.SelectedValue;
if (this.comboBoxPiersideArrival.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPiersideArrival.SelectedIndex == 0);
}
else
{
this.ShipcallModel.Shipcall.PierSide = null;
}
this.Times.BerthInfo = this.textBoxBerthRemarksArrival.Text.Trim();
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
if(!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.MOORING
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = pa;
}
participant = (Participant?)this.comboBoxPilot.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.PILOT
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = pa;
}
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TERMINAL
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = pa;
}
participant = (Participant?)this.comboBoxTug.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TUG
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = pa;
}
}
}
private void CopyToControls()
{
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
if (this.Times.EtaBerth.HasValue)
{
this.datePickerETA.Value = this.Times.EtaBerth.Value;
}
else
{
// if not set through times use value of BSMD entry
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
}
if(this.Times.EtdBerth.HasValue)
{
this.datePickerETD.Value = this.Times.EtdBerth.Value;
}
else
{
if (this.ShipcallModel.Shipcall.Etd != DateTime.MinValue)
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
}
this.datePickerETA_End.Value = this.Times.EtaIntervalEnd;
this.datePickerETD_End.Value = this.Times.EtdIntervalEnd;
if (this.Times.BerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = this.Times.BerthId;
else if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
if (this.ShipcallModel.Shipcall.DepartureBerthId.HasValue)
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
{
if (this.ShipcallModel.Shipcall.PierSide.Value) this.comboBoxPiersideArrival.SelectedIndex = 0;
else this.comboBoxPiersideArrival.SelectedIndex = 1;
}
this.textBoxBerthRemarksArrival.Text = this.Times.BerthInfo;
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
if (!string.IsNullOrEmpty(this.Times.Remarks))
this.textBoxRemarks.Text = this.Times.Remarks;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
{
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
{
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
{
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
{
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
}
}
}
}
private void EnableControls()
{
this.datePickerETD_End.IsEnabled = _editing;
this.datePickerETA_End.IsEnabled = _editing;
this.datePickerETD.IsEnabled = _editing;
this.comboBoxArrivalBerth.IsEnabled = _editing;
this.doubleUpDownDraft.IsEnabled = _editing;
this.datePickerTidalWindowFrom.IsEnabled = _editing;
this.datePickerTidalWindowTo.IsEnabled = _editing;
this.datePickerETA.IsEnabled = _editing;
this.comboBoxDepartureBerth.IsEnabled = _editing;
this.comboBoxPiersideArrival.IsEnabled = _editing;
this.textBoxBerthRemarksArrival.IsReadOnly = !_editing;
this.checkBoxCanceled.IsEnabled = _editing;
this.comboBoxTug.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.comboBoxPilot.IsEnabled = _editing;
this.comboBoxMooring.IsEnabled = _editing;
this.checkBoxMooredLock.IsEnabled = _editing;
this.comboBoxTerminal.IsEnabled = _editing;
this.checkBoxRainsensitiveCargo.IsEnabled = _editing;
this.textBoxRemarks.IsReadOnly = !_editing;
CheckOKButton();
}
private bool RequiredFieldsSet()
{
bool areSet = this.datePickerETA.Value.HasValue &&
this.datePickerETD.Value.HasValue &&
this.doubleUpDownDraft.Value.HasValue &&
(this.comboBoxArrivalBerth.SelectedIndex >= 0) &&
(this.comboBoxDepartureBerth.SelectedIndex >= 0);
if (this.datePickerETA_End.Value.HasValue)
areSet &= (this.datePickerETA_End.Value > this.datePickerETA.Value);
if (this.datePickerETD_End.Value.HasValue)
areSet &= (this.datePickerETD_End.Value > this.datePickerETD.Value);
return areSet;
}
private void CheckOKButton()
{
this.buttonOK.IsEnabled = _editing && RequiredFieldsSet();
}
#endregion
#region event handlers
private void contextMenuItemDepartureBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxDepartureBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTug.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TUG);
}
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPilot.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.PILOT);
}
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
{
this.comboBoxMooring.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.MOORING);
}
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTerminal.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPiersideArrival.SelectedIndex = -1;
}
private void datePickerETD_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void comboBoxDepartureBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
CheckOKButton();
}
private void doubleUpDownDraft_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void datePickerETA_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void comboBoxArrivalBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
CheckOKButton();
}
#endregion
}
}

View File

@ -0,0 +1,164 @@
<Window x:Class="BreCalClient.EditTimesControl"
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:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditTimes}" Height="331" Width="500" Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip" Icon="Resources/containership.ico">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".20*" />
<ColumnDefinition Width=".80*" />
<!--ColumnDefinition Width="40" /-->
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" x:Name="rowETA" />
<RowDefinition Height="28" x:Name="rowETD" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Button x:Name="buttonFixedOrder" Grid.Row="0" Grid.Column="1" Margin="2" Click="buttonFixedOrder_Click" Width="28" HorizontalAlignment="Left">
<Image x:Name="imageFixedOrder" Source="Resources\lock_open.png" />
</Button>
<!-- Label Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textFixed}" /-->
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textETABerth}" HorizontalContentAlignment="Right" x:Name="labelETA" />
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textETDBerth}" HorizontalContentAlignment="Right" x:Name="labelETD" />
<Label Grid.Row="3" Grid.Column="0" Content="ATA" HorizontalContentAlignment="Right" x:Name="labelATA" />
<Label Grid.Row="4" Grid.Column="0" Content="ATD" HorizontalContentAlignment="Right" x:Name="labelATD" />
<Label Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textLockTime}" HorizontalContentAlignment="Right" />
<Label Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textZoneEntryTime}" HorizontalContentAlignment="Right" />
<Label Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" HorizontalContentAlignment="Right" />
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerETABerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETA" Click="contextMenuItemClearETA_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="1" Margin="2" x:Name="datePickerETABerth_End" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETA_End" Click="contextMenuItemClearETA_End_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
</Grid>
<Grid Grid.Row="2" Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerETDBerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETD" Click="contextMenuItemClearETD_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="1" Margin="2" x:Name="datePickerETDBerth_End" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETD_End" Click="contextMenuItemClearETD_End_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
</Grid>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="3" Grid.Column="1" Margin="2" x:Name="datePickerATA" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearATA" Click="contextMenuItemClearATA_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="4" Grid.Column="1" Margin="2" x:Name="datePickerATD" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearATD" Click="contextMenuItemClearATD_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="5" Grid.Column="1" Margin="2" x:Name="datePickerLockTime" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearLockTime" Click="contextMenuItemClearLockTime_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<!--CheckBox IsEnabled="False" Grid.Row="3" Grid.Column="2" Margin="4,0,0,0" Name="checkBoxLockTimeFixed" VerticalAlignment="Center" /-->
<local:DateTimePickerExt IsEnabled="False" Grid.Row="6" Grid.Column="1" Margin="2" x:Name="datePickerZoneEntry" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearZoneEntry" Click="contextMenuItemClearZoneEntry_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<!--CheckBox IsEnabled="False" Grid.Row="4" Grid.Column="2" Margin="4,0,0,0" Name="checkBoxZoneEntryFixed" VerticalAlignment="Center" /-->
<TextBox Grid.Row="7" Grid.Column="1" Margin="2" Name="textBoxRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="False" IsReadOnly="True" MaxLength="512"/>
<StackPanel Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
<Button Width="28" x:Name="buttonClearAll" Click="buttonClearAll_Click" Margin="2" IsEnabled="False">
<Image Source="Resources\nav_undo_red.png"/>
</Button>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,355 @@
// Copyright (c) 2023 schick Informatik
// Description: Single dialog to edit times for all participant types
// (we might use different controls at a later time)
//
using BreCalClient.misc.Model;
using System;
using System.Windows;
using System.Windows.Media.Imaging;
using Xceed.Wpf.Toolkit;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesControl.xaml
/// </summary>
public partial class EditTimesControl : Window, IEditTimesControl
{
#region Construction
public EditTimesControl()
{
InitializeComponent();
}
#endregion
#region Properties
public Times Times { get; set; } = new();
public Times? AgencyTimes { get; set; } = new();
public ShipcallControlModel ShipcallModel { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.EnableControls();
this.CopyToControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
System.Windows.MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning,
MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
private void buttonFixedOrder_Click(object sender, RoutedEventArgs e)
{
bool newValue = true;
if (this.Times.EtaBerthFixed ?? false)
newValue = false;
SetLockButton(newValue);
}
private void buttonClearAll_Click(object sender, RoutedEventArgs e)
{
if (System.Windows.MessageBox.Show(BreCalClient.Resources.Resources.textClearAll, BreCalClient.Resources.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
this.datePickerETABerth.Value = null;
this.datePickerETABerth_End.Value = null;
this.datePickerETDBerth.Value = null;
this.datePickerETDBerth_End.Value = null;
this.datePickerATA.Value = null;
this.datePickerATD.Value = null;
this.datePickerLockTime.Value = null;
this.datePickerZoneEntry.Value = null;
this.textBoxRemarks.Text = null;
}
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if ((this.datePickerETABerth.Value != this.Times.EtaBerth) || (this.datePickerETABerth_End.Value != this.Times.EtaIntervalEnd))
{
if (this.datePickerETABerth.Value.IsTooOld() || this.datePickerETABerth_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
}
if (this.datePickerETABerth.Value.HasValue && this.datePickerETABerth_End.Value.HasValue && this.datePickerETABerth.Value > this.datePickerETABerth_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if((this.datePickerETDBerth.Value != this.Times.EtdBerth) || (this.datePickerETDBerth_End.Value != this.Times.EtdIntervalEnd))
{
if(this.datePickerETDBerth.Value.IsTooOld() || this.datePickerETDBerth_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETDBerth.Value.HasValue && this.datePickerETDBerth_End.Value.HasValue && this.datePickerETDBerth.Value > this.datePickerETDBerth_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if (this.datePickerLockTime.Value.IsTooOld() && (this.datePickerLockTime.Value != this.Times.LockTime))
{
message = BreCalClient.Resources.Resources.textLockTimeInThePast;
return false;
}
if (this.datePickerZoneEntry.Value.IsTooOld() && (this.datePickerZoneEntry.Value != this.Times.ZoneEntry))
{
message = BreCalClient.Resources.Resources.textZoneEntryInThePast;
return false;
}
if(this.datePickerATA.Value.IsTooFar() || this.datePickerATD.Value.IsTooFar() || this.datePickerETABerth.Value.IsTooFar() || this.datePickerETABerth_End.Value.IsTooFar() ||
this.datePickerETDBerth.Value.IsTooFar() || this.datePickerETDBerth_End.Value.IsTooFar() || this.datePickerLockTime.Value.IsTooFar() || this.datePickerZoneEntry.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerETABerth_End.Value.HasValue && !this.datePickerETABerth.Value.HasValue) || (this.datePickerETDBerth_End.Value.HasValue && !this.datePickerETDBerth.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
this.Times.Remarks = this.textBoxRemarks.Text.Trim().Truncate(512);
this.Times.EtaBerth = this.datePickerETABerth.Value;
this.Times.EtdBerth = this.datePickerETDBerth.Value;
this.Times.EtaIntervalEnd = this.datePickerETABerth_End.Value;
this.Times.EtdIntervalEnd = this.datePickerETDBerth_End.Value;
this.Times.LockTime = this.datePickerLockTime.Value;
this.Times.ZoneEntry = this.datePickerZoneEntry.Value;
this.Times.Ata = this.datePickerATA.Value;
this.Times.Atd = this.datePickerATD.Value;
}
private void CopyToControls()
{
this.textBoxRemarks.Text = this.Times.Remarks;
this.datePickerETABerth.Value = this.Times.EtaBerth;
if(this.datePickerETABerth.IsEnabled && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaBerth != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) && (this.AgencyTimes?.EtaBerth > DateTime.Now))
{
this.datePickerETABerth.Value = this.AgencyTimes.EtaBerth;
if (this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
}
this.datePickerETDBerth.Value = this.Times.EtdBerth;
if(this.datePickerETDBerth.IsEnabled && (this.Times.EtdBerth == null) && (this.AgencyTimes?.EtdBerth != null) && ((ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting)) && (this.AgencyTimes?.EtdBerth > DateTime.Now))
{
this.datePickerETDBerth.Value = this.AgencyTimes.EtdBerth;
if (this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) is WatermarkTextBox tb) tb.SelectAll();
}
this.datePickerLockTime.Value = this.Times.LockTime;
this.datePickerZoneEntry.Value = this.Times.ZoneEntry;
this.datePickerATA.Value = this.Times.Ata;
this.datePickerATD.Value = this.Times.Atd;
this.datePickerETABerth_End.Value = this.Times.EtaIntervalEnd;
if (this.datePickerETABerth_End.IsEnabled && (this.Times.EtaIntervalEnd == null) && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaIntervalEnd != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival))
{
this.datePickerETABerth_End.Value = this.AgencyTimes.EtaIntervalEnd;
//if (this.datePickerETABerth_End.Template.FindName("PART_TextBox", this.datePickerETABerth_End) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
}
this.datePickerETDBerth_End.Value = this.Times.EtdIntervalEnd;
if (this.datePickerETDBerth_End.IsEnabled && (this.Times.EtdIntervalEnd == null) && (this.Times.EtdBerth == null) && (this.AgencyTimes?.EtdIntervalEnd != null) && ((ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting)))
{
this.datePickerETDBerth_End.Value = this.AgencyTimes.EtdIntervalEnd;
//if (this.datePickerETDBerth_End.Template.FindName("PART_TextBox", this.datePickerETDBerth_End) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
}
if (this.ShipcallModel.Shipcall?.Type != ShipcallType.Shifting)
{
int displayIndex = this.ShipcallModel.Shipcall?.TimeRefPoint ?? 0;
if (displayIndex > 0)
{
this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[displayIndex]);
this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[displayIndex]);
}
else
{
this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth;
this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth;
}
}
this.SetLockButton(this.Times.EtaBerthFixed ?? false);
}
private void EnableControls()
{
Extensions.ParticipantType pType = (Extensions.ParticipantType) this.Times.ParticipantType;
// setting visibility
if (pType != Extensions.ParticipantType.MOORING)
{
this.labelATA.Visibility = Visibility.Hidden;
this.datePickerATA.Visibility = Visibility.Hidden;
this.labelATD.Visibility = Visibility.Hidden;
this.datePickerATD.Visibility = Visibility.Hidden;
}
else
{
if(ShipcallModel.Shipcall?.Type == ShipcallType.Arrival)
{
this.labelATD.Visibility = Visibility.Hidden;
this.datePickerATD.Visibility = Visibility.Hidden;
}
if (ShipcallModel.Shipcall?.Type == ShipcallType.Departure)
{
this.labelATA.Visibility = Visibility.Hidden;
this.datePickerATA.Visibility = Visibility.Hidden;
}
}
if (ShipcallModel.Shipcall?.Type != ShipcallType.Arrival)
{
this.rowETA.Height = new(0);
}
else
{
this.rowETD.Height = new(0);
}
// setting en/dis-abled
if (this.Times.ParticipantId != App.Participant.Id)
{
this.buttonFixedOrder.IsEnabled = false;
this.buttonOK.IsEnabled = false;
return; // if this is not "my" entry, there is no editing!
}
this.datePickerETABerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerETABerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerETDBerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerETDBerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.textBoxRemarks.IsReadOnly = false;
this.buttonClearAll.IsEnabled = true;
switch (pType)
{
case Extensions.ParticipantType.MOORING:
this.datePickerATA.IsEnabled = true;
this.datePickerATD.IsEnabled = true;
break;
case Extensions.ParticipantType.PORT_ADMINISTRATION:
this.datePickerLockTime.IsEnabled = true;
break;
case Extensions.ParticipantType.TUG:
case Extensions.ParticipantType.PILOT:
this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
break;
}
}
private void SetLockButton(bool newValue)
{
if (newValue)
{
this.Times.EtaBerthFixed = true;
this.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock.png", UriKind.RelativeOrAbsolute));
this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipUnSetFixedOrder;
}
else
{
this.Times.EtaBerthFixed = false;
this.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock_open.png", UriKind.RelativeOrAbsolute));
this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipSetFixedOrder;
}
}
#endregion
#region clear value event handler
private void contextMenuItemClearETA_Click(object sender, RoutedEventArgs e)
{
this.datePickerETABerth.Value = null;
}
private void contextMenuItemClearETD_Click(object sender, RoutedEventArgs e)
{
this.datePickerETDBerth.Value = null;
}
private void contextMenuItemClearLockTime_Click(object sender, RoutedEventArgs e)
{
this.datePickerLockTime.Value = null;
}
private void contextMenuItemClearZoneEntry_Click(object sender, RoutedEventArgs e)
{
this.datePickerZoneEntry.Value = null;
}
private void contextMenuItemClearATA_Click(object sender, RoutedEventArgs e)
{
this.datePickerATA.Value = null;
}
private void contextMenuItemClearATD_Click(object sender, RoutedEventArgs e)
{
this.datePickerATD.Value = null;
}
private void contextMenuItemClearETA_End_Click(object sender, RoutedEventArgs e)
{
this.datePickerETABerth_End.Value = null;
}
private void contextMenuItemClearETD_End_Click(object sender, RoutedEventArgs e)
{
this.datePickerETDBerth_End.Value = null;
}
#endregion
}
}

View File

@ -0,0 +1,126 @@
<Window x:Class="BreCalClient.EditTimesTerminalControl"
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:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:local="clr-namespace:BreCalClient"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditTimes}" Loaded="Window_Loaded" Height="295" Width="500" ResizeMode="CanResizeWithGrip" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".3*" />
<ColumnDefinition Width=".7*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" x:Name="rowStart"/>
<RowDefinition Height="28" x:Name="rowEnd"/>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="56" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textOperationsStart}" HorizontalContentAlignment="Right" x:Name="labelStart" />
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textOperationsEnd}" HorizontalContentAlignment="Right" x:Name="labelEnd" />
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textBerth}" HorizontalAlignment="Right" x:Name="labelBerth"/>
<Label Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textPierside}" HorizontalContentAlignment="Right" x:Name="labelPierside" />
<Label Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textBerthRemarks}" HorizontalContentAlignment="Right" x:Name="labelBerthRemarks"/>
<Label Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" HorizontalContentAlignment="Right" />
<Grid Grid.Row="0" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerOperationStart" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" >
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationStart" Click="contextMenuItemClearOperationStart_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="1" Margin="2" x:Name="datePickerOperationStart_End" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationStart_End" Click="contextMenuItemClearOperationStart_End_Click">
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerOperationEnd" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" >
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationEnd" Click="contextMenuItemClearOperationEnd_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="1" Margin="2" x:Name="datePickerOperationEnd_End" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationEnd_End" Click="contextMenuItemClearOperationEnd_End_Click">
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
</Grid>
<ComboBox Name="comboBoxBerth" Grid.Column="1" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" IsEnabled="False">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemBerth" Click="contextMenuItemBerth_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="3" Margin="2" IsEnabled="False">
<ComboBoxItem Content="{x:Static p:Resources.textPort}" />
<ComboBoxItem Content="{x:Static p:Resources.textStarboard}" />
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPierside" Click="contextMenuItemClearPierside_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<TextBox Grid.Row="4" Grid.Column="1" Margin="2" Name="textBoxBerthRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="False" IsReadOnly="True" MaxLength="512" />
<TextBox Grid.Row="5" Grid.Column="1" Margin="2" Name="textBoxRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="False" IsReadOnly="True" MaxLength="512" />
<StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="True"/>
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
<Button Width="28" x:Name="buttonClearAll" Click="buttonClearAll_Click" Margin="2" IsEnabled="False">
<Image Source="Resources\nav_undo_red.png"/>
</Button>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,241 @@
// Copyright (c) 2023 schick Informatik
// Description: Terminals have all different fields so a different dialog
//
using BreCalClient.misc.Model;
using System;
using System.Windows;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesTerminalControl.xaml
/// </summary>
public partial class EditTimesTerminalControl : Window, IEditTimesControl
{
public EditTimesTerminalControl()
{
InitializeComponent();
}
#region Properties
public Times Times { get; set; } = new();
public ShipcallControlModel ShipcallModel { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
this.comboBoxBerth.ItemsSource = BreCalLists.GetBerthsByPort(this.ShipcallModel.Shipcall.PortId);
else
this.comboBoxBerth.ItemsSource = BreCalLists.Berths;
this.CopyToControls();
this.EnableControls();
}
private void contextMenuItemClearOperationStart_Click(object sender, RoutedEventArgs e)
{
this.datePickerOperationStart.Value = null;
}
private void contextMenuItemClearOperationEnd_Click(object sender, RoutedEventArgs e)
{
this.datePickerOperationEnd.Value = null;
}
private void contextMenuItemClearOperationStart_End_Click(object sender, RoutedEventArgs e)
{
this.datePickerOperationStart_End.Value = null;
}
private void contextMenuItemClearOperationEnd_End_Click(object sender, RoutedEventArgs e)
{
this.datePickerOperationEnd_End.Value = null;
}
private void contextMenuItemBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxBerth.SelectedIndex -= 1;
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
System.Windows.MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPierside.SelectedIndex = -1;
}
private void buttonClearAll_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show(BreCalClient.Resources.Resources.textClearAll, BreCalClient.Resources.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
this.datePickerOperationStart.Value = null;
this.datePickerOperationStart_End.Value = null;
this.datePickerOperationEnd.Value = null;
this.datePickerOperationEnd_End.Value = null;
this.comboBoxBerth.SelectedIndex = -1;
this.comboBoxPierside.SelectedIndex = -1;
this.textBoxRemarks.Text = null;
this.textBoxBerthRemarks.Text = null;
}
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if((this.datePickerOperationStart.Value != this.Times.OperationsStart) || (this.datePickerOperationStart_End.Value != this.Times.EtaIntervalEnd))
{
if(this.datePickerOperationStart.Value.IsTooOld() || this.datePickerOperationStart_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textOperationStartInThePast;
return false;
}
}
if (this.datePickerOperationStart.Value.HasValue && this.datePickerOperationStart_End.Value.HasValue && this.datePickerOperationStart.Value > this.datePickerOperationStart_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerOperationEnd.Value != this.Times.OperationsEnd) || (this.datePickerOperationEnd_End.Value != this.Times.EtdIntervalEnd))
{
if(this.datePickerOperationEnd.Value.IsTooOld() || this.datePickerOperationEnd_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textOperationEndInThePast;
return false;
}
}
if (this.datePickerOperationEnd.Value.HasValue && this.datePickerOperationEnd_End.Value.HasValue && this.datePickerOperationEnd.Value > this.datePickerOperationEnd_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if(this.datePickerOperationEnd.Value.IsTooFar() || this.datePickerOperationEnd_End.Value.IsTooFar() || this.datePickerOperationStart.Value.IsTooFar() || this.datePickerOperationStart_End.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerOperationEnd_End.Value.HasValue && !this.datePickerOperationEnd.Value.HasValue) || (this.datePickerOperationStart_End.Value.HasValue && !this.datePickerOperationStart.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
this.Times.PierSide = this.comboBoxPierside.SelectedIndex switch
{
0 => true,
1 => false,
_ => null,
};
this.Times.OperationsStart = this.datePickerOperationStart.Value;
this.Times.OperationsEnd = this.datePickerOperationEnd.Value;
this.Times.EtaIntervalEnd = this.datePickerOperationStart_End.Value;
this.Times.EtdIntervalEnd = this.datePickerOperationEnd_End.Value;
this.Times.BerthId = (this.comboBoxBerth.SelectedItem != null) ? ((Berth)this.comboBoxBerth.SelectedItem).Id : null;
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
}
private void CopyToControls()
{
this.datePickerOperationStart.Value = this.Times.OperationsStart;
this.datePickerOperationEnd.Value = this.Times.OperationsEnd;
this.datePickerOperationStart_End.Value = this.Times.EtaIntervalEnd;
this.datePickerOperationEnd_End.Value = this.Times.EtdIntervalEnd;
if(this.Times.PierSide == null) { this.comboBoxPierside.SelectedIndex = -1; }
else this.comboBoxPierside.SelectedIndex = (this.Times.PierSide ?? false) ? 0 : 1;
this.comboBoxBerth.SelectedValue = this.Times.BerthId;
this.textBoxRemarks.Text = this.Times.Remarks;
this.textBoxBerthRemarks.Text = this.Times.BerthInfo;
switch (ShipcallModel.Shipcall?.Type)
{
case ShipcallType.Arrival:
this.labelEnd.Visibility = Visibility.Hidden;
this.datePickerOperationEnd.Visibility = Visibility.Hidden;
this.datePickerOperationEnd_End.Visibility = Visibility.Hidden;
this.rowEnd.Height = new(0);
break;
case ShipcallType.Departure:
this.rowStart.Height = new(0);
this.labelBerth.Visibility = Visibility.Hidden;
this.comboBoxBerth.Visibility= Visibility.Hidden;
this.labelPierside.Visibility = Visibility.Hidden;
this.comboBoxPierside.Visibility = Visibility.Hidden;
this.labelBerthRemarks.Visibility = Visibility.Hidden;
this.textBoxBerthRemarks.Visibility = Visibility.Hidden;
break;
case ShipcallType.Shifting:
this.rowStart.Height = new(0);
this.labelBerth.Visibility = Visibility.Hidden;
this.comboBoxBerth.Visibility = Visibility.Hidden;
this.labelPierside.Visibility = Visibility.Hidden;
this.comboBoxPierside.Visibility = Visibility.Hidden;
this.labelBerthRemarks.Visibility = Visibility.Hidden;
this.textBoxBerthRemarks.Visibility = Visibility.Hidden;
break;
}
}
private void EnableControls()
{
if (this.Times.ParticipantId != App.Participant.Id)
{
this.buttonOK.IsEnabled = false;
return;
}
this.datePickerOperationStart.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.datePickerOperationStart_End.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.datePickerOperationEnd.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerOperationEnd_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.comboBoxBerth.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.comboBoxPierside.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.textBoxBerthRemarks.IsReadOnly = ShipcallModel.Shipcall?.Type != ShipcallType.Arrival;
this.textBoxRemarks.IsReadOnly = false;
this.buttonClearAll.IsEnabled = true;
}
#endregion
}
}

View File

@ -0,0 +1,71 @@
// Copyright (c) 2024- schick Informatik
// Description: Helpers to display localized Enum values in Comboboxes
// https://stackoverflow.com/questions/29658721/enum-in-wpf-comboxbox-with-localized-names
//
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;
namespace BreCalClient
{
#region class EnumToStringConverter
public sealed class EnumToStringConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{ return null; }
return Resources.Resources.ResourceManager.GetString(value.ToString() ?? "");
}
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string str = (string)value;
foreach (object enumValue in Enum.GetValues(targetType))
{
if (str == Resources.Resources.ResourceManager.GetString(enumValue.ToString() ?? ""))
{ return enumValue; }
}
return null;
}
}
#endregion
#region class EnumerateExtension
public sealed class EnumerateExtension : MarkupExtension
{
public Type Type { get; set; }
public EnumerateExtension(Type type)
{
this.Type = type;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
string[] names = Enum.GetNames(Type);
// skip value "0" == "Unknown" (we dont want this selectable in the Combobox)
// NOTE: This will only work in the future if the first element is always "undefined" aka unused
string[] values = new string[names.Length - 1];
for (int i = 0; i < names.Length - 1; i++)
{
values[i] = Resources.Resources.ResourceManager.GetString(names[i + 1]) ?? names[i];
}
return values;
}
}
#endregion
}

View File

@ -0,0 +1,174 @@
// Copyright (c) 2023 schick Informatik
// Description: some helpers
//
using BreCalClient.misc.Model;
using System;
using System.ComponentModel;
namespace BreCalClient
{
public static class Extensions
{
#region Enum
/// <summary>
/// Copied from models clunky I know
/// </summary>
[Flags]
public enum ParticipantType
{
[Description("not assigned")]
NONE = 0,
[Description("BSMD")]
BSMD = 1,
[Description("Terminal")]
TERMINAL = 2,
[Description("Flusslotsen")]
PILOT = 4,
[Description("Agentur")]
AGENCY = 8,
[Description("Festmacher")]
MOORING = 16,
[Description("Hafenamt")]
PORT_ADMINISTRATION = 32,
[Description("Schlepper")]
TUG = 64,
}
/// <summary>
/// Custom participant flags
/// </summary>
[Flags]
public enum ParticipantFlag
{
[Description("allow BSMD initial info")]
ALLOW_BSMD = 1,
}
public enum SortOrder
{
SHIP_NAME,
ETA_ETD,
MODIFIED
}
#endregion
#region public helper
public static bool IsTooFar(this DateTime datetime)
{
return datetime > DateTime.Now.AddYears(1);
}
public static bool IsTooFar(this DateTime? datetime)
{
if (datetime == null) return false;
return datetime > DateTime.Now.AddYears(1);
}
public static bool IsTooOld(this DateTime? datetime)
{
if (datetime == null) return false;
{
return datetime < DateTime.Now.AddDays(-1);
}
}
public static bool IsTypeFlagSet(this Participant participant, ParticipantType flag)
{
return (participant.Type & (uint)flag) != 0;
}
public static bool IsFlagSet(this Participant participant, ParticipantFlag flag)
{
return (participant.Flags & (uint)flag) != 0;
}
public static string Truncate(this string value, int maxLength)
{
if (string.IsNullOrEmpty(value)) return value;
return value.Length <= maxLength ? value : value[..maxLength];
}
public static string TruncateDots(this string value, int maxLength)
{
if(string.IsNullOrEmpty(value)) return value;
if (value.Length <= maxLength) return value;
if (value.Length > (maxLength + 1))
{
int i = maxLength - 2;
for (; (i > 0) && !(char.IsWhiteSpace(value[i])); i--) ; // try to put the "..." at a word break
return value.Substring(0, i) + " ...";
}
return value[..maxLength];
}
public static string DisplayTime(this Times times, bool isArrival)
{
if (isArrival)
{
if(times.ParticipantType == (int) ParticipantType.TERMINAL)
{
if(times.OperationsStart.HasValue)
{
string result = times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm");
if (times.EtaIntervalEnd.HasValue) result = times.OperationsStart.Value.ToString("d.M. HH:mm") + " - " + times.EtaIntervalEnd.Value.ToString("d.M. HH:mm");
return result;
}
else
{
return "- / -";
}
}
else
{
if(times.EtaBerth.HasValue)
{
string result = times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm");
if (times.EtaIntervalEnd.HasValue) result = times.EtaBerth.Value.ToString("d.M. HH:mm") + " - " + times.EtaIntervalEnd.Value.ToString("d.M. HH:mm");
return result;
}
else
{
return "- / -";
}
}
}
else
{
if (times.ParticipantType == (int)ParticipantType.TERMINAL)
{
if(times.OperationsEnd.HasValue)
{
string result = times.OperationsEnd.Value.ToString("dd.MM.yyyy HH:mm");
if (times.EtdIntervalEnd.HasValue) result = times.OperationsEnd.Value.ToString("d.M. HH:mm") + " - " + times.EtdIntervalEnd.Value.ToString("d.M. HH:mm");
return result;
}
else
{
return "- / -";
}
}
else
{
if(times.EtdBerth.HasValue)
{
string result = times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm");
if (times.EtdIntervalEnd.HasValue) result = times.EtdBerth.Value.ToString("d.M. HH:mm") + " - " + times.EtdIntervalEnd.Value.ToString("d.M. HH:mm");
return result;
}
else
{
return "- / -";
}
}
}
}
#endregion
}
}

View File

@ -0,0 +1,39 @@
<UserControl x:Class="BreCalClient.HistoryControl"
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:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d"
d:DesignHeight="46" d:DesignWidth="800">
<Border BorderBrush="Black" BorderThickness="0 0 0 .5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="14" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".2*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textShip}" VerticalAlignment="Center" Foreground="Gray" />
<TextBlock Grid.Row="0" Grid.Column="1" FontSize="10" FontWeight="DemiBold" VerticalAlignment="Center" x:Name="textBlockShipcallType" />
<TextBlock Grid.Row="0" Grid.Column="2" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textTimestamp}" VerticalAlignment="Center" Foreground="Gray"/>
<TextBlock Grid.Row="0" Grid.Column="3" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textOperation}" VerticalAlignment="Center" Foreground="Gray"/>
<TextBlock Grid.Row="0" Grid.Column="4" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textParticipant}" VerticalAlignment="Center" Foreground="Gray"/>
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="textBlockShip" FontWeight="DemiBold">
<Hyperlink Click="textBlockShip_Click">
<TextBlock x:Name="hyperLinkShip" />
</Hyperlink>
</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="textBlockEta" />
<TextBlock Grid.Row="1" Grid.Column="2" x:Name="textBlockTimestamp" />
<TextBlock Grid.Row="1" Grid.Column="3" x:Name="textBlockOperation" />
<TextBlock Grid.Row="1" Grid.Column="4" x:Name="textBlockParticipant" />
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,38 @@
// Copyright (c) 2024- schick Informatik
// Description: display single history element (later shown in a list)
//
using BreCalClient.misc.Model;
using System;
using System.Windows.Controls;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for HistoryControl.xaml
/// </summary>
public partial class HistoryControl : UserControl
{
private readonly History _history;
public event Action<int>? HistorySelected;
public HistoryControl(string ship, History history, string callType, string etaetd)
{
InitializeComponent();
_history = history;
this.textBlockOperation.Text = $"{history.Operation} on {history.Type}";
this.hyperLinkShip.Text = ship;
if(BreCalLists.ParticipantLookupDict.ContainsKey(history.ParticipantId))
this.textBlockParticipant.Text = BreCalLists.ParticipantLookupDict[history.ParticipantId].Name;
this.textBlockTimestamp.Text = history.Timestamp.ToString();
this.textBlockEta.Text = etaetd;
this.textBlockShipcallType.Text = callType;
}
private void textBlockShip_Click(object sender, System.Windows.RoutedEventArgs e)
{
this.HistorySelected?.Invoke(_history.ShipcallId);
}
}
}

View File

@ -0,0 +1,32 @@
<Window x:Class="BreCalClient.HistoryDialog"
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:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d" Left="{local:SettingBinding W4Left}" Top="{local:SettingBinding W4Top}"
Title="{x:Static p:Resources.textChangeHistory}" Height="450" Width="800" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Margin="2">
<StackPanel x:Name="stackPanel"/>
</ScrollViewer>
<Grid Grid.Row="1" Grid.Column="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="22" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width=".2*" />
</Grid.ColumnDefinitions>
<CheckBox x:Name="checkboxMyOwnOnly" VerticalContentAlignment="Center" Grid.Column="0" Margin="2" Checked="checkboxMyOwnOnly_Checked" Unchecked="checkboxMyOwnOnly_Checked" />
<Label Content="{x:Static p:Resources.textMineOnly}" Grid.Column="1" />
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Right" />
</Grid>
</Grid>
</Window>

View File

@ -0,0 +1,136 @@
// Copyright (c) 2024- schick Informatik
// Description: Window to show (complete) list of current shipcall histories
//
using BreCalClient.misc.Api;
using BreCalClient.misc.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Printing;
using System.Windows;
using System.Windows.Input;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for HistoryDialog.xaml
/// </summary>
public partial class HistoryDialog : Window
{
#region Fields
private readonly ConcurrentDictionary<int, ShipcallControlModel> _shipcalls;
private readonly StaticApi _staticApi;
#endregion
#region delegate/event to react to history item selection
public event Action<int>? HistoryItemSelected;
#endregion
#region Construction
public HistoryDialog(ConcurrentDictionary<int, ShipcallControlModel> shipcalls, StaticApi staticApi)
{
InitializeComponent();
_shipcalls = shipcalls;
_staticApi = staticApi;
}
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Mouse.OverrideCursor = Cursors.Wait;
RefreshHistory();
}
private void buttonClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void checkboxMyOwnOnly_Checked(object sender, RoutedEventArgs e)
{
Mouse.OverrideCursor = Cursors.Wait;
RefreshHistory();
}
#endregion
#region private methods
private async void RefreshHistory()
{
List<History> allHistories = new();
this.stackPanel.Children.Clear();
foreach (int shipcall_id in _shipcalls.Keys)
{
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
System.Diagnostics.Trace.WriteLine($"{shipcallHistory.Count} history elements loaded for shipcall {shipcall_id}");
allHistories.AddRange( shipcallHistory );
}
// sort all entries
allHistories.Sort((x, y) => { return y.Timestamp.CompareTo(x.Timestamp); });
EnumToStringConverter enumToStringConverter = new();
// create controls for all entries
foreach (History history in allHistories)
{
if (FilterShipcall(history.ShipcallId)) continue;
string shipname = "";
Ship? ship = this._shipcalls[history.ShipcallId].Ship;
if (ship != null)
shipname = ship.Name;
string etaetd = "", calltype = "";
if (_shipcalls.ContainsKey(history.ShipcallId))
{
etaetd = _shipcalls[history.ShipcallId].GetETAETD();
if (_shipcalls[history.ShipcallId].Shipcall != null)
{
ShipcallType? type = _shipcalls[history.ShipcallId].Shipcall?.Type;
if (type != null) calltype = (string) (enumToStringConverter.Convert(type ?? ShipcallType.Undefined, typeof(ShipcallType), new(), System.Globalization.CultureInfo.CurrentCulture) ?? "");
}
}
HistoryControl hc = new(shipname, history, calltype, etaetd);
hc.HistorySelected += (x) => { HistoryItemSelected?.Invoke(x); }; // bubble event
this.stackPanel.Children.Add(hc);
}
Mouse.OverrideCursor = null;
}
bool FilterShipcall(int shipcallId)
{
bool result = true;
if (shipcallId < 0) return result;
if(_shipcalls.TryGetValue(shipcallId, out ShipcallControlModel? scm))
{
if(this.checkboxMyOwnOnly.IsChecked ?? false)
{
foreach(ParticipantAssignment p in scm.AssignedParticipants.Values)
{
if (p.ParticipantId.Equals(App.Participant.Id)) return false;
}
}
else
{
return false;
}
}
return result;
}
#endregion
}
}

View File

@ -0,0 +1,22 @@
// Copyright (c) 2023 schick Informatik
// Description: Interfaces to simplify dialog handling
//
using BreCalClient.misc.Model;
namespace BreCalClient
{
internal interface IEditTimesControl
{
Times Times { get; set; }
string Title { get; set; }
ShipcallControlModel ShipcallModel { get; set; }
bool? ShowDialog();
}
}

View File

@ -0,0 +1,178 @@
<Window x:Class="BreCalClient.MainWindow"
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:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:sets="clr-namespace:BreCalClient.Properties"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d"
Title="{DynamicResource textApplicationTitle}" Height="{local:SettingBinding Height}" Width="{local:SettingBinding Width}"
Top="{local:SettingBinding Top}" Left="{local:SettingBinding Left}" Loaded="Window_Loaded" Closing="Window_Closing" Icon="Resources/containership.ico">
<Window.Resources>
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
</Window.Resources>
<xctk:BusyIndicator Name="busyIndicator" IsBusy="True">
<xctk:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</xctk:BusyIndicator.ProgressBarStyle>
<xctk:BusyIndicator.BusyContent>
<Grid Width="320">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="84" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Content="{x:Static p:Resources.textUserlogin}" Grid.Row="0" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Label Content="{x:Static p:Resources.textUsername}" Grid.Row="1" VerticalContentAlignment="Center" />
<Label Content="{x:Static p:Resources.textPassword}" Grid.Row="2" VerticalContentAlignment="Center" />
<TextBox Name="textUsername" Grid.Row="1" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" />
<PasswordBox Name="textPassword" Grid.Row="2" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" PasswordChar="*"/>
<Label Name="labelLoginResult" Grid.Row="3" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" />
<Button Name="buttonLogin" Content="{x:Static p:Resources.textLogin}" Grid.Row="4" Grid.Column="0" Margin="2" Click="buttonLogin_Click" IsDefault="True" />
<Button Name="buttonExit" Content="{x:Static p:Resources.textExit}" Grid.Row="4" Grid.Column="1" Margin="2" Click="buttonExit_Click" />
<TextBlock FontSize="10" TextWrapping="Wrap" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" >
<Underline>Hinweis</Underline>:<LineBreak />
Mit der Anmeldung in Bremen Calling akzeptieren Sie die Bedingungen<LineBreak />
des Systems, die Sie in der aktuell gültigen Fassung unter dem nachfolgenden Link
einsehen können: <Hyperlink NavigateUri="https://www.bsmd-emswe.eu/disclaimer.html" RequestNavigate="Hyperlink_RequestNavigate">Datenschutzerklärung</Hyperlink>.
</TextBlock>
</Grid>
</xctk:BusyIndicator.BusyContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="56" />
<RowDefinition Height="28" />
<RowDefinition Height="34" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<local:SearchFilterControl Grid.Row="0" x:Name="searchFilterControl" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60" />
<ColumnDefinition Width=".1*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".1*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".1*" />
<ColumnDefinition Width=".2*" />
</Grid.ColumnDefinitions>
<Button Margin="2" Grid.Column="0" Content="{x:Static p:Resources.textNewDots}" x:Name="buttonNew" Visibility="Hidden" Click="buttonNew_Click" Background="Transparent"/>
<Label Content="{x:Static p:Resources.textSortOrder}" Grid.Column="1" HorizontalContentAlignment="Right"/>
<Grid Grid.Column="2" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<ComboBox x:Name="comboBoxSortOrder" Margin="2" Grid.Column="0" SelectionChanged="comboBoxSortOrder_SelectionChanged" />
<CheckBox x:Name="checkboxShowCancelledCalls" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="2" Checked="checkboxShowCancelledCalls_Checked" Unchecked="checkboxShowCancelledCalls_Checked" />
<Label Content="{x:Static p:Resources.textShowCancelledShipcalls}" Grid.Column="2" />
</Grid>
<Label Content="{x:Static p:Resources.textHarbour}" Grid.Column="3" HorizontalAlignment="Right" />
<xctk:CheckComboBox x:Name="comboBoxPorts" Margin="2" Grid.Column="4" ItemSelectionChanged="comboBoxPorts_ItemSelectionChanged" DisplayMemberPath="Name" />
<Button Margin="2" Grid.Column="6" Content="{x:Static p:Resources.textClearFilters}" x:Name="buttonClearFilter" Click="buttonClearFilter_Click" Background="Transparent" />
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".13*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="1" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textAgency}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="2" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textMooring}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="3" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textPortAuthority}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="4" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textPilots}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="5" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textTug}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="6" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textTerminal}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
</Grid>
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
<StackPanel x:Name="stackPanel"/>
</ScrollViewer>
<StatusBar Grid.Row="4">
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Grid.Column="0">
<TextBlock Name="labelGeneralStatus" FontSize="9"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="1"/>
<StatusBarItem Grid.Column="2">
<TextBlock Name="labelVersion"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="3"/>
<StatusBarItem Grid.Column="4">
<TextBlock Name="labelUsername"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="5"/>
<StatusBarItem Grid.Column="6">
<Button x:Name="buttonInfo" Content="?" Click="buttonInfo_Click" Width="20" ToolTip="{x:Static p:Resources.textInfoChangePW}"/>
</StatusBarItem>
<Separator Grid.Column="7"/>
<StatusBarItem Grid.Column="8">
<Button x:Name="buttonHistory" Click="buttonHistory_Click" Width="20" ToolTip="{x:Static p:Resources.textShowHistory}">
<Image Source="./Resources/clock.png"/>
</Button>
</StatusBarItem>
<Separator Grid.Column="9"/>
<StatusBarItem Grid.Column="10">
<TextBlock Name="labelStatusBar"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="11"/>
<StatusBarItem Grid.Column="12">
<Button x:Name="buttonManualRefresh" Width="20" Click="buttonManualRefresh_Click" ToolTip="{x:Static p:Resources.textTriggerManualRefresh}">
<Image Source="./Resources/nav_refresh_green.png"/>
</Button>
</StatusBarItem>
<StatusBarItem Grid.Column="13">
<TextBlock x:Name="labelLatestUpdate" />
</StatusBarItem>
<Separator Grid.Column="14"/>
<StatusBarItem Grid.Column="15">
<ProgressBar Name="generalProgressStatus" Width="90" Height="16" Foreground="LightGray"/>
</StatusBarItem>
</StatusBar>
</Grid>
</xctk:BusyIndicator>
</Window>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>1.6.0.4</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Debug</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
<ErrorReportUrl>https://www.textbausteine.net/</ErrorReportUrl>
<GenerateManifests>true</GenerateManifests>
<Install>True</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>https://www.bsmd-emswe.eu/develclient/</InstallUrl>
<IsRevisionIncremented>False</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<MapFileExtensions>True</MapFileExtensions>
<OpenBrowserOnPublish>False</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<ProductName>Bremen calling development client</ProductName>
<PublishDir>bin\Debug\net6.0-windows\win-x64\app.publish\</PublishDir>
<PublishUrl>bin\publish.devel\</PublishUrl>
<PublisherName>Informatikbüro Daniel Schick</PublisherName>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>True</PublishReadyToRun>
<PublishSingleFile>True</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>True</SelfContained>
<SignatureAlgorithm>(none)</SignatureAlgorithm>
<SignManifests>False</SignManifests>
<SuiteName>Bremen calling</SuiteName>
<SupportUrl>https://www.textbausteine.net/</SupportUrl>
<TargetFramework>net6.0-windows</TargetFramework>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>True</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
<MinimumRequiredVersion>1.6.0.4</MinimumRequiredVersion>
<SkipPublishVerification>false</SkipPublishVerification>
</PropertyGroup>
<ItemGroup>
<PublishFile Include="containership.ico">
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>true</IncludeHash>
<FileType>File</FileType>
</PublishFile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>6.0</ApplicationVersion>
<BootstrapperEnabled>False</BootstrapperEnabled>
<Configuration>Release</Configuration>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
<ErrorReportUrl>http://www.textbausteine.net</ErrorReportUrl>
<GenerateManifests>true</GenerateManifests>
<Install>True</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>https://www.bsmd-emswe.eu/client/</InstallUrl>
<IsRevisionIncremented>False</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<MapFileExtensions>True</MapFileExtensions>
<OpenBrowserOnPublish>False</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\net6.0-windows\win-x64\app.publish\</PublishDir>
<PublishUrl>bin\publish\</PublishUrl>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishSingleFile>True</PublishSingleFile>
<SelfContained>True</SelfContained>
<SignatureAlgorithm>(none)</SignatureAlgorithm>
<SignManifests>False</SignManifests>
<TargetFramework>net6.0-windows</TargetFramework>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>False</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<ErrorReportUrl>https://www.bsmd-emswe.eu/</ErrorReportUrl>
<ProductName>BreCalClient</ProductName>
<PublisherName>Informatikbüro Daniel Schick</PublisherName>
<SuiteName>Bremen calling client</SuiteName>
<SupportUrl>https://www.bsmd-emswe.eu/</SupportUrl>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SkipPublishVerification>false</SkipPublishVerification>
</PropertyGroup>
<ItemGroup>
<PublishFile Include="containership.ico">
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>true</IncludeHash>
<FileType>File</FileType>
</PublishFile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<ApplicationRevision>4</ApplicationRevision>
<ApplicationVersion>1.6.0.4</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Debug</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
<ErrorReportUrl>https://www.textbausteine.net/</ErrorReportUrl>
<GenerateManifests>true</GenerateManifests>
<Install>True</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>https://www.bsmd-emswe.eu/testclient/</InstallUrl>
<IsRevisionIncremented>False</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<MapFileExtensions>True</MapFileExtensions>
<OpenBrowserOnPublish>False</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<PublishUrl>bin\publish.test\</PublishUrl>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>True</PublishReadyToRun>
<PublishSingleFile>True</PublishSingleFile>
<SelfContained>True</SelfContained>
<SignatureAlgorithm>(none)</SignatureAlgorithm>
<SignManifests>False</SignManifests>
<TargetFramework>net6.0-windows</TargetFramework>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>False</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<ErrorReportUrl>https://www.bsmd-emswe.eu/</ErrorReportUrl>
<ProductName>Bremen Calling Testclient</ProductName>
<PublisherName>Informatikbüro Daniel Schick</PublisherName>
<SuiteName>Bremen Calling</SuiteName>
<SupportUrl>http://www.textbausteine.net/</SupportUrl>
<PublishDir>bin\Debug\net6.0-windows\win-x64\app.publish\</PublishDir>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SkipPublishVerification>false</SkipPublishVerification>
</PropertyGroup>
<ItemGroup>
<PublishFile Include="containership.ico">
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>true</IncludeHash>
<FileType>File</FileType>
</PublishFile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,230 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BreCalClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#751D1F")]
public string BG_COLOR {
get {
return ((string)(this["BG_COLOR"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("!!Bremen calling Testversion!!")]
public string APP_TITLE {
get {
return ((string)(this["APP_TITLE"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://www.textbausteine.net/")]
public string LOGO_IMAGE_URL {
get {
return ((string)(this["LOGO_IMAGE_URL"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string FilterCriteria {
get {
return ((string)(this["FilterCriteria"]));
}
set {
this["FilterCriteria"] = value;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://brecaltest.bsmd-emswe.eu")]
public string API_URL {
get {
return ((string)(this["API_URL"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("800")]
public double Width {
get {
return ((double)(this["Width"]));
}
set {
this["Width"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("450")]
public double Height {
get {
return ((double)(this["Height"]));
}
set {
this["Height"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double Left {
get {
return ((double)(this["Left"]));
}
set {
this["Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double Top {
get {
return ((double)(this["Top"]));
}
set {
this["Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W1Left {
get {
return ((double)(this["W1Left"]));
}
set {
this["W1Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W1Top {
get {
return ((double)(this["W1Top"]));
}
set {
this["W1Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W2Left {
get {
return ((double)(this["W2Left"]));
}
set {
this["W2Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W2Top {
get {
return ((double)(this["W2Top"]));
}
set {
this["W2Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W3Left {
get {
return ((double)(this["W3Left"]));
}
set {
this["W3Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W3Top {
get {
return ((double)(this["W3Top"]));
}
set {
this["W3Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W4Left {
get {
return ((double)(this["W4Left"]));
}
set {
this["W4Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W4Top {
get {
return ((double)(this["W4Top"]));
}
set {
this["W4Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string FilterCriteriaMap {
get {
return ((string)(this["FilterCriteriaMap"]));
}
set {
this["FilterCriteriaMap"] = value;
}
}
}
}

View File

@ -0,0 +1,60 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="BreCalClient.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="BG_COLOR" Type="System.String" Scope="Application">
<Value Profile="(Default)">#751D1F</Value>
</Setting>
<Setting Name="APP_TITLE" Type="System.String" Scope="Application">
<Value Profile="(Default)">!!Bremen calling Testversion!!</Value>
</Setting>
<Setting Name="LOGO_IMAGE_URL" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://www.textbausteine.net/</Value>
</Setting>
<Setting Name="FilterCriteria" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="API_URL" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://brecaltest.bsmd-emswe.eu</Value>
</Setting>
<Setting Name="Width" Type="System.Double" Scope="User">
<Value Profile="(Default)">800</Value>
</Setting>
<Setting Name="Height" Type="System.Double" Scope="User">
<Value Profile="(Default)">450</Value>
</Setting>
<Setting Name="Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W1Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W1Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W2Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W2Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W3Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W3Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W4Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W4Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="FilterCriteriaMap" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,40 @@
# Bremen calling WPF client
## Introduction
## API / code generation
The Rest API client is generated from the OpenAPI specification [BreCalApi.yaml](../../misc/BreCalApiyaml) into the C# file [BreCalApi.cs](../../misc/BreCalApi.cs).
In order to do so an extension for Visual Studio needs to be installed: REST API Client Code Generator for VS 2022.
https://marketplace.visualstudio.com/items?itemName=ChristianResmaHelle.ApiClientCodeGenerator2022
This extension has multiple generators, for this project OpenApiCodeGenerator is used (must be set on the yaml file in the project settings).
Internally this uses Java, currently > 55 which translates into Java JDK 17 LTS.
If code generation is not working please have a look in the output pane and select appropriate output source.
## Installation
The client is deployed via ClickOnce.
To deploy the test client, leave everything as it is in develop branch and publish using the profile [ClickOnceTestProfile.pubxml](./Properties/PublishProfiles/ClickOnceTestProfile.pubxml).
To deploy the productive version, use the profile [ClickOnceProfile.pubxml](./Properties/PublishProfiles/ClickOnceProfile.pubxml).
You will also need to change the AssemblyName in BreCalClient.csproj back to BreCalClient.
```xml
<AssemblyName>BreCalClient</AssemblyName>
```
Resources are embedded in the assembly. Therefore wherever Resources are referenced via assembly name this name has to be adjusted as well. For example:
```C++
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalClient;component/Resources/arrow_right_green.png"));
```
It is debatable if the single contained file deployment makes sense at this point. Installation file size
is at about 150MB which takes a long time to upload however it should run on any current windows installation.
Theoretically it should also work on Linux.
### Signing
Currently neither assemblies nor the installation is signed. This probably only makes sense with a paid public code signing certificate.

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,556 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Arrival" xml:space="preserve">
<value>Einkommend</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="arrow_down_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>arrow_down_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="clipboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>clipboard.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="clock" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>clock.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="containership" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>containership.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Departure" xml:space="preserve">
<value>Ausgehend</value>
</data>
<data name="emergency_stop_button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>emergency_stop_button.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="logo_bremen_calling" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>logo_bremen_calling.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Shifting" xml:space="preserve">
<value>Verholung</value>
</data>
<data name="ship2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>ship2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="textAdd" xml:space="preserve">
<value>Hinzufügen</value>
</data>
<data name="textAgencies" xml:space="preserve">
<value>Agenturen</value>
</data>
<data name="textAgency" xml:space="preserve">
<value>Agentur</value>
</data>
<data name="textAnchored" xml:space="preserve">
<value>Ankerorder</value>
</data>
<data name="textArrivalTerminal" xml:space="preserve">
<value>Terminal Ankunft</value>
</data>
<data name="textBerth" xml:space="preserve">
<value>Liegeplatz</value>
</data>
<data name="textBerthRemarks" xml:space="preserve">
<value>Liegeplatz Informationen</value>
</data>
<data name="textBerths" xml:space="preserve">
<value>Liegeplätze</value>
</data>
<data name="textBothTideTimesNecessary" xml:space="preserve">
<value>Beide Tidenzeiten sollten angegeben werden (von - bis)</value>
</data>
<data name="textBSMDGranted" xml:space="preserve">
<value>Freigabe zur Bearb. f. BSMD erteilt</value>
</data>
<data name="textBunkering" xml:space="preserve">
<value>Bunkeraufnahme</value>
</data>
<data name="textCallsign" xml:space="preserve">
<value>Rufzeichen</value>
</data>
<data name="textCancel" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="textCancelled" xml:space="preserve">
<value>Annulliert</value>
</data>
<data name="textCategories" xml:space="preserve">
<value>Kategorien</value>
</data>
<data name="textChange" xml:space="preserve">
<value>Ändern</value>
</data>
<data name="textChangeContactInfo" xml:space="preserve">
<value>Kontaktdaten bearbeiten</value>
</data>
<data name="textChangeHistory" xml:space="preserve">
<value>Verlauf</value>
</data>
<data name="textChangePassword" xml:space="preserve">
<value>Passwort ändern</value>
</data>
<data name="textClearAll" xml:space="preserve">
<value>Alle Eintragungen zurücksetzen?</value>
</data>
<data name="textClearAssignment" xml:space="preserve">
<value>Zuordnung entfernen</value>
</data>
<data name="textClearFilters" xml:space="preserve">
<value>Filter löschen</value>
</data>
<data name="textClearValue" xml:space="preserve">
<value>Eingabe löschen</value>
</data>
<data name="textClose" xml:space="preserve">
<value>Schliessen</value>
</data>
<data name="textConfirmation" xml:space="preserve">
<value>Bestätigung</value>
</data>
<data name="textDelete" xml:space="preserve">
<value>Löschen</value>
</data>
<data name="textDeleted" xml:space="preserve">
<value>Gelöscht</value>
</data>
<data name="textDepartureTerminal" xml:space="preserve">
<value>Terminal Abfahrt</value>
</data>
<data name="textDraft" xml:space="preserve">
<value>Tiefgang (m)</value>
</data>
<data name="textEdit" xml:space="preserve">
<value>Bearbeiten</value>
</data>
<data name="textEditShip" xml:space="preserve">
<value>Schiff bearbeiten</value>
</data>
<data name="textEditShipcall" xml:space="preserve">
<value>Schiffsanlauf bearbeiten</value>
</data>
<data name="textEditShips" xml:space="preserve">
<value>Schiffe anlegen / bearbeiten</value>
</data>
<data name="textEditTimes" xml:space="preserve">
<value>Zeiten bearbeiten</value>
</data>
<data name="textEmail" xml:space="preserve">
<value>E-Mail</value>
</data>
<data name="textEndValueBeforeStartValue" xml:space="preserve">
<value>Endzeit liegt vor Startzeit</value>
</data>
<data name="textEnterKeyword" xml:space="preserve">
<value>Schiff / Bemerkung</value>
</data>
<data name="textError" xml:space="preserve">
<value>Error</value>
</data>
<data name="textETABerth" xml:space="preserve">
<value>ETA Liegeplatz</value>
</data>
<data name="textETAInThePast" xml:space="preserve">
<value>Zeitpunkt ETA liegt in der Vergangenheit</value>
</data>
<data name="textETDBerth" xml:space="preserve">
<value>ETD Liegeplatz</value>
</data>
<data name="textETDInThePast" xml:space="preserve">
<value>Zeitpunkt ETD liegt in der Vergangenheit</value>
</data>
<data name="textExit" xml:space="preserve">
<value>Verlassen</value>
</data>
<data name="textFixed" xml:space="preserve">
<value>Fest</value>
</data>
<data name="textFixedOrder" xml:space="preserve">
<value>Als feste Bestellung vermerkt</value>
</data>
<data name="textFrom" xml:space="preserve">
<value>von</value>
</data>
<data name="textHarbour" xml:space="preserve">
<value>Hafen</value>
</data>
<data name="textIncoming" xml:space="preserve">
<value>Einkommend</value>
</data>
<data name="textInfoChangePW" xml:space="preserve">
<value>App Info anzeigen und Passwort ändern</value>
</data>
<data name="textInterval" xml:space="preserve">
<value>Zeitraum</value>
</data>
<data name="textLength" xml:space="preserve">
<value>Länge</value>
</data>
<data name="textLengthWidth" xml:space="preserve">
<value>L/B (m)</value>
</data>
<data name="textLockTime" xml:space="preserve">
<value>Zeit Schleuse</value>
</data>
<data name="textLockTimeInThePast" xml:space="preserve">
<value>Schleusenzeit liegt in der Vergangenheit</value>
</data>
<data name="textLogin" xml:space="preserve">
<value>Anmelden</value>
</data>
<data name="textMineOnly" xml:space="preserve">
<value>nur eigene</value>
</data>
<data name="textMooredLock" xml:space="preserve">
<value>auch in Schleuse</value>
</data>
<data name="textMooring" xml:space="preserve">
<value>Festmacher</value>
</data>
<data name="textNewDots" xml:space="preserve">
<value>Neu..</value>
</data>
<data name="textNewPassword" xml:space="preserve">
<value>Neues Passwort</value>
</data>
<data name="textNotRotated" xml:space="preserve">
<value>Ungedreht</value>
</data>
<data name="textOK" xml:space="preserve">
<value>OK</value>
</data>
<data name="textOldPassword" xml:space="preserve">
<value>Altes Passwort</value>
</data>
<data name="textOperation" xml:space="preserve">
<value>Vorgang</value>
</data>
<data name="textOperationEndInThePast" xml:space="preserve">
<value>Operation Endzeit liegt in der Vergangenheit</value>
</data>
<data name="textOperationsEnd" xml:space="preserve">
<value>Operation Ende</value>
</data>
<data name="textOperationsStart" xml:space="preserve">
<value>Operation Start</value>
</data>
<data name="textOperationStartInThePast" xml:space="preserve">
<value>Operation Startzeit liegt in der Vergangenheit</value>
</data>
<data name="textOutgoing" xml:space="preserve">
<value>Ausgehend</value>
</data>
<data name="textParticipant" xml:space="preserve">
<value>Teilnehmer</value>
</data>
<data name="textParticipants" xml:space="preserve">
<value>Teilnehmer</value>
</data>
<data name="textPassword" xml:space="preserve">
<value>Passwort</value>
</data>
<data name="textPasswordChanged" xml:space="preserve">
<value>Passwort geändert.</value>
</data>
<data name="textPhone" xml:space="preserve">
<value>Telefon</value>
</data>
<data name="textPierside" xml:space="preserve">
<value>Anlegeseite</value>
</data>
<data name="textPilot" xml:space="preserve">
<value>Flusslotse</value>
</data>
<data name="textPilotRequired" xml:space="preserve">
<value>Lotsorder</value>
</data>
<data name="textPilots" xml:space="preserve">
<value>Flusslotsen</value>
</data>
<data name="textPort" xml:space="preserve">
<value>Backbord</value>
</data>
<data name="textPortAuthority" xml:space="preserve">
<value>Hafenamt</value>
</data>
<data name="textRainSensitiveCargo" xml:space="preserve">
<value>Regensensitive Ladung</value>
</data>
<data name="textRecommendedTugs" xml:space="preserve">
<value>Anzahl Schlepper</value>
</data>
<data name="textRemarks" xml:space="preserve">
<value>Info</value>
</data>
<data name="textRepeatNewPassword" xml:space="preserve">
<value>Neues Passwort wiederholen</value>
</data>
<data name="textReplenishingLock" xml:space="preserve">
<value>Güterübernahme in der Schleuse geplant</value>
</data>
<data name="textReplenishingTerminal" xml:space="preserve">
<value>Güterübernahme am Terminal geplant</value>
</data>
<data name="textRotated" xml:space="preserve">
<value>Gedreht</value>
</data>
<data name="textSearch" xml:space="preserve">
<value>Suche</value>
</data>
<data name="textShifting" xml:space="preserve">
<value>Verholung</value>
</data>
<data name="textShiftingFrom" xml:space="preserve">
<value>Verholung von</value>
</data>
<data name="textShiftingSequence" xml:space="preserve">
<value>Verhol. Nr.</value>
</data>
<data name="textShiftingTo" xml:space="preserve">
<value>Verholung nach</value>
</data>
<data name="textShip" xml:space="preserve">
<value>Schiff</value>
</data>
<data name="textShipLength" xml:space="preserve">
<value>Schiffslänge</value>
</data>
<data name="textShips" xml:space="preserve">
<value>Schiffe</value>
</data>
<data name="textShowCancelledShipcalls" xml:space="preserve">
<value>Stornierte anzeigen</value>
</data>
<data name="textShowHistory" xml:space="preserve">
<value>Änderungshistorie der Anläufe anzeigen</value>
</data>
<data name="textSortOrder" xml:space="preserve">
<value>Sortierung</value>
</data>
<data name="textStarboard" xml:space="preserve">
<value>Steuerbord</value>
</data>
<data name="textTerminal" xml:space="preserve">
<value>Terminal</value>
</data>
<data name="textTidalBothValues" xml:space="preserve">
<value>Für das Tidenfenster müssen beide Zeiten angegeben werden</value>
</data>
<data name="textTidalWindow" xml:space="preserve">
<value>Tidenfenster</value>
</data>
<data name="textTideTimesInThePast" xml:space="preserve">
<value>Tidenzeit liegt in der Vergangenheit</value>
</data>
<data name="textTimestamp" xml:space="preserve">
<value>Zeitpunkt</value>
</data>
<data name="textTo" xml:space="preserve">
<value>bis</value>
</data>
<data name="textTooFarInTheFuture" xml:space="preserve">
<value>Eine Zeiteingabe ist zu weit in der Zukunft</value>
</data>
<data name="textTooltipSetFixedOrder" xml:space="preserve">
<value>Als feste Bestellung vermerken</value>
</data>
<data name="textTooltipUnSetFixedOrder" xml:space="preserve">
<value>Feste Bestellung zurücknehmen</value>
</data>
<data name="textTriggerManualRefresh" xml:space="preserve">
<value>Manuelle Aktualisierung der Anläufe auslösen</value>
</data>
<data name="textTug" xml:space="preserve">
<value>Schlepper</value>
</data>
<data name="textTugCompany" xml:space="preserve">
<value>Schlepper-Reederei</value>
</data>
<data name="textTugRequired" xml:space="preserve">
<value>Schlepperorder</value>
</data>
<data name="textType" xml:space="preserve">
<value>Typ</value>
</data>
<data name="textUserlogin" xml:space="preserve">
<value>Anmeldung</value>
</data>
<data name="textUsername" xml:space="preserve">
<value>Benutzername</value>
</data>
<data name="textUserNamePasswordEmpty" xml:space="preserve">
<value>Benutzername / Passwort leer!</value>
</data>
<data name="textVoyage" xml:space="preserve">
<value>Reise</value>
</data>
<data name="textWarning" xml:space="preserve">
<value>Warnung</value>
</data>
<data name="textWidth" xml:space="preserve">
<value>Breite</value>
</data>
<data name="textWrongCredentials" xml:space="preserve">
<value>Benutzername / Passwort falsch</value>
</data>
<data name="textZoneEntryInThePast" xml:space="preserve">
<value>Zeit Reviereintritt liegt in der Vergangenheit</value>
</data>
<data name="textZoneEntryTime" xml:space="preserve">
<value>Reviereintritt</value>
</data>
<data name="trafficlight_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_off" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_off.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_on" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_on.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_red_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_red_yellow.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_yellow.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="umbrella_closed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>umbrella_closed.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="umbrella_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>umbrella_open.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Undefined" xml:space="preserve">
<value>Unbekannt</value>
</data>
<data name="worker2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>worker2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="arrow_right_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>arrow_right_blue.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="arrow_up_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>arrow_up_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="textStartTimeMissing" xml:space="preserve">
<value>Wenn eine Ende-Zeit angegeben wird, muss auch eine Start-Zeit angegeben werden</value>
</data>
</root>

View File

@ -0,0 +1,604 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>add.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Arrival" xml:space="preserve">
<value>Incoming</value>
</data>
<data name="arrow_down_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>arrow_down_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="arrow_down_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>arrow_down_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="arrow_right_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>arrow_right_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="arrow_up_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>arrow_up_blue.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="arrow_up_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>arrow_up_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="check" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>check.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="clipboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>clipboard.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="clock" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>clock.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="containership" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>containership.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="containership1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>containership.ico;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>delete.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="delete2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>delete2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Departure" xml:space="preserve">
<value>Outgoing</value>
</data>
<data name="edit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>edit.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="emergency_stop_button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>emergency_stop_button.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="lock_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>lock_open.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="logo_bremen_calling" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>logo_bremen_calling.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="nav_refresh_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>nav_refresh_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="nav_undo_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>nav_undo_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Shifting" xml:space="preserve">
<value>Shifting</value>
</data>
<data name="ship2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>ship2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="sign_warning" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>sign_warning.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="textAdd" xml:space="preserve">
<value>Add</value>
</data>
<data name="textAgencies" xml:space="preserve">
<value>Agencies</value>
</data>
<data name="textAgency" xml:space="preserve">
<value>Agency</value>
</data>
<data name="textAnchored" xml:space="preserve">
<value>Anchored</value>
</data>
<data name="textArrivalTerminal" xml:space="preserve">
<value>Arrival terminal</value>
</data>
<data name="textBerth" xml:space="preserve">
<value>Berth</value>
</data>
<data name="textBerthRemarks" xml:space="preserve">
<value>Berth remarks</value>
</data>
<data name="textBerths" xml:space="preserve">
<value>Berths</value>
</data>
<data name="textBothTideTimesNecessary" xml:space="preserve">
<value>Both tide times are required</value>
</data>
<data name="textBSMDGranted" xml:space="preserve">
<value>BSMD right to edit granted</value>
</data>
<data name="textBunkering" xml:space="preserve">
<value>Bunkering</value>
</data>
<data name="textCallsign" xml:space="preserve">
<value>Callsign</value>
</data>
<data name="textCancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="textCancelled" xml:space="preserve">
<value>Cancelled</value>
</data>
<data name="textCategories" xml:space="preserve">
<value>Categories</value>
</data>
<data name="textChange" xml:space="preserve">
<value>Change</value>
</data>
<data name="textChangeContactInfo" xml:space="preserve">
<value>Update contact info</value>
</data>
<data name="textChangeHistory" xml:space="preserve">
<value>Change history</value>
</data>
<data name="textChangePassword" xml:space="preserve">
<value>Change password</value>
</data>
<data name="textClearAll" xml:space="preserve">
<value>Clear all entries?</value>
</data>
<data name="textClearAssignment" xml:space="preserve">
<value>Clear assignment</value>
</data>
<data name="textClearFilters" xml:space="preserve">
<value>Clear filters</value>
</data>
<data name="textClearValue" xml:space="preserve">
<value>Clear value</value>
</data>
<data name="textClose" xml:space="preserve">
<value>Close</value>
</data>
<data name="textConfirmation" xml:space="preserve">
<value>Confirmation</value>
</data>
<data name="textDelete" xml:space="preserve">
<value>Delete</value>
</data>
<data name="textDeleted" xml:space="preserve">
<value>Deleted</value>
</data>
<data name="textDepartureTerminal" xml:space="preserve">
<value>Departure terminal</value>
</data>
<data name="textDraft" xml:space="preserve">
<value>Draft (m)</value>
</data>
<data name="textEdit" xml:space="preserve">
<value>Edit</value>
</data>
<data name="textEditShip" xml:space="preserve">
<value>Edit ship</value>
</data>
<data name="textEditShipcall" xml:space="preserve">
<value>Edit ship call</value>
</data>
<data name="textEditShips" xml:space="preserve">
<value>Edit ships</value>
</data>
<data name="textEditTimes" xml:space="preserve">
<value>Edit times</value>
</data>
<data name="textEmail" xml:space="preserve">
<value>E-mail</value>
</data>
<data name="textEndValueBeforeStartValue" xml:space="preserve">
<value>Some interval end times are before start times</value>
</data>
<data name="textEnterKeyword" xml:space="preserve">
<value>Ship / remark</value>
</data>
<data name="textError" xml:space="preserve">
<value>Error</value>
</data>
<data name="textETABerth" xml:space="preserve">
<value>ETA berth</value>
</data>
<data name="textETAInThePast" xml:space="preserve">
<value>ETA value is in the past</value>
</data>
<data name="textETDBerth" xml:space="preserve">
<value>ETD berth</value>
</data>
<data name="textETDInThePast" xml:space="preserve">
<value>ETD value is in the past</value>
</data>
<data name="textExit" xml:space="preserve">
<value>Exit</value>
</data>
<data name="textFixed" xml:space="preserve">
<value>Fixed</value>
</data>
<data name="textFixedOrder" xml:space="preserve">
<value>Marked as a fixed order</value>
</data>
<data name="textFrom" xml:space="preserve">
<value>from</value>
</data>
<data name="textHarbour" xml:space="preserve">
<value>Harbour</value>
</data>
<data name="textIncoming" xml:space="preserve">
<value>Incoming</value>
</data>
<data name="textInfoChangePW" xml:space="preserve">
<value>Show app info and change user password</value>
</data>
<data name="textInterval" xml:space="preserve">
<value>Interval</value>
</data>
<data name="textLength" xml:space="preserve">
<value>Length</value>
</data>
<data name="textLengthWidth" xml:space="preserve">
<value>L/W</value>
</data>
<data name="textLockTime" xml:space="preserve">
<value>Lock time</value>
</data>
<data name="textLockTimeInThePast" xml:space="preserve">
<value>Lock time is in the past</value>
</data>
<data name="textLogin" xml:space="preserve">
<value>Login</value>
</data>
<data name="textMineOnly" xml:space="preserve">
<value>mine only</value>
</data>
<data name="textMooredLock" xml:space="preserve">
<value>Moored in lock</value>
</data>
<data name="textMooring" xml:space="preserve">
<value>Mooring</value>
</data>
<data name="textNewDots" xml:space="preserve">
<value>New..</value>
</data>
<data name="textNewPassword" xml:space="preserve">
<value>New password</value>
</data>
<data name="textNotRotated" xml:space="preserve">
<value>Not rotated</value>
</data>
<data name="textOK" xml:space="preserve">
<value>OK</value>
</data>
<data name="textOldPassword" xml:space="preserve">
<value>Old password</value>
</data>
<data name="textOperation" xml:space="preserve">
<value>Operation</value>
</data>
<data name="textOperationEndInThePast" xml:space="preserve">
<value>Operation end is in the past</value>
</data>
<data name="textOperationsEnd" xml:space="preserve">
<value>Operations end</value>
</data>
<data name="textOperationsStart" xml:space="preserve">
<value>Operations start</value>
</data>
<data name="textOperationStartInThePast" xml:space="preserve">
<value>Operation start is in the past</value>
</data>
<data name="textOutgoing" xml:space="preserve">
<value>Outgoing</value>
</data>
<data name="textParticipant" xml:space="preserve">
<value>Participant</value>
</data>
<data name="textParticipants" xml:space="preserve">
<value>Participants</value>
</data>
<data name="textPassword" xml:space="preserve">
<value>Password</value>
</data>
<data name="textPasswordChanged" xml:space="preserve">
<value>Password changed.</value>
</data>
<data name="textPhone" xml:space="preserve">
<value>Phone</value>
</data>
<data name="textPierside" xml:space="preserve">
<value>Pier side</value>
</data>
<data name="textPilot" xml:space="preserve">
<value>Pilot</value>
</data>
<data name="textPilotRequired" xml:space="preserve">
<value>Pilot required</value>
</data>
<data name="textPilots" xml:space="preserve">
<value>Pilot</value>
</data>
<data name="textPort" xml:space="preserve">
<value>Port</value>
</data>
<data name="textPortAuthority" xml:space="preserve">
<value>Port authority</value>
</data>
<data name="textRainSensitiveCargo" xml:space="preserve">
<value>Rain sensitive cargo</value>
</data>
<data name="textRecommendedTugs" xml:space="preserve">
<value>Recommended tugs</value>
</data>
<data name="textRemarks" xml:space="preserve">
<value>Remarks</value>
</data>
<data name="textRepeatNewPassword" xml:space="preserve">
<value>Repeat new password</value>
</data>
<data name="textReplenishingLock" xml:space="preserve">
<value>Replenishing lock</value>
</data>
<data name="textReplenishingTerminal" xml:space="preserve">
<value>Replenishing terminal</value>
</data>
<data name="textRotated" xml:space="preserve">
<value>Rotated</value>
</data>
<data name="textSearch" xml:space="preserve">
<value>Search</value>
</data>
<data name="textShifting" xml:space="preserve">
<value>Shifting</value>
</data>
<data name="textShiftingFrom" xml:space="preserve">
<value>Shifting from</value>
</data>
<data name="textShiftingSequence" xml:space="preserve">
<value>Shift. number</value>
</data>
<data name="textShiftingTo" xml:space="preserve">
<value>Shifting to</value>
</data>
<data name="textShip" xml:space="preserve">
<value>Ship</value>
</data>
<data name="textShipLength" xml:space="preserve">
<value>Ship length</value>
</data>
<data name="textShips" xml:space="preserve">
<value>Ships</value>
</data>
<data name="textShowCancelledShipcalls" xml:space="preserve">
<value>Show cancelled calls</value>
</data>
<data name="textShowHistory" xml:space="preserve">
<value>Show shipcall change history</value>
</data>
<data name="textSortOrder" xml:space="preserve">
<value>Sort order</value>
</data>
<data name="textStarboard" xml:space="preserve">
<value>Starboard</value>
</data>
<data name="textTerminal" xml:space="preserve">
<value>Terminal</value>
</data>
<data name="textTidalBothValues" xml:space="preserve">
<value>For a tidal window both values must be set</value>
</data>
<data name="textTidalWindow" xml:space="preserve">
<value>Tidal window</value>
</data>
<data name="textTideTimesInThePast" xml:space="preserve">
<value>Times for the tide window are in the past</value>
</data>
<data name="textTimestamp" xml:space="preserve">
<value>Timestamp</value>
</data>
<data name="textTo" xml:space="preserve">
<value>to</value>
</data>
<data name="textTooFarInTheFuture" xml:space="preserve">
<value>A time value is too far in the future</value>
</data>
<data name="textTooltipSetFixedOrder" xml:space="preserve">
<value>Set as a fixed order</value>
</data>
<data name="textTooltipUnSetFixedOrder" xml:space="preserve">
<value>Unset as a a fixed order</value>
</data>
<data name="textTriggerManualRefresh" xml:space="preserve">
<value>Trigger a manual refresh of all shipcalls</value>
</data>
<data name="textTug" xml:space="preserve">
<value>Tug</value>
</data>
<data name="textTugCompany" xml:space="preserve">
<value>Tug company</value>
</data>
<data name="textTugRequired" xml:space="preserve">
<value>Tug required</value>
</data>
<data name="textType" xml:space="preserve">
<value>Type</value>
</data>
<data name="textUserlogin" xml:space="preserve">
<value>User login</value>
</data>
<data name="textUsername" xml:space="preserve">
<value>User name</value>
</data>
<data name="textUserNamePasswordEmpty" xml:space="preserve">
<value>Username and/or password empty!</value>
</data>
<data name="textVoyage" xml:space="preserve">
<value>Voyage</value>
</data>
<data name="textWarning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="textWidth" xml:space="preserve">
<value>Width</value>
</data>
<data name="textWrongCredentials" xml:space="preserve">
<value>Wrong username or password</value>
</data>
<data name="textZoneEntryInThePast" xml:space="preserve">
<value>Zone entry time is in the past</value>
</data>
<data name="textZoneEntryTime" xml:space="preserve">
<value>Zone entry</value>
</data>
<data name="trafficlight_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_off" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_off.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_on" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_on.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_red_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_red_yellow.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="trafficlight_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>trafficlight_yellow.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="umbrella_closed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>umbrella_closed.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="umbrella_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>umbrella_open.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Undefined" xml:space="preserve">
<value>Undefined</value>
</data>
<data name="worker2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>worker2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="_24hours" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>24hours.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="_lock" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>lock.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="arrow_right_blue" xml:space="preserve">
<value />
</data>
<data name="arrow_up_green" xml:space="preserve">
<value />
</data>
<data name="textStartTimeMissing" xml:space="preserve">
<value>If an end time is set, a start time is also required</value>
</data>
</root>

View File

@ -0,0 +1,9 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="textLoginCaption">Benutzer Anmeldung</system:String>
<system:String x:Key="textUsername">Benutzername</system:String>
<system:String x:Key="textPassword">Passwort</system:String>
<system:String x:Key="textLogin">Anmelden</system:String>
<system:String x:Key="textExit">Abbrechen</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="textLoginCaption">User login</system:String>
<system:String x:Key="textUsername">Username</system:String>
<system:String x:Key="textPassword">Password</system:String>
<system:String x:Key="textLogin">Login</system:String>
<system:String x:Key="textExit">Exit</system:String>
<system:String x:Key="textApplicationTitle">Bremen calling</system:String>
</ResourceDictionary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

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