diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs
index 3a006be..cbbd2b8 100644
--- a/misc/BreCalApi.cs
+++ b/misc/BreCalApi.cs
@@ -1,7 +1,7 @@
//----------------------
//
-// 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 14:30:55
// Using the tool OpenAPI Generator v6.6.0
//
//----------------------
@@ -50,6 +50,7 @@ using System.Threading.Tasks;
*/
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'
///
/// Represents a collection of functions to interact with the API endpoints
///
@@ -6322,33 +6323,6 @@ namespace BreCalClient.misc.Model
[DataContract(Name = "shipcall")]
public partial class Shipcall : IEquatable, IValidatableObject
{
- ///
- /// Defines Type
- ///
- [JsonConverter(typeof(StringEnumConverter))]
- public enum TypeEnum
- {
- ///
- /// Enum Incoming for value: incoming
- ///
- [EnumMember(Value = "incoming")]
- Incoming = 1,
- ///
- /// Enum Outgoing for value: outgoing
- ///
- [EnumMember(Value = "outgoing")]
- Outgoing = 2,
- ///
- /// Enum Shifting for value: shifting
- ///
- [EnumMember(Value = "shifting")]
- Shifting = 3
- }
- ///
- /// Gets or Sets Type
- ///
- [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)]
- public TypeEnum Type { get; set; }
///
/// Initializes a new instance of the class.
///
@@ -6365,7 +6339,7 @@ namespace BreCalClient.misc.Model
/// etd.
/// arrivalBerthId.
/// departureBerthId.
- /// tugReguired.
+ /// tugRequired.
/// pilotRequired.
/// flags.
/// pierSide.
@@ -6383,7 +6357,7 @@ namespace BreCalClient.misc.Model
/// participants.
/// created.
/// modified.
- 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 participants = default(List), 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 participants = default(List), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
{
this.Id = id;
this.ShipId = shipId;
@@ -6393,7 +6367,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 +6398,11 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "ship_id", IsRequired = true, EmitDefaultValue = true)]
public int ShipId { get; set; }
///
+ /// Gets or Sets Type
+ ///
+ [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)]
+ public int Type { get; set; }
+ ///
/// Gets or Sets Eta
///
[DataMember(Name = "eta", IsRequired = true, EmitDefaultValue = true)]
@@ -6449,10 +6428,10 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "departure_berth_id", EmitDefaultValue = true)]
public int? DepartureBerthId { get; set; }
///
- /// Gets or Sets TugReguired
+ /// Gets or Sets TugRequired
///
- [DataMember(Name = "tug_reguired", EmitDefaultValue = true)]
- public bool? TugReguired { get; set; }
+ [DataMember(Name = "tug_required", EmitDefaultValue = true)]
+ public bool? TugRequired { get; set; }
///
/// Gets or Sets PilotRequired
///
@@ -6554,7 +6533,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 +6621,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 +6744,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)
{
@@ -7399,5 +7378,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'
}
diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml
index 0fa15ff..9ffc176 100644
--- a/misc/BreCalApi.yaml
+++ b/misc/BreCalApi.yaml
@@ -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:
diff --git a/src/BreCalClient/.editorconfig b/src/BreCalClient/.editorconfig
index 5d552a4..6c674dd 100644
--- a/src/BreCalClient/.editorconfig
+++ b/src/BreCalClient/.editorconfig
@@ -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
diff --git a/src/BreCalClient/BoolToIndexConverter.cs b/src/BreCalClient/BoolToIndexConverter.cs
new file mode 100644
index 0000000..cae4812
--- /dev/null
+++ b/src/BreCalClient/BoolToIndexConverter.cs
@@ -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);
+ }
+ }
+}
diff --git a/src/BreCalClient/EditShipcallControl.xaml b/src/BreCalClient/EditShipcallControl.xaml
index a269c97..25ede33 100644
--- a/src/BreCalClient/EditShipcallControl.xaml
+++ b/src/BreCalClient/EditShipcallControl.xaml
@@ -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">
+
+
+
@@ -49,7 +52,7 @@
-
+
@@ -65,19 +68,22 @@
-
+
-
-
+
+
-
+
+
+
+
-
+
@@ -93,11 +99,13 @@
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs
index b22b005..8889dd8 100644
--- a/src/BreCalClient/EditShipcallControl.xaml.cs
+++ b/src/BreCalClient/EditShipcallControl.xaml.cs
@@ -5,18 +5,9 @@
using BreCalClient.misc.Model;
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
{
@@ -68,7 +59,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 +69,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 +90,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.MooredLock = this.checkBoxMooredLock.IsChecked;
this.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
this.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
this.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
@@ -117,12 +109,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;
+ 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)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id;
+ if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id;
+ if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id;
+ if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id;
+ if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id;
+ }
}
diff --git a/src/BreCalClient/Extensions.cs b/src/BreCalClient/Extensions.cs
index eae3ed0..40bf07b 100644
--- a/src/BreCalClient/Extensions.cs
+++ b/src/BreCalClient/Extensions.cs
@@ -41,6 +41,16 @@ namespace BreCalClient
TUG = 64,
}
+ ///
+ /// Should actually be defined in yaml
+ ///
+ public enum TypeEnum
+ {
+ Incoming = 1,
+ Outgoing = 2,
+ Shifting = 3
+ }
+
#endregion
#region public helper
diff --git a/src/BreCalClient/MainWindow.xaml b/src/BreCalClient/MainWindow.xaml
index fdc42d4..aec9bba 100644
--- a/src/BreCalClient/MainWindow.xaml
+++ b/src/BreCalClient/MainWindow.xaml
@@ -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">
-
+
+
+
-
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
+ HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelAgent" PreviewMouseUp="labelAgent_PreviewMouseUp"/>
+ HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelMooring" PreviewMouseUp="labelMooring_PreviewMouseUp"/>
+ HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelPortAuthority" PreviewMouseUp="labelPortAuthority_PreviewMouseUp" />
+ HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelPilot" PreviewMouseUp="labelPilot_PreviewMouseUp"/>
+ HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTug" PreviewMouseUp="labelTug_PreviewMouseUp"/>
-
+ HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTerminal" PreviewMouseUp="labelTerminal_PreviewMouseUp" />
diff --git a/src/BreCalClient/ShipcallControl.xaml.cs b/src/BreCalClient/ShipcallControl.xaml.cs
index 2819256..c0ea0fd 100644
--- a/src/BreCalClient/ShipcallControl.xaml.cs
+++ b/src/BreCalClient/ShipcallControl.xaml.cs
@@ -5,6 +5,7 @@
using System;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Media.Imaging;
namespace BreCalClient
{
@@ -66,6 +67,29 @@ namespace BreCalClient
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TERMINAL);
if (name != null)
this.labelTerminal.Content = name;
+
+ 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;
+ this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta.ToString();
+ this.textBlockIMO.Text = this.ShipcallControlModel?.Ship?.Imo.ToString();
+ this.textBlockLengthWidth.Text = $"{this.ShipcallControlModel?.Ship?.Length} / {this.ShipcallControlModel?.Ship?.Width}";
+
}
#endregion
@@ -74,7 +98,7 @@ namespace BreCalClient
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
- this.DataContext = this.ShipcallControlModel;
+
}
private void buttonListTimes_Click(object sender, RoutedEventArgs e)
@@ -94,5 +118,39 @@ namespace BreCalClient
#endregion
+ private void labelAgent_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+
+ }
+
+ private void Image_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+ this.EditRequested?.Invoke(this);
+ }
+
+ private void labelMooring_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+
+ }
+
+ private void labelPortAuthority_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+
+ }
+
+ private void labelPilot_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+
+ }
+
+ private void labelTug_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+
+ }
+
+ private void labelTerminal_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+
+ }
}
}
diff --git a/src/RoleEditor/MainWindow.xaml.cs b/src/RoleEditor/MainWindow.xaml.cs
index a98188a..27bc1ef 100644
--- a/src/RoleEditor/MainWindow.xaml.cs
+++ b/src/RoleEditor/MainWindow.xaml.cs
@@ -641,6 +641,7 @@ namespace RoleEditor
// 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++;
diff --git a/src/brecal.model/EnumHelper.cs b/src/brecal.model/EnumHelper.cs
index 719d308..1daba5a 100644
--- a/src/brecal.model/EnumHelper.cs
+++ b/src/brecal.model/EnumHelper.cs
@@ -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();
}
diff --git a/src/server/BreCal/schemas/model.py b/src/server/BreCal/schemas/model.py
index 439098b..59140e2 100644
--- a/src/server/BreCal/schemas/model.py
+++ b/src/server/BreCal/schemas/model.py
@@ -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