diff --git a/misc/BreCal.postman_collection.json b/misc/BreCal.postman_collection.json
index f1ef9ad..23307fb 100644
--- a/misc/BreCal.postman_collection.json
+++ b/misc/BreCal.postman_collection.json
@@ -18,7 +18,8 @@
"pm.environment.set(\"LOGON_TOKEN\", responseData.token)\r",
"console.log(\"Id: \" + responseData.id)"
],
- "type": "text/javascript"
+ "type": "text/javascript",
+ "packages": {}
}
}
],
@@ -76,6 +77,39 @@
},
"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": {
@@ -120,7 +154,7 @@
"header": [],
"body": {
"mode": "raw",
- "raw": "{\r\n \"ship_id\" : 1,\r\n \"type\" : 1,\r\n \"eta\" : \"2023-07-23T07:18:19\",\r\n \"voyage\" : \"43B\",\r\n \"tug_required\" : false,\r\n \"pilot_required\" : true,\r\n \"flags\" : 0,\r\n \"pier_side\" : false,\r\n \"bunkering\" : true,\r\n \"recommended_tugs\" : 2\r\n}",
+ "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"
@@ -156,7 +190,7 @@
"header": [],
"body": {
"mode": "raw",
- "raw": "{\r\n \"id\" : 2, \r\n \"recommended_tugs\" : 3\r\n}",
+ "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"
@@ -218,7 +252,7 @@
"method": "GET",
"header": [],
"url": {
- "raw": "{{SCHEMA}}{{PATH}}/notifications?participant_id=1",
+ "raw": "{{SCHEMA}}{{PATH}}/notifications?shipcall_id=4",
"host": [
"{{SCHEMA}}{{PATH}}"
],
@@ -227,8 +261,8 @@
],
"query": [
{
- "key": "participant_id",
- "value": "1"
+ "key": "shipcall_id",
+ "value": "4"
}
]
}
@@ -262,6 +296,99 @@
},
"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": {
@@ -278,7 +405,7 @@
"method": "GET",
"header": [],
"url": {
- "raw": "{{SCHEMA}}{{PATH}}/times?shipcall_id=3",
+ "raw": "{{SCHEMA}}{{PATH}}/times?shipcall_id=112",
"host": [
"{{SCHEMA}}{{PATH}}"
],
@@ -288,7 +415,7 @@
"query": [
{
"key": "shipcall_id",
- "value": "3"
+ "value": "112"
}
]
}
@@ -348,7 +475,12 @@
"header": [],
"body": {
"mode": "raw",
- "raw": "{\r\n \"start_planned\" : \"2023-05-18T07:18:19\",\r\n \"end_planned\" : \"2023-05-18T09:18:19\", \r\n \"id\" : 1\r\n}"
+ "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",
@@ -378,7 +510,7 @@
"method": "DELETE",
"header": [],
"url": {
- "raw": "{{SCHEMA}}{{PATH}}/times?id=3",
+ "raw": "{{SCHEMA}}{{PATH}}/times?id=118",
"host": [
"{{SCHEMA}}{{PATH}}"
],
@@ -388,12 +520,43 @@
"query": [
{
"key": "id",
- "value": "3"
+ "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": {
diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs
index 539d113..68a9e32 100644
--- a/misc/BreCalApi.cs
+++ b/misc/BreCalApi.cs
@@ -46,7 +46,7 @@ using System.Web;
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -850,7 +850,7 @@ namespace BreCalClient.misc.Api
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -1505,7 +1505,7 @@ namespace BreCalClient.misc.Api
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -2290,7 +2290,7 @@ namespace BreCalClient.misc.Api
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -3109,7 +3109,7 @@ namespace BreCalClient.misc.Api
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -3594,7 +3594,7 @@ namespace BreCalClient.misc.Api
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -4330,7 +4330,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -4390,7 +4390,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -4530,7 +4530,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -4748,7 +4748,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5207,7 +5207,7 @@ namespace BreCalClient.misc.Client
string report = "C# SDK (BreCalClient.misc) Debug Report:\n";
report += " OS: " + System.Environment.OSVersion + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
- report += " Version of the API: 1.3.0\n";
+ report += " Version of the API: 1.4.0\n";
report += " SDK Package Version: 1.0.0\n";
return report;
}
@@ -5276,7 +5276,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5296,7 +5296,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5353,7 +5353,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5386,7 +5386,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5419,7 +5419,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5510,7 +5510,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5627,7 +5627,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5711,7 +5711,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5970,7 +5970,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -5998,7 +5998,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6068,7 +6068,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6095,7 +6095,7 @@ namespace BreCalClient.misc.Client
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6162,7 +6162,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6288,7 +6288,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6373,7 +6373,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6446,7 +6446,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6486,7 +6486,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6596,7 +6596,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6658,7 +6658,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6784,7 +6784,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6888,7 +6888,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6923,7 +6923,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6953,7 +6953,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -6993,7 +6993,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -7150,7 +7150,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -7226,7 +7226,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -7396,7 +7396,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -7701,7 +7701,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -7741,7 +7741,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
@@ -8023,7 +8023,7 @@ namespace BreCalClient.misc.Model
*
* Administer DEBRE ship calls, times and notifications
*
- * The version of the OpenAPI document: 1.3.0
+ * The version of the OpenAPI document: 1.4.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml
index aa42b53..be9d091 100644
--- a/misc/BreCalApi.yaml
+++ b/misc/BreCalApi.yaml
@@ -2,7 +2,7 @@ openapi: 3.0.0
x-stoplight:
id: mwv4y8vcnopwr
info:
- version: 1.3.0
+ version: 1.4.0
title: Bremen calling API
description: 'Administer DEBRE ship calls, times and notifications'
termsOfService: 'https://www.bsmd.de/'
diff --git a/misc/disclaimer.html b/misc/disclaimer.html
new file mode 100644
index 0000000..7341c15
--- /dev/null
+++ b/misc/disclaimer.html
@@ -0,0 +1,67 @@
+
+
+
+ Information gemäß Art. 13 und Art. 14 DSGVO für Auftraggeber Software BremenCalling
+
+
+
+Information gemäß Art. 13 und Art. 14 DSGVO für Auftraggeber
+Software BremenCalling
+
+Hier erhalten Sie Informationen gem. Art. 13 DSGVO über unseren Umgang mit Ihren Daten, wenn Sie die von uns betriebene Software „Bremen Calling“ nutzen.
+
+Verantwortlicher:
+
+
+
+BREMER SCHIFFSMELDEDIENST Kapt. P. Langbein e.K.
+Vertreten durch die Geschäftsführer Bastian Güttner und Benjamin Wiese
+Hafenkopf II / Überseetor 20, 28217 Bremen / Germany
+Tel. +49 (0) 421 38 48 27
+E-Mail : report@bsmd.de
+
+
+Zweck der Datenverarbeitung:
+
+Bereitstellung der Software „Bremen Calling“ zur Nutzung für Kunden und Auftraggeber
+
+Rechtsgrundlage für die Datenverarbeitung:
+Art. 6 Abs. 1 lit. b DSGVO (Vertrag, vorvertragliche Maßnahmen auf Anfrage der betroffenen Person)
+Berechtigte Interesse des Verantwortlichen:
+Hier nicht einschlägig.
+
+Wozu benötigen wir Ihre Daten? („Hintergründe für die Bereitstellung der Daten“):
+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.
+Holen wir bei anderen Stellen außer bei Ihnen selber Informationen über Sie ein?
+Nein.
+Empfänger der Daten:
+Wir verarbeiten Ihre Daten nur innerhalb des BSMD.
+Übermittlung in Drittländer:
+Eine Übermittlung Ihrer Daten in Staaten außerhalb der EU findet nicht statt.
+Dauer der Speicherung:
+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.
+Ihre Rechte in Bezug auf Ihre Daten:
+
+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).
+
+
+Sollten wir unrichtige oder unvollständige Daten von Ihnen haben, können Sie die Berichtigung dieser Daten verlangen (Art. 16 DSGVO).
+
+
+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.
+
+
+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.
+
+
+Möchten Sie von Ihren hier beschriebenen Rechten Gebrauch machen, genügt eine E-Mail an bremencalling@bsmd.de.
+
+
+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:
+https://www.bfdi.bund.de/DE/Infothek/Anschriften_Links/anschriften_links-node.html .
+
+
+
+Stand dieser Datenschutzinformationen: April 2024
+
+
\ No newline at end of file
diff --git a/misc/product_codes.txt b/misc/product_codes.txt
new file mode 100644
index 0000000..dbb4e54
--- /dev/null
+++ b/misc/product_codes.txt
@@ -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.
\ No newline at end of file
diff --git a/misc/version.txt b/misc/version.txt
index fd76c73..77d55b2 100644
--- a/misc/version.txt
+++ b/misc/version.txt
@@ -1 +1 @@
-1.3.0.0
\ No newline at end of file
+1.4.0.0
\ No newline at end of file
diff --git a/src/BreCalClient/App.config b/src/BreCalClient/App.config
index cab52d2..335a433 100644
--- a/src/BreCalClient/App.config
+++ b/src/BreCalClient/App.config
@@ -83,6 +83,9 @@
0
+
+
+
\ No newline at end of file
diff --git a/src/BreCalClient/BreCalClient.csproj b/src/BreCalClient/BreCalClient.csproj
index 44af52b..b42f599 100644
--- a/src/BreCalClient/BreCalClient.csproj
+++ b/src/BreCalClient/BreCalClient.csproj
@@ -8,8 +8,8 @@
True
BreCalClient.App
..\..\misc\brecal.snk
- 1.3.0.0
- 1.3.0.0
+ 1.4.0.0
+ 1.4.0.0
Bremen calling client
A Windows WPF client for the Bremen calling API.
containership.ico
@@ -17,6 +17,7 @@
+
@@ -38,6 +39,7 @@
+
@@ -73,6 +75,7 @@
OpenApiCodeGenerator
BreCalApi.cs
+
@@ -94,6 +97,7 @@
+
diff --git a/src/BreCalClient/BreCalClient.sln b/src/BreCalClient/BreCalClient.sln
index 469c133..fa8a760 100644
--- a/src/BreCalClient/BreCalClient.sln
+++ b/src/BreCalClient/BreCalClient.sln
@@ -10,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.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
@@ -20,6 +22,8 @@ Global
{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
diff --git a/src/BreCalClient/BreCalLists.cs b/src/BreCalClient/BreCalLists.cs
index 4fe6b2f..b0316a2 100644
--- a/src/BreCalClient/BreCalLists.cs
+++ b/src/BreCalClient/BreCalLists.cs
@@ -144,9 +144,12 @@ namespace BreCalClient
internal static void InitializeShips(List ships)
{
+ _ships.Clear();
+ _allShips.Clear();
+
foreach (var ship in ships)
{
- ShipModel sm = new ShipModel(ship);
+ ShipModel sm = new(ship);
_shipLookupDict[ship.Id] = sm;
if (!ship.Deleted)
_ships.Add(sm);
diff --git a/src/BreCalClient/DateTimePickerExt.cs b/src/BreCalClient/DateTimePickerExt.cs
new file mode 100644
index 0000000..d3642d4
--- /dev/null
+++ b/src/BreCalClient/DateTimePickerExt.cs
@@ -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);
+ }
+
+ }
+ }
+}
diff --git a/src/BreCalClient/EditShipcallControl.xaml b/src/BreCalClient/EditShipcallControl.xaml
index 6ebe2cf..006256f 100644
--- a/src/BreCalClient/EditShipcallControl.xaml
+++ b/src/BreCalClient/EditShipcallControl.xaml
@@ -4,11 +4,11 @@
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: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="270" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
+ Title="{x:Static p:Resources.textEditShipcall}" Height="298" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
@@ -29,6 +29,7 @@
+
@@ -46,7 +47,7 @@
-
+
@@ -64,12 +65,13 @@
-
-
-
+
+
+
-
-
+
+
+
@@ -80,8 +82,12 @@
-
-
+
+
+
+
+
+
diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs
index 7f0acf1..322b534 100644
--- a/src/BreCalClient/EditShipcallControl.xaml.cs
+++ b/src/BreCalClient/EditShipcallControl.xaml.cs
@@ -64,6 +64,8 @@ namespace BreCalClient
this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs;
+ this.integerUpDownShiftingCount.Value = this.ShipcallModel.ShiftSequence;
+
if (this.ShipcallModel.Shipcall == null) this.ShipcallModel.Shipcall = new();
this.CopyToControls();
@@ -116,32 +118,48 @@ namespace BreCalClient
{
switch (type)
{
- case ShipcallType.Arrival:
- this.datePickerETA.IsEnabled = true;
- this.datePickerETD.IsEnabled = false;
+ 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.datePickerETA.IsEnabled = false;
- this.datePickerETD.IsEnabled = true;
+ 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:
- this.datePickerETA.IsEnabled = true;
- this.datePickerETD.IsEnabled = true;
+ 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;
}
}
@@ -226,6 +244,7 @@ namespace BreCalClient
{
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;
@@ -289,7 +308,7 @@ namespace BreCalClient
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
- this.comboBoxTimeRef.SelectedIndex = this.ShipcallModel.Shipcall.TimeRefPoint ?? 0;
+ 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;
@@ -354,7 +373,7 @@ namespace BreCalClient
this.comboBoxDepartureBerth.IsEnabled = isBsmd || isAgency;
this.comboBoxShip.IsEnabled = isBsmd;
this.datePickerETA.IsEnabled = isAgency || isBsmd;
- this.datePickerETD.IsEnabled = isAgency;
+ this.datePickerETD.IsEnabled = isAgency || isBsmd;
this.labelBSMDGranted.Visibility = editRightGrantedForBSMD ? Visibility.Visible : Visibility.Hidden;
diff --git a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml
index 4c3ccac..84cfade 100644
--- a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml
+++ b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml
@@ -5,7 +5,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
- xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
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">
@@ -42,19 +41,19 @@
-
+
-
-
+
+
-
+
diff --git a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
index 58cbac4..8a38a07 100644
--- a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
@@ -94,7 +94,7 @@ namespace BreCalClient
if (this.comboBoxPierside.SelectedIndex >= 0)
{
- this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
+ this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0);
}
else
{
@@ -209,7 +209,10 @@ namespace BreCalClient
this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock ?? false;
this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal ?? false;
- this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
+ 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;
diff --git a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml
index dc13bd2..5de2857 100644
--- a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml
+++ b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml
@@ -5,7 +5,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
- xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
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">
@@ -39,15 +38,15 @@
-
+
-
-
+
+
diff --git a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
index 20c3c69..0a778fd 100644
--- a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
@@ -4,8 +4,15 @@
using BreCalClient.misc.Model;
using System;
+using System.Text.RegularExpressions;
using System.Windows;
+using System.Windows.Controls.Primitives;
+using System.Windows.Controls;
+using Xceed.Wpf.Toolkit;
using static BreCalClient.Extensions;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Media;
namespace BreCalClient
{
@@ -66,9 +73,11 @@ namespace BreCalClient
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
-
+
}
+
+
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
this.CopyToModel();
@@ -95,7 +104,7 @@ namespace BreCalClient
if (this.comboBoxPierside.SelectedIndex >= 0)
{
- this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
+ this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0);
}
else
{
@@ -202,7 +211,10 @@ namespace BreCalClient
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
- this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
+ 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;
@@ -337,7 +349,7 @@ namespace BreCalClient
CheckOKButton();
}
- #endregion
-
+ #endregion
+
}
}
diff --git a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml
index e742510..5dbafcb 100644
--- a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml
+++ b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml
@@ -5,7 +5,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
- xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
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">
@@ -33,7 +32,7 @@
-
+
@@ -44,14 +43,14 @@
-
+
-
-
+
+
@@ -82,16 +81,16 @@
-
+
-
-
+
+
-
+
@@ -143,7 +142,7 @@
-
+
diff --git a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
index 5837881..5fa79ad 100644
--- a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
@@ -98,7 +98,7 @@ namespace BreCalClient
this.ShipcallModel.Shipcall.DepartureBerthId = (int)this.comboBoxDepartureBerth.SelectedValue;
if (this.comboBoxPiersideArrival.SelectedIndex >= 0)
{
- this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPiersideArrival.SelectedIndex == 0) ? true : false;
+ this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPiersideArrival.SelectedIndex == 0);
}
else
{
@@ -217,10 +217,7 @@ namespace BreCalClient
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
-
- this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
- 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;
diff --git a/src/BreCalClient/EditTimesControl.xaml b/src/BreCalClient/EditTimesControl.xaml
index 465f90b..ad03ed9 100644
--- a/src/BreCalClient/EditTimesControl.xaml
+++ b/src/BreCalClient/EditTimesControl.xaml
@@ -5,7 +5,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
- xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
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">
@@ -17,8 +16,8 @@
-
-
+
+
@@ -36,7 +35,7 @@
-
+
@@ -45,7 +44,7 @@
-
+
@@ -55,9 +54,9 @@
-
+
-
+
@@ -67,7 +66,7 @@
-
+
@@ -77,7 +76,7 @@
-
+
@@ -87,9 +86,9 @@
-
+
-
+
@@ -99,11 +98,11 @@
-
+
-
+
@@ -113,9 +112,9 @@
-
+
-
+
@@ -125,9 +124,9 @@
-
+
-
+
@@ -137,9 +136,9 @@
-
+
-
+
@@ -149,13 +148,16 @@
-
+
-
+
+
+
+
diff --git a/src/BreCalClient/EditTimesControl.xaml.cs b/src/BreCalClient/EditTimesControl.xaml.cs
index b09a40e..dfd841d 100644
--- a/src/BreCalClient/EditTimesControl.xaml.cs
+++ b/src/BreCalClient/EditTimesControl.xaml.cs
@@ -7,6 +7,7 @@ using BreCalClient.misc.Model;
using System;
using System.Windows;
using System.Windows.Media.Imaging;
+using Xceed.Wpf.Toolkit;
namespace BreCalClient
{
@@ -27,7 +28,9 @@ namespace BreCalClient
#region Properties
- public Times Times { get; set; } = new();
+ public Times Times { get; set; } = new();
+
+ public Times? AgencyTimes { get; set; } = new();
public ShipcallControlModel ShipcallModel { get; set; } = new();
@@ -36,9 +39,9 @@ namespace BreCalClient
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- this.CopyToControls();
+ {
this.EnableControls();
+ this.CopyToControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
@@ -62,14 +65,20 @@ namespace BreCalClient
SetLockButton(newValue);
}
- private void datePickerETABerth_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ private void buttonClearAll_Click(object sender, RoutedEventArgs e)
{
- CheckOKButton();
- }
-
- private void datePickerETDBerth_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
- {
- CheckOKButton();
+ 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
@@ -93,30 +102,51 @@ namespace BreCalClient
{
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.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.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;
- this.datePickerETDBerth_End.Value = this.Times.EtdIntervalEnd;
-
- this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall?.TimeRefPoint ?? 0]);
- this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall?.TimeRefPoint ?? 0]);
-
- switch (ShipcallModel.Shipcall?.Type)
+ if (this.datePickerETABerth_End.IsEnabled && (this.Times.EtaIntervalEnd == null) && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaIntervalEnd != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival))
{
- case ShipcallType.Arrival:
- this.labelETA.FontWeight = FontWeights.Bold;
- this.datePickerETABerth.ContextMenu.IsEnabled = false;
- break;
- case ShipcallType.Departure:
- case ShipcallType.Shifting:
- this.labelETD.FontWeight = FontWeights.Bold;
- this.datePickerETDBerth.ContextMenu.IsEnabled = false;
- break;
+ 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);
}
@@ -147,6 +177,15 @@ namespace BreCalClient
}
}
+ 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)
@@ -160,6 +199,7 @@ namespace BreCalClient
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)
{
@@ -174,10 +214,7 @@ namespace BreCalClient
case Extensions.ParticipantType.PILOT:
this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
break;
- }
-
- CheckOKButton();
-
+ }
}
private void SetLockButton(bool newValue)
@@ -194,17 +231,7 @@ namespace BreCalClient
this.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock_open.png", UriKind.RelativeOrAbsolute));
this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipSetFixedOrder;
}
- }
-
- private void CheckOKButton()
- {
- Extensions.ParticipantType pType = (Extensions.ParticipantType)this.Times.ParticipantType;
- if (pType != Extensions.ParticipantType.PORT_ADMINISTRATION)
- this.buttonOK.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) ?
- this.datePickerETABerth.Value.HasValue : this.datePickerETDBerth.Value.HasValue;
- else
- this.buttonOK.IsEnabled = true;
- }
+ }
#endregion
diff --git a/src/BreCalClient/EditTimesTerminalControl.xaml b/src/BreCalClient/EditTimesTerminalControl.xaml
index 0854263..6875bca 100644
--- a/src/BreCalClient/EditTimesTerminalControl.xaml
+++ b/src/BreCalClient/EditTimesTerminalControl.xaml
@@ -12,11 +12,11 @@
-
+
-
-
+
+
@@ -26,9 +26,9 @@
-
-
-
+
+
+
@@ -37,8 +37,8 @@
-
-
+
+
@@ -48,8 +48,8 @@
-
-
+
+
@@ -59,8 +59,8 @@
-
-
+
+
@@ -68,8 +68,8 @@
-
-
+
+
@@ -79,9 +79,9 @@
-
+
-
+
@@ -91,11 +91,11 @@
-
+
-
-
+
+
@@ -115,8 +115,11 @@
-
+
+
+
+
diff --git a/src/BreCalClient/EditTimesTerminalControl.xaml.cs b/src/BreCalClient/EditTimesTerminalControl.xaml.cs
index c09cd73..6071ba9 100644
--- a/src/BreCalClient/EditTimesTerminalControl.xaml.cs
+++ b/src/BreCalClient/EditTimesTerminalControl.xaml.cs
@@ -76,14 +76,19 @@ namespace BreCalClient
this.comboBoxPierside.SelectedIndex = -1;
}
- private void datePickerOperationStart_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ private void buttonClearAll_Click(object sender, RoutedEventArgs e)
{
- this.CheckOKButton();
- }
-
- private void datePickerOperationEnd_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
- {
- this.CheckOKButton();
+ 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
@@ -122,13 +127,28 @@ namespace BreCalClient
switch (ShipcallModel.Shipcall?.Type)
{
case ShipcallType.Arrival:
- this.labelStart.FontWeight = FontWeights.Bold;
- this.datePickerOperationStart.ContextMenu.IsEnabled = false;
+ 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.labelEnd.FontWeight = FontWeights.Bold;
- this.datePickerOperationEnd.ContextMenu.IsEnabled = false;
+ 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;
}
@@ -146,13 +166,8 @@ namespace BreCalClient
this.comboBoxPierside.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.textBoxBerthRemarks.IsReadOnly = ShipcallModel.Shipcall?.Type != ShipcallType.Arrival;
this.textBoxRemarks.IsReadOnly = false;
- this.CheckOKButton();
- }
-
- private void CheckOKButton()
- {
- this.buttonOK.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) ? this.datePickerOperationStart.Value.HasValue :
- this.datePickerOperationEnd.Value.HasValue;
+ this.buttonClearAll.IsEnabled = true;
+
}
#endregion
diff --git a/src/BreCalClient/Extensions.cs b/src/BreCalClient/Extensions.cs
index b57cbb4..f341598 100644
--- a/src/BreCalClient/Extensions.cs
+++ b/src/BreCalClient/Extensions.cs
@@ -27,7 +27,7 @@ namespace BreCalClient
BSMD = 1,
[Description("Terminal")]
TERMINAL = 2,
- [Description("Lotsen")]
+ [Description("Flusslotsen")]
PILOT = 4,
[Description("Agentur")]
AGENCY = 8,
@@ -98,7 +98,7 @@ namespace BreCalClient
if(times.OperationsStart.HasValue)
{
string result = times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm");
- if (times.EtaIntervalEnd.HasValue) result += " - " + times.EtaIntervalEnd.Value.ToString("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
@@ -111,7 +111,7 @@ namespace BreCalClient
if(times.EtaBerth.HasValue)
{
string result = times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm");
- if (times.EtaIntervalEnd.HasValue) result += " - " + times.EtaIntervalEnd.Value.ToString("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
@@ -127,7 +127,7 @@ namespace BreCalClient
if(times.OperationsEnd.HasValue)
{
string result = times.OperationsEnd.Value.ToString("dd.MM.yyyy HH:mm");
- if (times.EtdIntervalEnd.HasValue) result += " - " + times.EtdIntervalEnd.Value.ToString("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
@@ -140,7 +140,7 @@ namespace BreCalClient
if(times.EtdBerth.HasValue)
{
string result = times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm");
- if (times.EtdIntervalEnd.HasValue) result += " - " + times.EtdIntervalEnd.Value.ToString("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
diff --git a/src/BreCalClient/MainWindow.xaml b/src/BreCalClient/MainWindow.xaml
index b05c5e8..aad3fa3 100644
--- a/src/BreCalClient/MainWindow.xaml
+++ b/src/BreCalClient/MainWindow.xaml
@@ -3,12 +3,12 @@
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: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}"
+ 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">
@@ -42,11 +42,11 @@
- Hinweis :
- Bei dem derzeitigen System handelt es sich um einen Testbetrieb.
- Alle angegebenen Daten sind unverbindlich und lösen damit keinerlei Auftrag oder Bestellung aus.
- Bei Fragen oder Anmerkungen wenden Sie sich gern an bremencalling@bsmd.de .
-
+ Hinweis :
+ Mit der Anmeldung in Bremen Calling akzeptieren Sie die Bedingungen
+ des Systems, die Sie in der aktuell gültigen Fassung unter dem nachfolgenden Link
+ einsehen können: Datenschutzerklärung .
+
@@ -89,12 +89,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs
index 19687bc..475c8ac 100644
--- a/src/BreCalClient/MainWindow.xaml.cs
+++ b/src/BreCalClient/MainWindow.xaml.cs
@@ -34,12 +34,13 @@ namespace BreCalClient
{
private readonly ILog _log = LogManager.GetLogger(typeof(MainWindow));
private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30;
+ private const int SHIPS_UPDATE_INTERVAL_SECONDS = 120;
private const int PROGRESS_STEPS = 50;
#region Fields
//private static int _uiUpdateRunning = 0;
- private static SemaphoreSlim uiLock = new SemaphoreSlim(1);
+ private static readonly SemaphoreSlim uiLock = new(1);
private Credentials? _credentials;
@@ -142,7 +143,7 @@ namespace BreCalClient
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
// serialize filter settings
- Properties.Settings.Default.FilterCriteria = this.searchFilterControl.SearchFilter.Serialize();
+ Properties.Settings.Default.FilterCriteriaMap = SearchFilterModel.Serialize();
Properties.Settings.Default.Save();
_tokenSource.Cancel();
}
@@ -404,6 +405,8 @@ namespace BreCalClient
private async void LoadStaticLists()
{
+ if (_loginResult == null) return;
+
BreCalLists.InitializeBerths(await _staticApi.BerthsGetAsync());
BreCalLists.InitializeShips(await _shipApi.ShipsGetAsync());
BreCalLists.InitializeParticipants(await _staticApi.ParticipantsGetAsync());
@@ -421,14 +424,43 @@ namespace BreCalClient
this.searchFilterControl.SetAgencies(BreCalLists.Participants_Agent);
- if (!string.IsNullOrEmpty(Properties.Settings.Default.FilterCriteria))
+ if (!string.IsNullOrEmpty(Properties.Settings.Default.FilterCriteriaMap))
{
- SearchFilterModel? sfm = SearchFilterModel.Deserialize(Properties.Settings.Default.FilterCriteria);
- if (sfm != null)
- this.searchFilterControl.SetFilterFromModel(sfm);
+ SearchFilterModel.Deserialize(Properties.Settings.Default.FilterCriteriaMap);
+ SearchFilterModel? currentFilter = null;
+ if (SearchFilterModel.filterMap != null)
+ {
+ if((_loginResult != null) && SearchFilterModel.filterMap.ContainsKey(_loginResult.Id))
+ {
+ currentFilter = SearchFilterModel.filterMap[_loginResult.Id];
+ }
+ }
+ else
+ {
+ SearchFilterModel.filterMap = new();
+ }
+ if (currentFilter == null)
+ {
+ currentFilter = new();
+ if(_loginResult != null)
+ SearchFilterModel.filterMap[_loginResult.Id] = currentFilter;
+ }
+ this.searchFilterControl.SetFilterFromModel(currentFilter);
}
_ = Task.Run(() => RefreshShipcalls());
+ _ = Task.Run(() => RefreshShips());
+
+ }
+
+
+ public async Task RefreshShips()
+ {
+ while (true)
+ {
+ Thread.Sleep(SHIPS_UPDATE_INTERVAL_SECONDS * 1000);
+ BreCalLists.InitializeShips(await _shipApi.ShipsGetAsync());
+ }
}
public async Task RefreshShipcalls()
@@ -513,7 +545,7 @@ namespace BreCalClient
this.FilterShipcalls();
await uiLock.WaitAsync();
- this.UpdateUI();
+ this.UpdateUI();
}
}
catch(Exception ex)
@@ -640,7 +672,7 @@ namespace BreCalClient
// first add everything
this._visibleControlModels.AddRange(_allShipcallsDict.Values);
- // now remove elements whose filter criteria are met
+ // now remove elements whose filter criteria are met
if(sfm.Berths.Count > 0 )
{
@@ -707,7 +739,7 @@ namespace BreCalClient
_ = this._visibleControlModels.RemoveAll(x =>
{
Times? t = x.GetTimesForParticipantType(ParticipantType.AGENCY);
- DateTime refValue = sfm.EtaTo.Value.AddMinutes(1439); // 23:59
+ DateTime refValue = sfm.EtaTo.Value.AddMinutes(1440); // including 23:59
switch (x.Shipcall?.Type)
{
case ShipcallType.Arrival:
@@ -745,7 +777,34 @@ namespace BreCalClient
_ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false);
}
- switch(this._sortOrder)
+ // special Basti case: Wenn das ATA / ATD eingetragen ist und schon 2 Stunden in der Vergangenheit liegt
+ if (searchPastDays <= 3)
+ {
+ _ = this._visibleControlModels.RemoveAll(x =>
+ {
+ Times? mooringTimes = x.GetTimesForParticipantType(ParticipantType.MOORING);
+ if (mooringTimes != null)
+ {
+ switch (x.Shipcall?.Type)
+ {
+ case ShipcallType.Arrival:
+ if (mooringTimes.Ata.HasValue && ((DateTime.Now - mooringTimes.Ata.Value).TotalHours > 2))
+ return true;
+ break;
+
+ default:
+ if (mooringTimes.Atd.HasValue && ((DateTime.Now - mooringTimes.Atd.Value).TotalHours > 2))
+ return true;
+ break;
+ }
+ }
+
+ return false;
+ });
+ }
+
+
+ switch (this._sortOrder)
{
case Extensions.SortOrder.SHIP_NAME:
this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); });
@@ -758,14 +817,20 @@ namespace BreCalClient
{
if (x.Shipcall == null) return 0;
if (y.Shipcall == null) return 0;
- DateTime xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? x.Eta ?? DateTime.Now : x.Etd ?? DateTime.Now;
+ DateTime now = DateTime.Now;
+
+ DateTime xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? (x.Eta ?? now) : (x.Etd ?? now);
+
Times? xTimes = x.GetTimesForParticipantType(ParticipantType.AGENCY);
if(xTimes != null)
- xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? xTimes.EtaBerth ?? DateTime.Now : xTimes.EtdBerth ?? DateTime.Now;
- DateTime yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? y.Eta ?? DateTime.Now : y.Etd ?? DateTime.Now;
+ xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? (xTimes.EtaBerth ?? now) : (xTimes.EtdBerth ?? now);
+
+ DateTime yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? (y.Eta ?? now) : (y.Etd ?? now);
+
Times? yTimes = y.GetTimesForParticipantType(ParticipantType.AGENCY);
if (yTimes != null)
- yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? yTimes.EtaBerth ?? DateTime.Now : yTimes.EtdBerth ?? DateTime.Now;
+ yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? (yTimes.EtaBerth ?? now) : (yTimes.EtdBerth ?? now);
+
return DateTime.Compare(xDate, yDate);
});
break;
@@ -854,10 +919,14 @@ namespace BreCalClient
if( obj.ShipcallControlModel == null) { return; }
if (!obj.ShipcallControlModel.AssignedParticipants.ContainsKey(participantType)) return; // no assigment means no dialog my friend
+ Times? agencyTimes = obj.ShipcallControlModel.GetTimesForParticipantType(ParticipantType.AGENCY);
+
// show a dialog that lets the user create / update times for the given shipcall
IEditTimesControl etc = (participantType == ParticipantType.TERMINAL) ? new EditTimesTerminalControl() : new EditTimesControl();
etc.Title = obj.ShipcallControlModel.Title;
etc.ShipcallModel = obj.ShipcallControlModel;
+ if (etc is EditTimesControl control)
+ control.AgencyTimes = agencyTimes;
bool wasEdit = false;
if (times != null)
diff --git a/src/BreCalClient/Properties/PublishProfiles/ClickOnceDevelProfile.pubxml b/src/BreCalClient/Properties/PublishProfiles/ClickOnceDevelProfile.pubxml
index bb9764c..0c88dd3 100644
--- a/src/BreCalClient/Properties/PublishProfiles/ClickOnceDevelProfile.pubxml
+++ b/src/BreCalClient/Properties/PublishProfiles/ClickOnceDevelProfile.pubxml
@@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
1
- 1.3.0.0
+ 1.4.0.0
True
Debug
True
diff --git a/src/BreCalClient/Properties/PublishProfiles/ClickOnceTestProfile.pubxml b/src/BreCalClient/Properties/PublishProfiles/ClickOnceTestProfile.pubxml
index 8a000ff..059b55a 100644
--- a/src/BreCalClient/Properties/PublishProfiles/ClickOnceTestProfile.pubxml
+++ b/src/BreCalClient/Properties/PublishProfiles/ClickOnceTestProfile.pubxml
@@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
0
- 1.3.0.0
+ 1.4.0.0
True
Debug
True
diff --git a/src/BreCalClient/Properties/Settings.Designer.cs b/src/BreCalClient/Properties/Settings.Designer.cs
index 2e8d6de..fd85a6b 100644
--- a/src/BreCalClient/Properties/Settings.Designer.cs
+++ b/src/BreCalClient/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace BreCalClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
+ [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())));
@@ -214,5 +214,17 @@ namespace BreCalClient.Properties {
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;
+ }
+ }
}
}
diff --git a/src/BreCalClient/Properties/Settings.settings b/src/BreCalClient/Properties/Settings.settings
index 7903ee0..b10fd5b 100644
--- a/src/BreCalClient/Properties/Settings.settings
+++ b/src/BreCalClient/Properties/Settings.settings
@@ -53,5 +53,8 @@
0
+
+
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/24hours.png b/src/BreCalClient/Resources/24hours.png
new file mode 100644
index 0000000..020b025
Binary files /dev/null and b/src/BreCalClient/Resources/24hours.png differ
diff --git a/src/BreCalClient/Resources/Resources.Designer.cs b/src/BreCalClient/Resources/Resources.Designer.cs
index 812d0fd..492ef15 100644
--- a/src/BreCalClient/Resources/Resources.Designer.cs
+++ b/src/BreCalClient/Resources/Resources.Designer.cs
@@ -60,6 +60,16 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ public static byte[] _24hours {
+ get {
+ object obj = ResourceManager.GetObject("_24hours", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Byte[].
///
@@ -268,6 +278,16 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ public static byte[] nav_undo_red {
+ get {
+ object obj = ResourceManager.GetObject("nav_undo_red", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
///
/// Looks up a localized string similar to Shifting.
///
@@ -459,6 +479,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Clear all entries?.
+ ///
+ public static string textClearAll {
+ get {
+ return ResourceManager.GetString("textClearAll", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Clear assignment.
///
@@ -900,6 +929,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Pilot.
+ ///
+ public static string textPilots {
+ get {
+ return ResourceManager.GetString("textPilots", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Port.
///
@@ -909,6 +947,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Port authority.
+ ///
+ public static string textPortAuthority {
+ get {
+ return ResourceManager.GetString("textPortAuthority", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Rain sensitive cargo.
///
@@ -999,6 +1046,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Shift. number.
+ ///
+ public static string textShiftingSequence {
+ get {
+ return ResourceManager.GetString("textShiftingSequence", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Shifting to.
///
diff --git a/src/BreCalClient/Resources/Resources.de.resx b/src/BreCalClient/Resources/Resources.de.resx
index 291e704..a681ad9 100644
--- a/src/BreCalClient/Resources/Resources.de.resx
+++ b/src/BreCalClient/Resources/Resources.de.resx
@@ -269,7 +269,7 @@
Anlegeseite
- Lotse
+ Flusslotse
Lotsorder
@@ -496,4 +496,16 @@
Schiffe
+
+ Flusslotsen
+
+
+ Hafenamt
+
+
+ Verhol. Nr.
+
+
+ Alle Eintragungen zurücksetzen?
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/Resources.resx b/src/BreCalClient/Resources/Resources.resx
index aa64fa9..1cf2a78 100644
--- a/src/BreCalClient/Resources/Resources.resx
+++ b/src/BreCalClient/Resources/Resources.resx
@@ -178,6 +178,9 @@
nav_refresh_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ nav_undo_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
Shifting
@@ -241,6 +244,9 @@
Change password
+
+ Clear all entries?
+
Clear assignment
@@ -388,9 +394,15 @@
Pilot required
+
+ Pilot
+
Port
+
+ Port authority
+
Rain sensitive cargo
@@ -421,6 +433,9 @@
Shifting from
+
+ Shift. number
+
Shifting to
@@ -529,6 +544,9 @@
worker2.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 24hours.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
lock.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
diff --git a/src/BreCalClient/Resources/nav_undo_red.png b/src/BreCalClient/Resources/nav_undo_red.png
new file mode 100644
index 0000000..692f6db
Binary files /dev/null and b/src/BreCalClient/Resources/nav_undo_red.png differ
diff --git a/src/BreCalClient/SearchFilterControl.xaml b/src/BreCalClient/SearchFilterControl.xaml
index d0e304f..b2a941a 100644
--- a/src/BreCalClient/SearchFilterControl.xaml
+++ b/src/BreCalClient/SearchFilterControl.xaml
@@ -8,7 +8,7 @@
xmlns:api="clr-namespace:BreCalClient.misc.Model"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
- d:DesignHeight="56" d:DesignWidth="800" Loaded="UserControl_Loaded">
+ d:DesignHeight="56" d:DesignWidth="800">
@@ -52,7 +52,8 @@
-
+
+
@@ -62,10 +63,14 @@
+
+
+
+
diff --git a/src/BreCalClient/SearchFilterControl.xaml.cs b/src/BreCalClient/SearchFilterControl.xaml.cs
index c176c27..92ac773 100644
--- a/src/BreCalClient/SearchFilterControl.xaml.cs
+++ b/src/BreCalClient/SearchFilterControl.xaml.cs
@@ -128,22 +128,17 @@ namespace BreCalClient
private void logoImage_MouseUp(object sender, MouseButtonEventArgs e)
{
LogoImageClicked?.Invoke();
- }
-
- private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
- {
-
- }
+ }
private void datePickerETAFrom_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
- this._model.EtaFrom = this.datePickerETAFrom.SelectedDate;
+ this._model.EtaFrom = this.datePickerETAFrom.SelectedDate?.Date;
SearchFilterChanged?.Invoke();
}
private void datePickerETATo_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
- this._model.EtaTo = datePickerETATo.SelectedDate;
+ this._model.EtaTo = datePickerETATo.SelectedDate?.Date;
SearchFilterChanged?.Invoke();
}
@@ -212,6 +207,13 @@ namespace BreCalClient
{
this._model.MineOnly = this.checkBoxOwn.IsChecked;
SearchFilterChanged?.Invoke();
+ }
+
+ private void toggleButton24Hrs_Click(object sender, System.Windows.RoutedEventArgs e)
+ {
+ this.datePickerETAFrom.SelectedDate = DateTime.Now;
+ this.datePickerETATo.SelectedDate = DateTime.Now.AddDays(1);
+ SearchFilterChanged?.Invoke();
}
#endregion
diff --git a/src/BreCalClient/SearchFilterModel.cs b/src/BreCalClient/SearchFilterModel.cs
index 478295e..a827ea3 100644
--- a/src/BreCalClient/SearchFilterModel.cs
+++ b/src/BreCalClient/SearchFilterModel.cs
@@ -33,18 +33,21 @@ namespace BreCalClient
public bool? MineOnly { get; set; }
+ public static Dictionary? filterMap = new();
+
#endregion
#region Serialisation
- public static SearchFilterModel? Deserialize(string json)
+ public static bool Deserialize(string json)
{
- return (SearchFilterModel?) JsonConvert.DeserializeObject(json, typeof(SearchFilterModel));
+ filterMap = (Dictionary?) JsonConvert.DeserializeObject(json, typeof(Dictionary));
+ return (filterMap != null);
}
- public string Serialize()
+ public static string Serialize()
{
- return JsonConvert.SerializeObject(this, Formatting.Indented);
+ return JsonConvert.SerializeObject(filterMap, Formatting.Indented);
}
#endregion
diff --git a/src/BreCalClient/ShipcallControl.xaml b/src/BreCalClient/ShipcallControl.xaml
index b9faa9f..934ae9f 100644
--- a/src/BreCalClient/ShipcallControl.xaml
+++ b/src/BreCalClient/ShipcallControl.xaml
@@ -41,15 +41,19 @@
+
-
+
+
+
-
+
@@ -226,8 +230,8 @@
-
-
+
+
diff --git a/src/BreCalClient/ShipcallControl.xaml.cs b/src/BreCalClient/ShipcallControl.xaml.cs
index 20b1913..fbf6fad 100644
--- a/src/BreCalClient/ShipcallControl.xaml.cs
+++ b/src/BreCalClient/ShipcallControl.xaml.cs
@@ -25,10 +25,7 @@ namespace BreCalClient
Participant? _terminal;
Participant? _tug;
Participant? _port_administration;
- private static readonly ILog _log = LogManager.GetLogger(typeof(ShipcallControl));
- bool ataAdded = false;
- bool atdAdded = false;
- bool lockTimeAdded = false;
+ private static readonly ILog _log = LogManager.GetLogger(typeof(ShipcallControl));
#endregion
@@ -68,6 +65,11 @@ namespace BreCalClient
{
if (this.ShipcallControlModel != null)
{
+
+ bool shiftingNoVisible = ((this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Shifting) && this.ShipcallControlModel.ShiftSequence.HasValue);
+ this.textBlockShiftingSequence.Text = shiftingNoVisible ? this.ShipcallControlModel?.ShiftSequence.ToString() : "";
+ this.columnDefinitionShiftingSequence.Width = shiftingNoVisible ? new(20) : new(0);
+
string agentName = "";
string? name;
_agency = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.AGENCY);
@@ -267,7 +269,12 @@ namespace BreCalClient
else
this.imageEvaluation.ToolTip = null;
- this.textBlockBerth.Text = this.ShipcallControlModel?.Berth;
+ //Times? bsmdTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.BSMD);
+ //if (bsmdTimes != null)
+ this.textBlockBerth.Text = this.ShipcallControlModel?.GetBerthText(null);
+ //else
+ // this.textBlockBerth.Text = this.ShipcallControlModel?.Berth;
+
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
if (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival)
{
@@ -336,26 +343,17 @@ namespace BreCalClient
this.labelMooringETAETDValue.Content = mooringTimes.DisplayTime(this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival);
this.textBlockMooringRemarks.Text = mooringTimes.Remarks.TruncateDots(50);
this.imageMooringLocked.Visibility = (mooringTimes.EtaBerthFixed ?? false) ? Visibility.Visible : Visibility.Hidden;
+ ataRowDefinition.Height = mooringTimes.Ata.HasValue ? new(15) : new(0);
+ atdRowDefinition.Height = mooringTimes.Atd.HasValue ? new(15) : new(0);
if(mooringTimes.Ata.HasValue)
- {
- if(!ataAdded)
- {
-
- ataRowDefinition.Height = new GridLength(15);
- labelTimesMooringATA.Content = mooringTimes.Ata.Value.ToString("dd.MM.yyyy HH:mm");
- ataAdded = true;
- }
+ {
+ labelTimesMooringATA.Content = mooringTimes.Ata.Value.ToString("dd.MM.yyyy HH:mm");
}
if (mooringTimes.Atd.HasValue)
- {
- if (!atdAdded)
- {
- atdRowDefinition.Height = new GridLength(15);
- labelTimesMooringATD.Content = mooringTimes.Atd.Value.ToString("dd.MM.yyyy HH:mm");
- atdAdded = true;
- }
+ {
+ labelTimesMooringATD.Content = mooringTimes.Atd.Value.ToString("dd.MM.yyyy HH:mm");
}
}
@@ -372,14 +370,10 @@ namespace BreCalClient
this.labelPortAuthorityETAETDValue.Content = portAuthorityTimes.DisplayTime(this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival);
this.textBlockPortAuthorityRemarks.Text = portAuthorityTimes.Remarks.TruncateDots(50);
this.imagePortAuthorityLocked.Visibility = (portAuthorityTimes.EtaBerthFixed ?? false) ? Visibility.Visible : Visibility.Hidden;
+ lockTimeRowDefinition.Height = portAuthorityTimes.LockTime.HasValue ? new(15) : new(0);
if(portAuthorityTimes.LockTime.HasValue)
- {
- if(!lockTimeAdded)
- {
- lockTimeRowDefinition.Height = new GridLength(15);
- labelPortAuthorityLockTime.Content = portAuthorityTimes.LockTime.Value.ToString("dd.MM.yyyy HH:mm");
- lockTimeAdded = true;
- }
+ {
+ labelPortAuthorityLockTime.Content = portAuthorityTimes.LockTime.Value.ToString("dd.MM.yyyy HH:mm");
}
}
else
@@ -417,9 +411,13 @@ namespace BreCalClient
this.imageTugLocked.Visibility = Visibility.Hidden;
}
- Times? terminalTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL);
+ this.rowDefinitionTerminalBerth.Height = (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival) ? new(14) : new(0);
+ this.rowDefinitionTerminalBerthRemarks.Height = (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival) ? new GridLength(.5, GridUnitType.Star) : new(0);
+
+ Times ? terminalTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL);
if (terminalTimes != null)
{
+ this.labelTerminalBerth.Visibility = (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival) ? Visibility.Visible : Visibility.Hidden;
this.labelTerminalBerth.Content = this.ShipcallControlModel?.GetBerthText(terminalTimes);
this.labelOperationsStart.Content = terminalTimes.DisplayTime(this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival);
this.textBlockTerminalRemarks.Text = terminalTimes.Remarks.TruncateDots(40);
diff --git a/src/BreCalClient/ShipcallControlModel.cs b/src/BreCalClient/ShipcallControlModel.cs
index 5b2a2b6..cf112c5 100644
--- a/src/BreCalClient/ShipcallControlModel.cs
+++ b/src/BreCalClient/ShipcallControlModel.cs
@@ -16,7 +16,7 @@ namespace BreCalClient
public class ShipcallControlModel
{
- #region Enumerations
+ #region Enumerations
[Flags]
public enum StatusFlags
@@ -90,6 +90,31 @@ namespace BreCalClient
}
}
+ ///
+ /// This property attempts to store the (hopefully short) shifting sequence in the topmost
+ /// byte of the "flags" integer which will not be used for the forseeable future
+ ///
+ /// This is a workaround to avoid adding another field to the interface and is only used in the
+ /// client display anyway. You could say hack as well.
+ ///
+ public byte? ShiftSequence
+ {
+ get
+ {
+ if((this.Shipcall == null) || (this.Shipcall.Flags == null)) return null;
+ return (byte?) (this.Shipcall?.Flags >> 24);
+ }
+ set
+ {
+ if ((value != null) && (this.Shipcall != null))
+ {
+ int currentFlag = this.Shipcall.Flags ?? 0;
+ int moveUp = ((value ?? 0) << 24);
+ this.Shipcall.Flags = (currentFlag & 0xffffff) | moveUp;
+ }
+ }
+ }
+
#endregion
#region public methods
@@ -146,28 +171,45 @@ namespace BreCalClient
return false;
}
- public string? GetBerthText(Times times)
+ ///
+ /// Get berth display text for columns AGENT and TERMINAL
+ ///
+ public string? GetBerthText(Times? times)
{
+ string? timesBerthText = null;
+ string? scArrivalBerthText = null;
+ string? scDepartureBerthText = null;
string? berthText = null;
- if ((BreCalLists.Berths != null) && times.BerthId.HasValue && (this.Shipcall?.Type != ShipcallType.Shifting))
+ Berth? berth;
+
+ if((times != null) && times.BerthId.HasValue)
{
- Berth? berth = BreCalLists.AllBerths.Find((x) => x.Id == times.BerthId);
- berthText = berth?.Name;
+ berth = BreCalLists.AllBerths.Find((x) => x.Id == times.BerthId.Value);
+ timesBerthText = berth?.Name;
}
- if ((berthText == null) && (times.ParticipantType != (int) Extensions.ParticipantType.TERMINAL))
+ berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.ArrivalBerthId);
+ scArrivalBerthText = berth?.Name;
+
+ berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.DepartureBerthId);
+ scDepartureBerthText= berth?.Name;
+
+ switch(this.Shipcall?.Type)
{
- if (this.Shipcall?.Type == ShipcallType.Arrival)
- {
- Berth? berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.ArrivalBerthId);
- berthText = berth?.Name;
- }
- else
- {
- Berth? berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.DepartureBerthId);
- berthText = berth?.Name;
- }
- }
+ case ShipcallType.Arrival:
+ berthText = timesBerthText ?? scArrivalBerthText;
+ break;
+ case ShipcallType.Departure:
+ berthText = timesBerthText ?? scDepartureBerthText;
+ break;
+ case ShipcallType.Shifting:
+ if (times?.ParticipantType != (int)Extensions.ParticipantType.TERMINAL)
+ berthText = (scDepartureBerthText ?? "") + " / " + (timesBerthText ?? scArrivalBerthText);
+ else
+ berthText = scDepartureBerthText ?? "";
+ break;
+ default: break;
+ }
return berthText;
}
@@ -194,7 +236,7 @@ namespace BreCalClient
{
if (agentTimes.EtdBerth != null)
theDate = agentTimes.EtdBerth.Value;
- }
+ }
}
return theDate.ToString();
}
diff --git a/src/Setup/Setup.vdproj b/src/Setup/Setup.vdproj
new file mode 100644
index 0000000..f1498e5
--- /dev/null
+++ b/src/Setup/Setup.vdproj
@@ -0,0 +1,747 @@
+"DeployProject"
+{
+"VSVersion" = "3:800"
+"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}"
+"IsWebType" = "8:FALSE"
+"ProjectName" = "8:Setup"
+"LanguageId" = "3:1033"
+"CodePage" = "3:1252"
+"UILanguageId" = "3:1033"
+"SccProjectName" = "8:"
+"SccLocalPath" = "8:"
+"SccAuxPath" = "8:"
+"SccProvider" = "8:"
+ "Hierarchy"
+ {
+ "Entry"
+ {
+ "MsmKey" = "8:_3E48B6E716164CC1826E094025517B3F"
+ "OwnerKey" = "8:_UNDEFINED"
+ "MsmSig" = "8:_UNDEFINED"
+ }
+ "Entry"
+ {
+ "MsmKey" = "8:_4EE484EAA4A246CBBB283030A6054BC0"
+ "OwnerKey" = "8:_UNDEFINED"
+ "MsmSig" = "8:_UNDEFINED"
+ }
+ }
+ "Configurations"
+ {
+ "Debug"
+ {
+ "DisplayName" = "8:Debug"
+ "IsDebugOnly" = "11:TRUE"
+ "IsReleaseOnly" = "11:FALSE"
+ "OutputFilename" = "8:Debug\\BremenCallingInstaller.msi"
+ "PackageFilesAs" = "3:2"
+ "PackageFileSize" = "3:-2147483648"
+ "CabType" = "3:1"
+ "Compression" = "3:2"
+ "SignOutput" = "11:FALSE"
+ "CertificateFile" = "8:"
+ "PrivateKeyFile" = "8:"
+ "TimeStampServer" = "8:"
+ "InstallerBootstrapper" = "3:2"
+ }
+ "Release"
+ {
+ "DisplayName" = "8:Release"
+ "IsDebugOnly" = "11:FALSE"
+ "IsReleaseOnly" = "11:TRUE"
+ "OutputFilename" = "8:Release\\BremenCallingInstaller.msi"
+ "PackageFilesAs" = "3:2"
+ "PackageFileSize" = "3:-2147483648"
+ "CabType" = "3:1"
+ "Compression" = "3:2"
+ "SignOutput" = "11:FALSE"
+ "CertificateFile" = "8:"
+ "PrivateKeyFile" = "8:"
+ "TimeStampServer" = "8:"
+ "InstallerBootstrapper" = "3:2"
+ }
+ }
+ "Deployable"
+ {
+ "CustomAction"
+ {
+ }
+ "DefaultFeature"
+ {
+ "Name" = "8:DefaultFeature"
+ "Title" = "8:"
+ "Description" = "8:"
+ }
+ "ExternalPersistence"
+ {
+ "LaunchCondition"
+ {
+ "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_7C5ED856EDF94532A041DBACD5D5C09E"
+ {
+ "Name" = "8:.NET Core"
+ "Message" = "8:[VSDNETCOREMSG]"
+ "AllowLaterVersions" = "11:FALSE"
+ "InstallUrl" = "8:https://dotnet.microsoft.com/download/dotnet-core/[NetCoreVerMajorDotMinor]"
+ "IsNETCore" = "11:TRUE"
+ "Architecture" = "2:0"
+ "Runtime" = "2:0"
+ }
+ }
+ }
+ "File"
+ {
+ "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4EE484EAA4A246CBBB283030A6054BC0"
+ {
+ "SourcePath" = "8:..\\BreCalClient\\Resources\\containership.ico"
+ "TargetName" = "8:containership.ico"
+ "Tag" = "8:"
+ "Folder" = "8:_7C8F7547CED64B3CAE7D0296A8BCE23F"
+ "Condition" = "8:"
+ "Transitive" = "11:FALSE"
+ "Vital" = "11:TRUE"
+ "ReadOnly" = "11:FALSE"
+ "Hidden" = "11:FALSE"
+ "System" = "11:FALSE"
+ "Permanent" = "11:FALSE"
+ "SharedLegacy" = "11:FALSE"
+ "PackageAs" = "3:1"
+ "Register" = "3:1"
+ "Exclude" = "11:FALSE"
+ "IsDependency" = "11:FALSE"
+ "IsolateTo" = "8:"
+ }
+ }
+ "FileType"
+ {
+ }
+ "Folder"
+ {
+ "{1525181F-901A-416C-8A58-119130FE478E}:_42539D5BC3044EB6A0CE1EFE84F3C07F"
+ {
+ "Name" = "8:#1916"
+ "AlwaysCreate" = "11:FALSE"
+ "Condition" = "8:"
+ "Transitive" = "11:FALSE"
+ "Property" = "8:DesktopFolder"
+ "Folders"
+ {
+ }
+ }
+ "{3C67513D-01DD-4637-8A68-80971EB9504F}:_7C8F7547CED64B3CAE7D0296A8BCE23F"
+ {
+ "DefaultLocation" = "8:[ProgramFiles64Folder][Manufacturer]\\[ProductName]"
+ "Name" = "8:#1925"
+ "AlwaysCreate" = "11:FALSE"
+ "Condition" = "8:"
+ "Transitive" = "11:FALSE"
+ "Property" = "8:TARGETDIR"
+ "Folders"
+ {
+ }
+ }
+ "{1525181F-901A-416C-8A58-119130FE478E}:_8BBC7FE2F38E4B41A71D26CCED7D0BCB"
+ {
+ "Name" = "8:#1919"
+ "AlwaysCreate" = "11:FALSE"
+ "Condition" = "8:"
+ "Transitive" = "11:FALSE"
+ "Property" = "8:ProgramMenuFolder"
+ "Folders"
+ {
+ }
+ }
+ }
+ "LaunchCondition"
+ {
+ }
+ "Locator"
+ {
+ }
+ "MsiBootstrapper"
+ {
+ "LangId" = "3:1033"
+ "RequiresElevation" = "11:FALSE"
+ }
+ "Product"
+ {
+ "Name" = "8:Microsoft Visual Studio"
+ "ProductName" = "8:Bremen calling"
+ "ProductCode" = "8:{6EF71F76-3E55-483B-A032-4B29FDAFE6A4}"
+ "PackageCode" = "8:{8E55F30F-A9C8-41E9-BCE8-431770A951ED}"
+ "UpgradeCode" = "8:{1C7FA3E4-BAB9-4911-9348-73094357FC7C}"
+ "AspNetVersion" = "8:"
+ "RestartWWWService" = "11:FALSE"
+ "RemovePreviousVersions" = "11:TRUE"
+ "DetectNewerInstalledVersion" = "11:TRUE"
+ "InstallAllUsers" = "11:FALSE"
+ "ProductVersion" = "8:1.2.2"
+ "Manufacturer" = "8:Informatikbüro Daniel Schick"
+ "ARPHELPTELEPHONE" = "8:+49 (0) 421 - 38 48 27"
+ "ARPHELPLINK" = "8:https://www.bsmd.de/"
+ "Title" = "8:Bremen Calling"
+ "Subject" = "8:"
+ "ARPCONTACT" = "8:Informatikbüro Daniel Schick"
+ "Keywords" = "8:"
+ "ARPCOMMENTS" = "8:Bremen calling desktop app"
+ "ARPURLINFOABOUT" = "8:https://www.textbausteine.net/"
+ "ARPPRODUCTICON" = "8:"
+ "ARPIconIndex" = "3:0"
+ "SearchPath" = "8:"
+ "UseSystemSearchPath" = "11:TRUE"
+ "TargetPlatform" = "3:1"
+ "PreBuildEvent" = "8:"
+ "PostBuildEvent" = "8:"
+ "RunPostBuildEvent" = "3:0"
+ }
+ "Registry"
+ {
+ "HKLM"
+ {
+ "Keys"
+ {
+ "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_621080AF02E34428A84F3B5008F9EFE8"
+ {
+ "Name" = "8:Software"
+ "Condition" = "8:"
+ "AlwaysCreate" = "11:FALSE"
+ "DeleteAtUninstall" = "11:FALSE"
+ "Transitive" = "11:FALSE"
+ "Keys"
+ {
+ "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_E6E863A158B246CDA6DC9DF011E759D6"
+ {
+ "Name" = "8:[Manufacturer]"
+ "Condition" = "8:"
+ "AlwaysCreate" = "11:FALSE"
+ "DeleteAtUninstall" = "11:FALSE"
+ "Transitive" = "11:FALSE"
+ "Keys"
+ {
+ }
+ "Values"
+ {
+ }
+ }
+ }
+ "Values"
+ {
+ }
+ }
+ }
+ }
+ "HKCU"
+ {
+ "Keys"
+ {
+ "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_4C5D672685C24D5CB9C3365480FF133D"
+ {
+ "Name" = "8:Software"
+ "Condition" = "8:"
+ "AlwaysCreate" = "11:FALSE"
+ "DeleteAtUninstall" = "11:FALSE"
+ "Transitive" = "11:FALSE"
+ "Keys"
+ {
+ "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_D60142B890324967A76C15BDECC179BD"
+ {
+ "Name" = "8:[Manufacturer]"
+ "Condition" = "8:"
+ "AlwaysCreate" = "11:FALSE"
+ "DeleteAtUninstall" = "11:FALSE"
+ "Transitive" = "11:FALSE"
+ "Keys"
+ {
+ }
+ "Values"
+ {
+ }
+ }
+ }
+ "Values"
+ {
+ }
+ }
+ }
+ }
+ "HKCR"
+ {
+ "Keys"
+ {
+ }
+ }
+ "HKU"
+ {
+ "Keys"
+ {
+ }
+ }
+ "HKPU"
+ {
+ "Keys"
+ {
+ }
+ }
+ }
+ "Sequences"
+ {
+ }
+ "Shortcut"
+ {
+ "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_5E8842D2923A4CED99FE0FF49BD7EB44"
+ {
+ "Name" = "8:Bremen calling"
+ "Arguments" = "8:"
+ "Description" = "8:"
+ "ShowCmd" = "3:1"
+ "IconIndex" = "3:0"
+ "Transitive" = "11:FALSE"
+ "Target" = "8:_3E48B6E716164CC1826E094025517B3F"
+ "Folder" = "8:_8BBC7FE2F38E4B41A71D26CCED7D0BCB"
+ "WorkingFolder" = "8:_7C8F7547CED64B3CAE7D0296A8BCE23F"
+ "Icon" = "8:_4EE484EAA4A246CBBB283030A6054BC0"
+ "Feature" = "8:"
+ }
+ "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_E3C6E6AB5F9B416C8AB4CB484AB16A04"
+ {
+ "Name" = "8:Bremen calling"
+ "Arguments" = "8:"
+ "Description" = "8:"
+ "ShowCmd" = "3:1"
+ "IconIndex" = "3:0"
+ "Transitive" = "11:FALSE"
+ "Target" = "8:_3E48B6E716164CC1826E094025517B3F"
+ "Folder" = "8:_42539D5BC3044EB6A0CE1EFE84F3C07F"
+ "WorkingFolder" = "8:_7C8F7547CED64B3CAE7D0296A8BCE23F"
+ "Icon" = "8:_4EE484EAA4A246CBBB283030A6054BC0"
+ "Feature" = "8:"
+ }
+ }
+ "UserInterface"
+ {
+ "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_03AD68BE31A34015840F64B788AE62D3"
+ {
+ "UseDynamicProperties" = "11:FALSE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdUserInterface.wim"
+ }
+ "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_03DFC57B49C04D4FAF4AFA2978E58D73"
+ {
+ "Name" = "8:#1901"
+ "Sequence" = "3:2"
+ "Attributes" = "3:2"
+ "Dialogs"
+ {
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_539DAA1B164044C3972295728D682887"
+ {
+ "Sequence" = "3:100"
+ "DisplayName" = "8:Progress"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdAdminProgressDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ "ShowProgress"
+ {
+ "Name" = "8:ShowProgress"
+ "DisplayName" = "8:#1009"
+ "Description" = "8:#1109"
+ "Type" = "3:5"
+ "ContextData" = "8:1;True=1;False=0"
+ "Attributes" = "3:0"
+ "Setting" = "3:0"
+ "Value" = "3:1"
+ "DefaultValue" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ }
+ }
+ "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_1911E796FA5D489EA62710F95FAF9302"
+ {
+ "UseDynamicProperties" = "11:FALSE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdBasicDialogs.wim"
+ }
+ "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_294C0DD534914D668B6B8D4963D157F5"
+ {
+ "Name" = "8:#1902"
+ "Sequence" = "3:2"
+ "Attributes" = "3:3"
+ "Dialogs"
+ {
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_047451965B9047229CFC992E233C1FA0"
+ {
+ "Sequence" = "3:100"
+ "DisplayName" = "8:Finished"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdAdminFinishedDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ }
+ }
+ "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_3E8E2283333C48529849E39663B8A994"
+ {
+ "Name" = "8:#1900"
+ "Sequence" = "3:1"
+ "Attributes" = "3:1"
+ "Dialogs"
+ {
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_56CB3060C3AD48EAABCC4E6F6340FD33"
+ {
+ "Sequence" = "3:100"
+ "DisplayName" = "8:Welcome"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdWelcomeDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ "CopyrightWarning"
+ {
+ "Name" = "8:CopyrightWarning"
+ "DisplayName" = "8:#1002"
+ "Description" = "8:#1102"
+ "Type" = "3:3"
+ "ContextData" = "8:"
+ "Attributes" = "3:0"
+ "Setting" = "3:1"
+ "Value" = "8:#1202"
+ "DefaultValue" = "8:#1202"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ "Welcome"
+ {
+ "Name" = "8:Welcome"
+ "DisplayName" = "8:#1003"
+ "Description" = "8:#1103"
+ "Type" = "3:3"
+ "ContextData" = "8:"
+ "Attributes" = "3:0"
+ "Setting" = "3:1"
+ "Value" = "8:#1203"
+ "DefaultValue" = "8:#1203"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_8CD43C22928545F8A3392FDCC650C893"
+ {
+ "Sequence" = "3:300"
+ "DisplayName" = "8:Confirm Installation"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdConfirmDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_E6254350E1FF43E7A231AC077BAB8F82"
+ {
+ "Sequence" = "3:200"
+ "DisplayName" = "8:Installation Folder"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdFolderDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ "InstallAllUsersVisible"
+ {
+ "Name" = "8:InstallAllUsersVisible"
+ "DisplayName" = "8:#1059"
+ "Description" = "8:#1159"
+ "Type" = "3:5"
+ "ContextData" = "8:1;True=1;False=0"
+ "Attributes" = "3:0"
+ "Setting" = "3:0"
+ "Value" = "3:1"
+ "DefaultValue" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ }
+ }
+ "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_4A86B004A86E4D3DAF096262FE76805C"
+ {
+ "Name" = "8:#1901"
+ "Sequence" = "3:1"
+ "Attributes" = "3:2"
+ "Dialogs"
+ {
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_16DE803E5AB14E1F9FE98B738BA75A4A"
+ {
+ "Sequence" = "3:100"
+ "DisplayName" = "8:Progress"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdProgressDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ "ShowProgress"
+ {
+ "Name" = "8:ShowProgress"
+ "DisplayName" = "8:#1009"
+ "Description" = "8:#1109"
+ "Type" = "3:5"
+ "ContextData" = "8:1;True=1;False=0"
+ "Attributes" = "3:0"
+ "Setting" = "3:0"
+ "Value" = "3:1"
+ "DefaultValue" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ }
+ }
+ "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_8453A720995D4255A3A1B309A36A7111"
+ {
+ "Name" = "8:#1900"
+ "Sequence" = "3:2"
+ "Attributes" = "3:1"
+ "Dialogs"
+ {
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_240EA1CF929842A7AB9F635AFA4F93EA"
+ {
+ "Sequence" = "3:100"
+ "DisplayName" = "8:Welcome"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ "CopyrightWarning"
+ {
+ "Name" = "8:CopyrightWarning"
+ "DisplayName" = "8:#1002"
+ "Description" = "8:#1102"
+ "Type" = "3:3"
+ "ContextData" = "8:"
+ "Attributes" = "3:0"
+ "Setting" = "3:1"
+ "Value" = "8:#1202"
+ "DefaultValue" = "8:#1202"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ "Welcome"
+ {
+ "Name" = "8:Welcome"
+ "DisplayName" = "8:#1003"
+ "Description" = "8:#1103"
+ "Type" = "3:3"
+ "ContextData" = "8:"
+ "Attributes" = "3:0"
+ "Setting" = "3:1"
+ "Value" = "8:#1203"
+ "DefaultValue" = "8:#1203"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F5EB176F97E14A8CBBA361E5EA6BF00A"
+ {
+ "Sequence" = "3:200"
+ "DisplayName" = "8:Installation Folder"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdAdminFolderDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F9D0FD5521A74505AFD3AFA0A4C3B9D5"
+ {
+ "Sequence" = "3:300"
+ "DisplayName" = "8:Confirm Installation"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdAdminConfirmDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ }
+ }
+ "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_8BFEF97EF6EC4B3094E8982994B8C6FF"
+ {
+ "Name" = "8:#1902"
+ "Sequence" = "3:1"
+ "Attributes" = "3:3"
+ "Dialogs"
+ {
+ "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_738B5FF6A9514E8F88896EFCE7980AF3"
+ {
+ "Sequence" = "3:100"
+ "DisplayName" = "8:Finished"
+ "UseDynamicProperties" = "11:TRUE"
+ "IsDependency" = "11:FALSE"
+ "SourcePath" = "8:\\VsdFinishedDlg.wid"
+ "Properties"
+ {
+ "BannerBitmap"
+ {
+ "Name" = "8:BannerBitmap"
+ "DisplayName" = "8:#1001"
+ "Description" = "8:#1101"
+ "Type" = "3:8"
+ "ContextData" = "8:Bitmap"
+ "Attributes" = "3:4"
+ "Setting" = "3:1"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ "UpdateText"
+ {
+ "Name" = "8:UpdateText"
+ "DisplayName" = "8:#1058"
+ "Description" = "8:#1158"
+ "Type" = "3:15"
+ "ContextData" = "8:"
+ "Attributes" = "3:0"
+ "Setting" = "3:1"
+ "Value" = "8:#1258"
+ "DefaultValue" = "8:#1258"
+ "UsePlugInResources" = "11:TRUE"
+ }
+ }
+ }
+ }
+ }
+ }
+ "MergeModule"
+ {
+ }
+ "ProjectOutput"
+ {
+ "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_3E48B6E716164CC1826E094025517B3F"
+ {
+ "SourcePath" = "8:..\\BreCalClient\\obj\\Release\\net6.0-windows\\apphost.exe"
+ "TargetName" = "8:"
+ "Tag" = "8:"
+ "Folder" = "8:_7C8F7547CED64B3CAE7D0296A8BCE23F"
+ "Condition" = "8:"
+ "Transitive" = "11:FALSE"
+ "Vital" = "11:TRUE"
+ "ReadOnly" = "11:FALSE"
+ "Hidden" = "11:FALSE"
+ "System" = "11:FALSE"
+ "Permanent" = "11:FALSE"
+ "SharedLegacy" = "11:FALSE"
+ "PackageAs" = "3:1"
+ "Register" = "3:1"
+ "Exclude" = "11:FALSE"
+ "IsDependency" = "11:FALSE"
+ "IsolateTo" = "8:"
+ "ProjectOutputGroupRegister" = "3:1"
+ "OutputConfiguration" = "8:"
+ "OutputGroupCanonicalName" = "8:PublishItems"
+ "OutputProjectGuid" = "8:{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}"
+ "ShowKeyOutput" = "11:TRUE"
+ "ExcludeFilters"
+ {
+ }
+ }
+ }
+ }
+}
diff --git a/src/brecal.model/Participant.cs b/src/brecal.model/Participant.cs
index 04cc118..e2a8119 100644
--- a/src/brecal.model/Participant.cs
+++ b/src/brecal.model/Participant.cs
@@ -10,6 +10,7 @@ namespace brecal.model
{
#region Enumerations
+ // TODO: should localize the descriptions
[Flags]
public enum ParticipantType
{
@@ -19,7 +20,7 @@ namespace brecal.model
BSMD = 1,
[Description("Terminal")]
TERMINAL = 2,
- [Description("Lotsen")]
+ [Description("Flusslotsen")]
PILOT = 4,
[Description("Agentur")]
AGENCY = 8,
diff --git a/src/server/BreCal/database/sql_handler.py b/src/server/BreCal/database/sql_handler.py
index 2d85175..05c9296 100644
--- a/src/server/BreCal/database/sql_handler.py
+++ b/src/server/BreCal/database/sql_handler.py
@@ -33,7 +33,8 @@ def get_synchronous_shipcall_times_standalone(query_time:pd.Timestamp, all_df_ti
returns: counts
"""
- assert isinstance(query_time,pd.Timestamp)
+ assert isinstance(query_time,pd.Timestamp) or pd.isnull(query_time), f"expected query_time to be a pd.Timestamp or pd.NaT. Found: {type(query_time)}"
+ assert isinstance(all_df_times,pd.DataFrame)
# get a timedelta for each valid (not Null) time entry
time_deltas_eta = [(query_time.to_pydatetime()-time_.to_pydatetime()) for time_ in all_df_times.loc[:,"eta_berth"] if not pd.isnull(time_)]
@@ -439,4 +440,5 @@ class SQLHandler():
def count_synchronous_shipcall_times(self, query_time:pd.Timestamp, all_df_times:pd.DataFrame, delta_threshold=900)->int:
"""count all times entries, which are too close to the query_time. The {delta_threshold} determines the threshold. returns counts (int)"""
+ assert isinstance(all_df_times, pd.DataFrame)
return get_synchronous_shipcall_times_standalone(query_time, all_df_times, delta_threshold)
diff --git a/src/server/BreCal/database/sql_queries.py b/src/server/BreCal/database/sql_queries.py
index 3f84d75..aac4ff9 100644
--- a/src/server/BreCal/database/sql_queries.py
+++ b/src/server/BreCal/database/sql_queries.py
@@ -222,7 +222,7 @@ class SQLQuery():
"api_key, notify_email, notify_whatsapp, notify_signal, notify_popup, created, modified FROM user " +\
"WHERE user_name = ?username? OR user_email = ?username?"
return query
-
+
@staticmethod
def get_notifications()->str:
query = "SELECT id, shipcall_id, level, type, message, created, modified FROM notification " + \
@@ -266,6 +266,11 @@ class SQLQuery():
query = "SELECT id, name, imo, callsign, participant_id, length, width, is_tug, bollard_pull, eni, created, modified, deleted FROM ship ORDER BY name"
return query
+ @staticmethod
+ def get_ship_by_id()->str:
+ query = "SELECT id, name, imo, callsign, participant_id, length, width, is_tug, bollard_pull, eni, created, modified, deleted FROM ship WHERE id = ?id?"
+ return query
+
@staticmethod
def get_times()->str:
query = "SELECT id, eta_berth, eta_berth_fixed, etd_berth, etd_berth_fixed, lock_time, lock_time_fixed, " + \
@@ -316,6 +321,22 @@ class SQLQuery():
query = prefix+stage1+bridge+stage2+suffix
return query
+
+ @staticmethod
+ def get_notifications_post(schemaModel:dict)->str:
+ param_keys = {key:key for key in schemaModel.keys()}
+
+ prefix = "INSERT INTO notification ("
+ bridge = ") VALUES ("
+ suffix = ")"
+
+ non_dynamic_keys = ["id", "created", "modified"]
+
+ stage1 = ",".join([key for key in schemaModel.keys() if not key in non_dynamic_keys])
+ stage2 = ",".join([f"?{param_keys.get(key)}?" for key in schemaModel.keys() if not key in non_dynamic_keys])
+
+ query = prefix+stage1+bridge+stage2+suffix
+ return query
@staticmethod
def get_last_insert_id()->str:
diff --git a/src/server/BreCal/notifications/accounts.py b/src/server/BreCal/notifications/accounts.py
new file mode 100644
index 0000000..0e3bbd0
--- /dev/null
+++ b/src/server/BreCal/notifications/accounts.py
@@ -0,0 +1,7 @@
+"""This file contains login information to register into distinct notification accounts."""
+
+
+mail_server = 'w01d5503.kasserver.com'
+mail_port=465
+mail_address="max.metz@scope-sorting.com"
+mail_pwd = b'gAAAAABmqJlkXbtJTL1tFiyQNHhF_Y7sgtVI0xEx07ybwbX70Ro1Vp73CLDq49eFSYG-1SswIDQ2JBSORYlWaR-Vh2kIwPHy_lX8SxkySrRvBRzkyZP5x0I='
diff --git a/src/server/BreCal/notifications/notifier.py b/src/server/BreCal/notifications/notifier.py
index dc74b91..9968fc6 100644
--- a/src/server/BreCal/notifications/notifier.py
+++ b/src/server/BreCal/notifications/notifier.py
@@ -1,7 +1,19 @@
import typing
+import datetime
from BreCal.database.sql_handler import execute_sql_query_standalone
from BreCal.database.sql_queries import SQLQuery
from BreCal.schemas import model
+from BreCal.brecal_utils.time_handling import difference_to_then
+from BreCal.notifications.accounts import mail_server, mail_port, mail_address, mail_pwd
+
+from BreCal.services.email_handling import EmailHandler, create_shipcall_evaluation_notification, send_notification, get_default_html_email
+from BreCal.database.enums import ParticipantwiseTimeDelta
+
+eta_etd_type_dict = {
+ model.ShipcallType.arrival : "Ankunft",
+ model.ShipcallType.departure : "Abfahrt",
+ model.ShipcallType.shifting : "Wechselnd"
+}
class Notifier():
"""
@@ -35,112 +47,82 @@ class Notifier():
- iterate over each remaining shipcall and apply .send_notification
- those which are unsent, shall be sent by the respective type
"""
- raise NotImplementedError("skeleton")
+ # set a threshold, when alarm event notifications become eligible
+ time_diff_threshold = float(ParticipantwiseTimeDelta.NOTIFICATION)*60 # m minutes, converted to seconds
+
+ debug = is_test # if is_test, the Emails will not be issued. Only a print message will be created.
+ update_database = True if not is_test else False # if_test, the database will not be updated.
+ time_diff_threshold = time_diff_threshold if not is_test else 0.0 # 0.0 delay when is_test is set.
- # get all shipcalls
- all_shipcalls = NotImplementedError
+ email_handler = EmailHandler(mail_server=mail_server, mail_port=mail_port, mail_address=mail_address)
- shipcalls = [shipcall for shipcall in all_shipcalls if not shipcall.evaluation_notifications_sent]
- for shipcall in shipcalls:
- notification_list = Notifier.send_notification(shipcall, is_test=is_test)
+ # get candidates: find all eligible shipcalls, where the evaluation state is yellow or red & the notifications are not yet sent
+ eligible_shipcalls = Notifier.get_eligible_shipcalls(time_diff_threshold)
- # #TODO: get all notifications
- # #TODO: get matching shipcall (based on shipcall_id)
+ # get a list of tuples, where (shipcall, users) are combined for easier iterations.
+ notification_instructions = Notifier.build_notification_tuples(eligible_shipcalls)
- # #TODO: filter: consider only those, which are not yet sent
+ if len(notification_instructions)>0: # only perform a login when there are any notification_instructions
+ try:
+ # login in advance, so the email handler uses a shared connection. It disconnects only once at the end of the call.
+ email_handler.login(interactive=False, pwd=mail_pwd)
+
+ for shipcall, users in notification_instructions:
+ assert isinstance(shipcall, model.Shipcall)
+ assert isinstance(users,list)
+ assert all([isinstance(user,model.User) for user in users])
- # identify necessity
- # #TODO: get the 'evaluation_notifications_sent' field from all shipcalls (based on shipcall_id)
- # if not -> return
- # USE shipcall.evaluation_notifications_sent
+ # iterate over each notification type
+ for notification_type in Notifier.get_all_notification_types():
+ # consider only those users, which have subscribed to the respective notification type
+ eligible_users = Notifier.get_eligible_users(users, notification_type)
- # #TODO: those which are unsent, shall be created&sent by the respective type -- Note: consider the is_test argument
- # iterate over the list of Notifier.build_notification_type_list
- # one might use Notifier.create(..., update_database=True)
- # use the History (GetHistory -- by shipcall_id) to identify all subscribed users
+ if len(eligible_users)>0:
+ Notifier.create_and_send_notification_mapper(notification_type, shipcall, eligible_users, email_handler, mail_pwd, debug=debug)
- # #TODO: update the shipcall dataset ('evaluation_notifications_sent') -- Note: consider the is_test argument
+ if not debug:
+ # populate notifications within the database to keep track
+ Notifier.generate_notification(shipcall, notification_type)
- # #TODO_clarify: how to handle the 'evaluation_notifications_sent', when there is no recipient?
+ # update the database entries, so notifications are only sent once.
+ if update_database:
+ Notifier.shipcall_put_update_evaluation_notifications_sent_flag(shipcall)
+
+ # #TODO: except... create log?
+
+ finally:
+ email_handler.close()
return
+
+ @staticmethod
+ def build_notification_tuples(eligible_shipcalls)->list[typing.Tuple[model.Shipcall,list[model.User]]]:
+ """
+ creates tuples, where shipcall and the list of attached users are grouped. One can iterate over the tuples
+ to perform actions, such as issueing notifications
+ """
+ notification_instructions = []
+ for shipcall in eligible_shipcalls:
+ # get all users, which are attached to the shipcall (uses the History dataset)
+ users = Notifier.get_users_via_history(shipcall.id)
+
+ # create and store tuples of (shipcall, users) for each eligible shipcall
+ notification_instructions.append((shipcall, users))
+ return notification_instructions
@staticmethod
- def send_notification(shipcall:model.Shipcall, is_test:bool=False)->list[model.Notification]:
- """
- Complex-function, which is responsible of creating notification messages, issuing them to users and optionally updating
- the database. The requirement is, that the notification is required and passes through an internal set of filters.
+ def get_eligible_users(users, notification_type):
+ eligible_users = [user for user in users if Notifier.check_user_is_subscribed_to_notification_type(user,notification_type=notification_type)]
- Steps:
- - get all notifications of shipcall_id
- - identify the assigned list of users
- - apply all filters. When a filter triggers, exit. If not, create and send a notification.
- """
- update_database = False if is_test else True
- # #TODO: the concept of old state and new state must be refactored.
- # old state: read shipcall_id from notifications and look for the latest finding (if None -> EvaluationType.undefined)
- # new state: read shipcall_id from shipcalls and look for the *current* 'evaluation' (-> EvaluationType(value))
-
- # get existing notifications by shipcall_id (list)
- existing_notifications = Notifier.get_existing_notifications(shipcall_id=shipcall.id)
- old_state = NotImplementedError
-
- new_state = shipcall.evaluation
-
- # get User by querying all History objects of a shipcall_id
- users = Notifier.get_users_via_history(shipcall_id=shipcall.id)
-
- # identify necessity
- # state-check: Did the 'evaluation' shift to a higher level of severity?
- severity_bool = Notifier.check_higher_severity(old_state, new_state)
- if not severity_bool:
- return None
-
-
- # #TODO: time-based filter. There shall be 'enough' time between the evaluation time and NOW
- evaluation_time = shipcall.evaluation_time
- # latency_bool = #TODO_DIFFERENCE_FROM_NOW_TO_EVALUATION_TIME____THIS_METHOD_ALREADY_EXISTS(evaluation_time)
- # careful: what is True, what is False?
- # if latency_booL:
- # return None
-
- notification_list = []
- for user in users:
- notification = Notifier.create(
- shipcall.id,
- old_state,
- new_state,
- user,
- update_database=update_database,
- is_test=is_test
- )
- notification_list.append(notification)
- return notification_list
-
- @staticmethod
- def publish(shipcall_id, old_state, new_state, user, update_database:bool=False)->typing.Optional[model.Notification]:
- """
- Complex-function, which creates, sends and documents a notification. It serves as a convenience function.
- The method does not apply internal filters to identify, whether a notification should be created in the first place.
-
- options:
- update_database: bool.
- # #TODO: instead of update_database, one may also use is_test
- """
- # 1.) create
- # ... = Notifier.create(shipcall_id, old_state, new_state, user) # e.g., might return a dictionary of dict[model.NotificationType, str], where str is the message
-
- # 2.) send
- # ... = Notifier.send(...) # should contain internal 'logistics', which user the respective handlers to send notifications
-
- # 3.) document (mysql database)
- # if update_database
- # ... = Notifier.document(...)
- raise NotImplementedError("skeleton")
- return
+ # filter: consider only those users, where an Email is set
+ # #TODO: this is Email-specific and should not be a filter for other notifications
+ eligible_users = [user for user in eligible_users if user.user_email is not None]
+ return eligible_users
@staticmethod
def create(shipcall_id, old_state, new_state, user, update_database:bool=False)->typing.Optional[model.Notification]:
"""
+ # #TODO_refactor: drastically change this method. It should only generate notifications, but not send them.
+
Standalone function, which creates a Notification for a specific user.
Steps:
@@ -173,6 +155,7 @@ class Notifier():
# get a list of all subscribed notification types and track the state (success or failure)
+ raise NotImplementedError("skeleton")
successes = {}
notification_type_list = Notifier.build_notification_type_list(user)
for notification_type in notification_type_list:
@@ -183,7 +166,6 @@ class Notifier():
success_state = Notifier.send_notification_by_type(notification_type, message)
successes[notification_type] = success_state
- raise NotImplementedError("skeleton")
notification = ...
return notification
@@ -197,11 +179,10 @@ class Notifier():
def get_users_via_history(shipcall_id:int)->list[model.User]:
"""using the History objects, one can infer the user_id, which allows querying the Users"""
histories = execute_sql_query_standalone(query=SQLQuery.get_history(), param={"shipcallid" : shipcall_id}, model=model.History, command_type="query")
- user_ids = [
- history.user_id
- for history in histories
- ]
- users = [Notifier.get_user(user_id) for user_id in user_ids]
+ assert isinstance(histories,list)
+ assert all([isinstance(history,model.History) for history in histories])
+
+ users = [Notifier.get_user(history.user_id) for history in histories]
return users
@staticmethod
@@ -306,8 +287,249 @@ class Notifier():
else:
raise ValueError(notification_type)
return
+
+ @staticmethod
+ def get_eligible_shipcalls(time_diff_threshold:float):
+ """
+ get all eligible shipcalls, which do not have a sent notification yet
+ criterion a) notification shall not be sent yet (evaluation_notifications_sent = 0)
+ criterion b) evaluation state is yellow or red (type 2 or 3)
+ """
+ query = 'SELECT * FROM shipcall WHERE (evaluation_notifications_sent = ?evaluation_notifications_sent?) AND (evaluation = 2 OR evaluation = 3)'
+ evaluation_notifications_sent = 0
+
+ # filter out the shipcalls, where the notifications were already sent (ignores null values, which is as expected)
+ eligible_shipcalls = execute_sql_query_standalone(query=query, model=model.Shipcall, param={"evaluation_notifications_sent" : evaluation_notifications_sent})
+
+ # filter out the shipcalls, where evaluation_time is not set
+ eligible_shipcalls = [shipcall for shipcall in eligible_shipcalls if shipcall.evaluation_time is not None]
+
+ # filter out the shipcalls, where the evaluation_time is too recent. We expect a minimum difference, so user input errors do not cause notifications
+ eligible_shipcalls = [shipcall for shipcall in eligible_shipcalls if Notifier.check_shipcall_evaluation_time_exceeds_minimum_time_difference(shipcall, time_diff_threshold)]
+ return eligible_shipcalls
+ @staticmethod
+ def get_eligible_notifications_of_shipcall(shipcall:model.Shipcall, time_diff_threshold:float)->list[model.Notification]:
+ """obtain all notifications, which belong to the shipcall id"""
+ query = SQLQuery.get_notifications()
+ eligible_notifications = execute_sql_query_standalone(query=query, model=model.Notification, param={"scid" : shipcall.id})
+ eligible_notifications = [notification for notification in eligible_notifications if Notifier.check_notification_level_matches_shipcall_entry(notification, shipcall)]
+ return eligible_notifications
+
+ @staticmethod
+ def check_shipcall_evaluation_time_exceeds_minimum_time_difference(shipcall:model.Shipcall, time_diff_threshold:float):
+ """
+ a notification may only be sent, when the created notification has been created or modified {time_diff_threshold} seconds ago.
+ """
+ assert (shipcall.evaluation_time is not None), f"must provide 'evaluation_time'"
+ return difference_to_then(shipcall.evaluation_time)>=time_diff_threshold
+
+ @staticmethod
+ def check_notification_level_matches_shipcall_entry(notification, shipcall):
+ """
+ a notification may only be sent, when the shipcall entry matches the notification level.
+ otherwise, a user may have adapted the shipcall in the mean-time, so a notification would no longer be useful.
+ """
+ return int(shipcall.evaluation) == int(notification.level)
+
+ @staticmethod
+ def get_eligible_notifications(shipcalls:list[model.Shipcall]):
+ """obtain a list of all notifications of each element of the shipcall list."""
+ eligible_notifications = []
+ for shipcall in shipcalls:
+ eligible_notification = Notifier.get_eligible_notifications_of_shipcall(shipcall)
+ eligible_notifications.extend(eligible_notification)
+ raise NotImplementedError("refactoring!")
+ return eligible_notifications
+
+ @staticmethod
+ def create_notifications_for_user_list(shipcall, users:list[model.User]):
+ raise NotImplementedError("deprecated")
+ notification_type_list = []
+ for user in users:
+ user_notification_type_list = Notifier.build_notification_type_list(user)
+ notification_type_list.extend(user_notification_type_list)
+
+ # get the unique notification types
+ notification_type_list = list(set(notification_type_list))
+ for notification_type in notification_type_list:
+ schemaModel = dict(shipcall_id = shipcall.id, level = int(shipcall.evaluation), type = notification_type, message = "", created = datetime.datetime.now(), modified=None)
+ query = SQLQuery.get_notifications_post(schemaModel)
+ schemas = execute_sql_query_standalone(query=query, param=schemaModel, command_type="execute")
+ return
+
+ @staticmethod
+ def generate_notification(shipcall:model.Shipcall, notification_type:model.NotificationType):
+ """
+ This one-line method creates a notification for the provided shipcall and notification type
+ """
+ schemaModel = dict(
+ shipcall_id = shipcall.id,
+ level = int(shipcall.evaluation),
+ type = notification_type,
+ message = "", # #TODO_messsage: what should be stored here? The HTML-template appears to be too long.
+ created = datetime.datetime.now(),
+ modified=None)
+ query = SQLQuery.get_notifications_post(schemaModel)
+ schemas = execute_sql_query_standalone(query=query, param=schemaModel, command_type="execute")
+ return
+
+ @staticmethod
+ def DEPRECATED_generate_notifications(shipcall_id):
+ """
+ # #TODO_delete: this method can be safely removed after 15.08.2024
+
+ This one-line method creates all notifications for the provided shipcall id. It does so by obtaining the shipcall,
+ looking up its history, and finding all attached users.
+ For each user, a notification will be created for each subscribed notification type (e.g., Email)
+ """
+ shipcall = Notifier.get_shipcall(shipcall_id)
+ notifications = execute_sql_query_standalone(query=SQLQuery.get_notifications(), param={"scid" : shipcall_id}, model=model.Notification, command_type="query")
+ latest_notification = Notifier.find_latest_notification(notifications)
+
+ old_state = model.EvaluationType(latest_notification.level) if latest_notification is not None else model.EvaluationType.undefined
+ new_state = shipcall.evaluation
+
+ # identify, whether the severity of the shipcall has increased to see, whether a notification is required
+ severity_increase = Notifier.check_higher_severity(old_state=old_state, new_state=new_state)
+
+ # when the severity increases, set the 'evaluation_notifications_sent' argument to 0 (False)
+ if severity_increase:
+ ### UPDATE Shipcall ###
+ # prepare and create a query
+ evaluation_notifications_sent = 0
+ schemaModel = {"id":shipcall.id, "evaluation_notifications_sent":evaluation_notifications_sent} # #TODO: should this require the 'modified' tag to be adapted?
+ query = SQLQuery.get_shipcall_put(schemaModel)
+
+ # execute the PUT-Request
+ schemas = execute_sql_query_standalone(query=query, param=schemaModel, command_type="execute")
+
+ ### Generate Notifications ###
+ # find all attached users of the shipcall (checks the history, then reads out the user ids and builds the users)
+ users = Notifier.get_users_via_history(shipcall_id=shipcall.id)
+
+ # for each user, identify the notification_types, which must be generated. Finally, create those
+ # notifications with a POST-request
+ Notifier.create_notifications_for_user_list(shipcall, users)
+ return
+
+ @staticmethod
+ def create_etaetd_string(eta, etd): # #TODO_rename: function name is improvable
+ eta = eta.strftime("%d.%m.%Y %H:%M") if eta is not None else None
+ etd = etd.strftime("%d.%m.%Y %H:%M") if etd is not None else None
+
+ eta_etd = ""
+
+ if eta is not None and etd is not None:
+ eta_etd = f"{eta} - {etd}"
+
+ if eta is not None and etd is None:
+ eta_etd = f"{eta}"
+
+ if etd is None and etd is not None:
+ eta_etd = f"{etd}"
+ return eta_etd
+
+ @staticmethod
+ def prepare_notification_body(shipcall:model.Shipcall):
+ # obtain the respective shipcall and ship
+ shipcall = execute_sql_query_standalone(query=SQLQuery.get_shipcall_by_id(), model=model.Shipcall, param={"id" : shipcall.id}, command_type="single")
+ ship = execute_sql_query_standalone(query=SQLQuery.get_ship_by_id(), model=model.Ship, param={"id" : shipcall.ship_id}, command_type="single")
+
+ # use ship & shipcall data models to prepare the body
+ ship_name = ship.name
+ eta_etd = Notifier.create_etaetd_string(shipcall.eta, shipcall.etd)
+ eta_etd_type = eta_etd_type_dict[model.ShipcallType(shipcall.type)]
+ evaluation_message = shipcall.evaluation_message
+ return (ship_name, evaluation_message, eta_etd, eta_etd_type)
+
+ @staticmethod
+ def shipcall_put_update_evaluation_notifications_sent_flag(shipcall):
+ # change the 'evaluation_notifications_sent' flag to 1
+ evaluation_notifications_sent = 1
+ schemaModel = {"id":shipcall.id, "evaluation_notifications_sent":evaluation_notifications_sent}
+ query = SQLQuery.get_shipcall_put(schemaModel)
+
+ schemas = execute_sql_query_standalone(query=query, param=schemaModel, command_type="execute")
+ return
+
+ @staticmethod
+ def build_email_targets_validation_notification(users)->list[str]:
+ # readout the email address of all users
+ email_tgts = [user.user_email for user in users if user.user_email is not None]
+
+ # additionally, always inform the BSMD
+ email_tgts.append("bremencalling@bsmd.de") # #TODO: for testing, use "bremencalling@bsmd.de". For live system, use "report@bsmd.de"
+
+ # #TODO_development: overwrite the recipients. Only send to 'bremencalling@bsmd.de' until the testing phase has succeeded.
+ email_tgts = ["bremencalling@bsmd.de" for tgt in email_tgts]
+
+ # avoid multi-mails, when (for some reason) multiple users share the same email address.
+ email_tgts = list(set(email_tgts))
+ return email_tgts
+
+ @staticmethod
+ def create_and_send_notification_mapper(notification_type:model.NotificationType, shipcall:model.Shipcall, eligible_users:list[model.User], email_handler:EmailHandler, mail_pwd:bytes, debug:bool=False):
+ # #TODO_refactor: instead create a method, which contains the 'distribution-logic' for all notification types
+ if int(notification_type)==int(model.NotificationType.email):
+ # create an Email and send it to each eligible_user.
+ # #TODO: this method must be a distributor. It should send emails for those, who want emails, and provide placeholders for other types of notifications
+ Notifier.create_and_send_email_notification(email_handler, mail_pwd, eligible_users, shipcall, debug=debug)
+
+ elif int(notification_type)==int(model.NotificationType.undefined): pass
+ elif int(notification_type)==int(model.NotificationType.push): pass
+ else: pass
+ return
+
+ @staticmethod
+ def create_and_send_email_notification(email_handler:EmailHandler, pwd:bytes, users:list[model.User], shipcall:model.Shipcall, debug:bool=False):
+ """
+ # #TODO_rename: when there is more than one type of notification, this should be renamed. This method refers to a validation-state notification
+
+ this 'naive' method creates a message and simply sends it to all users in a list of users.
+ Afterwards, the database will be updated, so the shipcall no longer requires a notification.
+ """
+ # get a list of all recipients
+ email_tgts = Notifier.build_email_targets_validation_notification(users)
+
+ # prepare and build the Email content
+ content = get_default_html_email()
+ files = [] # optional attachments
+ ship_name, evaluation_message, eta_etd, eta_etd_type = Notifier.prepare_notification_body(shipcall)
+
+ msg_multipart,msg_content = create_shipcall_evaluation_notification(
+ email_handler, ship_name, evaluation_message, eta_etd, eta_etd_type, content, files=files
+ )
+
+ # send the messages via smtlib's SSL functions
+ send_notification(email_handler, email_tgts, msg_multipart, pwd, debug=debug)
+ return
+
+ @staticmethod
+ def check_user_is_subscribed_to_notification_type(user,notification_type):
+ """given a notification, one can check, whether the current user has subscribed to the respective notification_type. Returns a boolean"""
+ if int(notification_type) == int(model.NotificationType.email):
+ return user.notify_email
+
+ elif int(notification_type) == int(model.NotificationType.push):
+ return user.notify_popup
+
+ elif int(notification_type) == int(model.NotificationType.undefined):
+ pass
+
+ ### placeholders:
+ #elif int(notification_type) == int(model.NotificationType.whatsapp):
+ #return user.notify_whatsapp
+
+ #elif int(notification_type) == int(model.NotificationType.signal):
+ #return user.notify_signal
+
+ else: # placeholder: whatsapp/signal
+ raise NotImplementedError(notification_type)
+
+ @staticmethod
+ def get_all_notification_types():
+ from BreCal.schemas import model
+ return list(model.NotificationType._member_map_.values())
-"""# build the list of evaluation times ('now', as isoformat)"""
-#evaluation_times = [datetime.datetime.now().isoformat() for _i in range(len(evaluation_states_new))]
\ No newline at end of file
diff --git a/src/server/BreCal/resources/__init__.py b/src/server/BreCal/resources/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/server/BreCal/resources/logo_bremen_calling.png b/src/server/BreCal/resources/logo_bremen_calling.png
new file mode 100644
index 0000000..bb97bf5
Binary files /dev/null and b/src/server/BreCal/resources/logo_bremen_calling.png differ
diff --git a/src/server/BreCal/resources/warning_notification_email_template.txt b/src/server/BreCal/resources/warning_notification_email_template.txt
new file mode 100644
index 0000000..819c668
--- /dev/null
+++ b/src/server/BreCal/resources/warning_notification_email_template.txt
@@ -0,0 +1,159 @@
+
+
+
+
+
+ Simple Transactional Email
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Ahoi,
+ ein Schiffsanlauf benötigt Ihre Aufmerksamkeit. Bei der Prüfung der Daten haben wir wahrgenommen, dass ein Problem aufgetreten sein könnte.
+
+ #ADAPTIVECONTENT
+ Falls es sich hierbei um eine Fehlmeldung handelt, Verzeihung. Wir sind stets interessiert daran, die Software zu verbessern. Senden Sie uns gerne eine Email .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/server/BreCal/services/email_handling.py b/src/server/BreCal/services/email_handling.py
index ba21027..923085f 100644
--- a/src/server/BreCal/services/email_handling.py
+++ b/src/server/BreCal/services/email_handling.py
@@ -1,6 +1,8 @@
import os
import typing
+import datetime
import smtplib
+from socket import gaierror
from getpass import getpass
from email.message import EmailMessage
import mimetypes
@@ -42,7 +44,10 @@ class EmailHandler():
self.mail_port = mail_port
self.mail_address = mail_address
- self.server = smtplib.SMTP_SSL(self.mail_server, self.mail_port) # alternatively, use smtplib.SMTP
+ try:
+ self.server = smtplib.SMTP_SSL(self.mail_server, self.mail_port) # alternatively, use smtplib.SMTP
+ except gaierror:
+ raise Exception(f"'socket.gaierror' raised. This commonly happens, when there is no access to the server (e.g., by not having an internet connection)")
def check_state(self):
"""check, whether the server login took place and is open."""
@@ -226,4 +231,118 @@ class EmailHandler():
time.sleep(delete_after_s_seconds)
if os.path.exists(temp_filename):
os.remove(temp_filename)
- return
\ No newline at end of file
+ return
+
+import typing
+from email.mime.application import MIMEApplication
+import mimetypes
+
+import os
+
+def find_warning_notification_email_template()->str:
+ """
+ dynamically finds the 'default_email_template.txt' file within the module.
+ """
+ # __file__ is BreCal/stubs/email_template.py
+ # parent of email_template.py is stubs
+ # parent of stubs is BreCal
+ brecal_root_folder = os.path.dirname(os.path.dirname(__file__)) # .../BreCal
+ resource_root_folder = os.path.join(brecal_root_folder, "resources") # .../BreCal/resources
+ html_filepath = os.path.join(resource_root_folder,"warning_notification_email_template.txt") # .../BreCal/resources/warning_notification_email_template.txt
+ assert os.path.exists(html_filepath), f"could not find default email template file at path: {html_filepath}"
+ return html_filepath
+
+def get_default_html_email()->str:
+ """
+ dynamically finds the 'default_email_template.txt' file within the module. It opens the file and returns the content.
+
+ __file__ returns to the file, where this function is stored (e.g., within BreCal.stubs.email_template)
+ using the dirname refers to the directory, where __file__ is stored.
+ finally, the 'default_email_template.txt' is stored within that folder
+ """
+ html_filepath = find_warning_notification_email_template()
+ with open(html_filepath,"r", encoding="utf-8") as file: # encoding = "utf-8" allows for German Umlaute
+ content = file.read()
+ return content
+
+def find_bremen_calling_logo():
+ """
+ find the path towards the logo file (located at 'brecal\src\BreCalClient\Resources\logo_bremen_calling.png')
+ """
+ # __file__ is services/email_handling.py
+ # parent of __file__ is services
+ # parent of services is BreCal
+ src_root_folder = os.path.dirname(os.path.dirname(__file__)) # .../BreCal
+ resource_root_folder = os.path.join(src_root_folder, "resources")
+
+ path = os.path.join(resource_root_folder, "logo_bremen_calling.png")
+ assert os.path.exists(path), f"cannot find logo of bremen calling at path: {os.path.abspath(path)}"
+ return path
+
+def add_bremen_calling_logo(msg_multipart):
+ """
+ The image is not attached automatically when it is embedded to the content. To circumvent this,
+ one commonly creates attachments, which are referred to in the email content.
+
+ The content body refers to 'LogoBremenCalling', which the 'Content-ID' of the logo is assigned as.
+ """
+ path = find_bremen_calling_logo()
+
+ with open(path, 'rb') as file:
+ attachment = MIMEApplication(file.read(), _subtype=mimetypes.MimeTypes().guess_type(path), Name="bremen_calling.png")
+
+ attachment.add_header('Content-Disposition','attachment',filename=str(os.path.basename(path)))
+ attachment.add_header('Content-ID', '')
+ msg_multipart.attach(attachment)
+ return msg_multipart
+
+
+def create_shipcall_evaluation_notification(email_handler, ship_name:str, evaluation_message:str, eta_etd_str:str, eta_etd_type:str, content:str, files:typing.Optional[list[str]]):
+ """
+ email_handler : EmailHandler. Contains meta-level information about the mail server and sender's Email.
+
+ ship_name : str. Name of the referenced ship, so the user knows the context.
+ evaluation_message : str. Brief description of the current evaluation state
+ eta_etd_str : str. Readable format of a datetime.datetime object, which is either ETA, ETD or both. Informs the user about when the shipcall is due.
+ eta_etd_type : str. Reference to the time, whether it arrives/leaves/shifts.
+
+ content : str (or filepath). Should refer to the template, which defines the content. This file contains HTML-structured text.
+
+ files: (optional). List of file paths, which are included as attachments.
+ """
+ subject = f"{ship_name} (vorauss. {eta_etd_type}: {eta_etd_str})"
+
+ # create message_body
+ message_body = content # "Hello World."
+ evaluation_message_reformatted = evaluation_message.replace("\n", " ")
+ adaptive_content = f' Betrifft: {ship_name} ({eta_etd_str}) {evaluation_message_reformatted} '
+ message_body = message_body.replace("#ADAPTIVECONTENT", adaptive_content)
+
+ msg = email_handler.create_email(subject=subject, message_body=message_body, subtype="html")
+ msg_multipart = email_handler.translate_mail_to_multipart(msg=msg)
+
+ if files is not None:
+ for path in files:
+ assert os.path.exists(path), f"cannot find attachment at path: {path}"
+ email_handler.attach_file(path, msg=msg_multipart)
+
+ # add the bremen calling logo, which is referred to in the email body
+ msg_multipart = add_bremen_calling_logo(msg_multipart)
+ return (msg_multipart,content)
+
+def send_notification(email_handler, email_tgts, msg, pwd, debug=False):
+ already_logged_in = email_handler.check_login()
+ if not already_logged_in:
+ email_handler.login(interactive=False, pwd=pwd)
+
+ try:
+ assert email_handler.check_login()
+ if not debug:
+ email_handler.send_email(msg, email_tgts)
+ else:
+ print(f"(send_notification INFO): debugging state. Would have sent an Email to: {email_tgts}")
+
+ finally:
+ if not already_logged_in:
+ email_handler.close()
+ return
diff --git a/src/server/BreCal/services/schedule_routines.py b/src/server/BreCal/services/schedule_routines.py
index 2e0be3e..5725594 100644
--- a/src/server/BreCal/services/schedule_routines.py
+++ b/src/server/BreCal/services/schedule_routines.py
@@ -51,7 +51,7 @@ def add_function_to_schedule__update_shipcalls(interval_in_minutes:int, options:
schedule.every(interval_in_minutes).minutes.do(UpdateShipcalls, **kwargs_)
return
-def add_function_to_schedule__send_notifications(vr, interval_in_minutes:int=10):
+def add_function_to_schedule__send_notifications(interval_in_minutes:int=15):
schedule.every(interval_in_minutes).minutes.do(Notifier.send_notifications)
return
@@ -65,8 +65,8 @@ def setup_schedule(update_shipcalls_interval_in_minutes:int=60):
# update the evaluation state in every recent shipcall
add_function_to_schedule__update_shipcalls(update_shipcalls_interval_in_minutes)
- # placeholder: create/send notifications
- # add_function_to_schedule__send_notifications(...)
+ # create/send notifications
+ add_function_to_schedule__send_notifications(15)
return
diff --git a/src/server/BreCal/validators/validation_rule_functions.py b/src/server/BreCal/validators/validation_rule_functions.py
index 24bbc62..693d253 100644
--- a/src/server/BreCal/validators/validation_rule_functions.py
+++ b/src/server/BreCal/validators/validation_rule_functions.py
@@ -929,6 +929,9 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions):
query_time = times_agency.iloc[0].eta_berth
# count the number of times, where a times entry is very close to the query time (uses an internal threshold, such as 15 minutes)
+ if all_times_agency is None:
+ all_times_agency = self.sql_handler.get_times_for_agency(non_null_column="eta_berth")
+
counts = self.sql_handler.count_synchronous_shipcall_times(query_time, all_df_times=all_times_agency)
violation_state = counts > maximum_threshold
@@ -952,6 +955,9 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions):
times_agency = df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]
query_time = times_agency.iloc[0].etd_berth
+ if all_times_agency is None:
+ all_times_agency = self.sql_handler.get_times_for_agency(non_null_column="etd_berth")
+
# count the number of times, where a times entry is very close to the query time (uses an internal threshold, such as 15 minutes)
counts = self.sql_handler.count_synchronous_shipcall_times(query_time, all_df_times=all_times_agency)
violation_state = counts > maximum_threshold
diff --git a/src/server/BreCal/validators/validation_rules.py b/src/server/BreCal/validators/validation_rules.py
index 03ffc1f..d813676 100644
--- a/src/server/BreCal/validators/validation_rules.py
+++ b/src/server/BreCal/validators/validation_rules.py
@@ -1,3 +1,4 @@
+import typing
import copy
import logging
import re
@@ -74,6 +75,9 @@ class ValidationRules(ValidationRuleFunctions):
"""apply 'evaluate_shipcall_from_df' to each individual shipcall in {shipcall_df}. Returns shipcall_df ('evaluation', 'evaluation_message', 'evaluation_time' and 'evaluation_notifications_sent' are updated)"""
evaluation_states_old = [state_old for state_old in shipcall_df.loc[:,"evaluation"]]
evaluation_states_old = [state_old if not pd.isna(state_old) else 0 for state_old in evaluation_states_old]
+
+ evaluation_notifications_sent_old = [ens for ens in shipcall_df.loc[:,"evaluation_notifications_sent"]]
+
results = shipcall_df.apply(lambda x: self.evaluate_shipcall_from_df(x), axis=1).values # returns tuple (state, message)
# unbundle individual results. evaluation_states becomes an integer, violation
@@ -82,6 +86,15 @@ class ValidationRules(ValidationRuleFunctions):
violations = [self.concise_evaluation_message_if_too_long(violation) for violation in violations]
# build the list of evaluation times ('now', as isoformat)
+ evaluation_time = self.get_notification_times(evaluation_states_new)
+
+ # build the list of 'evaluation_notifications_sent'. The value is 'False', when a notification should be created
+ evaluation_notifications_sent = self.get_notification_states(evaluation_states_old, evaluation_states_new, evaluation_notifications_sent_old)
+
+ shipcall_df.loc[:,"evaluation"] = evaluation_states_new
+ shipcall_df.loc[:,"evaluation_message"] = violations
+ shipcall_df.loc[:,"evaluation_time"] = evaluation_time
+ shipcall_df.loc[:,"evaluation_notifications_sent"] = evaluation_notifications_sent
#evaluation_time = self.get_notification_times(evaluation_states_new)
# build the list of 'evaluation_notifications_sent'. The value is 'False', when a notification should be created
@@ -112,16 +125,24 @@ class ValidationRules(ValidationRuleFunctions):
"""this function should apply the ValidationRules to the respective .shipcall, in regards to .times"""
return (StatusFlags.GREEN, False) # (state:str, should_notify:bool)
- def determine_notification_state(self, state_old, state_new):
+ def determine_notification_state(self, state_old, state_new, evaluation_notifications_sent)->typing.Optional[bool]:
"""
this method determines state changes in the notification state. When the state increases, a user is notified about it.
state order: (NONE = GREEN < YELLOW < RED)
+
+ If a notification shall be sent, this method returns False. If no notification shall be sent, this method returns None or the prior state.
+ The method *never* returns True, as it shall only be called on novel shipcalls.
+
+ args:
+ evaluation_notifications_sent: the PREVIOUS state (if any) of this boolean. When no notification is required, the prior bool is used (e.g., None, False, True).
"""
+ previous_state = evaluation_notifications_sent
+
# identify a state increase
should_notify = self.identify_notification_state_change(state_old=state_old, state_new=state_new)
# when a state increases, a notification must be sent. Thereby, the field should be set to False ({evaluation_notifications_sent})
- evaluation_notifications_sent = False if bool(should_notify) else None
+ evaluation_notifications_sent = False if bool(should_notify) else previous_state
return evaluation_notifications_sent
def identify_notification_state_change(self, state_old, state_new) -> bool:
@@ -147,13 +168,13 @@ class ValidationRules(ValidationRuleFunctions):
return int(state_new) > int(state_old)
def get_notification_times(self, evaluation_states_new)->list[datetime.datetime]:
- """# build the list of evaluation times ('now', as isoformat)"""
- evaluation_times = [datetime.datetime.now().isoformat() for _i in range(len(evaluation_states_new))]
+ """# build the list of evaluation times ('now'-datetime)"""
+ evaluation_times = [datetime.datetime.now() for _i in range(len(evaluation_states_new))] # .isoformat()
return evaluation_times
- def get_notification_states(self, evaluation_states_old, evaluation_states_new)->list[bool]:
- """# build the list of 'evaluation_notifications_sent'. The value is 'False', when a notification should be created"""
- evaluation_notifications_sent = [self.determine_notification_state(state_old=int(state_old), state_new=int(state_new)) for state_old, state_new in zip(evaluation_states_old, evaluation_states_new)]
+ def get_notification_states(self, evaluation_states_old, evaluation_states_new, evaluation_notifications_sent_old)->list[typing.Optional[bool]]:
+ """# build the list of 'evaluation_notifications_sent'. The value is 'False', when a notification should be created and None, when not"""
+ evaluation_notifications_sent = [self.determine_notification_state(state_old=int(state_old), state_new=int(state_new), evaluation_notifications_sent=ens) for state_old, state_new, ens in zip(evaluation_states_old, evaluation_states_new, evaluation_notifications_sent_old)]
return evaluation_notifications_sent
diff --git a/src/server/setup.py b/src/server/setup.py
index 2733082..44750aa 100644
--- a/src/server/setup.py
+++ b/src/server/setup.py
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
setup(
name='BreCal',
- version='1.3.0',
+ version='1.4.0',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
diff --git a/src/server/tests/notifications/__init__.py b/src/server/tests/notifications/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/server/tests/notifications/test_accounts.py b/src/server/tests/notifications/test_accounts.py
new file mode 100644
index 0000000..8cf21fe
--- /dev/null
+++ b/src/server/tests/notifications/test_accounts.py
@@ -0,0 +1,21 @@
+import pytest
+from BreCal.notifications.accounts import mail_server, mail_port, mail_address, mail_pwd
+
+
+def test_mail_server():
+ assert isinstance(mail_server, str)
+ assert not "@" in mail_server
+ return
+
+def test_mail_port():
+ assert isinstance(mail_port, int)
+ return
+
+def test_mail_address():
+ assert isinstance(mail_address, str)
+ assert "@" in mail_address
+ return
+
+def test_mail_pwd():
+ assert isinstance(mail_pwd, bytes), f"must be a bytes-encoded password to protect the account"
+ return
diff --git a/src/server/tests/resources/__init__.py b/src/server/tests/resources/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/server/tests/resources/test_find_defaults.py b/src/server/tests/resources/test_find_defaults.py
new file mode 100644
index 0000000..214f0d7
--- /dev/null
+++ b/src/server/tests/resources/test_find_defaults.py
@@ -0,0 +1,14 @@
+import pytest
+import os
+
+def test_find_bremen_calling_logo():
+ from BreCal.services.email_handling import find_bremen_calling_logo
+ path = find_bremen_calling_logo()
+ assert os.path.exists(path), f"cannot find the bremen calling logo file, which is needed for notifications (e.g., Email). Searched at path: \n\t{path}"
+ return
+
+def test_find_warning_notification_email_template():
+ from BreCal.services.email_handling import find_warning_notification_email_template
+ path = find_warning_notification_email_template()
+ assert os.path.exists(path), f"cannot find the required email template, which is needed for warning notifications. Searched at path: \n\t{path}"
+ return