If an agency allows BSMD entries, then the flag is set and the dialog controls are enabled

This commit is contained in:
Daniel Schick 2023-09-06 09:04:30 +02:00
parent 4093c2eb21
commit f200673023
7 changed files with 90 additions and 51 deletions

View File

@ -112,7 +112,7 @@
<Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="3" Grid.Row="12" /> <Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="3" Grid.Row="12" />
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="3" Grid.Row="13" /> <Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="3" Grid.Row="13" />
<ComboBox Name="comboBoxAgency" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id"> <ComboBox Name="comboBoxAgency" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxAgency_SelectionChanged">
<ComboBox.ContextMenu> <ComboBox.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearAgency" Click="contextMenuItemClearAgency_Click" /> <MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearAgency" Click="contextMenuItemClearAgency_Click" />

View File

@ -8,6 +8,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using static BreCalClient.Extensions;
namespace BreCalClient namespace BreCalClient
{ {
@ -25,10 +26,19 @@ namespace BreCalClient
public ShipcallControlModel ShipcallModel { get; set; } = new (); public ShipcallControlModel ShipcallModel { get; set; } = new ();
/// <summary>
/// All participants
/// </summary>
public List<Participant> Participants { get; set; } = new(); public List<Participant> Participants { get; set; } = new();
/// <summary>
/// All berths
/// </summary>
public List<Berth> Berths { get; set; } = new(); public List<Berth> Berths { get; set; } = new();
/// <summary>
/// All ships
/// </summary>
public List<Ship> Ships { get; set; } = new(); public List<Ship> Ships { get; set; } = new();
public Ship? SelectedShip { public Ship? SelectedShip {
@ -52,11 +62,11 @@ namespace BreCalClient
foreach(Participant p in Participants) foreach(Participant p in Participants)
{ {
if (p.IsFlagSet(Extensions.ParticipantType.AGENCY)) aList.Add(p); if (p.IsTypeFlagSet(Extensions.ParticipantType.AGENCY)) aList.Add(p);
if (p.IsFlagSet(Extensions.ParticipantType.MOORING)) mList.Add(p); if (p.IsTypeFlagSet(Extensions.ParticipantType.MOORING)) mList.Add(p);
if (p.IsFlagSet(Extensions.ParticipantType.PILOT)) pList.Add(p); if (p.IsTypeFlagSet(Extensions.ParticipantType.PILOT)) pList.Add(p);
if (p.IsFlagSet(Extensions.ParticipantType.TUG)) tList.Add(p); if (p.IsTypeFlagSet(Extensions.ParticipantType.TUG)) tList.Add(p);
if (p.IsFlagSet(Extensions.ParticipantType.TERMINAL)) terList.Add(p); if (p.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL)) terList.Add(p);
} }
this.comboBoxAgency.ItemsSource = aList; this.comboBoxAgency.ItemsSource = aList;
@ -93,6 +103,11 @@ namespace BreCalClient
this.buttonOK.IsEnabled = this.comboBoxShip.SelectedItem != null; this.buttonOK.IsEnabled = this.comboBoxShip.SelectedItem != null;
} }
private void comboBoxAgency_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.EnableControls();
}
#endregion #endregion
#region Context menu handlers #region Context menu handlers
@ -257,6 +272,9 @@ namespace BreCalClient
if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new(); if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();
// Hier wird noch ein Problem vergessen: Wenn ein Participant mehrere Types gleichzeitig ist und es einen weitere Participant mit diesem Type gibt
// müsste der "einzelne" Participant für die Rolle ausgewählt werden. (Angenommen ein Test-Teilnehmer hat "alle" Rollen..)
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) 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.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id;
@ -270,8 +288,20 @@ namespace BreCalClient
private void EnableControls() private void EnableControls()
{ {
bool isBsmd = App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD); bool isBsmd = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD);
bool isAgency = App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY); bool isAgency = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY);
// Special case: Selected Agency allows BSMD to edit their fields
if (this.comboBoxAgency.SelectedIndex >= 0)
{
int agencyParticipantId = (int)this.comboBoxAgency.SelectedValue;
Participant? p = this.Participants.Find(x => x.Id == agencyParticipantId);
if (p != null)
{
if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD) && isBsmd)
isAgency = true;
}
}
this.comboBoxAgency.IsEnabled = isBsmd; this.comboBoxAgency.IsEnabled = isBsmd;
this.comboBoxArrivalBerth.IsEnabled = isBsmd || isAgency; this.comboBoxArrivalBerth.IsEnabled = isBsmd || isAgency;

