EXTENDED TIMES TO DIFFERENTIATE BETWEEN PARTICIPANT TYPES
Participants can be of multiple types (e.g. agent and terminal), therefore the participant type must be stored in the times data record in order to assign times correctly during display and to differentiate in calculation.
This commit is contained in:
parent
df641f096c
commit
110ff5ccce
@ -1,7 +1,7 @@
|
||||
|
||||
//----------------------
|
||||
// <auto-generated>
|
||||
// Generated REST API Client Code Generator v1.8.4.0 on 11.09.2023 10:29:36
|
||||
// Generated REST API Client Code Generator v1.8.4.0 on 21.09.2023 07:07:32
|
||||
// Using the tool OpenAPI Generator v7.0.0
|
||||
// </auto-generated>
|
||||
//----------------------
|
||||
@ -51,6 +51,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'
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
@ -6921,9 +6922,10 @@ namespace BreCalClient.misc.Model
|
||||
/// <param name="berthId">berthId.</param>
|
||||
/// <param name="berthInfo">berthInfo.</param>
|
||||
/// <param name="pierSide">pierSide.</param>
|
||||
/// <param name="participantType">participantType.</param>
|
||||
/// <param name="created">created.</param>
|
||||
/// <param name="modified">modified.</param>
|
||||
public Times(int id = default(int), DateTime? etaBerth = default(DateTime?), bool? etaBerthFixed = default(bool?), DateTime? etdBerth = default(DateTime?), bool? etdBerthFixed = default(bool?), DateTime? lockTime = default(DateTime?), bool? lockTimeFixed = default(bool?), DateTime? zoneEntry = default(DateTime?), bool? zoneEntryFixed = default(bool?), DateTime? operationsStart = default(DateTime?), DateTime? operationsEnd = default(DateTime?), string remarks = default(string), int shipcallId = default(int), int participantId = default(int), int? berthId = default(int?), string berthInfo = default(string), bool? pierSide = default(bool?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
||||
public Times(int id = default(int), DateTime? etaBerth = default(DateTime?), bool? etaBerthFixed = default(bool?), DateTime? etdBerth = default(DateTime?), bool? etdBerthFixed = default(bool?), DateTime? lockTime = default(DateTime?), bool? lockTimeFixed = default(bool?), DateTime? zoneEntry = default(DateTime?), bool? zoneEntryFixed = default(bool?), DateTime? operationsStart = default(DateTime?), DateTime? operationsEnd = default(DateTime?), string remarks = default(string), int shipcallId = default(int), int participantId = default(int), int? berthId = default(int?), string berthInfo = default(string), bool? pierSide = default(bool?), int? participantType = default(int?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
||||
{
|
||||
this.ShipcallId = shipcallId;
|
||||
this.ParticipantId = participantId;
|
||||
@ -6942,6 +6944,7 @@ namespace BreCalClient.misc.Model
|
||||
this.BerthId = berthId;
|
||||
this.BerthInfo = berthInfo;
|
||||
this.PierSide = pierSide;
|
||||
this.ParticipantType = participantType;
|
||||
this.Created = created;
|
||||
this.Modified = modified;
|
||||
}
|
||||
@ -7031,6 +7034,11 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "pier_side", EmitDefaultValue = true)]
|
||||
public bool? PierSide { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets ParticipantType
|
||||
/// </summary>
|
||||
[DataMember(Name = "participant_type", EmitDefaultValue = true)]
|
||||
public int? ParticipantType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Created
|
||||
/// </summary>
|
||||
[DataMember(Name = "created", EmitDefaultValue = true)]
|
||||
@ -7065,6 +7073,7 @@ namespace BreCalClient.misc.Model
|
||||
sb.Append(" BerthId: ").Append(BerthId).Append("\n");
|
||||
sb.Append(" BerthInfo: ").Append(BerthInfo).Append("\n");
|
||||
sb.Append(" PierSide: ").Append(PierSide).Append("\n");
|
||||
sb.Append(" ParticipantType: ").Append(ParticipantType).Append("\n");
|
||||
sb.Append(" Created: ").Append(Created).Append("\n");
|
||||
sb.Append(" Modified: ").Append(Modified).Append("\n");
|
||||
sb.Append("}\n");
|
||||
@ -7181,6 +7190,11 @@ namespace BreCalClient.misc.Model
|
||||
(this.PierSide != null &&
|
||||
this.PierSide.Equals(input.PierSide))
|
||||
) &&
|
||||
(
|
||||
this.ParticipantType == input.ParticipantType ||
|
||||
(this.ParticipantType != null &&
|
||||
this.ParticipantType.Equals(input.ParticipantType))
|
||||
) &&
|
||||
(
|
||||
this.Created == input.Created ||
|
||||
(this.Created != null &&
|
||||
@ -7260,6 +7274,10 @@ namespace BreCalClient.misc.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.PierSide.GetHashCode();
|
||||
}
|
||||
if (this.ParticipantType != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ParticipantType.GetHashCode();
|
||||
}
|
||||
if (this.Created != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.Created.GetHashCode();
|
||||
@ -7472,5 +7490,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'
|
||||
}
|
||||
|
||||
|
||||
@ -484,6 +484,9 @@ components:
|
||||
pier_side:
|
||||
type: boolean
|
||||
nullable: true
|
||||
participant_type:
|
||||
type: integer
|
||||
nullable: true
|
||||
created:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
@ -280,6 +280,7 @@ CREATE TABLE `times` (
|
||||
`berth_id` int unsigned DEFAULT NULL,
|
||||
`berth_info` varchar(512) DEFAULT NULL,
|
||||
`pier_side` bit(1) DEFAULT NULL,
|
||||
`participant_type` int unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FK_TIME_SHIPCALL` (`shipcall_id`),
|
||||
KEY `FK_TIME_PART` (`participant_id`) /*!80000 INVISIBLE */,
|
||||
|
||||
@ -115,31 +115,31 @@ namespace BreCalClient
|
||||
private void contextMenuItemClearAgency_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxAgency.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.AGENCY);
|
||||
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.AGENCY);
|
||||
}
|
||||
|
||||
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxMooring.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.MOORING);
|
||||
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.MOORING);
|
||||
}
|
||||
|
||||
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxPilot.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.PILOT);
|
||||
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.PILOT);
|
||||
}
|
||||
|
||||
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxTug.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.TUG);
|
||||
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TUG);
|
||||
}
|
||||
|
||||
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxTerminal.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.TERMINAL);
|
||||
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
|
||||
}
|
||||
|
||||
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
|
||||
@ -195,29 +195,29 @@ namespace BreCalClient
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = participant;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxMooring.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxPilot.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
|
||||
if (participant != null) {
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTug.SelectedItem;
|
||||
if (participant != null) {
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant;
|
||||
}
|
||||
|
||||
// BSMD and port authority are always added
|
||||
@ -226,12 +226,12 @@ namespace BreCalClient
|
||||
if (p.Type == (int)Extensions.ParticipantType.PORT_ADMINISTRATION)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(p.Id);
|
||||
this.ShipcallModel.AssignedParticipants[p.Type] = p;
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PORT_ADMINISTRATION] = p;
|
||||
}
|
||||
if (p.Type == (int)Extensions.ParticipantType.BSMD)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(p.Id);
|
||||
this.ShipcallModel.AssignedParticipants[p.Type] = p;
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.BSMD] = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textEditTimes}" Height="280" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
|
||||
Title="{x:Static p:Resources.textEditTimes}" Height="265" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width=".25*" />
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:local="clr-namespace:BreCalClient"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textEditTimes}" Loaded="Window_Loaded" Height="280" Width="400" >
|
||||
Title="{x:Static p:Resources.textEditTimes}" Loaded="Window_Loaded" Height="295" Width="400" >
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width=".4*" />
|
||||
@ -19,7 +19,7 @@
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="56" />
|
||||
<RowDefinition Height="56" />
|
||||
<RowDefinition Height="28" />
|
||||
</Grid.RowDefinitions>
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" HorizontalContentAlignment="Right" />
|
||||
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="0" Grid.Column="1" Margin="2" Name="datePickerOperationStart" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
|
||||
<xctk:DateTimePicker Grid.Row="0" Grid.Column="1" Margin="2" Name="datePickerOperationStart" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
|
||||
<xctk:DateTimePicker.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationStart" Click="contextMenuItemClearOperationStart_Click" >
|
||||
@ -43,7 +43,7 @@
|
||||
</ContextMenu>
|
||||
</xctk:DateTimePicker.ContextMenu>
|
||||
</xctk:DateTimePicker>
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="1" Grid.Column="1" Margin="2" Name="datePickerOperationEnd" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
|
||||
<xctk:DateTimePicker Grid.Row="1" Grid.Column="1" Margin="2" Name="datePickerOperationEnd" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
|
||||
<xctk:DateTimePicker.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationEnd" Click="contextMenuItemClearOperationEnd_Click" >
|
||||
|
||||
@ -87,8 +87,8 @@ namespace BreCalClient
|
||||
}
|
||||
this.Times.OperationsStart = this.datePickerOperationStart.Value;
|
||||
this.Times.OperationsEnd = this.datePickerOperationEnd.Value;
|
||||
|
||||
this.Times.Remarks = this.textBoxBerthRemarks.Text.Trim();
|
||||
this.Times.BerthId = (this.comboBoxBerth.SelectedItem != null) ? ((Berth)this.comboBoxBerth.SelectedItem).Id : null;
|
||||
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
|
||||
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
|
||||
}
|
||||
|
||||
@ -96,6 +96,11 @@ namespace BreCalClient
|
||||
{
|
||||
this.datePickerOperationStart.Value = this.Times.OperationsStart;
|
||||
this.datePickerOperationEnd.Value = this.Times.OperationsEnd;
|
||||
if(this.Times.PierSide == null) { this.comboBoxPierside.SelectedIndex = -1; }
|
||||
else this.comboBoxPierside.SelectedIndex = (this.Times.PierSide ?? false) ? 0 : 1;
|
||||
this.comboBoxBerth.SelectedValue = this.Times.BerthId;
|
||||
this.textBoxRemarks.Text = this.Times.Remarks;
|
||||
this.textBoxBerthRemarks.Text = this.Times.BerthInfo;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -50,8 +50,8 @@ namespace BreCalClient
|
||||
|
||||
private bool? _showCanceled = null;
|
||||
private Extensions.SortOrder? _sortOrder;
|
||||
private bool _filterChanged = false;
|
||||
private bool _sequenceChanged = false;
|
||||
// private bool _filterChanged = false;
|
||||
// private bool _sequenceChanged = false;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -361,7 +361,8 @@ namespace BreCalClient
|
||||
{
|
||||
Height = 120,
|
||||
ShipcallControlModel = scm,
|
||||
ParticipantDict = _participantLookupDict
|
||||
ParticipantDict = _participantLookupDict,
|
||||
Berths = _berths
|
||||
};
|
||||
sc.EditTimesRequested += Sc_EditTimesRequested;
|
||||
sc.EditRequested += Sc_EditRequested;
|
||||
@ -533,12 +534,19 @@ namespace BreCalClient
|
||||
{
|
||||
// show a dialog that lets the user create / update times for the given shipcall
|
||||
IEditTimesControl etc = (participantType == ParticipantType.TERMINAL) ? new EditTimesTerminalControl() : new EditTimesControl();
|
||||
if (etc is EditTimesTerminalControl ettc)
|
||||
ettc.Berths = this._berths;
|
||||
|
||||
bool wasEdit = false;
|
||||
if (times != null)
|
||||
{
|
||||
etc.Times = times;
|
||||
wasEdit = true;
|
||||
}
|
||||
|
||||
// actually we should only do this on create but we have existing data
|
||||
etc.Times.ParticipantType = (int) participantType;
|
||||
|
||||
if(etc.ShowDialog() ?? false)
|
||||
{
|
||||
try
|
||||
|
||||
@ -379,4 +379,7 @@
|
||||
<data name="textBerthRemarks" xml:space="preserve">
|
||||
<value>Liegeplatz Informationen</value>
|
||||
</data>
|
||||
<data name="textRemarks" xml:space="preserve">
|
||||
<value>Info</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -219,12 +219,12 @@
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textBerth}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="ETD" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="labelTerminalBerth" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Start" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="End" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelTerminalETA" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelTerminalETD" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelOperationsStart" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelOperationsEnd" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockTerminalRemarks" />
|
||||
</Grid>
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
using BreCalClient.misc.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@ -32,7 +33,7 @@ namespace BreCalClient
|
||||
|
||||
public event Action<ShipcallControl>? EditRequested;
|
||||
|
||||
internal event Action<ShipcallControl, Times?, Extensions.ParticipantType>? EditTimesRequested;
|
||||
internal event Action<ShipcallControl, Times?, Extensions.ParticipantType>? EditTimesRequested;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -48,6 +49,11 @@ namespace BreCalClient
|
||||
/// </summary>
|
||||
public Dictionary<int, Participant>? ParticipantDict { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For berth name lookup
|
||||
/// </summary>
|
||||
public List<Berth>? Berths {get; set;}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public methods
|
||||
@ -150,46 +156,48 @@ namespace BreCalClient
|
||||
if (this.ShipcallControlModel != null)
|
||||
{
|
||||
foreach (Times times in this.ShipcallControlModel.Times)
|
||||
{
|
||||
if(this.ParticipantDict.ContainsKey(times.ParticipantId))
|
||||
{
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.AGENCY)
|
||||
{
|
||||
if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.AGENCY))
|
||||
{
|
||||
this.labelAgencyETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelAgencyETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockAgencyRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.MOORING))
|
||||
{
|
||||
this.labelMooringETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelMooringETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockMooringRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION))
|
||||
{
|
||||
this.labelPortAuthorityETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelPortAuthorityETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockPortAuthorityRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.PILOT))
|
||||
{
|
||||
this.labelPilotETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelPilotETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockPilotRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.TUG))
|
||||
{
|
||||
this.labelTugETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelTugETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockTugRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.TERMINAL))
|
||||
{
|
||||
this.labelTerminalETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelTerminalETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockTerminalRemarks.Text = times.Remarks;
|
||||
}
|
||||
this.labelAgencyETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelAgencyETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockAgencyRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (times.ParticipantType == (int) Extensions.ParticipantType.MOORING)
|
||||
{
|
||||
this.labelMooringETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelMooringETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockMooringRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.PORT_ADMINISTRATION)
|
||||
{
|
||||
this.labelPortAuthorityETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelPortAuthorityETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockPortAuthorityRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.PILOT)
|
||||
{
|
||||
this.labelPilotETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelPilotETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockPilotRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.TUG)
|
||||
{
|
||||
this.labelTugETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelTugETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockTugRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.TERMINAL)
|
||||
{
|
||||
if (this.Berths != null)
|
||||
{
|
||||
Berth? berth = this.Berths.Find((x) => x.Id == times.BerthId);
|
||||
this.labelTerminalBerth.Content = (berth != null) ? berth.Name : "";
|
||||
}
|
||||
this.labelOperationsStart.Content = times.OperationsStart.HasValue ? times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelOperationsEnd.Content = times.OperationsEnd.HasValue ? times.OperationsEnd.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockTerminalRemarks.Text = times.Remarks;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,8 +228,7 @@ namespace BreCalClient
|
||||
{
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.AGENCY)))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.AGENCY);
|
||||
this.EditRequested?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ namespace BreCalClient
|
||||
|
||||
public string? Berth { get; set; }
|
||||
|
||||
public Dictionary<int, Participant> AssignedParticipants { get; } = new();
|
||||
internal Dictionary<Extensions.ParticipantType, Participant> AssignedParticipants { get; } = new();
|
||||
|
||||
public List<Times> Times { get; set; } = new();
|
||||
|
||||
@ -86,11 +86,15 @@ namespace BreCalClient
|
||||
{
|
||||
foreach (int participantId in Shipcall.Participants)
|
||||
{
|
||||
foreach(Participant participant in participants)
|
||||
Participant? participant = participants.Find((x) => x.Id == participantId);
|
||||
if (participant != null)
|
||||
{
|
||||
if(participant.Id == participantId)
|
||||
AssignedParticipants[participant.Type] = participant;
|
||||
}
|
||||
foreach(Extensions.ParticipantType participantType in Enum.GetValues(typeof(Extensions.ParticipantType)))
|
||||
{
|
||||
if(participant.IsTypeFlagSet(participantType))
|
||||
AssignedParticipants[participantType] = participant;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,11 +102,11 @@ namespace BreCalClient
|
||||
internal Times? GetTimesForParticipantType(Extensions.ParticipantType type)
|
||||
{
|
||||
|
||||
if (AssignedParticipants.ContainsKey((int)type)) {
|
||||
int participantId = AssignedParticipants[(int)type].Id;
|
||||
if (AssignedParticipants.ContainsKey(type)) {
|
||||
int participantId = AssignedParticipants[type].Id;
|
||||
foreach (Times times in this.Times)
|
||||
{
|
||||
if (times.ParticipantId == participantId)
|
||||
if ((times.ParticipantId == participantId) && (times.ParticipantType == (int) type))
|
||||
return times;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ def GetTimes(options):
|
||||
commands = pydapper.using(pooledConnection)
|
||||
data = commands.query("SELECT id, eta_berth, eta_berth_fixed, etd_berth, etd_berth_fixed, lock_time, lock_time_fixed, " +
|
||||
"zone_entry, zone_entry_fixed, operations_start, operations_end, remarks, shipcall_id, participant_id, " +
|
||||
"berth_id, berth_info, pier_side, created, modified FROM times " +
|
||||
"berth_id, berth_info, pier_side, participant_type, created, modified FROM times " +
|
||||
"WHERE times.shipcall_id = ?scid?", model=model.Times, param={"scid" : options["shipcall_id"]})
|
||||
pooledConnection.close()
|
||||
|
||||
|
||||
@ -146,6 +146,7 @@ class TimesSchema(Schema):
|
||||
berth_info = fields.String(Required = False, allow_none=True)
|
||||
pier_side = fields.Bool(Required = False, allow_none = True)
|
||||
shipcall_id = fields.Int(Required = True)
|
||||
participant_type = fields.Int(Required = False, allow_none=True)
|
||||
created = fields.DateTime(Required = False, allow_none=True)
|
||||
modified = fields.DateTime(Required = False, allow_none=True)
|
||||
|
||||
@ -181,6 +182,7 @@ class Times:
|
||||
berth_id: int
|
||||
berth_info: str
|
||||
pier_side: bool
|
||||
participant_type: int
|
||||
shipcall_id: int
|
||||
created: datetime
|
||||
modified: datetime
|
||||
|
||||
Loading…
Reference in New Issue
Block a user