Merge branch 'release/0.4.0'
This commit is contained in:
commit
d0c0a62cfe
@ -1,7 +1,7 @@
|
||||
|
||||
//----------------------
|
||||
// <auto-generated>
|
||||
// Generated REST API Client Code Generator v1.7.17.0 on 18.08.2023 15:15:15
|
||||
// Generated REST API Client Code Generator v1.7.17.0 on 21.08.2023 19:15:39
|
||||
// Using the tool OpenAPI Generator v6.6.0
|
||||
// </auto-generated>
|
||||
//----------------------
|
||||
@ -44,12 +44,13 @@ using System.Threading.Tasks;
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
namespace BreCalClient.misc.Api
|
||||
{
|
||||
#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null'
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
@ -2322,7 +2323,7 @@ namespace BreCalClient.misc.Api
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -3057,7 +3058,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -3117,7 +3118,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -3257,7 +3258,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -3475,7 +3476,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -3915,7 +3916,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: 0.3.0\n";
|
||||
report += " Version of the API: 0.4.0\n";
|
||||
report += " SDK Package Version: 1.0.0\n";
|
||||
return report;
|
||||
}
|
||||
@ -3982,7 +3983,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4002,7 +4003,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4059,7 +4060,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4092,7 +4093,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4125,7 +4126,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4216,7 +4217,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4324,7 +4325,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4408,7 +4409,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4667,7 +4668,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4695,7 +4696,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4765,7 +4766,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4792,7 +4793,7 @@ namespace BreCalClient.misc.Client
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4859,7 +4860,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -4972,6 +4973,7 @@ namespace BreCalClient.misc.Model
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return
|
||||
(
|
||||
this.Id == input.Id ||
|
||||
@ -5006,6 +5008,7 @@ namespace BreCalClient.misc.Model
|
||||
this.Deleted == input.Deleted ||
|
||||
this.Deleted.Equals(input.Deleted)
|
||||
);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
@ -5063,7 +5066,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -5200,7 +5203,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -5316,7 +5319,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -5528,7 +5531,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -5754,7 +5757,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -6003,7 +6006,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -6310,7 +6313,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -6322,33 +6325,6 @@ namespace BreCalClient.misc.Model
|
||||
[DataContract(Name = "shipcall")]
|
||||
public partial class Shipcall : IEquatable<Shipcall>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines Type
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum TypeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum Incoming for value: incoming
|
||||
/// </summary>
|
||||
[EnumMember(Value = "incoming")]
|
||||
Incoming = 1,
|
||||
/// <summary>
|
||||
/// Enum Outgoing for value: outgoing
|
||||
/// </summary>
|
||||
[EnumMember(Value = "outgoing")]
|
||||
Outgoing = 2,
|
||||
/// <summary>
|
||||
/// Enum Shifting for value: shifting
|
||||
/// </summary>
|
||||
[EnumMember(Value = "shifting")]
|
||||
Shifting = 3
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or Sets Type
|
||||
/// </summary>
|
||||
[DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)]
|
||||
public TypeEnum Type { get; set; }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Shipcall" /> class.
|
||||
/// </summary>
|
||||
@ -6365,7 +6341,7 @@ namespace BreCalClient.misc.Model
|
||||
/// <param name="etd">etd.</param>
|
||||
/// <param name="arrivalBerthId">arrivalBerthId.</param>
|
||||
/// <param name="departureBerthId">departureBerthId.</param>
|
||||
/// <param name="tugReguired">tugReguired.</param>
|
||||
/// <param name="tugRequired">tugRequired.</param>
|
||||
/// <param name="pilotRequired">pilotRequired.</param>
|
||||
/// <param name="flags">flags.</param>
|
||||
/// <param name="pierSide">pierSide.</param>
|
||||
@ -6383,7 +6359,7 @@ namespace BreCalClient.misc.Model
|
||||
/// <param name="participants">participants.</param>
|
||||
/// <param name="created">created.</param>
|
||||
/// <param name="modified">modified.</param>
|
||||
public Shipcall(int id = default(int), int shipId = default(int), TypeEnum type = default(TypeEnum), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugReguired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), List<int> participants = default(List<int>), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
||||
public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), List<int> participants = default(List<int>), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
||||
{
|
||||
this.Id = id;
|
||||
this.ShipId = shipId;
|
||||
@ -6393,7 +6369,7 @@ namespace BreCalClient.misc.Model
|
||||
this.Etd = etd;
|
||||
this.ArrivalBerthId = arrivalBerthId;
|
||||
this.DepartureBerthId = departureBerthId;
|
||||
this.TugReguired = tugReguired;
|
||||
this.TugRequired = tugRequired;
|
||||
this.PilotRequired = pilotRequired;
|
||||
this.Flags = flags;
|
||||
this.PierSide = pierSide;
|
||||
@ -6424,6 +6400,11 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "ship_id", IsRequired = true, EmitDefaultValue = true)]
|
||||
public int ShipId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Type
|
||||
/// </summary>
|
||||
[DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)]
|
||||
public int Type { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Eta
|
||||
/// </summary>
|
||||
[DataMember(Name = "eta", IsRequired = true, EmitDefaultValue = true)]
|
||||
@ -6449,10 +6430,10 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "departure_berth_id", EmitDefaultValue = true)]
|
||||
public int? DepartureBerthId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets TugReguired
|
||||
/// Gets or Sets TugRequired
|
||||
/// </summary>
|
||||
[DataMember(Name = "tug_reguired", EmitDefaultValue = true)]
|
||||
public bool? TugReguired { get; set; }
|
||||
[DataMember(Name = "tug_required", EmitDefaultValue = true)]
|
||||
public bool? TugRequired { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets PilotRequired
|
||||
/// </summary>
|
||||
@ -6554,7 +6535,7 @@ namespace BreCalClient.misc.Model
|
||||
sb.Append(" Etd: ").Append(Etd).Append("\n");
|
||||
sb.Append(" ArrivalBerthId: ").Append(ArrivalBerthId).Append("\n");
|
||||
sb.Append(" DepartureBerthId: ").Append(DepartureBerthId).Append("\n");
|
||||
sb.Append(" TugReguired: ").Append(TugReguired).Append("\n");
|
||||
sb.Append(" TugRequired: ").Append(TugRequired).Append("\n");
|
||||
sb.Append(" PilotRequired: ").Append(PilotRequired).Append("\n");
|
||||
sb.Append(" Flags: ").Append(Flags).Append("\n");
|
||||
sb.Append(" PierSide: ").Append(PierSide).Append("\n");
|
||||
@ -6642,9 +6623,9 @@ namespace BreCalClient.misc.Model
|
||||
this.DepartureBerthId.Equals(input.DepartureBerthId))
|
||||
) &&
|
||||
(
|
||||
this.TugReguired == input.TugReguired ||
|
||||
(this.TugReguired != null &&
|
||||
this.TugReguired.Equals(input.TugReguired))
|
||||
this.TugRequired == input.TugRequired ||
|
||||
(this.TugRequired != null &&
|
||||
this.TugRequired.Equals(input.TugRequired))
|
||||
) &&
|
||||
(
|
||||
this.PilotRequired == input.PilotRequired ||
|
||||
@ -6765,9 +6746,9 @@ namespace BreCalClient.misc.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.DepartureBerthId.GetHashCode();
|
||||
}
|
||||
if (this.TugReguired != null)
|
||||
if (this.TugRequired != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.TugReguired.GetHashCode();
|
||||
hashCode = (hashCode * 59) + this.TugRequired.GetHashCode();
|
||||
}
|
||||
if (this.PilotRequired != null)
|
||||
{
|
||||
@ -6862,7 +6843,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -7220,7 +7201,7 @@ namespace BreCalClient.misc.Model
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.0
|
||||
* The version of the OpenAPI document: 0.4.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
@ -7399,5 +7380,6 @@ namespace BreCalClient.misc.Model
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null'
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
openapi: "3.0.0"
|
||||
info:
|
||||
version: "0.3.0"
|
||||
version: "0.4.0"
|
||||
title: "Bremen calling API"
|
||||
description: Administer DEBRE ship calls, times and notifications
|
||||
termsOfService: "https://www.bsmd.de/" # url to terms page
|
||||
@ -337,11 +337,8 @@ components:
|
||||
ship_id:
|
||||
type: integer
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- incoming
|
||||
- outgoing
|
||||
- shifting
|
||||
type: integer
|
||||
# TODO: use an enum
|
||||
eta:
|
||||
type: string
|
||||
format: date-time
|
||||
@ -359,7 +356,7 @@ components:
|
||||
departure_berth_id:
|
||||
type: integer
|
||||
nullable: true
|
||||
tug_reguired:
|
||||
tug_required:
|
||||
type: boolean
|
||||
nullable: true
|
||||
pilot_required:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[*.cs]
|
||||
|
||||
# CS8073: The result of the expression is always the same since a value of this type is never equal to 'null'
|
||||
dotnet_diagnostic.CS8073.severity = silent
|
||||
dotnet_diagnostic.CS8073.severity = none
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
csharp_prefer_braces = true:silent
|
||||
|
||||
@ -1,10 +1,4 @@
|
||||
using BreCalClient.misc.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace BreCalClient
|
||||
|
||||
23
src/BreCalClient/BoolToIndexConverter.cs
Normal file
23
src/BreCalClient/BoolToIndexConverter.cs
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2023 schick Informatik
|
||||
// Description: Helper for combobox binding of bool to combobox
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
public class BoolToIndexConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return ((bool) value == true) ? 0 : 1;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return ((int)value == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,8 +8,8 @@
|
||||
<SignAssembly>True</SignAssembly>
|
||||
<StartupObject>BreCalClient.App</StartupObject>
|
||||
<AssemblyOriginatorKeyFile>E:\gitlager\git_brcal\misc\brecal.snk</AssemblyOriginatorKeyFile>
|
||||
<AssemblyVersion>0.3.0.0</AssemblyVersion>
|
||||
<FileVersion>0.3.0.0</FileVersion>
|
||||
<AssemblyVersion>0.4.0.0</AssemblyVersion>
|
||||
<FileVersion>0.4.0.0</FileVersion>
|
||||
<Title>Bremen calling client</Title>
|
||||
<Description>A Windows WPF client for the Bremen calling API.</Description>
|
||||
<ApplicationIcon>containership.ico</ApplicationIcon>
|
||||
|
||||
@ -9,6 +9,9 @@
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textEditShipcall}" Height="466" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
|
||||
<Window.Resources>
|
||||
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.15*"/>
|
||||
@ -49,7 +52,7 @@
|
||||
<Label Content="{x:Static p:Resources.textReplenishingLock}" Grid.Column="1" Grid.Row="12" />
|
||||
<Label Content="{x:Static p:Resources.textDraft}" Grid.Column="0" Grid.Row="13" HorizontalContentAlignment="Right" />
|
||||
|
||||
<ComboBox x:Name="comboBoxShip" Margin="2" Grid.Column="1" Grid.Row="0" SelectionChanged="comboBoxShip_SelectionChanged">
|
||||
<ComboBox x:Name="comboBoxShip" Margin="2" Grid.Column="1" Grid.Row="0" SelectionChanged="comboBoxShip_SelectionChanged" SelectedValuePath="Id">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!--Border-->
|
||||
@ -65,19 +68,22 @@
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="comboBoxCategories" Grid.Column="1" Margin="2" Grid.Row="1" />
|
||||
<ComboBox x:Name="comboBoxCategories" Grid.Column="1" Margin="2" Grid.Row="1" SelectedValuePath="Key"/>
|
||||
<xctk:DateTimePicker x:Name="datePickerETA" Grid.Column="1" Grid.Row="2" Margin="2" />
|
||||
<TextBox x:Name="textBoxVoyage" Grid.Column="1" Grid.Row="3" Margin="2" VerticalContentAlignment="Center" />
|
||||
<xctk:DateTimePicker x:Name="datePickerETD" Grid.Column="1" Grid.Row="4" Margin="2" />
|
||||
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="1" Grid.Row="5" Margin="2" DisplayMemberPath="Name" />
|
||||
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Grid.Row="6" Margin="2" DisplayMemberPath="Name" />
|
||||
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="1" Grid.Row="5" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" />
|
||||
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Grid.Row="6" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" />
|
||||
<CheckBox x:Name="checkBoxTugRequired" Grid.Column="0" Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
<CheckBox x:Name="checkBoxPilotRequired" Grid.Column="0" Grid.Row="8" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="9" Margin="2" />
|
||||
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="9" Margin="2" >
|
||||
<ComboBoxItem Content="{x:Static p:Resources.textNotRotated}" />
|
||||
<ComboBoxItem Content="{x:Static p:Resources.textRotated}" />
|
||||
</ComboBox>
|
||||
<CheckBox x:Name="checkBoxBunkering" Grid.Column="0" Grid.Row="10" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
<CheckBox x:Name="checkBoxReplenishingTerminal" Grid.Column="0" Grid.Row="11" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
<CheckBox x:Name="checkBoxReplenishingLock" Grid.Column="0" Grid.Row="12" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownDraft" Grid.Column="1" Grid.Row="13" Margin="2" FormatString="C2" Minimum="0" />
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownDraft" Grid.Column="1" Grid.Row="13" Margin="2" FormatString="N2" Minimum="0" />
|
||||
|
||||
<Label Content="{x:Static p:Resources.textParticipants}" FontWeight="DemiBold" Grid.Column="3" Grid.Row="0" />
|
||||
<Label Content="{x:Static p:Resources.textAgency}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
|
||||
@ -93,11 +99,13 @@
|
||||
<Label Content="{x:Static p:Resources.textAnchored}" Grid.Column="3" Grid.Row="11" />
|
||||
<Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="3" Grid.Row="12" />
|
||||
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="3" Grid.Row="13" />
|
||||
<ComboBox Name="comboBoxAgency" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name"/>
|
||||
<ComboBox Name="comboBoxMooring" Grid.Column="3" Grid.Row="2" Margin="2" DisplayMemberPath="Name"/>
|
||||
<ComboBox Name="comboBoxPilot" Grid.Column="3" Grid.Row="3" Margin="2" DisplayMemberPath="Name"/>
|
||||
<ComboBox Name="comboBoxTug" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name"/>
|
||||
<ComboBox Name="comboBoxTerminal" Grid.Column="3" Grid.Row="5" Margin="2" DisplayMemberPath="Name"/>
|
||||
|
||||
<ComboBox Name="comboBoxAgency" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id"/>
|
||||
<ComboBox Name="comboBoxMooring" Grid.Column="3" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id"/>
|
||||
<ComboBox Name="comboBoxPilot" Grid.Column="3" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id"/>
|
||||
<ComboBox Name="comboBoxTug" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id"/>
|
||||
<ComboBox Name="comboBoxTerminal" Grid.Column="3" Grid.Row="5" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id"/>
|
||||
|
||||
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="3" Grid.Row="7" Margin="2" />
|
||||
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="3" Grid.Row="8" Margin="2" />
|
||||
<CheckBox x:Name="checkBoxRainsensitiveCargo" Grid.Column="2" Grid.Row="9" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
|
||||
@ -7,16 +7,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -40,6 +32,13 @@ namespace BreCalClient
|
||||
|
||||
public List<Ship> Ships { get; set; } = new();
|
||||
|
||||
public Ship? SelectedShip {
|
||||
get
|
||||
{
|
||||
return this.comboBoxShip.SelectedItem as Ship;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event handler
|
||||
@ -68,7 +67,7 @@ namespace BreCalClient
|
||||
this.comboBoxTerminal.ItemsSource = terList;
|
||||
|
||||
this.comboBoxShip.ItemsSource = Ships;
|
||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(Shipcall.TypeEnum));
|
||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(Extensions.TypeEnum));
|
||||
this.comboBoxArrivalBerth.ItemsSource = this.Berths;
|
||||
this.comboBoxDepartureBerth.ItemsSource = this.Berths;
|
||||
|
||||
@ -78,12 +77,14 @@ namespace BreCalClient
|
||||
private void buttonOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.CopyToModel();
|
||||
this.DialogResult = true; this.Close();
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult= false; this.Close();
|
||||
this.DialogResult= false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void comboBoxShip_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
@ -97,19 +98,18 @@ namespace BreCalClient
|
||||
|
||||
private void CopyToModel()
|
||||
{
|
||||
this.Shipcall.Type = (Shipcall.TypeEnum)this.comboBoxCategories.SelectedValue;
|
||||
this.Shipcall.Type = (int) this.comboBoxCategories.SelectedItem;
|
||||
this.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now;
|
||||
this.Shipcall.Voyage = this.textBoxVoyage.Text.Trim();
|
||||
this.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1);
|
||||
this.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
|
||||
this.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id;
|
||||
this.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedValue != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedValue).Id : null;
|
||||
this.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedValue != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedValue).Id : null;
|
||||
this.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
|
||||
this.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
|
||||
this.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
|
||||
this.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
|
||||
this.Shipcall.Draft = (float?) this.doubleUpDownDraft.Value;
|
||||
this.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
|
||||
// this.Shipcall.PierSide = this.comboBoxPierside.SelectedValue;
|
||||
this.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
|
||||
this.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
|
||||
this.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
|
||||
@ -117,12 +117,76 @@ namespace BreCalClient
|
||||
this.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
|
||||
this.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
||||
this.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
|
||||
this.Shipcall.TugReguired = this.checkBoxTugRequired.IsChecked;
|
||||
this.Shipcall.TugRequired = this.checkBoxTugRequired.IsChecked;
|
||||
if(this.comboBoxPierside.SelectedIndex >= 0)
|
||||
{
|
||||
this.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
|
||||
}
|
||||
|
||||
// remove all and add selected participants
|
||||
this.Shipcall.Participants.Clear();
|
||||
Participant? participant;
|
||||
participant = (Participant?) this.comboBoxAgency.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
participant = (Participant?) this.comboBoxMooring.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
participant = (Participant?) this.comboBoxPilot.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
participant = (Participant?) this.comboBoxTerminal.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
participant = (Participant?) this.comboBoxTug.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
|
||||
// BSMD and port authority are always added
|
||||
foreach(Participant p in Participants)
|
||||
{
|
||||
if(p.Type == (int) Extensions.ParticipantType.PORT_ADMINISTRATION) this.Shipcall.Participants.Add(p.Id);
|
||||
if (p.Type == (int)Extensions.ParticipantType.BSMD) this.Shipcall.Participants.Add(p.Id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CopyToControls()
|
||||
{
|
||||
if (this.Shipcall == null) return;
|
||||
this.comboBoxCategories.SelectedItem = (Extensions.TypeEnum) this.Shipcall.Type;
|
||||
if(this.Shipcall.Eta != DateTime.MinValue)
|
||||
this.datePickerETA.Value = this.Shipcall.Eta;
|
||||
this.textBoxVoyage.Text = this.Shipcall.Voyage;
|
||||
this.datePickerETD.Value = this.Shipcall.Etd;
|
||||
this.checkBoxAnchored.IsChecked = this.Shipcall.Anchored;
|
||||
this.comboBoxShip.SelectedValue = this.Shipcall.ShipId;
|
||||
this.comboBoxArrivalBerth.SelectedValue = this.Shipcall.ArrivalBerthId;
|
||||
this.comboBoxDepartureBerth.SelectedValue = this.Shipcall.DepartureBerthId;
|
||||
this.checkBoxBunkering.IsChecked = this.Shipcall.Bunkering;
|
||||
this.checkBoxCanceled.IsChecked = this.Shipcall.Canceled;
|
||||
this.doubleUpDownDraft.Value = this.Shipcall.Draft;
|
||||
this.checkBoxMooredLock.IsChecked = this.Shipcall.MooredLock;
|
||||
|
||||
this.checkBoxRainsensitiveCargo.IsChecked = this.Shipcall.RainSensitiveCargo;
|
||||
this.checkBoxPilotRequired.IsChecked = this.Shipcall.PilotRequired;
|
||||
this.checkBoxReplenishingLock.IsChecked = this.Shipcall.ReplenishingLock;
|
||||
this.checkBoxReplenishingTerminal.IsChecked = this.Shipcall.ReplenishingTerminal;
|
||||
this.integerUpDownRecommendedTugs.Value = this.Shipcall.RecommendedTugs;
|
||||
this.datePickerTidalWindowFrom.Value = this.Shipcall.TidalWindowFrom;
|
||||
this.datePickerTidalWindowTo.Value = this.Shipcall.TidalWindowTo;
|
||||
this.checkBoxTugRequired.IsChecked = this.Shipcall.TugRequired;
|
||||
if(this.Shipcall.PierSide.HasValue)
|
||||
{
|
||||
if (this.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
|
||||
else this.comboBoxPierside.SelectedIndex = 1;
|
||||
}
|
||||
|
||||
if (this.Shipcall.Participants == null) this.Shipcall.Participants = new();
|
||||
|
||||
foreach(int participant_id in this.Shipcall.Participants)
|
||||
{
|
||||
if (((List<Participant>)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,16 @@ namespace BreCalClient
|
||||
TUG = 64,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should actually be defined in yaml
|
||||
/// </summary>
|
||||
public enum TypeEnum
|
||||
{
|
||||
Incoming = 1,
|
||||
Outgoing = 2,
|
||||
Shifting = 3
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public helper
|
||||
|
||||
@ -8,7 +8,9 @@
|
||||
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
||||
mc:Ignorable="d"
|
||||
Title="{DynamicResource textApplicationTitle}" Height="450" Width="800" Loaded="Window_Loaded" Closing="Window_Closing" Icon="Resources/containership.ico">
|
||||
|
||||
<Window.Resources>
|
||||
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
|
||||
</Window.Resources>
|
||||
<xctk:BusyIndicator Name="busyIndicator" IsBusy="True">
|
||||
<xctk:BusyIndicator.ProgressBarStyle>
|
||||
<Style TargetType="ProgressBar">
|
||||
|
||||
@ -88,9 +88,9 @@ namespace BreCalClient
|
||||
try
|
||||
{
|
||||
_loginResult = await _api.LoginPostAsync(credentials);
|
||||
if(_loginResult != null)
|
||||
if (_loginResult != null)
|
||||
{
|
||||
if(_loginResult.Id > 0)
|
||||
if (_loginResult.Id > 0)
|
||||
{
|
||||
this.busyIndicator.IsBusy = false;
|
||||
this._api.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
@ -105,7 +105,7 @@ namespace BreCalClient
|
||||
this.labelLoginResult.Content = ex.Message;
|
||||
labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
|
||||
@ -128,10 +128,9 @@ namespace BreCalClient
|
||||
|
||||
if (esc.ShowDialog() ?? false)
|
||||
{
|
||||
// save new dialog model
|
||||
|
||||
// add dialog model to list
|
||||
|
||||
// create UI & save new dialog model
|
||||
this.UpdateShipcallUI(esc.Shipcall, new List<Times>());
|
||||
this._api.ShipcallsPost(esc.Shipcall);
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,54 +230,9 @@ namespace BreCalClient
|
||||
{
|
||||
foreach (Shipcall shipcall in shipcalls)
|
||||
{
|
||||
ShipcallControlModel? selectedSCMModel = null;
|
||||
|
||||
foreach (ShipcallControlModel scm in this._controlModels)
|
||||
{
|
||||
if (scm.Shipcall?.Id == shipcall.Id)
|
||||
{
|
||||
selectedSCMModel = scm;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedSCMModel != null)
|
||||
{
|
||||
selectedSCMModel.Shipcall = shipcall;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no: create new entry
|
||||
selectedSCMModel = new()
|
||||
{
|
||||
Shipcall = shipcall
|
||||
};
|
||||
if (this._shipLookupDict.ContainsKey(shipcall.ShipId))
|
||||
selectedSCMModel.Ship = this._shipLookupDict[shipcall.ShipId];
|
||||
if (this._berthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0))
|
||||
selectedSCMModel.Berth = this._berthLookupDict[shipcall.ArrivalBerthId ?? 0].Name;
|
||||
|
||||
_controlModels.Add(selectedSCMModel);
|
||||
this.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
ShipcallControl sc = new()
|
||||
{
|
||||
Height = 120,
|
||||
ShipcallControlModel = selectedSCMModel
|
||||
};
|
||||
sc.TimesRequested += Sc_TimesRequested;
|
||||
sc.EditRequested += Sc_EditRequested;
|
||||
this.stackPanel.Children.Add(sc);
|
||||
this._shipCallControlDict[shipcall.Id] = sc;
|
||||
}));
|
||||
}
|
||||
|
||||
selectedSCMModel.AssignParticipants(this._participants);
|
||||
this.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
this._shipCallControlDict[shipcall.Id].RefreshData();
|
||||
}));
|
||||
List<Times> currentTimes = await _api.TimesGetAsync(shipcall.Id);
|
||||
|
||||
this.UpdateShipcallUI(shipcall, currentTimes);
|
||||
}
|
||||
|
||||
List<ShipcallControl> removeList = new();
|
||||
@ -302,16 +256,100 @@ namespace BreCalClient
|
||||
}
|
||||
}
|
||||
|
||||
private void Sc_EditRequested(ShipcallControl obj)
|
||||
private void UpdateShipcallUI(Shipcall shipcall, List<Times> times)
|
||||
{
|
||||
// TODO: get the shipcall from the control and show the edit control
|
||||
ShipcallControlModel? selectedSCMModel = null;
|
||||
|
||||
foreach (ShipcallControlModel scm in this._controlModels)
|
||||
{
|
||||
if (scm.Shipcall?.Id == shipcall.Id)
|
||||
{
|
||||
selectedSCMModel = scm;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedSCMModel != null)
|
||||
{
|
||||
selectedSCMModel.Shipcall = shipcall;
|
||||
selectedSCMModel.Times = times;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no: create new entry
|
||||
selectedSCMModel = new()
|
||||
{
|
||||
Shipcall = shipcall,
|
||||
Times = times
|
||||
};
|
||||
if (this._shipLookupDict.ContainsKey(shipcall.ShipId))
|
||||
selectedSCMModel.Ship = this._shipLookupDict[shipcall.ShipId];
|
||||
if (this._berthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0))
|
||||
selectedSCMModel.Berth = this._berthLookupDict[shipcall.ArrivalBerthId ?? 0].Name;
|
||||
|
||||
_controlModels.Add(selectedSCMModel);
|
||||
this.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
ShipcallControl sc = new()
|
||||
{
|
||||
Height = 120,
|
||||
ShipcallControlModel = selectedSCMModel
|
||||
};
|
||||
sc.EditTimesRequested += Sc_EditTimesRequested;
|
||||
sc.EditRequested += Sc_EditRequested;
|
||||
this.stackPanel.Children.Add(sc);
|
||||
this._shipCallControlDict[shipcall.Id] = sc;
|
||||
}));
|
||||
}
|
||||
|
||||
selectedSCMModel.AssignParticipants(this._participants);
|
||||
this.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
this._shipCallControlDict[shipcall.Id].RefreshData();
|
||||
}));
|
||||
}
|
||||
|
||||
private async void Sc_EditRequested(ShipcallControl obj)
|
||||
{
|
||||
Shipcall? sc = obj.ShipcallControlModel?.Shipcall;
|
||||
if (sc != null)
|
||||
{
|
||||
EditShipcallControl esc = new()
|
||||
{
|
||||
Shipcall = sc,
|
||||
Ships = _ships,
|
||||
Participants = _participants,
|
||||
Berths = _berths
|
||||
};
|
||||
|
||||
if(esc.ShowDialog() ?? false)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _api.ShipcallsPutAsync(sc);
|
||||
obj.RefreshData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowErrorDialog(ex.Message, "Error saving edited shipcall");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Sc_EditTimesRequested(ShipcallControl obj, Times times)
|
||||
{
|
||||
// show a dialog that lets the user create / update times for the given shipcall
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Sc_TimesRequested(ShipcallControl obj)
|
||||
private void ShowErrorDialog(string message, string caption)
|
||||
{
|
||||
// TODO: get the shipcall, load and show a list of the times
|
||||
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>0.3.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>0.4.0.0</ApplicationVersion>
|
||||
<BootstrapperEnabled>False</BootstrapperEnabled>
|
||||
<Configuration>Release</Configuration>
|
||||
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
|
||||
|
||||
18
src/BreCalClient/Resources/Resources.Designer.cs
generated
18
src/BreCalClient/Resources/Resources.Designer.cs
generated
@ -423,6 +423,15 @@ namespace BreCalClient.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Not rotated.
|
||||
/// </summary>
|
||||
public static string textNotRotated {
|
||||
get {
|
||||
return ResourceManager.GetString("textNotRotated", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to OK.
|
||||
/// </summary>
|
||||
@ -531,6 +540,15 @@ namespace BreCalClient.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Rotated.
|
||||
/// </summary>
|
||||
public static string textRotated {
|
||||
get {
|
||||
return ResourceManager.GetString("textRotated", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Search.
|
||||
/// </summary>
|
||||
|
||||
@ -226,6 +226,9 @@
|
||||
<data name="textNewPassword" xml:space="preserve">
|
||||
<value>Neues Passwort</value>
|
||||
</data>
|
||||
<data name="textNotRotated" xml:space="preserve">
|
||||
<value>Ungedreht</value>
|
||||
</data>
|
||||
<data name="textOK" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
@ -262,6 +265,9 @@
|
||||
<data name="textReplenishingTerminal" xml:space="preserve">
|
||||
<value>Versorgungsaufnahme Terminal</value>
|
||||
</data>
|
||||
<data name="textRotated" xml:space="preserve">
|
||||
<value>Gedreht</value>
|
||||
</data>
|
||||
<data name="textSearch" xml:space="preserve">
|
||||
<value>Suche</value>
|
||||
</data>
|
||||
|
||||
@ -235,6 +235,9 @@
|
||||
<data name="textNewPassword" xml:space="preserve">
|
||||
<value>New password</value>
|
||||
</data>
|
||||
<data name="textNotRotated" xml:space="preserve">
|
||||
<value>Not rotated</value>
|
||||
</data>
|
||||
<data name="textOK" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
@ -271,6 +274,9 @@
|
||||
<data name="textReplenishingTerminal" xml:space="preserve">
|
||||
<value>Replenishing terminal</value>
|
||||
</data>
|
||||
<data name="textRotated" xml:space="preserve">
|
||||
<value>Rotated</value>
|
||||
</data>
|
||||
<data name="textSearch" xml:space="preserve">
|
||||
<value>Search</value>
|
||||
</data>
|
||||
|
||||
@ -59,7 +59,7 @@ namespace BreCalClient
|
||||
|
||||
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(Shipcall.TypeEnum));
|
||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(Extensions.TypeEnum));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -45,86 +45,61 @@
|
||||
<ColumnDefinition Width="30" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Margin="2" Grid.Column="0" >
|
||||
<Image.Style>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="Source" Value="{Binding Shipcall.Type}"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Shipcall.Type}" Value="{x:Static db2:Shipcall+TypeEnum.Incoming}">
|
||||
<Setter Property="Source" Value="./Resources/arrow_down_red.png"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Shipcall.Type}" Value="{x:Static db2:Shipcall+TypeEnum.Outgoing}">
|
||||
<Setter Property="Source" Value="./Resources/arrow_up_green.png"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Shipcall.Type}" Value="{x:Static db2:Shipcall+TypeEnum.Shifting}">
|
||||
<Setter Property="Source" Value="./Resources/arrow_right_blue.png"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Image.Style>
|
||||
</Image>
|
||||
<Label Grid.Column="1" FontSize="10" Content="{Binding Ship.Name}" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
|
||||
<Image Margin="2" Grid.Column="0" PreviewMouseUp="Image_PreviewMouseUp" x:Name="imageShipcallType" />
|
||||
<Label Grid.Column="1" FontSize="12" x:Name="labelShipName" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewMouseUp="Image_PreviewMouseUp"/>
|
||||
</Grid>
|
||||
<Viewbox Grid.Row="1" Grid.Column="0">
|
||||
<TextBlock Text="IMO" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="1" Grid.Column="1">
|
||||
<TextBlock Text="{Binding Ship.Imo}" />
|
||||
<TextBlock x:Name="textBlockIMO" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="2" Grid.Column="0">
|
||||
<TextBlock Text="{x:Static p:Resources.textCallsign}" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="2" Grid.Column="1">
|
||||
<TextBlock Text="{Binding Ship.Callsign}" />
|
||||
<TextBlock x:Name="textBlockCallsign" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="3" Grid.Column="0">
|
||||
<TextBlock Text="{x:Static p:Resources.textLengthWidth}" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="3" Grid.Column="1">
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0}m/{1}m">
|
||||
<Binding Path="Ship.Length" />
|
||||
<Binding Path="Ship.Width" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="textBlockLengthWidth" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="5" Grid.Column="0">
|
||||
<TextBlock Text="ETA" />
|
||||
<TextBlock Text="ETA" x:Name="labelETA"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="5" Grid.Column="1">
|
||||
<TextBlock Text="{Binding Shipcall.Eta}" />
|
||||
<TextBlock x:Name="textBlockETA" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="6" Grid.Column="0">
|
||||
<TextBlock Text="{x:Static p:Resources.textBerth}" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="6" Grid.Column="1">
|
||||
<TextBlock Text="{Binding Berth}" />
|
||||
<TextBlock x:Name="textBlockBerth" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="7" Grid.Column="0">
|
||||
<TextBlock Text="{x:Static p:Resources.textAgency}" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="7" Grid.Column="1">
|
||||
<TextBlock Text="{Binding Agency}" />
|
||||
<TextBlock x:Name="textBlockAgency" />
|
||||
</Viewbox>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="1" Grid.RowSpan="1" FontSize="12" Content="- / -" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelAgent"/>
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelAgent" PreviewMouseUp="labelAgent_PreviewMouseUp"/>
|
||||
<Label Grid.Row="0" Grid.Column="2" Grid.RowSpan="1" FontSize="12" Content="- / -" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelMooring"/>
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelMooring" PreviewMouseUp="labelMooring_PreviewMouseUp"/>
|
||||
<Label Grid.Row="0" Grid.Column="3" Grid.RowSpan="1" FontSize="12" Content="- / -" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelPortAuthority"/>
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelPortAuthority" PreviewMouseUp="labelPortAuthority_PreviewMouseUp" />
|
||||
<Label Grid.Row="0" Grid.Column="4" Grid.RowSpan="1" FontSize="12" Content="- / -" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelPilot"/>
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelPilot" PreviewMouseUp="labelPilot_PreviewMouseUp"/>
|
||||
<Label Grid.Row="0" Grid.Column="5" Grid.RowSpan="1" FontSize="12" Content="- / -" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTug"/>
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTug" PreviewMouseUp="labelTug_PreviewMouseUp"/>
|
||||
<Label Grid.Row="0" Grid.Column="6" Grid.RowSpan="1" FontSize="12" Content="- / -" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTerminal"/>
|
||||
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTerminal" PreviewMouseUp="labelTerminal_PreviewMouseUp" />
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2,9 +2,12 @@
|
||||
// Description: Show general shipcall info
|
||||
//
|
||||
|
||||
using BreCalClient.misc.Model;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -27,7 +30,7 @@ namespace BreCalClient
|
||||
|
||||
public event Action<ShipcallControl>? EditRequested;
|
||||
|
||||
public event Action<ShipcallControl>? TimesRequested;
|
||||
public event Action<ShipcallControl, Times>? EditTimesRequested;
|
||||
|
||||
public event Action<ShipcallControl>? OpenExtraRequested;
|
||||
|
||||
@ -66,6 +69,68 @@ namespace BreCalClient
|
||||
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TERMINAL);
|
||||
if (name != null)
|
||||
this.labelTerminal.Content = name;
|
||||
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL)) {
|
||||
this.labelTerminal.FontWeight = FontWeights.Bold;
|
||||
this.labelTerminal.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT))
|
||||
{
|
||||
this.labelPilot.FontWeight = FontWeights.Bold;
|
||||
this.labelPilot.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY))
|
||||
{
|
||||
this.labelAgent.FontWeight = FontWeights.Bold;
|
||||
this.labelAgent.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING))
|
||||
{
|
||||
this.labelMooring.FontWeight = FontWeights.Bold;
|
||||
this.labelMooring.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION))
|
||||
{
|
||||
this.labelPortAuthority.FontWeight = FontWeights.Bold;
|
||||
this.labelPortAuthority.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG))
|
||||
{
|
||||
this.labelTug.FontWeight = FontWeights.Bold;
|
||||
this.labelTug.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
this.labelShipName.Content = this.ShipcallControlModel?.Ship?.Name;
|
||||
switch(this.ShipcallControlModel?.Shipcall?.Type)
|
||||
{
|
||||
case 1: // incoming
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalClient;component/Resources/arrow_down_red.png"));
|
||||
break;
|
||||
case 2: // outgoing
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalClient;component/Resources/arrow_up_green.png"));
|
||||
break;
|
||||
case 3: // shifting
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalClient;component/Resources/arrow_right_blue.png"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.textBlockAgency.Text = this.ShipcallControlModel?.Agency;
|
||||
this.textBlockBerth.Text = this.ShipcallControlModel?.Berth;
|
||||
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
|
||||
if ((this.ShipcallControlModel?.Shipcall?.Type == 1) || (this.ShipcallControlModel?.Shipcall?.Type == 3))
|
||||
{
|
||||
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta.ToString();
|
||||
}
|
||||
if(this.ShipcallControlModel?.Shipcall?.Type == 2)
|
||||
{
|
||||
this.labelETA.Text = "ETD";
|
||||
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Etd.ToString();
|
||||
}
|
||||
|
||||
this.textBlockIMO.Text = this.ShipcallControlModel?.Ship?.Imo.ToString();
|
||||
this.textBlockLengthWidth.Text = $"{this.ShipcallControlModel?.Ship?.Length} / {this.ShipcallControlModel?.Ship?.Width}";
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -74,12 +139,7 @@ namespace BreCalClient
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DataContext = this.ShipcallControlModel;
|
||||
}
|
||||
|
||||
private void buttonListTimes_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.TimesRequested?.Invoke(this);
|
||||
}
|
||||
|
||||
private void buttonEditShipcall_Click(object sender, RoutedEventArgs e)
|
||||
@ -92,6 +152,83 @@ namespace BreCalClient
|
||||
this.OpenExtraRequested?.Invoke(this);
|
||||
}
|
||||
|
||||
private void Image_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
this.EditRequested?.Invoke(this);
|
||||
}
|
||||
|
||||
private void labelAgent_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
||||
if (times != null)
|
||||
{
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void labelMooring_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING);
|
||||
if(times != null)
|
||||
{
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void labelPortAuthority_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
if (times != null)
|
||||
{
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void labelPilot_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PILOT);
|
||||
if (times != null)
|
||||
{
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void labelTug_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TUG);
|
||||
if (times != null)
|
||||
{
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void labelTerminal_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL);
|
||||
if (times != null)
|
||||
{
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@ -2,12 +2,9 @@
|
||||
// Description: Container model for shipcall related info
|
||||
//
|
||||
|
||||
using BreCalClient.misc.Client;
|
||||
using BreCalClient.misc.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -42,6 +39,8 @@ namespace BreCalClient
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public Shipcall? Shipcall { get; set; }
|
||||
public Ship? Ship { get; set; }
|
||||
|
||||
@ -51,6 +50,36 @@ namespace BreCalClient
|
||||
|
||||
public Dictionary<int, Participant> AssignedParticipants { get; } = new();
|
||||
|
||||
public List<Times> Times { get; set; } = new();
|
||||
|
||||
public TrafficLightMode LightMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsFlagSet(StatusFlags.RED))
|
||||
{
|
||||
if (IsFlagSet((StatusFlags)StatusFlags.YELLOW))
|
||||
{
|
||||
if (IsFlagSet(StatusFlags.GREEN))
|
||||
{
|
||||
return TrafficLightMode.ALL;
|
||||
}
|
||||
return TrafficLightMode.RED_YELLOW;
|
||||
}
|
||||
return TrafficLightMode.RED;
|
||||
}
|
||||
if (IsFlagSet(StatusFlags.YELLOW))
|
||||
return TrafficLightMode.YELLOW;
|
||||
if (IsFlagSet(StatusFlags.GREEN))
|
||||
return TrafficLightMode.GREEN;
|
||||
return TrafficLightMode.OFF;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public methods
|
||||
|
||||
public void AssignParticipants(List<Participant> participants)
|
||||
{
|
||||
this.AssignedParticipants.Clear();
|
||||
@ -67,29 +96,23 @@ namespace BreCalClient
|
||||
}
|
||||
}
|
||||
|
||||
public TrafficLightMode LightMode
|
||||
internal Times? GetTimesForParticipantType(Extensions.ParticipantType type)
|
||||
{
|
||||
get
|
||||
|
||||
if (AssignedParticipants.ContainsKey((int)type)) {
|
||||
int participantId = AssignedParticipants[(int)type].Id;
|
||||
foreach (Times times in this.Times)
|
||||
{
|
||||
if(IsFlagSet(StatusFlags.RED))
|
||||
{
|
||||
if(IsFlagSet((StatusFlags)StatusFlags.YELLOW))
|
||||
{
|
||||
if(IsFlagSet(StatusFlags.GREEN))
|
||||
{
|
||||
return TrafficLightMode.ALL;
|
||||
}
|
||||
return TrafficLightMode.RED_YELLOW;
|
||||
}
|
||||
return TrafficLightMode.RED;
|
||||
}
|
||||
if(IsFlagSet(StatusFlags.YELLOW))
|
||||
return TrafficLightMode.YELLOW;
|
||||
if(IsFlagSet(StatusFlags.GREEN))
|
||||
return TrafficLightMode.GREEN;
|
||||
return TrafficLightMode.OFF;
|
||||
if (times.ParticipantId == participantId)
|
||||
return times;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region helper
|
||||
|
||||
internal string? GetParticipantNameForType(Extensions.ParticipantType participantType)
|
||||
{
|
||||
@ -101,8 +124,6 @@ namespace BreCalClient
|
||||
return null;
|
||||
}
|
||||
|
||||
#region private helper
|
||||
|
||||
private bool IsFlagSet(StatusFlags flag)
|
||||
{
|
||||
if(this.Shipcall == null) return false;
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="160" />
|
||||
<ColumnDefinition Width=".38*" />
|
||||
<ColumnDefinition Width=".62*" />
|
||||
<ColumnDefinition Width=".4*" />
|
||||
<ColumnDefinition Width=".2*" />
|
||||
<ColumnDefinition Width=".4*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox x:Name="listBoxParticipant" Margin="2" Grid.RowSpan="7" SelectionChanged="listBoxParticipant_SelectionChanged">
|
||||
<ListBox.ContextMenu>
|
||||
|
||||
@ -45,6 +45,7 @@ namespace RoleEditor
|
||||
{
|
||||
InitializeComponent();
|
||||
_dbManager = new();
|
||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); // for ExcelDataReader on .NET Core
|
||||
}
|
||||
|
||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
@ -573,7 +574,7 @@ namespace RoleEditor
|
||||
|
||||
#region Excel import
|
||||
|
||||
private void buttonImportBerths_Click(object sender, RoutedEventArgs e)
|
||||
private async void buttonImportBerths_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
@ -595,6 +596,8 @@ namespace RoleEditor
|
||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
||||
{
|
||||
List<Berth> importBerthList = new();
|
||||
int bCounter = 0;
|
||||
int pCounter = 0;
|
||||
|
||||
try
|
||||
{
|
||||
@ -606,25 +609,66 @@ namespace RoleEditor
|
||||
{
|
||||
throw new InvalidDataException("Sheet must have at least 2 Columns of data");
|
||||
}
|
||||
Berth b = new Berth();
|
||||
|
||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
||||
if (!reader.IsDBNull(0)) b.Name = reader.GetString(0);
|
||||
string participant_name;
|
||||
string berth_name = "";
|
||||
if (!reader.IsDBNull(0)) berth_name = reader.GetString(0);
|
||||
if (berth_name.Equals("Liegeplatz", StringComparison.OrdinalIgnoreCase)) continue;
|
||||
|
||||
string participant_name = "";
|
||||
if (!reader.IsDBNull(1)) participant_name = reader.GetString(1);
|
||||
|
||||
importBerthList.Add(b);
|
||||
// find berth in existing list
|
||||
if (_berths.Any(predicate: x => (x.Name != null) && x.Name.Equals(berth_name, StringComparison.OrdinalIgnoreCase)))
|
||||
continue;
|
||||
|
||||
Berth b = new Berth();
|
||||
b.Name = berth_name;
|
||||
bool found_participant = false;
|
||||
|
||||
foreach(Participant p in this._participants)
|
||||
{
|
||||
if ((p.Name != null) && p.Name.Contains(participant_name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
b.Participant_Id = p.Id;
|
||||
found_participant = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found_participant)
|
||||
{
|
||||
// create new participant
|
||||
Participant p = new Participant();
|
||||
p.Name = participant_name;
|
||||
p.Type = (uint) Participant.ParticipantType.TERMINAL;
|
||||
await p.Save(_dbManager);
|
||||
_participants.Add(p);
|
||||
pCounter++;
|
||||
b.Participant_Id = p.Id;
|
||||
}
|
||||
|
||||
await b.Save(_dbManager);
|
||||
_berths.Add(b);
|
||||
bCounter++;
|
||||
|
||||
}
|
||||
} while (reader.NextResult());
|
||||
|
||||
if((pCounter > 0) || (bCounter > 0))
|
||||
{
|
||||
MessageBox.Show($"Imported {bCounter} berths and added {pCounter} participants while doing so");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error reading Excel: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
stream.Close();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
// Copyright (c) 2023- schick Informatik
|
||||
// Description: Enum description string conversion helper
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace brecal.model
|
||||
{
|
||||
@ -9,9 +9,14 @@ namespace brecal.model
|
||||
{
|
||||
public static string Description(this Enum eValue)
|
||||
{
|
||||
var nAttributes = eValue.GetType().GetField(eValue.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
if (nAttributes.Any())
|
||||
return (nAttributes.First() as DescriptionAttribute).Description;
|
||||
var nAttributes = eValue.GetType().GetField(eValue.ToString())?.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
if (nAttributes != null)
|
||||
{
|
||||
if (nAttributes.Any() && nAttributes.First() != null && (nAttributes.First() is DescriptionAttribute da))
|
||||
{
|
||||
return da.Description;
|
||||
}
|
||||
}
|
||||
return eValue.ToString();
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
from dataclasses import field
|
||||
from marshmallow import Schema, fields, INCLUDE, ValidationError
|
||||
|
||||
from marshmallow_dataclass import dataclass
|
||||
from typing import List
|
||||
|
||||
@ -22,7 +23,7 @@ class Berth(Schema):
|
||||
deleted: bool
|
||||
|
||||
class Error(Schema):
|
||||
message = fields.String(required=True,)
|
||||
message = fields.String(required=True)
|
||||
|
||||
|
||||
class GetVerifyInlineResp(Schema):
|
||||
@ -56,7 +57,6 @@ class Participant(Schema):
|
||||
class ParticipantList(Participant):
|
||||
pass
|
||||
|
||||
|
||||
class ShipcallSchema(Schema):
|
||||
def __init__(self):
|
||||
super().__init__(unknown=None)
|
||||
@ -66,35 +66,35 @@ class ShipcallSchema(Schema):
|
||||
ship_id = fields.Int()
|
||||
type = fields.Int()
|
||||
eta = fields.DateTime()
|
||||
voyage = fields.Str()
|
||||
etd = fields.DateTime()
|
||||
arrival_berth_id = fields.Int()
|
||||
departure_berth_id = fields.Int()
|
||||
tug_required = fields.Bool()
|
||||
pilot_required = fields.Bool()
|
||||
flags = fields.Int()
|
||||
pier_side = fields.Bool()
|
||||
bunkering = fields.Bool()
|
||||
replenishing_terminal = fields.Bool()
|
||||
replenishing_lock = fields.Bool()
|
||||
draft = fields.Float()
|
||||
tidal_window_from = fields.DateTime()
|
||||
tidal_window_to = fields.DateTime()
|
||||
rain_sensitive_cargo = fields.Bool()
|
||||
recommended_tugs = fields.Int()
|
||||
anchored = fields.Bool()
|
||||
moored_lock = fields.Bool()
|
||||
canceled = fields.Bool()
|
||||
voyage = fields.Str(Required = False, allow_none=True)
|
||||
etd = fields.DateTime(Required = False, allow_none=True)
|
||||
arrival_berth_id = fields.Int(Required = False, allow_none=True)
|
||||
departure_berth_id = fields.Int(Required = False, allow_none=True)
|
||||
tug_required = fields.Bool(Required = False, allow_none=True)
|
||||
pilot_required = fields.Bool(Required = False, allow_none=True)
|
||||
flags = fields.Int(Required = False, allow_none=True)
|
||||
pier_side = fields.Bool(Required = False, allow_none=True)
|
||||
bunkering = fields.Bool(Required = False, allow_none=True)
|
||||
replenishing_terminal = fields.Bool(Required = False, allow_none=True)
|
||||
replenishing_lock = fields.Bool(Required = False, allow_none=True)
|
||||
draft = fields.Float(Required = False, allow_none=True)
|
||||
tidal_window_from = fields.DateTime(Required = False, allow_none=True)
|
||||
tidal_window_to = fields.DateTime(Required = False, allow_none=True)
|
||||
rain_sensitive_cargo = fields.Bool(Required = False, allow_none=True)
|
||||
recommended_tugs = fields.Int(Required = False, allow_none=True)
|
||||
anchored = fields.Bool(Required = False, allow_none=True)
|
||||
moored_lock = fields.Bool(Required = False, allow_none=True)
|
||||
canceled = fields.Bool(Required = False, allow_none=True)
|
||||
participants = fields.List(fields.Int)
|
||||
created = fields.DateTime()
|
||||
modified = fields.DateTime()
|
||||
created = fields.DateTime(Required = False, allow_none=True)
|
||||
modified = fields.DateTime(Required = False, allow_none=True)
|
||||
|
||||
@dataclass
|
||||
class Shipcall:
|
||||
|
||||
id: int
|
||||
ship_id: int
|
||||
type: int
|
||||
type: str
|
||||
eta: datetime
|
||||
voyage: str
|
||||
etd: datetime
|
||||
|
||||
Reference in New Issue
Block a user