Merge branch 'feature/client_with_ports' into develop

This commit is contained in:
Daniel Schick 2024-09-19 09:45:38 +02:00
commit 12c1fc59b1
24 changed files with 567 additions and 1820 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1858,6 +1858,22 @@ components:
maxLength: 5 maxLength: 5
minLength: 5 minLength: 5
example: DEHAM 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: example:
id: 2 id: 2
name: Hamburg name: Hamburg

View 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;

View File

@ -1 +1 @@
1.6.0.0 1.6.0.1

View File

@ -8,8 +8,8 @@
<SignAssembly>True</SignAssembly> <SignAssembly>True</SignAssembly>
<StartupObject>BreCalClient.App</StartupObject> <StartupObject>BreCalClient.App</StartupObject>
<AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.6.0.0</AssemblyVersion> <AssemblyVersion>1.6.0.1</AssemblyVersion>
<FileVersion>1.6.0.0</FileVersion> <FileVersion>1.6.0.1</FileVersion>
<Title>Bremen calling client</Title> <Title>Bremen calling client</Title>
<Description>A Windows WPF client for the Bremen calling API.</Description> <Description>A Windows WPF client for the Bremen calling API.</Description>
<ApplicationIcon>containership.ico</ApplicationIcon> <ApplicationIcon>containership.ico</ApplicationIcon>

View File

@ -25,16 +25,19 @@ namespace BreCalClient
private static List<Participant> _participants = new(); private static List<Participant> _participants = new();
private static readonly List<ShipModel> _ships = new(); private static readonly List<ShipModel> _ships = new();
private static readonly List<ShipModel> _allShips = 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, ShipModel> _shipLookupDict = new();
private readonly static ConcurrentDictionary<int, Berth> _berthLookupDict = new(); private readonly static ConcurrentDictionary<int, Berth> _berthLookupDict = new();
private readonly static Dictionary<int, Participant> _participantLookupDict = new(); private readonly static Dictionary<int, Participant> _participantLookupDict = new();
private readonly static ConcurrentDictionary<int, Port> _portLookupDict = new();
/// <summary> /// <summary>
/// List of TimeRef points /// List of TimeRef points
/// </summary> /// </summary>
// TODO: To make this portable the list of texts should come from a configuration file // 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", "ETB",
"Geeste", "Geeste",
@ -45,12 +48,26 @@ namespace BreCalClient
#region Properties #region Properties
/// <summary>
/// fast ship lookup
/// </summary>
public static ConcurrentDictionary<int, ShipModel> ShipLookupDict { get { return _shipLookupDict; } } public static ConcurrentDictionary<int, ShipModel> ShipLookupDict { get { return _shipLookupDict; } }
/// <summary>
/// fast port lookup
/// </summary>
public static ConcurrentDictionary<int, Berth> BerthLookupDict { get { return _berthLookupDict; } } public static ConcurrentDictionary<int, Berth> BerthLookupDict { get { return _berthLookupDict; } }
/// <summary>
/// fast participant lookup
/// </summary>
public static Dictionary<int, Participant> ParticipantLookupDict { get { return _participantLookupDict; } } public static Dictionary<int, Participant> ParticipantLookupDict { get { return _participantLookupDict; } }
/// <summary>
/// fast port lookup
/// </summary>
public static ConcurrentDictionary<int, Port> PortLookupDict { get { return _portLookupDict; } }
/// <summary> /// <summary>
/// Participants that are agents /// Participants that are agents
/// </summary> /// </summary>
@ -91,6 +108,16 @@ namespace BreCalClient
/// </summary> /// </summary>
public static List<Berth> AllBerths { get { return _allBerths; } } 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> /// <summary>
/// All active ships /// All active ships
/// </summary> /// </summary>
@ -108,7 +135,33 @@ namespace BreCalClient
#endregion #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) 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 #endregion
} }

View File

@ -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"/> <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" /> <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" /> <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" /> <Label Content="{x:Static p:Resources.textType}" Grid.Column="2" Grid.Row="0" HorizontalContentAlignment="Right" />