View File

@ -37,28 +37,28 @@ namespace BreCalClient
{ {
this.CopyToControls(); this.CopyToControls();
// enable controls according to participant type // enable controls according to participant type
this.datePickerETABerth.IsEnabled = App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) || this.datePickerETABerth.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) ||
App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING) || App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) ||
App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT) || App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT) ||
App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) || App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) ||
App.Participant.IsFlagSet(Extensions.ParticipantType.TUG); App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TUG);
this.checkBoxEtaBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled; this.checkBoxEtaBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled;
this.datePickerETDBerth.IsEnabled = this.datePickerETABerth.IsEnabled; this.datePickerETDBerth.IsEnabled = this.datePickerETABerth.IsEnabled;
this.checkBoxEtDBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled; this.checkBoxEtDBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled;
this.datePickerLockTime.IsEnabled = App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) || this.datePickerLockTime.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) ||
App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING) || App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) ||
App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION); App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION);
this.checkBoxLockTimeFixed.IsEnabled = this.datePickerLockTime.IsEnabled; this.checkBoxLockTimeFixed.IsEnabled = this.datePickerLockTime.IsEnabled;
this.datePickerZoneEntry.IsEnabled = App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) || this.datePickerZoneEntry.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) ||
App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT); App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT);
this.checkBoxZoneEntryFixed.IsEnabled = this.datePickerZoneEntry.IsEnabled; this.checkBoxZoneEntryFixed.IsEnabled = this.datePickerZoneEntry.IsEnabled;
this.datePickerOperationStart.IsEnabled = App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL); this.datePickerOperationStart.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL);
this.datePickerOperationEnd.IsEnabled = App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL); this.datePickerOperationEnd.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL);
} }
private void buttonOK_Click(object sender, RoutedEventArgs e) private void buttonOK_Click(object sender, RoutedEventArgs e)

View File

@ -41,6 +41,16 @@ namespace BreCalClient
TUG = 64, TUG = 64,
} }
/// <summary>
/// Custom participant flags
/// </summary>
[Flags]
public enum ParticipantFlag
{
[Description("allow BSMD initial info")]
ALLOW_BSMD = 1,
}
/// <summary> /// <summary>
/// Should actually be defined in yaml /// Should actually be defined in yaml
/// </summary> /// </summary>
@ -55,16 +65,15 @@ namespace BreCalClient
#region public helper #region public helper
public static bool IsFlagSet(this Participant participant, ParticipantType flag) public static bool IsTypeFlagSet(this Participant participant, ParticipantType flag)
{ {
return (participant.Type & (uint)flag) != 0; return (participant.Type & (uint)flag) != 0;
} }
public static void SetFlag(this Participant participant, bool value, ParticipantType flag) public static bool IsFlagSet(this Participant participant, ParticipantFlag flag)
{ {
if (value) participant.Type |= (int)flag; return (participant.Flags & (uint)flag) != 0;
else participant.Type &= (int)~flag; }
}
public static string Truncate(this string value, int maxLength) public static string Truncate(this string value, int maxLength)
{ {

View File

@ -199,7 +199,7 @@ namespace BreCalClient
App.Participant = participant; App.Participant = participant;
EnableControlsForParticipant(); EnableControlsForParticipant();
} }
if(participant.IsFlagSet(Extensions.ParticipantType.AGENCY)) if(participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY))
agencies.Add(participant); agencies.Add(participant);
} }
this.searchFilterControl.SetAgencies(agencies); this.searchFilterControl.SetAgencies(agencies);
@ -209,7 +209,7 @@ namespace BreCalClient
private void EnableControlsForParticipant() private void EnableControlsForParticipant()
{ {
if (App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD)) if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD))
this.buttonNew.Visibility = Visibility.Visible; this.buttonNew.Visibility = Visibility.Visible;
} }

