Added agency port dependency when editing shipcalls

This commit is contained in:
Daniel Schick 2024-09-19 09:10:15 +02:00
parent 6215449bc8
commit 3b3601baeb
3 changed files with 20 additions and 3 deletions

View File

@ -148,6 +148,17 @@ namespace BreCalClient
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

View File

@ -445,9 +445,9 @@ namespace BreCalClient
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
// Filter agency combobox by port
// TODO
List<Participant> availableAgencies = BreCalLists.GetParticipants(port.Id, ParticipantType.AGENCY);
this.comboBoxAgency.ItemsSource = null;
this.comboBoxAgency.ItemsSource = availableAgencies;
}
#endregion

View File

@ -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();
}