View File

@ -63,6 +63,7 @@ namespace BreCalClient
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths; this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs; this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs;
this.comboBoxHarbour.ItemsSource = BreCalLists.Ports;
this.integerUpDownShiftingCount.Value = this.ShipcallModel.ShiftSequence; this.integerUpDownShiftingCount.Value = this.ShipcallModel.ShiftSequence;
@ -192,6 +193,7 @@ namespace BreCalClient
isEnabled &= this.comboBoxShip.SelectedItem != null; isEnabled &= this.comboBoxShip.SelectedItem != null;
isEnabled &= this.comboBoxCategories.SelectedItem != null; isEnabled &= this.comboBoxCategories.SelectedItem != null;
isEnabled &= this.comboBoxHarbour.SelectedItem != null;
if (comboBoxCategories.SelectedItem == null) if (comboBoxCategories.SelectedItem == null)
{ {
@ -313,7 +315,7 @@ namespace BreCalClient
// set the time reference value (which point do all times refer to?) // set the time reference value (which point do all times refer to?)
this.ShipcallModel.Shipcall.TimeRefPoint = this.comboBoxTimeRef.SelectedIndex; 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; 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; 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 #endregion
} }

View File

@ -4,7 +4,6 @@
using BreCalClient.misc.Model; using BreCalClient.misc.Model;
using System; using System;
using System.Runtime.Serialization;
using System.Windows; using System.Windows;
using static BreCalClient.Extensions; using static BreCalClient.Extensions;
@ -42,19 +41,27 @@ namespace BreCalClient
private void Window_Loaded(object sender, RoutedEventArgs e) 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.CopyToControls();
this.Title = this.ShipcallModel.Title; this.Title = this.ShipcallModel?.Title;
Participant? p = null; Participant? p = null;
if(this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) if (this.ShipcallModel != null)
{
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId); p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false; bool allowBSMD = false;
if (p != null) if (p != null)

View File

