From 49e3f5a07d6bedff1e3b1e50147ba335ff83bede Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 8 Nov 2023 07:44:17 +0100 Subject: [PATCH] Bugfix: switch arrival/departure berth combobox for incoming / outgoing calls (just for display, not logical) --- src/BreCalClient/EditShipcallControl.xaml | 4 +-- src/BreCalClient/EditShipcallControl.xaml.cs | 27 ++++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/BreCalClient/EditShipcallControl.xaml b/src/BreCalClient/EditShipcallControl.xaml index ffd82ee..0ed9c54 100644 --- a/src/BreCalClient/EditShipcallControl.xaml +++ b/src/BreCalClient/EditShipcallControl.xaml @@ -66,14 +66,14 @@ - + - + diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs index 041d16a..9c157e7 100644 --- a/src/BreCalClient/EditShipcallControl.xaml.cs +++ b/src/BreCalClient/EditShipcallControl.xaml.cs @@ -158,9 +158,17 @@ namespace BreCalClient this.ShipcallModel.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id; this.ShipcallModel.Ship = (Ship)this.comboBoxShip.SelectedItem; - this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null; - this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null; - + + if (this.ShipcallModel.Shipcall.Type != 3) // incoming, outgoing + { + this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null; + this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null; + } + else // shifting + { + this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null; + this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null; + } Participant? participant; participant = (Participant?)this.comboBoxAgency.SelectedItem; @@ -224,8 +232,17 @@ namespace BreCalClient // this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage; this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd; this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId; - this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId; - this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId; + + if (this.ShipcallModel.Shipcall.Type != 3) // incoming, outgoing + { + this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId; + this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId; + } + else // shifting + { + this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId; + this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId; + } if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();