Fixed adding and removing assignments of participants and berths
This commit is contained in:
parent
cab09c594f
commit
c3f16f4b20
@ -25,6 +25,7 @@
|
||||
<None Remove="Resources\clock.png" />
|
||||
<None Remove="Resources\containership.ico" />
|
||||
<None Remove="Resources\containership.png" />
|
||||
<None Remove="Resources\delete.png" />
|
||||
<None Remove="Resources\emergency_stop_button.png" />
|
||||
<None Remove="Resources\logo_bremen_calling.png" />
|
||||
<None Remove="Resources\ship2.png" />
|
||||
@ -70,6 +71,7 @@
|
||||
<Resource Include="Resources\clock.png" />
|
||||
<Resource Include="Resources\containership.ico" />
|
||||
<Resource Include="Resources\containership.png" />
|
||||
<Resource Include="Resources\delete.png" />
|
||||
<Resource Include="Resources\emergency_stop_button.png" />
|
||||
<Resource Include="Resources\logo_bremen_calling.png" />
|
||||
<Resource Include="Resources\ship2.png" />
|
||||
|
||||
@ -69,11 +69,23 @@
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="comboBoxCategories" Grid.Column="1" Margin="2" Grid.Row="1" SelectedValuePath="Key"/>
|
||||
<xctk:DateTimePicker x:Name="datePickerETA" Grid.Column="1" Grid.Row="2" Margin="2" />
|
||||
<xctk:DateTimePicker x:Name="datePickerETA" Grid.Column="1" Grid.Row="2" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
|
||||
<TextBox x:Name="textBoxVoyage" Grid.Column="1" Grid.Row="3" Margin="2" VerticalContentAlignment="Center" />
|
||||
<xctk:DateTimePicker x:Name="datePickerETD" Grid.Column="1" Grid.Row="4" Margin="2" />
|
||||
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="1" Grid.Row="5" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" />
|
||||
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Grid.Row="6" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" />
|
||||
<xctk:DateTimePicker x:Name="datePickerETD" Grid.Column="1" Grid.Row="4" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
|
||||
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="1" Grid.Row="5" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
|
||||
<ComboBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemArrivalBerth" Click="contextMenuItemArrivalBerth_Click" />
|
||||
</ContextMenu>
|
||||
</ComboBox.ContextMenu>
|
||||
</ComboBox>
|
||||
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Grid.Row="6" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
|
||||
<ComboBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemDepartureBerth" Click="contextMenuItemDepartureBerth_Click" />
|
||||
</ContextMenu>
|
||||
</ComboBox.ContextMenu>
|
||||
</ComboBox>
|
||||
<CheckBox x:Name="checkBoxTugRequired" Grid.Column="0" Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
<CheckBox x:Name="checkBoxPilotRequired" Grid.Column="0" Grid.Row="8" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="9" Margin="2" >
|
||||
@ -135,9 +147,9 @@
|
||||
</ContextMenu>
|
||||
</ComboBox.ContextMenu>
|
||||
</ComboBox>
|
||||
|
||||
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="3" Grid.Row="7" Margin="2" />
|
||||
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="3" Grid.Row="8" Margin="2" />
|
||||
|
||||
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="3" Grid.Row="7" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
|
||||
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="3" Grid.Row="8" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
|
||||
<CheckBox x:Name="checkBoxRainsensitiveCargo" Grid.Column="2" Grid.Row="9" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
<xctk:IntegerUpDown x:Name="integerUpDownRecommendedTugs" Grid.Column="3" Grid.Row="10" Minimum="0" Margin="2" />
|
||||
<CheckBox x:Name="checkBoxAnchored" Grid.Column="2" Grid.Row="11" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
|
||||
|
||||
@ -23,7 +23,7 @@ namespace BreCalClient
|
||||
|
||||
#region Properties
|
||||
|
||||
public Shipcall Shipcall { get; set; } = new ();
|
||||
public ShipcallControlModel ShipcallModel { get; set; } = new ();
|
||||
|
||||
public List<Participant> Participants { get; set; } = new();
|
||||
|
||||
@ -98,26 +98,42 @@ namespace BreCalClient
|
||||
private void contextMenuItemClearAgency_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxAgency.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.AGENCY);
|
||||
}
|
||||
|
||||
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxMooring.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.MOORING);
|
||||
}
|
||||
|
||||
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxPilot.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.PILOT);
|
||||
}
|
||||
|
||||
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxTug.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.TUG);
|
||||
}
|
||||
|
||||
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxTerminal.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove((int)Extensions.ParticipantType.TERMINAL);
|
||||
}
|
||||
|
||||
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxArrivalBerth.SelectedIndex = -1;
|
||||
this.ShipcallModel.Berth = "";
|
||||
}
|
||||
|
||||
private void contextMenuItemDepartureBerth_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxDepartureBerth.SelectedIndex -= 1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -126,100 +142,132 @@ namespace BreCalClient
|
||||
|
||||
private void CopyToModel()
|
||||
{
|
||||
this.Shipcall.Type = (int) this.comboBoxCategories.SelectedItem;
|
||||
this.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now;
|
||||
this.Shipcall.Voyage = this.textBoxVoyage.Text.Trim();
|
||||
this.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1);
|
||||
this.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
|
||||
this.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id;
|
||||
this.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
|
||||
this.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
|
||||
this.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
|
||||
this.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
|
||||
this.Shipcall.Draft = (float?) this.doubleUpDownDraft.Value;
|
||||
this.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
|
||||
this.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
|
||||
this.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
|
||||
this.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
|
||||
this.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
|
||||
this.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
|
||||
this.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
||||
this.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
|
||||
this.Shipcall.TugRequired = this.checkBoxTugRequired.IsChecked;
|
||||
if(this.comboBoxPierside.SelectedIndex >= 0)
|
||||
if (this.ShipcallModel.Shipcall != null)
|
||||
{
|
||||
this.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
|
||||
this.ShipcallModel.Shipcall.Type = (int)this.comboBoxCategories.SelectedItem;
|
||||
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now;
|
||||
this.ShipcallModel.Shipcall.Voyage = this.textBoxVoyage.Text.Trim();
|
||||
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1);
|
||||
this.ShipcallModel.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
|
||||
this.ShipcallModel.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id;
|
||||
this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
|
||||
this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
|
||||
this.ShipcallModel.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
|
||||
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
|
||||
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
|
||||
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
|
||||
this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
|
||||
this.ShipcallModel.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
|
||||
this.ShipcallModel.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
|
||||
this.ShipcallModel.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
|
||||
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
|
||||
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
||||
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
|
||||
this.ShipcallModel.Shipcall.TugRequired = this.checkBoxTugRequired.IsChecked;
|
||||
if (this.comboBoxPierside.SelectedIndex >= 0)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
|
||||
}
|
||||
|
||||
// remove all and add selected participants
|
||||
this.ShipcallModel.Shipcall.Participants.Clear();
|
||||
this.ShipcallModel.AssignedParticipants.Clear();
|
||||
|
||||
Participant? participant;
|
||||
participant = (Participant?)this.comboBoxAgency.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxMooring.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxPilot.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
|
||||
if (participant != null) {
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTug.SelectedItem;
|
||||
if (participant != null) {
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[participant.Type] = participant;
|
||||
}
|
||||
|
||||
// BSMD and port authority are always added
|
||||
foreach (Participant p in Participants)
|
||||
{
|
||||
if (p.Type == (int)Extensions.ParticipantType.PORT_ADMINISTRATION)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(p.Id);
|
||||
this.ShipcallModel.AssignedParticipants[p.Type] = p;
|
||||
}
|
||||
if (p.Type == (int)Extensions.ParticipantType.BSMD)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(p.Id);
|
||||
this.ShipcallModel.AssignedParticipants[p.Type] = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove all and add selected participants
|
||||
this.Shipcall.Participants.Clear();
|
||||
Participant? participant;
|
||||
participant = (Participant?) this.comboBoxAgency.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
participant = (Participant?) this.comboBoxMooring.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
participant = (Participant?) this.comboBoxPilot.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
participant = (Participant?) this.comboBoxTerminal.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
participant = (Participant?) this.comboBoxTug.SelectedItem;
|
||||
if (participant != null) this.Shipcall.Participants.Add(participant.Id);
|
||||
|
||||
// BSMD and port authority are always added
|
||||
foreach(Participant p in Participants)
|
||||
{
|
||||
if(p.Type == (int) Extensions.ParticipantType.PORT_ADMINISTRATION) this.Shipcall.Participants.Add(p.Id);
|
||||
if (p.Type == (int)Extensions.ParticipantType.BSMD) this.Shipcall.Participants.Add(p.Id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CopyToControls()
|
||||
{
|
||||
if (this.Shipcall == null) return;
|
||||
this.comboBoxCategories.SelectedItem = (Extensions.TypeEnum) this.Shipcall.Type;
|
||||
if(this.Shipcall.Eta != DateTime.MinValue)
|
||||
this.datePickerETA.Value = this.Shipcall.Eta;
|
||||
this.textBoxVoyage.Text = this.Shipcall.Voyage;
|
||||
this.datePickerETD.Value = this.Shipcall.Etd;
|
||||
this.checkBoxAnchored.IsChecked = this.Shipcall.Anchored;
|
||||
this.comboBoxShip.SelectedValue = this.Shipcall.ShipId;
|
||||
this.comboBoxArrivalBerth.SelectedValue = this.Shipcall.ArrivalBerthId;
|
||||
this.comboBoxDepartureBerth.SelectedValue = this.Shipcall.DepartureBerthId;
|
||||
this.checkBoxBunkering.IsChecked = this.Shipcall.Bunkering;
|
||||
this.checkBoxCanceled.IsChecked = this.Shipcall.Canceled;
|
||||
this.doubleUpDownDraft.Value = this.Shipcall.Draft;
|
||||
this.checkBoxMooredLock.IsChecked = this.Shipcall.MooredLock;
|
||||
|
||||
this.checkBoxRainsensitiveCargo.IsChecked = this.Shipcall.RainSensitiveCargo;
|
||||
this.checkBoxPilotRequired.IsChecked = this.Shipcall.PilotRequired;
|
||||
this.checkBoxReplenishingLock.IsChecked = this.Shipcall.ReplenishingLock;
|
||||
this.checkBoxReplenishingTerminal.IsChecked = this.Shipcall.ReplenishingTerminal;
|
||||
this.integerUpDownRecommendedTugs.Value = this.Shipcall.RecommendedTugs;
|
||||
this.datePickerTidalWindowFrom.Value = this.Shipcall.TidalWindowFrom;
|
||||
this.datePickerTidalWindowTo.Value = this.Shipcall.TidalWindowTo;
|
||||
this.checkBoxTugRequired.IsChecked = this.Shipcall.TugRequired;
|
||||
if(this.Shipcall.PierSide.HasValue)
|
||||
if (this.ShipcallModel == null) return;
|
||||
if (this.ShipcallModel.Shipcall != null)
|
||||
{
|
||||
if (this.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
|
||||
else this.comboBoxPierside.SelectedIndex = 1;
|
||||
this.comboBoxCategories.SelectedItem = (Extensions.TypeEnum)this.ShipcallModel.Shipcall.Type;
|
||||
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
|
||||
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
|
||||
this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage;
|
||||
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
|
||||
this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored;
|
||||
this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId;
|
||||
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
|
||||
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
|
||||
this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering;
|
||||
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled;
|
||||
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
|
||||
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock;
|
||||
|
||||
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo;
|
||||
this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired;
|
||||
this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock;
|
||||
this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal;
|
||||
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
|
||||
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
|
||||
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
|
||||
this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired;
|
||||
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
|
||||
{
|
||||
if (this.ShipcallModel.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
|
||||
else this.comboBoxPierside.SelectedIndex = 1;
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();
|
||||
|
||||
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
|
||||
{
|
||||
if (((List<Participant>)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.Shipcall.Participants == null) this.Shipcall.Participants = new();
|
||||
|
||||
foreach(int participant_id in this.Shipcall.Participants)
|
||||
{
|
||||
if (((List<Participant>)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id;
|
||||
if (((List<Participant>)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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="320" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
|
||||
Title="{x:Static p:Resources.textEditTimes}" Height="330" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width=".25*" />
|
||||
@ -35,16 +35,76 @@
|
||||
<Label Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textOperationsEnd}" HorizontalContentAlignment="Right" />
|
||||
<Label Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" HorizontalContentAlignment="Right" />
|
||||
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="1" Grid.Column="1" Margin="2" Name="datePickerETABerth" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="1" Grid.Column="1" Margin="2" Name="datePickerETABerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
|
||||
<xctk:DateTimePicker.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETA" Click="contextMenuItemClearETA_Click" >
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources\delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</xctk:DateTimePicker.ContextMenu>
|
||||
</xctk:DateTimePicker>
|
||||
<CheckBox IsEnabled="False" Grid.Row="1" Grid.Column="2" Margin="4,0,0,0" Name="checkBoxEtaBerthFixed" VerticalAlignment="Center" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="2" Grid.Column="1" Margin="2" Name="datePickerETDBerth" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="2" Grid.Column="1" Margin="2" Name="datePickerETDBerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
|
||||
<xctk:DateTimePicker.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETD" Click="contextMenuItemClearETD_Click" >
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources\delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</xctk:DateTimePicker.ContextMenu>
|
||||
</xctk:DateTimePicker>
|
||||
<CheckBox IsEnabled="False" Grid.Row="2" Grid.Column="2" Margin="4,0,0,0" Name="checkBoxEtDBerthFixed" VerticalAlignment="Center" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="3" Grid.Column="1" Margin="2" Name="datePickerLockTime" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="3" Grid.Column="1" Margin="2" Name="datePickerLockTime" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
|
||||
<xctk:DateTimePicker.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearLockTime" Click="contextMenuItemClearLockTime_Click" >
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources\delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</xctk:DateTimePicker.ContextMenu>
|
||||
</xctk:DateTimePicker>
|
||||
<CheckBox IsEnabled="False" Grid.Row="3" Grid.Column="2" Margin="4,0,0,0" Name="checkBoxLockTimeFixed" VerticalAlignment="Center" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="4" Grid.Column="1" Margin="2" Name="datePickerZoneEntry" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="4" Grid.Column="1" Margin="2" Name="datePickerZoneEntry" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
|
||||
<xctk:DateTimePicker.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearZoneEntry" Click="contextMenuItemClearZoneEntry_Click" >
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources\delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</xctk:DateTimePicker.ContextMenu>
|
||||
</xctk:DateTimePicker>
|
||||
<CheckBox IsEnabled="False" Grid.Row="4" Grid.Column="2" Margin="4,0,0,0" Name="checkBoxZoneEntryFixed" VerticalAlignment="Center" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="5" Grid.Column="1" Margin="2" Name="datePickerOperationStart" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="6" Grid.Column="1" Margin="2" Name="datePickerOperationEnd" />
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="5" 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" >
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources\delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</xctk:DateTimePicker.ContextMenu>
|
||||
</xctk:DateTimePicker>
|
||||
<xctk:DateTimePicker IsEnabled="False" Grid.Row="6" 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" >
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources\delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</xctk:DateTimePicker.ContextMenu>
|
||||
</xctk:DateTimePicker>
|
||||
<TextBox Grid.Row="7" Grid.Column="1" Margin="2" Name="textBoxRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="True" />
|
||||
<StackPanel Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" />
|
||||
|
||||
@ -110,5 +110,39 @@ namespace BreCalClient
|
||||
|
||||
#endregion
|
||||
|
||||
#region clear value event handler
|
||||
|
||||
private void contextMenuItemClearETA_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.datePickerETABerth.Value = null;
|
||||
}
|
||||
|
||||
private void contextMenuItemClearETD_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.datePickerETDBerth.Value = null;
|
||||
}
|
||||
|
||||
private void contextMenuItemClearLockTime_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.datePickerLockTime.Value = null;
|
||||
}
|
||||
|
||||
private void contextMenuItemClearZoneEntry_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.datePickerZoneEntry.Value = null;
|
||||
}
|
||||
|
||||
private void contextMenuItemClearOperationStart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.datePickerOperationStart.Value = null;
|
||||
}
|
||||
|
||||
private void contextMenuItemClearOperationEnd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.datePickerOperationEnd.Value = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ namespace BreCalClient
|
||||
private readonly Dictionary<int, ShipcallControl> _shipCallControlDict = new();
|
||||
private readonly CancellationTokenSource _tokenSource = new();
|
||||
private LoginResult? _loginResult;
|
||||
private bool _refreshImmediately = false;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -129,8 +130,13 @@ namespace BreCalClient
|
||||
if (esc.ShowDialog() ?? false)
|
||||
{
|
||||
// create UI & save new dialog model
|
||||
this.UpdateShipcallUI(esc.Shipcall, new List<Times>());
|
||||
this._api.ShipcallsPost(esc.Shipcall);
|
||||
if (esc.ShipcallModel.Shipcall != null)
|
||||
{
|
||||
this.UpdateShipcallUI(esc.ShipcallModel.Shipcall, new List<Times>());
|
||||
this._api.ShipcallsPost(esc.ShipcallModel.Shipcall);
|
||||
_refreshImmediately = true;
|
||||
_tokenSource.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,8 +212,9 @@ namespace BreCalClient
|
||||
|
||||
public async Task RefreshShipcalls()
|
||||
{
|
||||
while (!_tokenSource.Token.IsCancellationRequested)
|
||||
while (!_tokenSource.Token.IsCancellationRequested || _refreshImmediately)
|
||||
{
|
||||
_refreshImmediately = false;
|
||||
List<Shipcall>? shipcalls = null;
|
||||
try
|
||||
{
|
||||
@ -252,7 +259,11 @@ namespace BreCalClient
|
||||
}
|
||||
}
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(SHIPCALL_UPDATE_INTERVAL_SECONDS), _tokenSource.Token);
|
||||
try
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(SHIPCALL_UPDATE_INTERVAL_SECONDS), _tokenSource.Token);
|
||||
}
|
||||
catch(TaskCanceledException) { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,13 +322,12 @@ namespace BreCalClient
|
||||
}
|
||||
|
||||
private async void Sc_EditRequested(ShipcallControl obj)
|
||||
{
|
||||
Shipcall? sc = obj.ShipcallControlModel?.Shipcall;
|
||||
if (sc != null)
|
||||
{
|
||||
if (obj.ShipcallControlModel != null)
|
||||
{
|
||||
EditShipcallControl esc = new()
|
||||
{
|
||||
Shipcall = sc,
|
||||
ShipcallModel = obj.ShipcallControlModel,
|
||||
Ships = _ships,
|
||||
Participants = _participants,
|
||||
Berths = _berths
|
||||
@ -327,8 +337,10 @@ namespace BreCalClient
|
||||
{
|
||||
try
|
||||
{
|
||||
await _api.ShipcallsPutAsync(sc);
|
||||
await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall);
|
||||
obj.RefreshData();
|
||||
_refreshImmediately = true;
|
||||
_tokenSource.Cancel();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -366,7 +378,8 @@ namespace BreCalClient
|
||||
await _api.TimesPostAsync(etc.Times);
|
||||
obj.ShipcallControlModel?.Times.Add(etc.Times);
|
||||
}
|
||||
obj.RefreshData();
|
||||
_refreshImmediately = true;
|
||||
_tokenSource.Cancel();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
19
src/BreCalClient/Resources/Resources.Designer.cs
generated
19
src/BreCalClient/Resources/Resources.Designer.cs
generated
@ -150,6 +150,16 @@ namespace BreCalClient.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
public static byte[] delete {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("delete", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
@ -306,6 +316,15 @@ namespace BreCalClient.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Clear value.
|
||||
/// </summary>
|
||||
public static string textClearValue {
|
||||
get {
|
||||
return ResourceManager.GetString("textClearValue", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Close.
|
||||
/// </summary>
|
||||
|
||||
@ -361,4 +361,7 @@
|
||||
<data name="textClearAssignment" xml:space="preserve">
|
||||
<value>Zuordnung entfernen</value>
|
||||
</data>
|
||||
<data name="textClearValue" xml:space="preserve">
|
||||
<value>Eingabe löschen</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -145,6 +145,9 @@
|
||||
<data name="containership1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>containership.ico;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>delete.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="emergency_stop_button" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>emergency_stop_button.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
@ -196,6 +199,9 @@
|
||||
<data name="textClearAssignment" xml:space="preserve">
|
||||
<value>Clear assignment</value>
|
||||
</data>
|
||||
<data name="textClearValue" xml:space="preserve">
|
||||
<value>Clear value</value>
|
||||
</data>
|
||||
<data name="textClose" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
|
||||
BIN
src/BreCalClient/Resources/delete.png
Normal file
BIN
src/BreCalClient/Resources/delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@ -31,9 +31,7 @@ namespace BreCalClient
|
||||
|
||||
public event Action<ShipcallControl>? EditRequested;
|
||||
|
||||
public event Action<ShipcallControl, Times?>? EditTimesRequested;
|
||||
|
||||
public event Action<ShipcallControl>? OpenExtraRequested;
|
||||
public event Action<ShipcallControl, Times?>? EditTimesRequested;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -59,56 +57,56 @@ namespace BreCalClient
|
||||
string agentName = "";
|
||||
string? name;
|
||||
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.AGENCY);
|
||||
if (name != null)
|
||||
{
|
||||
this.labelAgent.Content = name;
|
||||
agentName = name;
|
||||
}
|
||||
if (name != null) agentName = name;
|
||||
this.labelAgent.Content = name ?? "- / -";
|
||||
|
||||
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.MOORING);
|
||||
this.labelMooring.Content = (name != null) ? name : "- / -";
|
||||
this.labelMooring.Content = name ?? "- / -";
|
||||
|
||||
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.PILOT);
|
||||
this.labelPilot.Content = (name != null) ? name : "- / - ";
|
||||
this.labelPilot.Content = name ?? "- / - ";
|
||||
|
||||
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TUG);
|
||||
this.labelTug.Content = (name != null) ? name : "- / - ";
|
||||
this.labelTug.Content = name ?? "- / - ";
|
||||
|
||||
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
this.labelPortAuthority.Content = (name != null) ? name : "- / - ";
|
||||
this.labelPortAuthority.Content = name ?? "- / - ";
|
||||
|
||||
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TERMINAL);
|
||||
this.labelTerminal.Content = (name != null) ? name : "- / - ";
|
||||
this.labelTerminal.Content = name ?? "- / - ";
|
||||
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL)) {
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.TERMINAL)))
|
||||
{
|
||||
this.labelTerminal.FontWeight = FontWeights.Bold;
|
||||
this.labelTerminal.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT))
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.PILOT)))
|
||||
{
|
||||
this.labelPilot.FontWeight = FontWeights.Bold;
|
||||
this.labelPilot.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY))
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.AGENCY)))
|
||||
{
|
||||
this.labelAgent.FontWeight = FontWeights.Bold;
|
||||
this.labelAgent.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING))
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.MOORING)))
|
||||
{
|
||||
this.labelMooring.FontWeight = FontWeights.Bold;
|
||||
this.labelMooring.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION))
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.PORT_ADMINISTRATION)))
|
||||
{
|
||||
this.labelPortAuthority.FontWeight = FontWeights.Bold;
|
||||
this.labelPortAuthority.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG))
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.TUG)))
|
||||
{
|
||||
this.labelTug.FontWeight = FontWeights.Bold;
|
||||
this.labelTug.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD))
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD) ||
|
||||
(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.AGENCY))))
|
||||
{
|
||||
this.labelShipName.FontWeight = FontWeights.Bold;
|
||||
this.labelShipName.Foreground = Brushes.LightYellow;
|
||||
@ -129,7 +127,7 @@ namespace BreCalClient
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.textBlockAgency.Text = this.ShipcallControlModel?.Agency;
|
||||
|
||||
this.textBlockBerth.Text = this.ShipcallControlModel?.Berth;
|
||||
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
|
||||
if ((this.ShipcallControlModel?.Shipcall?.Type == 1) || (this.ShipcallControlModel?.Shipcall?.Type == 3))
|
||||
@ -158,7 +156,7 @@ namespace BreCalClient
|
||||
{
|
||||
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.textBlockAgency.Text = times.Remarks;
|
||||
this.textBlockAgencyRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (this.ParticipantDict[times.ParticipantId].IsFlagSet(Extensions.ParticipantType.MOORING))
|
||||
{
|
||||
@ -205,24 +203,21 @@ namespace BreCalClient
|
||||
|
||||
}
|
||||
|
||||
private void buttonEditShipcall_Click(object sender, RoutedEventArgs e)
|
||||
private void buttonEditShipcall_Click(object? sender, RoutedEventArgs? e)
|
||||
{
|
||||
if(App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD) ||
|
||||
(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.AGENCY))))
|
||||
this.EditRequested?.Invoke(this);
|
||||
}
|
||||
|
||||
private void buttonOpenDropDown_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.OpenExtraRequested?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void Image_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
this.EditRequested?.Invoke(this);
|
||||
this.buttonEditShipcall_Click(null, null);
|
||||
}
|
||||
|
||||
private void labelAgent_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY))
|
||||
if (App.Participant.IsFlagSet(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);
|
||||
@ -231,7 +226,7 @@ namespace BreCalClient
|
||||
|
||||
private void labelMooring_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING))
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.MOORING)))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING);
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
@ -240,7 +235,7 @@ namespace BreCalClient
|
||||
|
||||
private void labelPortAuthority_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION))
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.PORT_ADMINISTRATION)))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
@ -249,7 +244,7 @@ namespace BreCalClient
|
||||
|
||||
private void labelPilot_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT))
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.PILOT)))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PILOT);
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
@ -258,7 +253,7 @@ namespace BreCalClient
|
||||
|
||||
private void labelTug_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG))
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.TUG)))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TUG);
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
@ -267,7 +262,7 @@ namespace BreCalClient
|
||||
|
||||
private void labelTerminal_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL))
|
||||
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.TERMINAL)))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL);
|
||||
this.EditTimesRequested?.Invoke(this, times);
|
||||
|
||||
@ -42,9 +42,7 @@ namespace BreCalClient
|
||||
#region Properties
|
||||
|
||||
public Shipcall? Shipcall { get; set; }
|
||||
public Ship? Ship { get; set; }
|
||||
|
||||
public string? Agency { get; set; }
|
||||
public Ship? Ship { get; set; }
|
||||
|
||||
public string? Berth { get; set; }
|
||||
|
||||
@ -122,7 +120,17 @@ namespace BreCalClient
|
||||
return p.Name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
internal int? GetParticipantIdForType(Extensions.ParticipantType participantType)
|
||||
{
|
||||
foreach(Participant p in AssignedParticipants.Values)
|
||||
{
|
||||
if(p.IsFlagSet(participantType))
|
||||
return p.Id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool IsFlagSet(StatusFlags flag)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user