Fixed an error regarding berth display in AGENT/TERMINAL and set to+from berth info for shifting shipcalls

This commit is contained in:
Daniel Schick 2024-07-11 11:39:12 +02:00
parent ec0eb3cbfa
commit 24138fc1e9

View File

@ -16,7 +16,7 @@ namespace BreCalClient
public class ShipcallControlModel
{
#region Enumerations
#region Enumerations
[Flags]
public enum StatusFlags
@ -146,28 +146,42 @@ namespace BreCalClient
return false;
}
/// <summary>
/// Get berth display text for columns AGENT and TERMINAL
/// </summary>
public string? GetBerthText(Times times)
{
string? timesBerthText = null;
string? scArrivalBerthText = null;
string? scDepartureBerthText = null;
string? berthText = null;
if ((BreCalLists.Berths != null) && times.BerthId.HasValue && (this.Shipcall?.Type != ShipcallType.Shifting))
Berth? berth;
if(times.BerthId.HasValue)
{
Berth? berth = BreCalLists.AllBerths.Find((x) => x.Id == times.BerthId);
berthText = berth?.Name;
berth = BreCalLists.AllBerths.Find((x) => x.Id == times.BerthId.Value);
timesBerthText = berth?.Name;
}
if ((berthText == null) && (times.ParticipantType != (int) Extensions.ParticipantType.TERMINAL))
berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.ArrivalBerthId);
scArrivalBerthText = berth?.Name;
berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.DepartureBerthId);
scDepartureBerthText= berth?.Name;
switch(this.Shipcall?.Type)
{
if (this.Shipcall?.Type == ShipcallType.Arrival)
{
Berth? berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.ArrivalBerthId);
berthText = berth?.Name;
}
else
{
Berth? berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.DepartureBerthId);
berthText = berth?.Name;
}
}
case ShipcallType.Arrival:
berthText = timesBerthText ?? scArrivalBerthText;
break;
case ShipcallType.Departure:
berthText = timesBerthText ?? scDepartureBerthText;
break;
case ShipcallType.Shifting:
berthText = (scDepartureBerthText ?? "") + "-" + timesBerthText ?? scArrivalBerthText;
break;
default: break;
}
return berthText;
}
@ -194,7 +208,7 @@ namespace BreCalClient
{
if (agentTimes.EtdBerth != null)
theDate = agentTimes.EtdBerth.Value;
}
}
}
return theDate.ToString();
}