View File

@ -75,38 +75,38 @@ namespace BreCalClient
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TERMINAL); name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.TERMINAL);
this.labelTerminal.Content = name ?? "- / - "; this.labelTerminal.Content = name ?? "- / - ";
if(App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.TERMINAL))) if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.TERMINAL)))
{ {
this.labelTerminal.FontWeight = FontWeights.Bold; this.labelTerminal.FontWeight = FontWeights.Bold;
this.labelTerminal.Foreground = Brushes.LightYellow; this.labelTerminal.Foreground = Brushes.LightYellow;
} }
if(App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.PILOT))) if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.PILOT)))
{ {
this.labelPilot.FontWeight = FontWeights.Bold; this.labelPilot.FontWeight = FontWeights.Bold;
this.labelPilot.Foreground = Brushes.LightYellow; this.labelPilot.Foreground = Brushes.LightYellow;
} }
if(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.AGENCY))) if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.AGENCY)))
{ {
this.labelAgent.FontWeight = FontWeights.Bold; this.labelAgent.FontWeight = FontWeights.Bold;
this.labelAgent.Foreground = Brushes.LightYellow; this.labelAgent.Foreground = Brushes.LightYellow;
} }
if(App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.MOORING))) if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.MOORING)))
{ {
this.labelMooring.FontWeight = FontWeights.Bold; this.labelMooring.FontWeight = FontWeights.Bold;
this.labelMooring.Foreground = Brushes.LightYellow; this.labelMooring.Foreground = Brushes.LightYellow;
} }
if(App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.PORT_ADMINISTRATION))) if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.PORT_ADMINISTRATION)))
{ {
this.labelPortAuthority.FontWeight = FontWeights.Bold; this.labelPortAuthority.FontWeight = FontWeights.Bold;
this.labelPortAuthority.Foreground = Brushes.LightYellow; this.labelPortAuthority.Foreground = Brushes.LightYellow;
} }
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.TUG))) if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.TUG)))
{ {
this.labelTug.FontWeight = FontWeights.Bold; this.labelTug.FontWeight = FontWeights.Bold;
this.labelTug.Foreground = Brushes.LightYellow; this.labelTug.Foreground = Brushes.LightYellow;
} }
if (App.Participant.IsFlagSet(Extensions.ParticipantType.BSMD) || if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD) ||
(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.AGENCY)))) (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel.GetParticipantIdForType(Extensions.ParticipantType.AGENCY))))
{ {
this.labelShipName.FontWeight = FontWeights.Bold; this.labelShipName.FontWeight = FontWeights.Bold;
this.labelShipName.Foreground = Brushes.LightYellow; this.labelShipName.Foreground = Brushes.LightYellow;
@ -152,37 +152,37 @@ namespace BreCalClient
{ {
if(this.ParticipantDict.ContainsKey(times.ParticipantId)) if(this.ParticipantDict.ContainsKey(times.ParticipantId))
{ {
if (this.ParticipantDict[times.ParticipantId].IsFlagSet(Extensions.ParticipantType.AGENCY)) if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.AGENCY))
{ {
this.labelAgencyETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.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.labelAgencyETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockAgencyRemarks.Text = times.Remarks; this.textBlockAgencyRemarks.Text = times.Remarks;
} }
if (this.ParticipantDict[times.ParticipantId].IsFlagSet(Extensions.ParticipantType.MOORING)) if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.MOORING))
{ {
this.labelMooringETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelMooringETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelMooringETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelMooringETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockMooringRemarks.Text = times.Remarks; this.textBlockMooringRemarks.Text = times.Remarks;
} }
if (this.ParticipantDict[times.ParticipantId].IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION)) if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION))
{ {
this.labelPortAuthorityETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelPortAuthorityETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelPortAuthorityETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelPortAuthorityETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockPortAuthorityRemarks.Text = times.Remarks; this.textBlockPortAuthorityRemarks.Text = times.Remarks;
} }
if (this.ParticipantDict[times.ParticipantId].IsFlagSet(Extensions.ParticipantType.PILOT)) if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.PILOT))
{ {
this.labelPilotETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelPilotETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelPilotETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelPilotETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockPilotRemarks.Text = times.Remarks; this.textBlockPilotRemarks.Text = times.Remarks;
} }
if (this.ParticipantDict[times.ParticipantId].IsFlagSet(Extensions.ParticipantType.TUG)) if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.TUG))
{ {
this.labelTugETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelTugETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelTugETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelTugETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockTugRemarks.Text = times.Remarks; this.textBlockTugRemarks.Text = times.Remarks;
} }
if (this.ParticipantDict[times.ParticipantId].IsFlagSet(Extensions.ParticipantType.TERMINAL)) if (this.ParticipantDict[times.ParticipantId].IsTypeFlagSet(Extensions.ParticipantType.TERMINAL))
{ {
this.labelTerminalETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelTerminalETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelTerminalETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -"; this.labelTerminalETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
@ -205,8 +205,8 @@ 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) || if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD) ||
(App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.AGENCY)))) (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.AGENCY))))
this.EditRequested?.Invoke(this); this.EditRequested?.Invoke(this);
} }
@ -217,7 +217,7 @@ namespace BreCalClient
private void labelAgent_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) private void labelAgent_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{ {
if (App.Participant.IsFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.AGENCY))) if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.AGENCY)))
{ {
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY); Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
this.EditTimesRequested?.Invoke(this, times); this.EditTimesRequested?.Invoke(this, times);
@ -226,7 +226,7 @@ namespace BreCalClient
private void labelMooring_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) private void labelMooring_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{ {
if (App.Participant.IsFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.MOORING))) if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.MOORING)))
{ {
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING); Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING);
this.EditTimesRequested?.Invoke(this, times); this.EditTimesRequested?.Invoke(this, times);
@ -235,7 +235,7 @@ namespace BreCalClient
private void labelPortAuthority_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) private void labelPortAuthority_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{ {
if (App.Participant.IsFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.PORT_ADMINISTRATION))) if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.PORT_ADMINISTRATION)))
{ {
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION); Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION);
this.EditTimesRequested?.Invoke(this, times); this.EditTimesRequested?.Invoke(this, times);
@ -244,7 +244,7 @@ namespace BreCalClient
private void labelPilot_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) private void labelPilot_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{ {
if (App.Participant.IsFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.PILOT))) if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.PILOT)))
{ {
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PILOT); Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PILOT);
this.EditTimesRequested?.Invoke(this, times); this.EditTimesRequested?.Invoke(this, times);
@ -253,7 +253,7 @@ namespace BreCalClient
private void labelTug_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) private void labelTug_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{ {
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.TUG))) if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.TUG)))
{ {
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TUG); Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TUG);
this.EditTimesRequested?.Invoke(this, times); this.EditTimesRequested?.Invoke(this, times);
@ -262,7 +262,7 @@ namespace BreCalClient
private void labelTerminal_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) private void labelTerminal_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{ {
if (App.Participant.IsFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.TERMINAL))) if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == this.ShipcallControlModel?.GetParticipantIdForType(Extensions.ParticipantType.TERMINAL)))
{ {
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL); Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL);
this.EditTimesRequested?.Invoke(this, times); this.EditTimesRequested?.Invoke(this, times);

View File

@ -116,7 +116,7 @@ namespace BreCalClient
{ {
foreach(Participant p in AssignedParticipants.Values) foreach(Participant p in AssignedParticipants.Values)
{ {
if (p.IsFlagSet(participantType)) if (p.IsTypeFlagSet(participantType))
return p.Name; return p.Name;
} }
return null; return null;
@ -126,7 +126,7 @@ namespace BreCalClient
{ {
foreach(Participant p in AssignedParticipants.Values) foreach(Participant p in AssignedParticipants.Values)
{ {
if(p.IsFlagSet(participantType)) if(p.IsTypeFlagSet(participantType))
return p.Id; return p.Id;
} }
return null; return null;