@ -49,20 +49,27 @@ namespace BreCalClient
private void Window_Loaded(object sender, RoutedEventArgs e) 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.CopyToControls();
this.Title = this.ShipcallModel.Title; this.Title = this.ShipcallModel?.Title;
Participant? p = null; Participant? p = null;
if (this.ShipcallModel != null)
{
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId); p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false; bool allowBSMD = false;
if (p != null) if (p != null)
{ {

View File

@ -4,7 +4,9 @@
using BreCalClient.misc.Model; using BreCalClient.misc.Model;
using System; using System;
using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Documents;
using static BreCalClient.Extensions; using static BreCalClient.Extensions;
namespace BreCalClient namespace BreCalClient
@ -41,20 +43,29 @@ namespace BreCalClient
private void Window_Loaded(object sender, RoutedEventArgs e) 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))
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths; {
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.CopyToControls();
this.Title = this.ShipcallModel.Title;
Participant? p = null; Participant? p = null;
if (this.ShipcallModel != null)
{
this.Title = this.ShipcallModel.Title;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId); p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false; bool allowBSMD = false;
if (p != null) if (p != null)

View File

@ -30,6 +30,9 @@ namespace BreCalClient
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
this.comboBoxBerth.ItemsSource = BreCalLists.GetBerthsByPort(this.ShipcallModel.Shipcall.PortId);
else
this.comboBoxBerth.ItemsSource = BreCalLists.Berths; this.comboBoxBerth.ItemsSource = BreCalLists.Berths;
this.CopyToControls(); this.CopyToControls();
this.EnableControls(); this.EnableControls();

View File

@ -73,9 +73,19 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button Margin="2" Grid.Column="0" Content="{x:Static p:Resources.textNewDots}" x:Name="buttonNew" Visibility="Hidden" Click="buttonNew_Click" Background="Transparent"/> <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"/> <Label Content="{x:Static p:Resources.textSortOrder}" Grid.Column="1" HorizontalContentAlignment="Right"/>
<ComboBox x:Name="comboBoxSortOrder" Margin="2" Grid.Column="2" SelectionChanged="comboBoxSortOrder_SelectionChanged" /> <Grid Grid.Column="2" Grid.Row="1">
<CheckBox x:Name="checkboxShowCancelledCalls" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="2" Checked="checkboxShowCancelledCalls_Checked" Unchecked="checkboxShowCancelledCalls_Checked" /> <Grid.ColumnDefinitions>
<Label Content="{x:Static p:Resources.textShowCancelledShipcalls}" Grid.Column="4" /> <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" /> <Button Margin="2" Grid.Column="6" Content="{x:Static p:Resources.textClearFilters}" x:Name="buttonClearFilter" Click="buttonClearFilter_Click" Background="Transparent" />
</Grid> </Grid>
<Grid Grid.Row="2"> <Grid Grid.Row="2">

View File

@ -287,6 +287,7 @@ namespace BreCalClient
} }
}; };
scmOut.Shipcall.ShipId = esc.ShipcallModel.Shipcall.ShipId; scmOut.Shipcall.ShipId = esc.ShipcallModel.Shipcall.ShipId;
scmOut.Shipcall.PortId = esc.ShipcallModel.Shipcall.PortId;
scmOut.Ship = esc.ShipcallModel.Ship; scmOut.Ship = esc.ShipcallModel.Ship;
DateTime eta = esc.ShipcallModel.Shipcall?.Eta ?? DateTime.Now; DateTime eta = esc.ShipcallModel.Shipcall?.Eta ?? DateTime.Now;
scmOut.Shipcall.Etd = eta.AddDays(2); scmOut.Shipcall.Etd = eta.AddDays(2);
@ -349,6 +350,7 @@ namespace BreCalClient
{ {
this.searchFilterControl.ClearFilters(); this.searchFilterControl.ClearFilters();
this.checkboxShowCancelledCalls.IsChecked = false; this.checkboxShowCancelledCalls.IsChecked = false;
this.comboBoxPorts.UnSelectAll();
this.FilterShipcalls(); this.FilterShipcalls();
} }
@ -366,6 +368,14 @@ namespace BreCalClient
this.SearchFilterControl_SearchFilterChanged(); 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) private async void comboBoxSortOrder_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{ {
_sortOrder = (Extensions.SortOrder) this.comboBoxSortOrder.SelectedIndex; _sortOrder = (Extensions.SortOrder) this.comboBoxSortOrder.SelectedIndex;
@ -409,11 +419,13 @@ namespace BreCalClient
{ {
if (_loginResult == null) return; if (_loginResult == null) return;
BreCalLists.InitializePorts(await _staticApi.GetPortsAsync());
BreCalLists.InitializeBerths(await _staticApi.BerthsGetAsync()); BreCalLists.InitializeBerths(await _staticApi.BerthsGetAsync());
BreCalLists.InitializeShips(await _shipApi.ShipsGetAsync()); BreCalLists.InitializeShips(await _shipApi.ShipsGetAsync());
BreCalLists.InitializeParticipants(await _staticApi.ParticipantsGetAsync()); BreCalLists.InitializeParticipants(await _staticApi.ParticipantsGetAsync());
this.searchFilterControl.SetBerths(BreCalLists.Berths); this.searchFilterControl.SetBerths(BreCalLists.Berths);
this.comboBoxPorts.ItemsSource = BreCalLists.AllPorts;
foreach (Participant participant in BreCalLists.Participants) foreach (Participant participant in BreCalLists.Participants)
{ {
@ -448,6 +460,14 @@ namespace BreCalClient
SearchFilterModel.filterMap[_loginResult.Id] = currentFilter; SearchFilterModel.filterMap[_loginResult.Id] = currentFilter;
} }
this.searchFilterControl.SetFilterFromModel(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()); _ = 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); }); _ = 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)) if(!string.IsNullOrEmpty(sfm.SearchString))
{ {
_ = this._visibleControlModels.RemoveAll(x => !(x.ContainsRemarkText(sfm.SearchString) || (x.Ship?.Name.Contains(sfm.SearchString, StringComparison.InvariantCultureIgnoreCase) ?? false))); _ = this._visibleControlModels.RemoveAll(x => !(x.ContainsRemarkText(sfm.SearchString) || (x.Ship?.Name.Contains(sfm.SearchString, StringComparison.InvariantCultureIgnoreCase) ?? false)));

View File

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<ApplicationRevision>1</ApplicationRevision> <ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.6.0.0</ApplicationVersion> <ApplicationVersion>1.6.0.1</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled> <BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut> <CreateDesktopShortcut>True</CreateDesktopShortcut>

View File

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.6.0.0</ApplicationVersion> <ApplicationVersion>1.6.0.1</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled> <BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut> <CreateDesktopShortcut>True</CreateDesktopShortcut>

View File

@ -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> /// <summary>
/// Looks up a localized string similar to Incoming. /// Looks up a localized string similar to Incoming.
/// </summary> /// </summary>

View File

@ -546,5 +546,7 @@
</data> </data>
<data name="textTooFarInTheFuture" xml:space="preserve"> <data name="textTooFarInTheFuture" xml:space="preserve">
<value>Eine Zeiteingabe ist zu weit in der Zukunft</value> <value>Eine Zeiteingabe ist zu weit in der Zukunft</value>
<data name="textHarbour" xml:space="preserve">
<value>Hafen</value>
</data> </data>
</root> </root>

View File

@ -328,6 +328,9 @@
<data name="textFrom" xml:space="preserve"> <data name="textFrom" xml:space="preserve">
<value>from</value> <value>from</value>
</data> </data>
<data name="textHarbour" xml:space="preserve">
<value>Harbour</value>
</data>
<data name="textIncoming" xml:space="preserve"> <data name="textIncoming" xml:space="preserve">
<value>Incoming</value> <value>Incoming</value>
</data> </data>

View File

@ -25,6 +25,8 @@ namespace BreCalClient
public List<int> Berths { get; set; } = new(); public List<int> Berths { get; set; } = new();
public List<int> Ports { get; set; } = new();
public string? SearchString { get; set; } public string? SearchString { get; set; }
public double? ShipLengthFrom { get; set; } public double? ShipLengthFrom { get; set; }

View File

@ -76,24 +76,20 @@
<TextBlock x:Name="textBlockLengthWidth" Padding="0"/> <TextBlock x:Name="textBlockLengthWidth" Padding="0"/>
</Viewbox> </Viewbox>
<Viewbox Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left"> <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"/> <TextBlock Text="ETA" x:Name="labelETA"/>
</Viewbox> </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"/> <TextBlock x:Name="textBlockETA" Padding="0" FontWeight="DemiBold"/>
</Viewbox> </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}"/> <TextBlock Text="{x:Static p:Resources.textBerth}"/>
</Viewbox> </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" /> <TextBlock x:Name="textBlockBerth" Padding="0" FontWeight="DemiBold" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left">
<TextBlock x:Name="textBlockHarbour" Padding="0" FontWeight="DemiBold" />
</Viewbox>
</Grid> </Grid>

View File

@ -72,7 +72,7 @@ namespace BreCalClient
string agentName = ""; string agentName = "";
string? name; string? name;
_agency = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.AGENCY); _agency = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.AGENCY);
name = _agency?.Name; name = _agency?.Name;
if (name != null) agentName = name; if (name != null) agentName = name;
this.labelAgent.Content = name ?? "- / -"; this.labelAgent.Content = name ?? "- / -";
@ -83,10 +83,9 @@ namespace BreCalClient
this.labelAgencyETAETDValue.Content = ""; this.labelAgencyETAETDValue.Content = "";
this.textBlockAgencyRemarks.Text = ""; this.textBlockAgencyRemarks.Text = "";
this.textBlockAgencyBerthRemarks.Text = ""; this.textBlockAgencyBerthRemarks.Text = "";
this.textBlockDraft.Text = "";
} }
_mooring = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.MOORING); _mooring = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.MOORING);
name = _mooring?.Name; name = _mooring?.Name;
this.labelMooring.Content = name ?? "- / -"; this.labelMooring.Content = name ?? "- / -";
if(_mooring == null) if(_mooring == null)
@ -95,7 +94,7 @@ namespace BreCalClient
this.textBlockMooringRemarks.Text = ""; this.textBlockMooringRemarks.Text = "";
} }
_pilot = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.PILOT); _pilot = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.PILOT);
name = _pilot?.Name; name = _pilot?.Name;
this.labelPilot.Content = name ?? "- / - "; this.labelPilot.Content = name ?? "- / - ";
if(_pilot == null) if(_pilot == null)
@ -104,7 +103,7 @@ namespace BreCalClient
this.textBlockPilotRemarks.Text = ""; this.textBlockPilotRemarks.Text = "";
} }
_tug = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.TUG); _tug = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.TUG);
name = _tug?.Name; name = _tug?.Name;
this.labelTug.Content = name ?? "- / - "; this.labelTug.Content = name ?? "- / - ";
if(_tug == null) if(_tug == null)
@ -113,7 +112,7 @@ namespace BreCalClient
this.textBlockTugRemarks.Text = ""; 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; name = _port_administration?.Name;
this.labelPortAuthority.Content = name ?? "- / - "; this.labelPortAuthority.Content = name ?? "- / - ";
if(_port_administration == null) if(_port_administration == null)
@ -122,7 +121,7 @@ namespace BreCalClient
this.textBlockPortAuthorityRemarks.Text = ""; this.textBlockPortAuthorityRemarks.Text = "";
} }
_terminal = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.TERMINAL); _terminal = this.ShipcallControlModel?.GetParticipantForType(Extensions.ParticipantType.TERMINAL);
name = _terminal?.Name; name = _terminal?.Name;
this.labelTerminal.Content = name ?? "- / - "; this.labelTerminal.Content = name ?? "- / - ";
if(_terminal == null) if(_terminal == null)
@ -315,6 +314,8 @@ namespace BreCalClient
if (this.ShipcallControlModel != null) 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); Times? agencyTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
if (agencyTimes != null) if (agencyTimes != null)
@ -323,7 +324,6 @@ namespace BreCalClient
this.labelAgencyETAETDValue.Content = agencyTimes.DisplayTime(this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival); this.labelAgencyETAETDValue.Content = agencyTimes.DisplayTime(this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival);
this.textBlockAgencyRemarks.Text = agencyTimes.Remarks.TruncateDots(50); this.textBlockAgencyRemarks.Text = agencyTimes.Remarks.TruncateDots(50);
this.textBlockAgencyBerthRemarks.Text = agencyTimes.BerthInfo.TruncateDots(50); this.textBlockAgencyBerthRemarks.Text = agencyTimes.BerthInfo.TruncateDots(50);
this.textBlockDraft.Text = ShipcallControlModel?.Shipcall?.Draft?.ToString("N2");
} }
else else
{ {
@ -332,7 +332,6 @@ namespace BreCalClient
this.labelAgencyETAETDValue.Content = "- / -"; this.labelAgencyETAETDValue.Content = "- / -";
this.textBlockAgencyRemarks.Text = ""; this.textBlockAgencyRemarks.Text = "";
this.textBlockAgencyBerthRemarks.Text = ""; this.textBlockAgencyBerthRemarks.Text = "";
this.textBlockDraft.Text = "";
} }
Times? mooringTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING); Times? mooringTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING);

View File

@ -45,6 +45,12 @@ namespace RoleEditor
else else
this.Berth.Authority_Id = null; 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.DialogResult = true;
this.Close(); this.Close();
} }

View File

@ -6,8 +6,8 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<ApplicationIcon>Resources\lock_preferences.ico</ApplicationIcon> <ApplicationIcon>Resources\lock_preferences.ico</ApplicationIcon>
<FileVersion>1.6.0.0</FileVersion> <FileVersion>1.6.0.1</FileVersion>
<AssemblyVersion>1.6.0.0</AssemblyVersion> <AssemblyVersion>1.6.0.1</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>