Merge branch 'feature/client_with_ports' into develop
This commit is contained in:
commit
12c1fc59b1
1982
misc/BreCalApi.cs
1982
misc/BreCalApi.cs
File diff suppressed because it is too large
Load Diff
@ -1858,6 +1858,22 @@ components:
|
||||
maxLength: 5
|
||||
minLength: 5
|
||||
example: DEHAM
|
||||
created:
|
||||
description: Readonly field set by the database when port was created
|
||||
type: string
|
||||
format: date-time
|
||||
example: '2023-08-21T08:23:35Z'
|
||||
modified:
|
||||
description: Readonly field set by the database when port was last modified
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
example: '2023-08-21T08:23:35Z'
|
||||
deleted:
|
||||
description: marks the port as logically deleted
|
||||
type: boolean
|
||||
default: false
|
||||
example: false
|
||||
example:
|
||||
id: 2
|
||||
name: Hamburg
|
||||
|
||||
23
misc/clear_entries_for_participant.sql
Normal file
23
misc/clear_entries_for_participant.sql
Normal file
@ -0,0 +1,23 @@
|
||||
DELETE FROM times WHERE
|
||||
times.shipcall_id IN
|
||||
(
|
||||
SELECT s.id FROM shipcall s
|
||||
JOIN shipcall_participant_map spm ON s.id = spm.shipcall_id
|
||||
JOIN participant p ON spm.participant_id = p.id
|
||||
WHERE p.id = 10
|
||||
);
|
||||
|
||||
DELETE `history` FROM `history`
|
||||
JOIN shipcall s on `history`.shipcall_id = s.id
|
||||
JOIN shipcall_participant_map spm ON s.id = spm.shipcall_id
|
||||
WHERE spm.participant_id = 10;
|
||||
|
||||
-- damit das hier funktioniert muss der FK in shipcall_participant_map von "RESTRICT" auf "SET NULL"
|
||||
-- geändert werden
|
||||
|
||||
DELETE shipcall FROM shipcall
|
||||
INNER JOIN shipcall_participant_map spm ON shipcall.id = spm.shipcall_id
|
||||
JOIN participant p ON spm.participant_id = p.id
|
||||
WHERE p.id = 10;
|
||||
|
||||
DELETE FROM shipcall_participant_map WHERE participant_id = 10;
|
||||
@ -1 +1 @@
|
||||
1.6.0.0
|
||||
1.6.0.1
|
||||
@ -8,8 +8,8 @@
|
||||
<SignAssembly>True</SignAssembly>
|
||||
<StartupObject>BreCalClient.App</StartupObject>
|
||||
<AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile>
|
||||
<AssemblyVersion>1.6.0.0</AssemblyVersion>
|
||||
<FileVersion>1.6.0.0</FileVersion>
|
||||
<AssemblyVersion>1.6.0.1</AssemblyVersion>
|
||||
<FileVersion>1.6.0.1</FileVersion>
|
||||
<Title>Bremen calling client</Title>
|
||||
<Description>A Windows WPF client for the Bremen calling API.</Description>
|
||||
<ApplicationIcon>containership.ico</ApplicationIcon>
|
||||
|
||||
@ -25,16 +25,19 @@ namespace BreCalClient
|
||||
private static List<Participant> _participants = new();
|
||||
private static readonly List<ShipModel> _ships = new();
|
||||
private static readonly List<ShipModel> _allShips = new();
|
||||
private static readonly List<Port> _ports = new();
|
||||
private static readonly List<Port> _allPorts = new();
|
||||
|
||||
private readonly static ConcurrentDictionary<int, ShipModel> _shipLookupDict = new();
|
||||
private readonly static ConcurrentDictionary<int, Berth> _berthLookupDict = new();
|
||||
private readonly static Dictionary<int, Participant> _participantLookupDict = new();
|
||||
private readonly static ConcurrentDictionary<int, Port> _portLookupDict = new();
|
||||
|
||||
/// <summary>
|
||||
/// List of TimeRef points
|
||||
/// </summary>
|
||||
// TODO: To make this portable the list of texts should come from a configuration file
|
||||
private readonly static List<string> _timeRefs = new List<string>
|
||||
private readonly static List<string> _timeRefs = new()
|
||||
{
|
||||
"ETB",
|
||||
"Geeste",
|
||||
@ -45,12 +48,26 @@ namespace BreCalClient
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// fast ship lookup
|
||||
/// </summary>
|
||||
public static ConcurrentDictionary<int, ShipModel> ShipLookupDict { get { return _shipLookupDict; } }
|
||||
|
||||
/// <summary>
|
||||
/// fast port lookup
|
||||
/// </summary>
|
||||
public static ConcurrentDictionary<int, Berth> BerthLookupDict { get { return _berthLookupDict; } }
|
||||
|
||||
/// <summary>
|
||||
/// fast participant lookup
|
||||
/// </summary>
|
||||
public static Dictionary<int, Participant> ParticipantLookupDict { get { return _participantLookupDict; } }
|
||||
|
||||
/// <summary>
|
||||
/// fast port lookup
|
||||
/// </summary>
|
||||
public static ConcurrentDictionary<int, Port> PortLookupDict { get { return _portLookupDict; } }
|
||||
|
||||
/// <summary>
|
||||
/// Participants that are agents
|
||||
/// </summary>
|
||||
@ -91,6 +108,16 @@ namespace BreCalClient
|
||||
/// </summary>
|
||||
public static List<Berth> AllBerths { get { return _allBerths; } }
|
||||
|
||||
/// <summary>
|
||||
/// All active ports
|
||||
/// </summary>
|
||||
public static List<Port> Ports { get { return _ports; } }
|
||||
|
||||
/// <summary>
|
||||
/// All ports including deleted ports
|
||||
/// </summary>
|
||||
public static List<Port> AllPorts { get { return _allPorts; } }
|
||||
|
||||
/// <summary>
|
||||
/// All active ships
|
||||
/// </summary>
|
||||
@ -108,7 +135,33 @@ namespace BreCalClient
|
||||
|
||||
#endregion
|
||||
|
||||
#region methods
|
||||
#region public static methods
|
||||
|
||||
public static List<Berth> GetBerthsByPort(int port)
|
||||
{
|
||||
List<Berth> berths = new();
|
||||
foreach(Berth berth in _berths)
|
||||
{
|
||||
if(berth.PortId == port)
|
||||
berths.Add(berth);
|
||||
}
|
||||
return berths;
|
||||
}
|
||||
|
||||
public static List<Participant> GetParticipants(int port, Extensions.ParticipantType type)
|
||||
{
|
||||
List<Participant> participants = new();
|
||||
foreach(Participant participant in _participants)
|
||||
{
|
||||
if(participant.IsTypeFlagSet(type) && participant.Ports.Contains(port))
|
||||
participants.Add(participant);
|
||||
}
|
||||
return participants;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal initializer methods
|
||||
|
||||
internal static void InitializeParticipants(List<Participant> participants)
|
||||
{
|
||||
@ -157,6 +210,17 @@ namespace BreCalClient
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InitializePorts(List<Port> ports)
|
||||
{
|
||||
foreach(var port in ports)
|
||||
{
|
||||
_portLookupDict[port.Id] = port;
|
||||
if(!port.Deleted)
|
||||
_ports.Add(port);
|
||||
_allPorts.Add(port);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@ -44,7 +44,9 @@
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownWidth" Margin="2" Grid.Column="1" Grid.Row="4" FormatString="N2" IsReadOnly="True" IsEnabled="False" ShowButtonSpinner="False"/>
|
||||
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="5" HorizontalContentAlignment="Right" />
|
||||
<CheckBox x:Name="checkBoxCancelled" Grid.Column="1" Grid.Row="5" Margin="2" VerticalContentAlignment="Center" />
|
||||
<Button x:Name="buttonEditShips" Grid.Column="1" Grid.Row="6" Margin="2" Content="{x:Static p:Resources.textEditShips}" Click="buttonEditShips_Click" Visibility="Hidden" />
|
||||
<Label Content="{x:Static p:Resources.textHarbour}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right" />
|
||||
<ComboBox x:Name="comboBoxHarbour" Grid.Column="1" Margin="2" Grid.Row="6" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxHarbour_SelectionChanged"/>
|
||||
<Button x:Name="buttonEditShips" Grid.Column="1" Grid.Row="7" Margin="2" Content="{x:Static p:Resources.textEditShips}" Click="buttonEditShips_Click" Visibility="Hidden" />
|
||||
|
||||
<Label Content="{x:Static p:Resources.textType}" Grid.Column="2" Grid.Row="0" HorizontalContentAlignment="Right" />
|
||||
|
||||
|
||||
@ -63,6 +63,7 @@ namespace BreCalClient
|
||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||
|
||||
this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs;
|
||||
this.comboBoxHarbour.ItemsSource = BreCalLists.Ports;
|
||||
|
||||
this.integerUpDownShiftingCount.Value = this.ShipcallModel.ShiftSequence;
|
||||
|
||||
@ -192,6 +193,7 @@ namespace BreCalClient
|
||||
|
||||
isEnabled &= this.comboBoxShip.SelectedItem != null;
|
||||
isEnabled &= this.comboBoxCategories.SelectedItem != null;
|
||||
isEnabled &= this.comboBoxHarbour.SelectedItem != null;
|
||||
|
||||
if (comboBoxCategories.SelectedItem == null)
|
||||
{
|
||||
@ -313,7 +315,7 @@ namespace BreCalClient
|
||||
|
||||
// set the time reference value (which point do all times refer to?)
|
||||
this.ShipcallModel.Shipcall.TimeRefPoint = this.comboBoxTimeRef.SelectedIndex;
|
||||
|
||||
this.ShipcallModel.Shipcall.PortId = ((Port) this.comboBoxHarbour.SelectedItem).Id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,6 +359,10 @@ namespace BreCalClient
|
||||
this.comboBoxAgency.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (BreCalLists.PortLookupDict.ContainsKey(this.ShipcallModel.Shipcall.PortId))
|
||||
this.comboBoxHarbour.SelectedValue = this.ShipcallModel.Shipcall.PortId;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,6 +438,24 @@ namespace BreCalClient
|
||||
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
||||
}
|
||||
|
||||
private void comboBoxHarbour_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
Port port = (Port)this.comboBoxHarbour.SelectedItem;
|
||||
if (port == null) return;
|
||||
|
||||
// Filter berth selection combobox by port
|
||||
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(port.Id);
|
||||
this.comboBoxArrivalBerth.ItemsSource = null;
|
||||
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
|
||||
this.comboBoxDepartureBerth.ItemsSource = null;
|
||||
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
|
||||
|
||||
// Filter agency combobox by port
|
||||
List<Participant> availableAgencies = BreCalLists.GetParticipants(port.Id, ParticipantType.AGENCY);
|
||||
this.comboBoxAgency.ItemsSource = null;
|
||||
this.comboBoxAgency.ItemsSource = availableAgencies;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
using BreCalClient.misc.Model;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows;
|
||||
using static BreCalClient.Extensions;
|
||||
|
||||
@ -42,19 +41,27 @@ namespace BreCalClient
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxMooring.ItemsSource = BreCalLists.Participants_Mooring;
|
||||
this.comboBoxPilot.ItemsSource = BreCalLists.Participants_Pilot;
|
||||
this.comboBoxTug.ItemsSource = BreCalLists.Participants_Tug;
|
||||
this.comboBoxTerminal.ItemsSource = BreCalLists.Participants_Terminal;
|
||||
|
||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
||||
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
|
||||
{
|
||||
int portId = this.ShipcallModel.Shipcall.PortId;
|
||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.GetBerthsByPort(portId);
|
||||
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
|
||||
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
|
||||
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
|
||||
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
|
||||
}
|
||||
|
||||
this.CopyToControls();
|
||||
|
||||
this.Title = this.ShipcallModel.Title;
|
||||
this.Title = this.ShipcallModel?.Title;
|
||||
|
||||
Participant? p = null;
|
||||
if(this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
if (this.ShipcallModel != null)
|
||||
{
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
}
|
||||
|
||||
bool allowBSMD = false;
|
||||
if (p != null)
|
||||
|
||||
@ -49,20 +49,27 @@ namespace BreCalClient
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxMooring.ItemsSource = BreCalLists.Participants_Mooring;
|
||||
this.comboBoxPilot.ItemsSource = BreCalLists.Participants_Pilot;
|
||||
this.comboBoxTug.ItemsSource = BreCalLists.Participants_Tug;
|
||||
this.comboBoxTerminal.ItemsSource = BreCalLists.Participants_Terminal;
|
||||
|
||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
|
||||
{
|
||||
int portId = this.ShipcallModel.Shipcall.PortId;
|
||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.GetBerthsByPort(portId);
|
||||
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
|
||||
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
|
||||
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
|
||||
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
|
||||
}
|
||||
|
||||
this.CopyToControls();
|
||||
|
||||
this.Title = this.ShipcallModel.Title;
|
||||
this.Title = this.ShipcallModel?.Title;
|
||||
|
||||
Participant? p = null;
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
|
||||
if (this.ShipcallModel != null)
|
||||
{
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
}
|
||||
bool allowBSMD = false;
|
||||
if (p != null)
|
||||
{
|
||||
|
||||
@ -4,7 +4,9 @@
|
||||
|
||||
using BreCalClient.misc.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using static BreCalClient.Extensions;
|
||||
|
||||
namespace BreCalClient
|
||||
@ -41,20 +43,29 @@ namespace BreCalClient
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxMooring.ItemsSource = BreCalLists.Participants_Mooring;
|
||||
this.comboBoxPilot.ItemsSource = BreCalLists.Participants_Pilot;
|
||||
this.comboBoxTug.ItemsSource = BreCalLists.Participants_Tug;
|
||||
this.comboBoxTerminal.ItemsSource = BreCalLists.Participants_Terminal;
|
||||
|
||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
||||
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
|
||||
{
|
||||
int portId = this.ShipcallModel.Shipcall.PortId;
|
||||
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(portId);
|
||||
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
|
||||
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
|
||||
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
|
||||
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
|
||||
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
|
||||
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
|
||||
}
|
||||
|
||||
this.CopyToControls();
|
||||
|
||||
this.Title = this.ShipcallModel.Title;
|
||||
|
||||
Participant? p = null;
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
|
||||
if (this.ShipcallModel != null)
|
||||
{
|
||||
this.Title = this.ShipcallModel.Title;
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
}
|
||||
|
||||
bool allowBSMD = false;
|
||||
if (p != null)
|
||||
|
||||
@ -30,7 +30,10 @@ namespace BreCalClient
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxBerth.ItemsSource = BreCalLists.Berths;
|
||||
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
|
||||
this.comboBoxBerth.ItemsSource = BreCalLists.GetBerthsByPort(this.ShipcallModel.Shipcall.PortId);
|
||||
else
|
||||
this.comboBoxBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.CopyToControls();
|
||||
this.EnableControls();
|
||||
}
|
||||
|
||||
@ -73,9 +73,19 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Margin="2" Grid.Column="0" Content="{x:Static p:Resources.textNewDots}" x:Name="buttonNew" Visibility="Hidden" Click="buttonNew_Click" Background="Transparent"/>
|
||||
<Label Content="{x:Static p:Resources.textSortOrder}" Grid.Column="1" HorizontalContentAlignment="Right"/>
|
||||
<ComboBox x:Name="comboBoxSortOrder" Margin="2" Grid.Column="2" SelectionChanged="comboBoxSortOrder_SelectionChanged" />
|
||||
<CheckBox x:Name="checkboxShowCancelledCalls" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="2" Checked="checkboxShowCancelledCalls_Checked" Unchecked="checkboxShowCancelledCalls_Checked" />
|
||||
<Label Content="{x:Static p:Resources.textShowCancelledShipcalls}" Grid.Column="4" />
|
||||
<Grid Grid.Column="2" Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width=".5*" />
|
||||
<ColumnDefinition Width="30" />
|
||||
<ColumnDefinition Width=".5*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox x:Name="comboBoxSortOrder" Margin="2" Grid.Column="0" SelectionChanged="comboBoxSortOrder_SelectionChanged" />
|
||||
<CheckBox x:Name="checkboxShowCancelledCalls" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="2" Checked="checkboxShowCancelledCalls_Checked" Unchecked="checkboxShowCancelledCalls_Checked" />
|
||||
<Label Content="{x:Static p:Resources.textShowCancelledShipcalls}" Grid.Column="2" />
|
||||
</Grid>
|
||||
<Label Content="{x:Static p:Resources.textHarbour}" Grid.Column="3" HorizontalAlignment="Right" />
|
||||
<xctk:CheckComboBox x:Name="comboBoxPorts" Margin="2" Grid.Column="4" ItemSelectionChanged="comboBoxPorts_ItemSelectionChanged" DisplayMemberPath="Name" />
|
||||
|
||||
<Button Margin="2" Grid.Column="6" Content="{x:Static p:Resources.textClearFilters}" x:Name="buttonClearFilter" Click="buttonClearFilter_Click" Background="Transparent" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="2">
|
||||
|
||||
@ -287,6 +287,7 @@ namespace BreCalClient
|
||||
}
|
||||
};
|
||||
scmOut.Shipcall.ShipId = esc.ShipcallModel.Shipcall.ShipId;
|
||||
scmOut.Shipcall.PortId = esc.ShipcallModel.Shipcall.PortId;
|
||||
scmOut.Ship = esc.ShipcallModel.Ship;
|
||||
DateTime eta = esc.ShipcallModel.Shipcall?.Eta ?? DateTime.Now;
|
||||
scmOut.Shipcall.Etd = eta.AddDays(2);
|
||||
@ -349,6 +350,7 @@ namespace BreCalClient
|
||||
{
|
||||
this.searchFilterControl.ClearFilters();
|
||||
this.checkboxShowCancelledCalls.IsChecked = false;
|
||||
this.comboBoxPorts.UnSelectAll();
|
||||
this.FilterShipcalls();
|
||||
}
|
||||
|
||||
@ -366,6 +368,14 @@ namespace BreCalClient
|
||||
this.SearchFilterControl_SearchFilterChanged();
|
||||
}
|
||||
|
||||
private void comboBoxPorts_ItemSelectionChanged(object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e)
|
||||
{
|
||||
this.searchFilterControl.SearchFilter.Ports.Clear();
|
||||
foreach (Port port in comboBoxPorts.SelectedItems)
|
||||
this.searchFilterControl.SearchFilter.Ports.Add(port.Id);
|
||||
this.SearchFilterControl_SearchFilterChanged();
|
||||
}
|
||||
|
||||
private async void comboBoxSortOrder_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
_sortOrder = (Extensions.SortOrder) this.comboBoxSortOrder.SelectedIndex;
|
||||
@ -409,11 +419,13 @@ namespace BreCalClient
|
||||
{
|
||||
if (_loginResult == null) return;
|
||||
|
||||
BreCalLists.InitializePorts(await _staticApi.GetPortsAsync());
|
||||
BreCalLists.InitializeBerths(await _staticApi.BerthsGetAsync());
|
||||
BreCalLists.InitializeShips(await _shipApi.ShipsGetAsync());
|
||||
BreCalLists.InitializeParticipants(await _staticApi.ParticipantsGetAsync());
|
||||
|
||||
this.searchFilterControl.SetBerths(BreCalLists.Berths);
|
||||
this.comboBoxPorts.ItemsSource = BreCalLists.AllPorts;
|
||||
|
||||
foreach (Participant participant in BreCalLists.Participants)
|
||||
{
|
||||
@ -448,6 +460,14 @@ namespace BreCalClient
|
||||
SearchFilterModel.filterMap[_loginResult.Id] = currentFilter;
|
||||
}
|
||||
this.searchFilterControl.SetFilterFromModel(currentFilter);
|
||||
|
||||
if (currentFilter.Ports != null)
|
||||
{
|
||||
foreach (Port p in this.comboBoxPorts.ItemsSource)
|
||||
{
|
||||
if (currentFilter.Ports.Contains(p.Id)) this.comboBoxPorts.SelectedItems.Add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_ = Task.Run(() => RefreshShipcalls());
|
||||
@ -700,6 +720,11 @@ namespace BreCalClient
|
||||
_ = this._visibleControlModels.RemoveAll(x => { if (x.Shipcall == null) return false; else return !sfm.Categories.Contains(x.Shipcall.Type); });
|
||||
}
|
||||
|
||||
if(sfm.Ports.Count > 0 )
|
||||
{
|
||||
_ = this._visibleControlModels.RemoveAll(x => { if(x.Shipcall == null) return false; else return !sfm.Ports.Contains(x.Shipcall.PortId); });
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(sfm.SearchString))
|
||||
{
|
||||
_ = this._visibleControlModels.RemoveAll(x => !(x.ContainsRemarkText(sfm.SearchString) || (x.Ship?.Name.Contains(sfm.SearchString, StringComparison.InvariantCultureIgnoreCase) ?? false)));
|
||||
|
||||
@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>1.6.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>1.6.0.1</ApplicationVersion>
|
||||
<BootstrapperEnabled>True</BootstrapperEnabled>
|
||||
<Configuration>Debug</Configuration>
|
||||
<CreateDesktopShortcut>True</CreateDesktopShortcut>
|
||||
|
||||
@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.6.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>1.6.0.1</ApplicationVersion>
|
||||
<BootstrapperEnabled>True</BootstrapperEnabled>
|
||||
<Configuration>Debug</Configuration>
|
||||
<CreateDesktopShortcut>True</CreateDesktopShortcut>
|
||||
|
||||
9
src/BreCalClient/Resources/Resources.Designer.cs
generated
9
src/BreCalClient/Resources/Resources.Designer.cs
generated
@ -731,6 +731,15 @@ namespace BreCalClient.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Harbour.
|
||||
/// </summary>
|
||||
public static string textHarbour {
|
||||
get {
|
||||
return ResourceManager.GetString("textHarbour", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Incoming.
|
||||
/// </summary>
|
||||
|
||||
@ -546,5 +546,7 @@
|
||||
</data>
|
||||
<data name="textTooFarInTheFuture" xml:space="preserve">
|
||||
<value>Eine Zeiteingabe ist zu weit in der Zukunft</value>
|
||||
<data name="textHarbour" xml:space="preserve">
|
||||
<value>Hafen</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -328,6 +328,9 @@
|
||||
<data name="textFrom" xml:space="preserve">
|
||||
<value>from</value>
|
||||
</data>
|
||||
<data name="textHarbour" xml:space="preserve">
|
||||
<value>Harbour</value>
|
||||
</data>
|
||||
<data name="textIncoming" xml:space="preserve">
|
||||
<value>Incoming</value>
|
||||
</data>
|
||||
|
||||
@ -25,6 +25,8 @@ namespace BreCalClient
|
||||
|
||||
public List<int> Berths { get; set; } = new();
|
||||
|
||||
public List<int> Ports { get; set; } = new();
|
||||
|
||||
public string? SearchString { get; set; }
|
||||
|
||||
public double? ShipLengthFrom { get; set; }
|
||||
|
||||
@ -76,24 +76,20 @@
|
||||
<TextBlock x:Name="textBlockLengthWidth" Padding="0"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{x:Static p:Resources.textDraft}" Padding="0" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left">
|
||||
<TextBlock x:Name="textBlockDraft" Padding="0"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left">
|
||||
<TextBlock Text="ETA" x:Name="labelETA"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left">
|
||||
<Viewbox Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left">
|
||||
<TextBlock x:Name="textBlockETA" Padding="0" FontWeight="DemiBold"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left">
|
||||
<Viewbox Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{x:Static p:Resources.textBerth}"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left">
|
||||
<Viewbox Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left">
|
||||
<TextBlock x:Name="textBlockBerth" Padding="0" FontWeight="DemiBold" />
|
||||
</Viewbox>
|
||||
|
||||
<Viewbox Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left">
|
||||
<TextBlock x:Name="textBlockHarbour" Padding="0" FontWeight="DemiBold" />
|
||||
</Viewbox>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ namespace BreCalClient
|
||||
|
||||
string agentName = "";
|
||||
string? name;
|
||||
_agency = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.AGENCY);
|
||||
_agency = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.AGENCY);
|
||||
name = _agency?.Name;
|
||||
if (name != null) agentName = name;
|
||||
this.labelAgent.Content = name ?? "- / -";
|
||||
@ -83,10 +83,9 @@ namespace BreCalClient
|
||||
this.labelAgencyETAETDValue.Content = "";
|
||||
this.textBlockAgencyRemarks.Text = "";
|
||||
this.textBlockAgencyBerthRemarks.Text = "";
|
||||
this.textBlockDraft.Text = "";
|
||||
}
|
||||
|
||||
_mooring = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.MOORING);
|
||||
_mooring = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.MOORING);
|
||||
name = _mooring?.Name;
|
||||
this.labelMooring.Content = name ?? "- / -";
|
||||
if(_mooring == null)
|
||||
@ -95,7 +94,7 @@ namespace BreCalClient
|
||||
this.textBlockMooringRemarks.Text = "";
|
||||
}
|
||||
|
||||
_pilot = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.PILOT);
|
||||
_pilot = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.PILOT);
|
||||
name = _pilot?.Name;
|
||||
this.labelPilot.Content = name ?? "- / - ";
|
||||
if(_pilot == null)
|
||||
@ -104,7 +103,7 @@ namespace BreCalClient
|
||||
this.textBlockPilotRemarks.Text = "";
|
||||
}
|
||||
|
||||
_tug = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.TUG);
|
||||
_tug = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.TUG);
|
||||
name = _tug?.Name;
|
||||
this.labelTug.Content = name ?? "- / - ";
|
||||
if(_tug == null)
|
||||
@ -113,7 +112,7 @@ namespace BreCalClient
|
||||
this.textBlockTugRemarks.Text = "";
|
||||
}
|
||||
|
||||
_port_administration = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
_port_administration = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
name = _port_administration?.Name;
|
||||
this.labelPortAuthority.Content = name ?? "- / - ";
|
||||
if(_port_administration == null)
|
||||
@ -122,7 +121,7 @@ namespace BreCalClient
|
||||
this.textBlockPortAuthorityRemarks.Text = "";
|
||||
}
|
||||
|
||||
_terminal = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.TERMINAL);
|
||||
_terminal = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.TERMINAL);
|
||||
name = _terminal?.Name;
|
||||
this.labelTerminal.Content = name ?? "- / - ";
|
||||
if(_terminal == null)
|
||||
@ -315,6 +314,8 @@ namespace BreCalClient
|
||||
|
||||
if (this.ShipcallControlModel != null)
|
||||
{
|
||||
this.textBlockHarbour.Text = ((ShipcallControlModel != null) && (ShipcallControlModel.Shipcall != null) && BreCalLists.PortLookupDict.ContainsKey(ShipcallControlModel.Shipcall.PortId)) ?
|
||||
BreCalLists.PortLookupDict[ShipcallControlModel.Shipcall.PortId].Name : "";
|
||||
|
||||
Times? agencyTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
||||
if (agencyTimes != null)
|
||||
@ -323,7 +324,6 @@ namespace BreCalClient
|
||||
this.labelAgencyETAETDValue.Content = agencyTimes.DisplayTime(this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival);
|
||||
this.textBlockAgencyRemarks.Text = agencyTimes.Remarks.TruncateDots(50);
|
||||
this.textBlockAgencyBerthRemarks.Text = agencyTimes.BerthInfo.TruncateDots(50);
|
||||
this.textBlockDraft.Text = ShipcallControlModel?.Shipcall?.Draft?.ToString("N2");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -332,7 +332,6 @@ namespace BreCalClient
|
||||
this.labelAgencyETAETDValue.Content = "- / -";
|
||||
this.textBlockAgencyRemarks.Text = "";
|
||||
this.textBlockAgencyBerthRemarks.Text = "";
|
||||
this.textBlockDraft.Text = "";
|
||||
}
|
||||
|
||||
Times? mooringTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING);
|
||||
|
||||
@ -45,6 +45,12 @@ namespace RoleEditor
|
||||
else
|
||||
this.Berth.Authority_Id = null;
|
||||
|
||||
this.Berth.Port = this.comboBoxPorts.SelectedItem as Port;
|
||||
if (this.Berth.Port != null)
|
||||
this.Berth.Port_Id = this.Berth.Port.Id;
|
||||
else
|
||||
this.Berth.Port_Id = null;
|
||||
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>Resources\lock_preferences.ico</ApplicationIcon>
|
||||
<FileVersion>1.6.0.0</FileVersion>
|
||||
<AssemblyVersion>1.6.0.0</AssemblyVersion>
|
||||
<FileVersion>1.6.0.1</FileVersion>
|
||||
<AssemblyVersion>1.6.0.1</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user