From effbf423038df3ae7fac69bee3cc8f3c1782bb27 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Fri, 8 Nov 2024 09:59:37 +0100 Subject: [PATCH] If the agency provided a time, display it in the BSMD column. Also corrected ETD/ETA Label right there --- src/BreCalClient/ShipcallControl.xaml.cs | 20 ++++---------------- src/BreCalClient/ShipcallControlModel.cs | 4 +++- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/BreCalClient/ShipcallControl.xaml.cs b/src/BreCalClient/ShipcallControl.xaml.cs index d8e30d0..1ff0158 100644 --- a/src/BreCalClient/ShipcallControl.xaml.cs +++ b/src/BreCalClient/ShipcallControl.xaml.cs @@ -267,23 +267,10 @@ namespace BreCalClient this.imageEvaluation.ToolTip = this.ShipcallControlModel?.Shipcall?.EvaluationMessage; else this.imageEvaluation.ToolTip = null; - - //Times? bsmdTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.BSMD); - //if (bsmdTimes != null) - this.textBlockBerth.Text = this.ShipcallControlModel?.GetBerthText(null); - //else - // this.textBlockBerth.Text = this.ShipcallControlModel?.Berth; - + + this.textBlockBerth.Text = this.ShipcallControlModel?.GetBerthText(null); this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign; - if (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival) - { - this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta?.ToString("dd.MM. HH:mm"); - } - if ((this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Departure) || (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Shifting)) - { - this.labelETA.Text = "ETD"; - this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Etd?.ToString("dd.MM. HH:mm"); - } + this.textBlockETA.Text = this.ShipcallControlModel?.GetETAETD(true); this.textBlockIMO.Text = this.ShipcallControlModel?.Ship?.Imo.ToString(); this.textBlockLengthWidth.Text = $"{this.ShipcallControlModel?.Ship?.Length} / {this.ShipcallControlModel?.Ship?.Width}"; @@ -293,6 +280,7 @@ namespace BreCalClient if (this.ShipcallControlModel?.Shipcall?.Type != ShipcallType.Arrival) { + this.labelETA.Text = "ETD"; this.labelETAETDAgent.Content = "ETD"; this.labelETAETDMooring.Content = "ETD"; this.labelETAETDPilot.Content = "ETD"; diff --git a/src/BreCalClient/ShipcallControlModel.cs b/src/BreCalClient/ShipcallControlModel.cs index 201dec1..7760639 100644 --- a/src/BreCalClient/ShipcallControlModel.cs +++ b/src/BreCalClient/ShipcallControlModel.cs @@ -219,7 +219,7 @@ namespace BreCalClient return berthText; } - public string GetETAETD() + public string GetETAETD(bool useShortVersion = false) { DateTime theDate = DateTime.Now; if(this.Shipcall != null) @@ -243,6 +243,8 @@ namespace BreCalClient theDate = agentTimes.EtdBerth.Value; } } + if(useShortVersion) + return theDate.ToString("dd.MM. HH:mm"); return theDate.ToString(); }