commit
5ed0a08ca2
File diff suppressed because it is too large
Load Diff
@ -332,6 +332,17 @@ components:
|
||||
shipcallId:
|
||||
description: The unique identifier of a ship call
|
||||
type: integer
|
||||
participant_assignment:
|
||||
description: Participant assigned to a shipcall with a given role (type)
|
||||
type: object
|
||||
required:
|
||||
- participant_id
|
||||
- type
|
||||
properties:
|
||||
participant_id:
|
||||
type: integer
|
||||
type:
|
||||
type: integer
|
||||
shipcall:
|
||||
type: object
|
||||
required:
|
||||
@ -350,6 +361,7 @@ components:
|
||||
eta:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
voyage:
|
||||
type: string
|
||||
maxLength: 16
|
||||
@ -421,8 +433,7 @@ components:
|
||||
participants:
|
||||
type: array
|
||||
items:
|
||||
type: integer
|
||||
example: [1, 5, 7]
|
||||
$ref: "#/components/schemas/participant_assignment"
|
||||
created:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
@ -225,6 +225,7 @@ CREATE TABLE `shipcall_participant_map` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`shipcall_id` int unsigned DEFAULT NULL,
|
||||
`participant_id` int unsigned DEFAULT NULL,
|
||||
`type` int unsigned DEFAULT NULL COMMENT 'Type of participant role',
|
||||
`created` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
<SignAssembly>True</SignAssembly>
|
||||
<StartupObject>BreCalClient.App</StartupObject>
|
||||
<AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile>
|
||||
<AssemblyVersion>0.7.0.0</AssemblyVersion>
|
||||
<FileVersion>0.7.0.0</FileVersion>
|
||||
<AssemblyVersion>0.8.0.0</AssemblyVersion>
|
||||
<FileVersion>0.8.0.0</FileVersion>
|
||||
<Title>Bremen calling client</Title>
|
||||
<Description>A Windows WPF client for the Bremen calling API.</Description>
|
||||
<ApplicationIcon>containership.ico</ApplicationIcon>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2023 schick Informatik
|
||||
// Description: Windows dialog to create / edit ship calls
|
||||
//
|
||||
//
|
||||
|
||||
using BreCalClient.misc.Model;
|
||||
using System;
|
||||
@ -26,11 +26,11 @@ namespace BreCalClient
|
||||
|
||||
public ShipcallControlModel ShipcallModel { get; set; } = new ();
|
||||
|
||||
public Ship? SelectedShip {
|
||||
public Ship? SelectedShip {
|
||||
get
|
||||
{
|
||||
return this.comboBoxShip.SelectedItem as Ship;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -39,10 +39,10 @@ namespace BreCalClient
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent;
|
||||
this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent;
|
||||
|
||||
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(Extensions.TypeEnum));
|
||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(TypeEnum));
|
||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||
|
||||
@ -55,13 +55,13 @@ namespace BreCalClient
|
||||
private void buttonOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.CopyToModel();
|
||||
this.DialogResult = true;
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult= false;
|
||||
this.DialogResult= false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ namespace BreCalClient
|
||||
{
|
||||
this.comboBoxAgency.SelectedIndex = -1;
|
||||
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.AGENCY);
|
||||
}
|
||||
}
|
||||
|
||||
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@ -122,15 +122,23 @@ namespace BreCalClient
|
||||
this.datePickerETA.IsEnabled = true;
|
||||
this.datePickerETD.IsEnabled = false;
|
||||
this.datePickerETD.Value = null;
|
||||
this.comboBoxDepartureBerth.SelectedIndex = -1;
|
||||
this.comboBoxDepartureBerth.IsEnabled = false;
|
||||
this.comboBoxArrivalBerth.IsEnabled = true;
|
||||
break;
|
||||
case TypeEnum.Outgoing:
|
||||
this.datePickerETA.IsEnabled = false;
|
||||
this.datePickerETD.IsEnabled = true;
|
||||
this.datePickerETA.Value = null;
|
||||
this.comboBoxArrivalBerth.SelectedIndex = -1;
|
||||
this.comboBoxArrivalBerth.IsEnabled = false;
|
||||
this.comboBoxDepartureBerth.IsEnabled = true;
|
||||
break;
|
||||
case TypeEnum.Shifting:
|
||||
this.datePickerETA.IsEnabled = true;
|
||||
this.datePickerETD.IsEnabled = true;
|
||||
this.comboBoxArrivalBerth.IsEnabled = true;
|
||||
this.comboBoxDepartureBerth.IsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -145,16 +153,16 @@ namespace BreCalClient
|
||||
if (this.ShipcallModel.Shipcall != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Type = (int)this.comboBoxCategories.SelectedItem;
|
||||
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now;
|
||||
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1);
|
||||
|
||||
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value;
|
||||
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value;
|
||||
|
||||
this.ShipcallModel.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id;
|
||||
this.ShipcallModel.Ship = (Ship)this.comboBoxShip.SelectedItem;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// remove all and add selected participants
|
||||
this.ShipcallModel.Shipcall.Participants.Clear();
|
||||
this.ShipcallModel.AssignedParticipants.Clear();
|
||||
@ -163,23 +171,42 @@ namespace BreCalClient
|
||||
participant = (Participant?)this.comboBoxAgency.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = participant;
|
||||
ParticipantAssignment pa = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.AGENCY
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = pa;
|
||||
}
|
||||
|
||||
|
||||
// BSMD and port authority are always added
|
||||
foreach (Participant p in BreCalLists.Participants)
|
||||
|
||||
// get port authority from berth
|
||||
|
||||
int? berthId = this.ShipcallModel.Shipcall.ArrivalBerthId;
|
||||
if (berthId == null) berthId = this.ShipcallModel.Shipcall.DepartureBerthId;
|
||||
if (berthId != null)
|
||||
{
|
||||
if (p.Type == (int)Extensions.ParticipantType.PORT_ADMINISTRATION)
|
||||
Berth? selectedBerth = BreCalLists.Berths.Find((x) => x.Id == berthId);
|
||||
if (selectedBerth?.AuthorityId != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(p.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PORT_ADMINISTRATION] = p;
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(selectedBerth.AuthorityId.Value))
|
||||
{
|
||||
ParticipantAssignment pab = new()
|
||||
{
|
||||
ParticipantId = selectedBerth.AuthorityId.Value,
|
||||
Type = (int)ParticipantType.PORT_ADMINISTRATION
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[ParticipantType.PORT_ADMINISTRATION] = pab;
|
||||
}
|
||||
}
|
||||
if (p.Type == (int)Extensions.ParticipantType.BSMD)
|
||||
|
||||
ParticipantAssignment pa = new()
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(p.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.BSMD] = p;
|
||||
}
|
||||
ParticipantId = App.Participant.Id,
|
||||
Type = (int)ParticipantType.BSMD
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[ParticipantType.BSMD] = pa;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -189,28 +216,31 @@ namespace BreCalClient
|
||||
if (this.ShipcallModel == null) return;
|
||||
if (this.ShipcallModel.Shipcall != null)
|
||||
{
|
||||
this.comboBoxCategories.SelectedItem = (Extensions.TypeEnum)this.ShipcallModel.Shipcall.Type;
|
||||
this.comboBoxCategories.SelectedItem = (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.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
|
||||
this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId;
|
||||
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
|
||||
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
|
||||
|
||||
if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();
|
||||
|
||||
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
|
||||
if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();
|
||||
|
||||
if(this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
{
|
||||
if (((List<Participant>)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id;
|
||||
}
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId))
|
||||
{
|
||||
this.comboBoxAgency.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableControls()
|
||||
{
|
||||
bool isBsmd = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD);
|
||||
bool isAgency = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY);
|
||||
bool isBsmd = App.Participant.IsTypeFlagSet(ParticipantType.BSMD);
|
||||
bool isAgency = App.Participant.IsTypeFlagSet(ParticipantType.AGENCY);
|
||||
|
||||
bool editRightGrantedForBSMD = false;
|
||||
|
||||
@ -223,7 +253,7 @@ namespace BreCalClient
|
||||
{
|
||||
if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD) && isBsmd)
|
||||
isAgency = true;
|
||||
if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD))
|
||||
if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD))
|
||||
editRightGrantedForBSMD = true;
|
||||
}
|
||||
}
|
||||
@ -231,16 +261,16 @@ namespace BreCalClient
|
||||
this.comboBoxAgency.IsEnabled = isBsmd;
|
||||
this.comboBoxArrivalBerth.IsEnabled = isBsmd || isAgency;
|
||||
this.comboBoxCategories.IsEnabled = isBsmd;
|
||||
this.comboBoxDepartureBerth.IsEnabled = isBsmd || isAgency;
|
||||
this.comboBoxShip.IsEnabled = isBsmd;
|
||||
this.comboBoxDepartureBerth.IsEnabled = isBsmd || isAgency;
|
||||
this.comboBoxShip.IsEnabled = isBsmd;
|
||||
this.datePickerETA.IsEnabled = isAgency || isBsmd;
|
||||
this.datePickerETD.IsEnabled = isAgency;
|
||||
|
||||
|
||||
|
||||
this.labelBSMDGranted.Visibility = editRightGrantedForBSMD ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using static BreCalClient.Extensions;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -43,6 +44,23 @@ namespace BreCalClient
|
||||
|
||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.CopyToControls();
|
||||
|
||||
|
||||
Participant? p = null;
|
||||
if(this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
|
||||
bool allowBSMD = false;
|
||||
if (p != null)
|
||||
{
|
||||
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
|
||||
}
|
||||
|
||||
bool enableControls = (this.Times.ParticipantId == App.Participant.Id) ||
|
||||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
|
||||
|
||||
this.EnableControls(enableControls);
|
||||
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, RoutedEventArgs e)
|
||||
@ -98,26 +116,42 @@ namespace BreCalClient
|
||||
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant;
|
||||
ParticipantAssignment participantAssignment = new() {
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.MOORING
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment;
|
||||
}
|
||||
|
||||
participant = (Participant?)this.comboBoxPilot.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant;
|
||||
ParticipantAssignment participantAssignment = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.PILOT
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant;
|
||||
ParticipantAssignment participantAssignment = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.TERMINAL
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTug.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant;
|
||||
ParticipantAssignment participantAssignment = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.TUG
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -152,32 +186,83 @@ namespace BreCalClient
|
||||
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
|
||||
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
|
||||
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
|
||||
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled;
|
||||
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
|
||||
|
||||
this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored;
|
||||
this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired;
|
||||
this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored ?? false;
|
||||
this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired ?? false;
|
||||
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
|
||||
this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired;
|
||||
this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired ?? false;
|
||||
|
||||
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock;
|
||||
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
|
||||
|
||||
this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering;
|
||||
this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock;
|
||||
this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal;
|
||||
this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering ?? false;
|
||||
this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock ?? false;
|
||||
this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal ?? false;
|
||||
|
||||
if(!string.IsNullOrEmpty(this.Times.Remarks))
|
||||
this.textBoxRemarks.Text = this.Times.Remarks;
|
||||
this.textBoxRemarks.Text = this.Times.Remarks;
|
||||
|
||||
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
|
||||
{
|
||||
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.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
|
||||
{
|
||||
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
|
||||
{
|
||||
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
|
||||
{
|
||||
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
|
||||
{
|
||||
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableControls(bool isEnabled)
|
||||
{
|
||||
this.datePickerETA.IsEnabled = isEnabled;
|
||||
this.comboBoxArrivalBerth.IsEnabled = isEnabled;
|
||||
this.comboBoxPierside.IsEnabled = isEnabled;
|
||||
this.textBoxBerthRemarks.IsEnabled = isEnabled;
|
||||
this.doubleUpDownDraft.IsEnabled = isEnabled;
|
||||
this.datePickerTidalWindowFrom.IsEnabled = isEnabled;
|
||||
this.datePickerTidalWindowTo.IsEnabled = isEnabled;
|
||||
this.checkBoxCanceled.IsEnabled = isEnabled;
|
||||
|
||||
this.checkBoxAnchored.IsEnabled = isEnabled;
|
||||
this.checkBoxTugRequired.IsEnabled = isEnabled;
|
||||
this.comboBoxTug.IsEnabled = isEnabled;
|
||||
this.integerUpDownRecommendedTugs.IsEnabled = isEnabled;
|
||||
this.checkBoxPilotRequired.IsEnabled = isEnabled;
|
||||
this.comboBoxPilot.IsEnabled = isEnabled;
|
||||
this.comboBoxMooring.IsEnabled = isEnabled;
|
||||
this.checkBoxMooredLock.IsEnabled = isEnabled;
|
||||
this.comboBoxTerminal.IsEnabled = isEnabled;
|
||||
this.checkBoxBunkering.IsEnabled = isEnabled;
|
||||
this.checkBoxReplenishingTerminal.IsEnabled = isEnabled;
|
||||
this.checkBoxReplenishingLock.IsEnabled = isEnabled;
|
||||
this.textBoxRemarks.IsEnabled = isEnabled;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region context menu handlers
|
||||
|
||||
@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using static BreCalClient.Extensions;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -44,6 +45,22 @@ namespace BreCalClient
|
||||
|
||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.CopyToControls();
|
||||
|
||||
Participant? p = null;
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
|
||||
bool allowBSMD = false;
|
||||
if (p != null)
|
||||
{
|
||||
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
|
||||
}
|
||||
|
||||
bool enableControls = (this.Times.ParticipantId == App.Participant.Id) ||
|
||||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
|
||||
|
||||
this.EnableControls(enableControls);
|
||||
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, RoutedEventArgs e)
|
||||
@ -93,26 +110,42 @@ namespace BreCalClient
|
||||
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant;
|
||||
ParticipantAssignment participantAssignment = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.MOORING
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxPilot.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant;
|
||||
ParticipantAssignment participantAssignment = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.PILOT
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant;
|
||||
ParticipantAssignment participantAssignment = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.TERMINAL
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTug.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant;
|
||||
ParticipantAssignment participantAssignment = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.TUG
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,27 +180,75 @@ namespace BreCalClient
|
||||
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
|
||||
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
|
||||
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
|
||||
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled;
|
||||
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
|
||||
|
||||
this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired;
|
||||
this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired ?? false;
|
||||
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
|
||||
this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired;
|
||||
this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired ?? false;
|
||||
|
||||
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock;
|
||||
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo;
|
||||
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
|
||||
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
|
||||
if(!string.IsNullOrEmpty(this.Times.Remarks))
|
||||
this.textBoxRemarks.Text = this.Times.Remarks;
|
||||
|
||||
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
|
||||
{
|
||||
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 (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
|
||||
{
|
||||
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
|
||||
{
|
||||
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
|
||||
{
|
||||
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
|
||||
{
|
||||
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableControls(bool isEnabled)
|
||||
{
|
||||
this.datePickerETD.IsEnabled = isEnabled;
|
||||
this.comboBoxDepartureBerth.IsEnabled = isEnabled;
|
||||
this.comboBoxPierside.IsEnabled = isEnabled;
|
||||
this.textBoxBerthRemarks.IsEnabled = isEnabled;
|
||||
this.doubleUpDownDraft.IsEnabled = isEnabled;
|
||||
this.datePickerTidalWindowFrom.IsEnabled = isEnabled;
|
||||
this.datePickerTidalWindowTo.IsEnabled = isEnabled;
|
||||
this.checkBoxCanceled.IsEnabled = isEnabled;
|
||||
|
||||
this.checkBoxTugRequired.IsEnabled = isEnabled;
|
||||
this.comboBoxTug.IsEnabled = isEnabled;
|
||||
this.integerUpDownRecommendedTugs.IsEnabled = isEnabled;
|
||||
this.checkBoxPilotRequired.IsEnabled = isEnabled;
|
||||
this.comboBoxPilot.IsEnabled = isEnabled;
|
||||
this.comboBoxMooring.IsEnabled = isEnabled;
|
||||
this.checkBoxMooredLock.IsEnabled = isEnabled;
|
||||
this.comboBoxTerminal.IsEnabled = isEnabled;
|
||||
this.checkBoxRainsensitiveCargo.IsEnabled = isEnabled;
|
||||
this.textBoxRemarks.IsEnabled = isEnabled;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region context menu handlers
|
||||
|
||||
@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using static BreCalClient.Extensions;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -45,6 +46,22 @@ namespace BreCalClient
|
||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.CopyToControls();
|
||||
|
||||
Participant? p = null;
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
|
||||
|
||||
bool allowBSMD = false;
|
||||
if (p != null)
|
||||
{
|
||||
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
|
||||
}
|
||||
|
||||
bool enableControls = (this.Times.ParticipantId == App.Participant.Id) ||
|
||||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
|
||||
|
||||
this.EnableControls(enableControls);
|
||||
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, RoutedEventArgs e)
|
||||
@ -98,26 +115,42 @@ namespace BreCalClient
|
||||
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant;
|
||||
ParticipantAssignment pa = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.MOORING
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = pa;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxPilot.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant;
|
||||
ParticipantAssignment pa = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.PILOT
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = pa;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant;
|
||||
ParticipantAssignment pa = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.TERMINAL
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = pa;
|
||||
}
|
||||
participant = (Participant?)this.comboBoxTug.SelectedItem;
|
||||
if (participant != null)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(participant.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant;
|
||||
ParticipantAssignment pa = new()
|
||||
{
|
||||
ParticipantId = participant.Id,
|
||||
Type = (int)Extensions.ParticipantType.TUG
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = pa;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -164,27 +197,76 @@ namespace BreCalClient
|
||||
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
|
||||
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
|
||||
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
|
||||
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled;
|
||||
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
|
||||
|
||||
this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired;
|
||||
this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired ?? false;
|
||||
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
|
||||
this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired;
|
||||
this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired ?? false;
|
||||
|
||||
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock;
|
||||
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo;
|
||||
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
|
||||
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
|
||||
if(!string.IsNullOrEmpty(this.Times.Remarks))
|
||||
this.textBoxRemarks.Text = this.Times.Remarks;
|
||||
|
||||
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
|
||||
{
|
||||
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 (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
|
||||
{
|
||||
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
|
||||
{
|
||||
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
|
||||
{
|
||||
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
|
||||
{
|
||||
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
|
||||
{
|
||||
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableControls(bool isEnabled)
|
||||
{
|
||||
this.datePickerETD.IsEnabled = isEnabled;
|
||||
this.comboBoxArrivalBerth.IsEnabled = isEnabled;
|
||||
this.doubleUpDownDraft.IsEnabled = isEnabled;
|
||||
this.datePickerTidalWindowFrom.IsEnabled = isEnabled;
|
||||
this.datePickerTidalWindowTo.IsEnabled = isEnabled;
|
||||
this.datePickerETA.IsEnabled = isEnabled;
|
||||
this.comboBoxDepartureBerth.IsEnabled = isEnabled;
|
||||
this.comboBoxPiersideArrival.IsEnabled = isEnabled;
|
||||
this.textBoxBerthRemarksArrival.IsEnabled = isEnabled;
|
||||
this.checkBoxCanceled.IsEnabled = isEnabled;
|
||||
|
||||
this.checkBoxTugRequired.IsEnabled = isEnabled;
|
||||
this.comboBoxTug.IsEnabled = isEnabled;
|
||||
this.integerUpDownRecommendedTugs.IsEnabled = isEnabled;
|
||||
this.checkBoxPilotRequired.IsEnabled = isEnabled;
|
||||
this.comboBoxPilot.IsEnabled = isEnabled;
|
||||
this.comboBoxMooring.IsEnabled = isEnabled;
|
||||
this.checkBoxMooredLock.IsEnabled = isEnabled;
|
||||
this.comboBoxTerminal.IsEnabled = isEnabled;
|
||||
this.checkBoxRainsensitiveCargo.IsEnabled = isEnabled;
|
||||
this.textBoxRemarks.IsEnabled = isEnabled;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region context menu handlers
|
||||
|
||||
@ -36,26 +36,19 @@ namespace BreCalClient
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.CopyToControls();
|
||||
// enable controls according to participant type
|
||||
this.datePickerETABerth.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) ||
|
||||
App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) ||
|
||||
App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT) ||
|
||||
App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) ||
|
||||
App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TUG);
|
||||
bool enableControls = this.Times.ParticipantId == App.Participant.Id;
|
||||
|
||||
|
||||
this.checkBoxEtaBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled;
|
||||
this.datePickerETDBerth.IsEnabled = this.datePickerETABerth.IsEnabled;
|
||||
this.checkBoxEtDBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled;
|
||||
this.datePickerETABerth.IsEnabled = enableControls;
|
||||
this.checkBoxEtaBerthFixed.IsEnabled = enableControls;
|
||||
this.datePickerETDBerth.IsEnabled = enableControls;
|
||||
this.checkBoxEtDBerthFixed.IsEnabled = enableControls;
|
||||
this.datePickerLockTime.IsEnabled = enableControls;
|
||||
this.checkBoxLockTimeFixed.IsEnabled = enableControls;
|
||||
this.datePickerZoneEntry.IsEnabled = enableControls;
|
||||
this.checkBoxZoneEntryFixed.IsEnabled = enableControls;
|
||||
this.textBoxRemarks.IsEnabled = enableControls;
|
||||
this.buttonOK.IsEnabled = enableControls;
|
||||
|
||||
this.datePickerLockTime.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) ||
|
||||
App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) ||
|
||||
App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
this.checkBoxLockTimeFixed.IsEnabled = this.datePickerLockTime.IsEnabled;
|
||||
|
||||
this.datePickerZoneEntry.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) ||
|
||||
App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT);
|
||||
this.checkBoxZoneEntryFixed.IsEnabled = this.datePickerZoneEntry.IsEnabled;
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@ -29,6 +29,15 @@ namespace BreCalClient
|
||||
{
|
||||
this.comboBoxBerth.ItemsSource = BreCalLists.Berths;
|
||||
this.CopyToControls();
|
||||
|
||||
bool enableControls = this.Times.ParticipantId == App.Participant.Id;
|
||||
this.datePickerOperationStart.IsEnabled = enableControls;
|
||||
this.datePickerOperationEnd.IsEnabled = enableControls;
|
||||
this.comboBoxBerth.IsEnabled = enableControls;
|
||||
this.comboBoxPierside.IsEnabled = enableControls;
|
||||
this.textBoxRemarks.IsEnabled = enableControls;
|
||||
this.textBoxBerthRemarks.IsEnabled = enableControls;
|
||||
this.buttonOK.IsEnabled = enableControls;
|
||||
}
|
||||
|
||||
private void contextMenuItemClearOperationStart_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@ -16,6 +16,7 @@ using BreCalClient.misc.Client;
|
||||
using BreCalClient.misc.Model;
|
||||
|
||||
using static BreCalClient.Extensions;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -172,6 +173,9 @@ namespace BreCalClient
|
||||
{
|
||||
this.UpdateUI();
|
||||
|
||||
esc.ShipcallModel.Shipcall?.Participants.Clear();
|
||||
foreach (ParticipantAssignment pa in esc.ShipcallModel.AssignedParticipants.Values)
|
||||
esc.ShipcallModel.Shipcall?.Participants.Add(pa);
|
||||
this._api.ShipcallsPost(esc.ShipcallModel.Shipcall); // save new ship call
|
||||
this.AddShipcall(esc.ShipcallModel);
|
||||
|
||||
@ -295,12 +299,17 @@ namespace BreCalClient
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
this.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
|
||||
labelStatusBar.Text = ex.Message;
|
||||
}));
|
||||
|
||||
if (ex.Message.Contains("access", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
this.RefreshToken(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (shipcalls != null)
|
||||
@ -365,7 +374,7 @@ namespace BreCalClient
|
||||
scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId];
|
||||
if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0))
|
||||
scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name;
|
||||
scm.AssignParticipants(BreCalLists.Participants);
|
||||
scm.AssignParticipants();
|
||||
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
@ -390,7 +399,7 @@ namespace BreCalClient
|
||||
scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId];
|
||||
if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0))
|
||||
scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name;
|
||||
scm.AssignParticipants(BreCalLists.Participants);
|
||||
scm.AssignParticipants();
|
||||
}
|
||||
|
||||
private void RemoveShipcall(int shipcallId)
|
||||
@ -485,8 +494,8 @@ namespace BreCalClient
|
||||
{
|
||||
if (x.Shipcall == null) return 0;
|
||||
if (y.Shipcall == null) return 0;
|
||||
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta : x.Shipcall.Etd ?? x.Shipcall.Eta;
|
||||
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta : y.Shipcall.Etd ?? y.Shipcall.Eta;
|
||||
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta ?? DateTime.Now : x.Shipcall.Etd ?? DateTime.Now;
|
||||
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta ?? DateTime.Now : y.Shipcall.Etd ?? DateTime.Now;
|
||||
return DateTime.Compare(xDate, yDate);
|
||||
});
|
||||
break;
|
||||
@ -533,6 +542,9 @@ namespace BreCalClient
|
||||
{
|
||||
try
|
||||
{
|
||||
obj.ShipcallControlModel.Shipcall?.Participants.Clear();
|
||||
foreach(ParticipantAssignment pa in obj.ShipcallControlModel.AssignedParticipants.Values)
|
||||
obj.ShipcallControlModel.Shipcall?.Participants.Add(pa);
|
||||
await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall);
|
||||
obj.RefreshData();
|
||||
_refreshImmediately = true;
|
||||
@ -548,8 +560,13 @@ namespace BreCalClient
|
||||
|
||||
private async void Sc_EditTimesRequested(ShipcallControl obj, Times? times, Extensions.ParticipantType participantType)
|
||||
{
|
||||
|
||||
if( obj.ShipcallControlModel == null) { return; }
|
||||
if (!obj.ShipcallControlModel.AssignedParticipants.ContainsKey(participantType)) return; // no assigment means no dialog my friend
|
||||
|
||||
// show a dialog that lets the user create / update times for the given shipcall
|
||||
IEditTimesControl etc = (participantType == ParticipantType.TERMINAL) ? new EditTimesTerminalControl() : new EditTimesControl();
|
||||
IEditTimesControl etc = (participantType == ParticipantType.TERMINAL) ? new EditTimesTerminalControl() : new EditTimesControl();
|
||||
|
||||
|
||||
bool wasEdit = false;
|
||||
if (times != null)
|
||||
@ -557,6 +574,13 @@ namespace BreCalClient
|
||||
etc.Times = times;
|
||||
wasEdit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(obj.ShipcallControlModel.AssignedParticipants[participantType].ParticipantId == App.Participant.Id)
|
||||
{
|
||||
etc.Times.ParticipantId = App.Participant.Id; // this is my record, so the Participant Id is set that allows editing
|
||||
}
|
||||
}
|
||||
|
||||
// actually we should only do this on create but we have existing data
|
||||
etc.Times.ParticipantType = (int) participantType;
|
||||
@ -620,7 +644,15 @@ namespace BreCalClient
|
||||
{
|
||||
try
|
||||
{
|
||||
editControl.Times.ParticipantId = App.Participant.Id;
|
||||
// always try to be the agent, even if we are BSMD
|
||||
if (editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
{
|
||||
editControl.Times.ParticipantId = editControl.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId;
|
||||
}
|
||||
else
|
||||
{
|
||||
editControl.Times.ParticipantId = App.Participant.Id;
|
||||
}
|
||||
|
||||
if (wasEdit)
|
||||
{
|
||||
@ -637,6 +669,9 @@ namespace BreCalClient
|
||||
|
||||
sc.ShipcallControlModel?.Times.Add(editControl.Times);
|
||||
}
|
||||
editControl.ShipcallModel.Shipcall?.Participants.Clear();
|
||||
foreach (ParticipantAssignment pa in editControl.ShipcallModel.AssignedParticipants.Values)
|
||||
editControl.ShipcallModel.Shipcall?.Participants.Add(pa);
|
||||
await _api.ShipcallsPutAsync(editControl.ShipcallModel.Shipcall);
|
||||
_refreshImmediately = true;
|
||||
_tokenSource.Cancel();
|
||||
|
||||
@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>0.7.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>0.8.0.0</ApplicationVersion>
|
||||
<BootstrapperEnabled>False</BootstrapperEnabled>
|
||||
<Configuration>Release</Configuration>
|
||||
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
|
||||
|
||||
@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>0.7.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>0.8.0.0</ApplicationVersion>
|
||||
<BootstrapperEnabled>False</BootstrapperEnabled>
|
||||
<Configuration>Debug</Configuration>
|
||||
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
<RowDefinition Height=".05*"/>
|
||||
<RowDefinition Height=".125*"/>
|
||||
<RowDefinition Height=".125*"/>
|
||||
<RowDefinition Height=".125*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width=".4*" />
|
||||
@ -72,20 +71,15 @@
|
||||
<TextBlock Text="ETA" x:Name="labelETA"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left">
|
||||
<TextBlock x:Name="textBlockETA" />
|
||||
<TextBlock x:Name="textBlockETA" Padding="0" FontWeight="DemiBold"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{x:Static p:Resources.textBerth}" />
|
||||
<TextBlock Text="{x:Static p:Resources.textBerth}"/>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left">
|
||||
<TextBlock x:Name="textBlockBerth" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="7" Grid.Column="0" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{x:Static p:Resources.textAgency}" />
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Row="7" Grid.Column="1" HorizontalAlignment="Left">
|
||||
<TextBlock x:Name="textBlockAgency" />
|
||||
<TextBlock x:Name="textBlockBerth" Padding="0" FontWeight="DemiBold" />
|
||||
</Viewbox>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
@ -101,138 +95,122 @@
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTug" PreviewMouseUp="labelTug_PreviewMouseUp"/>
|
||||
<Label Grid.Row="0" Grid.Column="6" Grid.RowSpan="1" FontSize="12" Content="- / -" Foreground="White" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTerminal" PreviewMouseUp="labelTerminal_PreviewMouseUp" />
|
||||
|
||||
<!-- AGENCY -->
|
||||
<Border Grid.Row="2" Grid.Column="1" BorderThickness="1, 0, 0, 0" BorderBrush="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Padding="3,0,0,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height=".5*" />
|
||||
<RowDefinition Height=".5*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textBerth}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content = "ETA" x:Name="labelETAETDAgent" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" HorizontalContentAlignment="Left" x:Name="labelAgencyBerth" Padding="0" VerticalContentAlignment="Center" FontSize="11" FontWeight="SemiBold" />
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelAgencyETAETDValue" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Grid.RowSpan="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockAgencyRemarks" FontSize="10"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{x:Static p:Resources.textBerthRemarks}" Padding="0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="9"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.RowSpan="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockAgencyBerthRemarks" FontSize="10"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- MOORING -->
|
||||
<Border Grid.Row="2" Grid.Column="2" BorderThickness="1, 0, 0, 0" BorderBrush="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Padding="3,0,0,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" x:Name="labelETAETDMooring" Grid.Column="0" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Top" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelMooringETAETDValue" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockMooringRemarks"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textBerth}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="ETD" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" HorizontalContentAlignment="Left" x:Name="labelAgencyBerth" Padding="0" VerticalContentAlignment="Center" FontSize="9" />
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelAgencyETA" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelAgencyETD" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockAgencyRemarks" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textBerth}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="ETD" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" HorizontalContentAlignment="Left" x:Name="labelMooringBerth" Padding="0" VerticalContentAlignment="Center" FontSize="9" />
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelMooringETA" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelMooringETD" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockMooringRemarks"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textBerth}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="ETD" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="0" Grid.Column="1" HorizontalContentAlignment="Left" x:Name="labelPortAuthorityBerth" Padding="0" VerticalContentAlignment="Center" FontSize="9" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelPortAuthorityETA" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelPortAuthorityETD" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockPortAuthorityRemarks"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textBerth}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="ETD" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="0" Grid.Column="1" HorizontalContentAlignment="Left" x:Name="labelPilotBerth" Padding="0" VerticalContentAlignment="Center" FontSize="9" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelPilotETA" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelPilotETD" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockPilotRemarks"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textBerth}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="ETD" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="0" Grid.Column="1" HorizontalContentAlignment="Left" x:Name="labelTugBerth" Padding="0" VerticalContentAlignment="Center" FontSize="9" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelTugETA" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelTugETD" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockTugRemarks" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Start" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="End" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" HorizontalContentAlignment="Left" x:Name="labelTerminalBerth" Padding="0" VerticalContentAlignment="Center" FontSize="9" />
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelOperationsStart" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelOperationsEnd" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockTerminalRemarks" />
|
||||
</Grid>
|
||||
<!-- PORT AUTHORITY -->
|
||||
<Border Grid.Row="2" Grid.Column="3" BorderThickness="1, 0, 0, 0" BorderBrush="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Padding="3,0,0,0">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" x:Name="labelETAETDPortAuthority" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Top" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelPortAuthorityETAETDValue" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockPortAuthorityRemarks"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- PILOT -->
|
||||
<Border Grid.Row="2" Grid.Column="4" BorderThickness="1, 0, 0, 0" BorderBrush="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Padding="3,0,0,0">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" x:Name="labelETAETDPilot" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Top" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelPilotETAETDValue" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockPilotRemarks"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- TUG -->
|
||||
<Border Grid.Row="2" Grid.Column="5" BorderThickness="1, 0, 0, 0" BorderBrush="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Padding="3,0,0,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" x:Name="labelETAETDTug" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Top" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelTugETAETDValue" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockTugRemarks"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- TERMINAL -->
|
||||
<Border Grid.Row="2" Grid.Column="6" BorderThickness="1, 0, 0, 0" BorderBrush="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Padding="3,0,0,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height=".5*" />
|
||||
<RowDefinition Height=".5*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textBerth}" Padding="0" VerticalContentAlignment="Center" FontSize="9"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" HorizontalContentAlignment="Left" x:Name="labelTerminalBerth" Padding="0" VerticalContentAlignment="Center" FontSize="11" FontWeight="SemiBold" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textOperationsEnd}" x:Name="labelETAETDTerminal" Padding="0" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="1" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelOperationsStart" FontWeight="DemiBold"/>
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Top" FontSize="9"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockTerminalRemarks" FontSize="10"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{x:Static p:Resources.textBerthRemarks}" TextWrapping="Wrap" Padding="0" VerticalAlignment="Top" FontSize="9"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockTerminalBerthRemarks" FontSize="10"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Image Margin="2" Grid.Column="3" Grid.Row="0" Grid.RowSpan="3">
|
||||
<Image.Style>
|
||||
|
||||
@ -59,113 +59,123 @@ namespace BreCalClient
|
||||
#region public methods
|
||||
|
||||
public void RefreshData()
|
||||
{
|
||||
if (this.ShipcallControlModel == null) return;
|
||||
string agentName = "";
|
||||
string? name;
|
||||
_agency = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.AGENCY);
|
||||
name = _agency?.Name;
|
||||
if (name != null) agentName = name;
|
||||
this.labelAgent.Content = name ?? "- / -";
|
||||
|
||||
_mooring = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.MOORING);
|
||||
name = _mooring?.Name;
|
||||
this.labelMooring.Content = name ?? "- / -";
|
||||
|
||||
_pilot = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.PILOT);
|
||||
name = _pilot?.Name;
|
||||
this.labelPilot.Content = name ?? "- / - ";
|
||||
|
||||
_tug = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.TUG);
|
||||
name = _tug?.Name;
|
||||
this.labelTug.Content = name ?? "- / - ";
|
||||
|
||||
_port_administration = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
name = _port_administration?.Name;
|
||||
this.labelPortAuthority.Content = name ?? "- / - ";
|
||||
|
||||
_terminal = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.TERMINAL);
|
||||
name = _terminal?.Name;
|
||||
this.labelTerminal.Content = name ?? "- / - ";
|
||||
|
||||
if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == _terminal?.Id))
|
||||
{
|
||||
this.labelTerminal.FontWeight = FontWeights.Bold;
|
||||
this.labelTerminal.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == _pilot?.Id))
|
||||
{
|
||||
this.labelPilot.FontWeight = FontWeights.Bold;
|
||||
this.labelPilot.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if((App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == _agency?.Id)) ||
|
||||
(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD) && (_agency != null) && _agency.IsFlagSet(Extensions.ParticipantFlag.ALLOW_BSMD)))
|
||||
{
|
||||
this.labelAgent.FontWeight = FontWeights.Bold;
|
||||
this.labelAgent.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == _mooring?.Id))
|
||||
{
|
||||
this.labelMooring.FontWeight = FontWeights.Bold;
|
||||
this.labelMooring.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == _port_administration?.Id))
|
||||
{
|
||||
this.labelPortAuthority.FontWeight = FontWeights.Bold;
|
||||
this.labelPortAuthority.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == _tug?.Id))
|
||||
{
|
||||
this.labelTug.FontWeight = FontWeights.Bold;
|
||||
this.labelTug.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD))
|
||||
{
|
||||
this.labelShipName.FontWeight = FontWeights.Bold;
|
||||
this.labelShipName.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
this.labelShipName.Content = this.ShipcallControlModel?.Ship?.Name;
|
||||
switch(this.ShipcallControlModel?.Shipcall?.Type)
|
||||
{
|
||||
case 1: // incoming
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_down_red.png"));
|
||||
break;
|
||||
case 2: // outgoing
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_up_blue.png"));
|
||||
break;
|
||||
case 3: // shifting
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_right_green.png"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this.textBlockBerth.Text = this.ShipcallControlModel?.Berth;
|
||||
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
|
||||
if ((this.ShipcallControlModel?.Shipcall?.Type == 1) || (this.ShipcallControlModel?.Shipcall?.Type == 3))
|
||||
{
|
||||
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta.ToString("dd.MM. HH:mm");
|
||||
}
|
||||
if(this.ShipcallControlModel?.Shipcall?.Type == 2)
|
||||
{
|
||||
this.labelETA.Text = "ETD";
|
||||
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Etd?.ToString("dd.MM. HH:mm");
|
||||
}
|
||||
|
||||
this.textBlockIMO.Text = this.ShipcallControlModel?.Ship?.Imo.ToString();
|
||||
this.textBlockLengthWidth.Text = $"{this.ShipcallControlModel?.Ship?.Length} / {this.ShipcallControlModel?.Ship?.Width}";
|
||||
this.textBlockAgency.Text = agentName.TruncateDots(10);
|
||||
|
||||
|
||||
{
|
||||
if (this.ShipcallControlModel != null)
|
||||
{
|
||||
string agentName = "";
|
||||
string? name;
|
||||
_agency = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.AGENCY);
|
||||
name = _agency?.Name;
|
||||
if (name != null) agentName = name;
|
||||
this.labelAgent.Content = name ?? "- / -";
|
||||
|
||||
_mooring = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.MOORING);
|
||||
name = _mooring?.Name;
|
||||
this.labelMooring.Content = name ?? "- / -";
|
||||
|
||||
_pilot = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.PILOT);
|
||||
name = _pilot?.Name;
|
||||
this.labelPilot.Content = name ?? "- / - ";
|
||||
|
||||
_tug = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.TUG);
|
||||
name = _tug?.Name;
|
||||
this.labelTug.Content = name ?? "- / - ";
|
||||
|
||||
_port_administration = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
name = _port_administration?.Name;
|
||||
this.labelPortAuthority.Content = name ?? "- / - ";
|
||||
|
||||
_terminal = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.TERMINAL);
|
||||
name = _terminal?.Name;
|
||||
this.labelTerminal.Content = name ?? "- / - ";
|
||||
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == _terminal?.Id))
|
||||
{
|
||||
this.labelTerminal.FontWeight = FontWeights.Bold;
|
||||
this.labelTerminal.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == _pilot?.Id))
|
||||
{
|
||||
this.labelPilot.FontWeight = FontWeights.Bold;
|
||||
this.labelPilot.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if ((App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == _agency?.Id)) ||
|
||||
(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD) && (_agency != null) && _agency.IsFlagSet(Extensions.ParticipantFlag.ALLOW_BSMD)))
|
||||
{
|
||||
this.labelAgent.FontWeight = FontWeights.Bold;
|
||||
this.labelAgent.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == _mooring?.Id))
|
||||
{
|
||||
this.labelMooring.FontWeight = FontWeights.Bold;
|
||||
this.labelMooring.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == _port_administration?.Id))
|
||||
{
|
||||
this.labelPortAuthority.FontWeight = FontWeights.Bold;
|
||||
this.labelPortAuthority.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == _tug?.Id))
|
||||
{
|
||||
this.labelTug.FontWeight = FontWeights.Bold;
|
||||
this.labelTug.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD))
|
||||
{
|
||||
this.labelShipName.FontWeight = FontWeights.Bold;
|
||||
this.labelShipName.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
|
||||
this.labelShipName.Content = this.ShipcallControlModel?.Ship?.Name;
|
||||
switch (this.ShipcallControlModel?.Shipcall?.Type)
|
||||
{
|
||||
case 1: // incoming
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_down_red.png"));
|
||||
break;
|
||||
case 2: // outgoing
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_up_blue.png"));
|
||||
break;
|
||||
case 3: // shifting
|
||||
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_right_green.png"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this.textBlockBerth.Text = this.ShipcallControlModel?.Berth;
|
||||
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
|
||||
if ((this.ShipcallControlModel?.Shipcall?.Type == 1) || (this.ShipcallControlModel?.Shipcall?.Type == 3))
|
||||
{
|
||||
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta?.ToString("dd.MM. HH:mm");
|
||||
}
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type == 2)
|
||||
{
|
||||
this.labelETA.Text = "ETD";
|
||||
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Etd?.ToString("dd.MM. HH:mm");
|
||||
}
|
||||
|
||||
this.textBlockIMO.Text = this.ShipcallControlModel?.Ship?.Imo.ToString();
|
||||
this.textBlockLengthWidth.Text = $"{this.ShipcallControlModel?.Ship?.Length} / {this.ShipcallControlModel?.Ship?.Width}";
|
||||
|
||||
// rename labels if this is not an incoming
|
||||
// must be here because there may not be a times record for each participant (yet)
|
||||
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
||||
{
|
||||
this.labelETAETDAgent.Content = "ETD";
|
||||
this.labelETAETDMooring.Content = "ETD";
|
||||
this.labelETAETDPilot.Content = "ETD";
|
||||
this.labelETAETDPortAuthority.Content = "ETD";
|
||||
this.labelETAETDTug.Content = "ETD";
|
||||
this.labelETAETDTerminal.Content = BreCalClient.Resources.Resources.textOperationsEnd;
|
||||
}
|
||||
|
||||
foreach (Times times in this.ShipcallControlModel.Times)
|
||||
{
|
||||
string? berthText = null;
|
||||
@ -174,16 +184,16 @@ namespace BreCalClient
|
||||
Berth? berth = BreCalLists.Berths.Find((x) => x.Id == times.BerthId);
|
||||
berthText = berth?.Name;
|
||||
}
|
||||
if(berthText == null)
|
||||
if (berthText == null)
|
||||
{
|
||||
if (this.ShipcallControlModel.Shipcall?.Type == (int) Extensions.TypeEnum.Outgoing)
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type == (int)Extensions.TypeEnum.Outgoing)
|
||||
{
|
||||
Berth? berth = BreCalLists.Berths?.Find((x) => x.Id == this.ShipcallControlModel.Shipcall?.DepartureBerthId);
|
||||
berthText = berth?.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
Berth? berth = BreCalLists.Berths?.Find((x) => x.Id == this.ShipcallControlModel.Shipcall?.ArrivalBerthId);
|
||||
Berth? berth = BreCalLists.Berths?.Find((x) => x.Id == this.ShipcallControlModel?.Shipcall?.ArrivalBerthId);
|
||||
berthText = berth?.Name;
|
||||
}
|
||||
}
|
||||
@ -191,47 +201,67 @@ namespace BreCalClient
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.AGENCY)
|
||||
{
|
||||
this.labelAgencyBerth.Content = berthText;
|
||||
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.labelAgencyETAETDValue.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockAgencyRemarks.Text = times.Remarks;
|
||||
this.textBlockAgencyBerthRemarks.Text = times.BerthInfo;
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
||||
{
|
||||
this.labelAgencyETAETDValue.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
}
|
||||
}
|
||||
if (times.ParticipantType == (int) Extensions.ParticipantType.MOORING)
|
||||
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.MOORING)
|
||||
{
|
||||
this.labelMooringBerth.Content = berthText;
|
||||
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.labelMooringETAETDValue.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockMooringRemarks.Text = times.Remarks;
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
||||
{
|
||||
this.labelMooringETAETDValue.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
}
|
||||
}
|
||||
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.PORT_ADMINISTRATION)
|
||||
{
|
||||
this.labelPortAuthorityBerth.Content = berthText;
|
||||
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.textBlockPortAuthorityRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.PILOT)
|
||||
{
|
||||
this.labelPilotBerth.Content = berthText;
|
||||
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.textBlockPilotRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.TUG)
|
||||
{
|
||||
this.labelTugBerth.Content = berthText;
|
||||
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.textBlockTugRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.TERMINAL)
|
||||
{
|
||||
this.labelTerminalBerth.Content = berthText;
|
||||
this.labelOperationsStart.Content = times.OperationsStart.HasValue ? times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelOperationsEnd.Content = times.OperationsEnd.HasValue ? times.OperationsEnd.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.labelPortAuthorityETAETDValue.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockPortAuthorityRemarks.Text = times.Remarks;
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
||||
{
|
||||
this.labelPortAuthorityETAETDValue.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
}
|
||||
}
|
||||
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.PILOT)
|
||||
{
|
||||
this.labelPilotETAETDValue.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockPilotRemarks.Text = times.Remarks;
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
||||
{
|
||||
this.labelPilotETAETDValue.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
}
|
||||
}
|
||||
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.TUG)
|
||||
{
|
||||
this.labelTugETAETDValue.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockTugRemarks.Text = times.Remarks;
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
||||
{
|
||||
this.labelTugETAETDValue.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
}
|
||||
}
|
||||
|
||||
if (times.ParticipantType == (int)Extensions.ParticipantType.TERMINAL)
|
||||
{
|
||||
this.labelOperationsStart.Content = times.OperationsStart.HasValue ? times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
this.textBlockTerminalRemarks.Text = times.Remarks;
|
||||
}
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
||||
{
|
||||
this.labelOperationsStart.Content = times.OperationsEnd.HasValue ? times.OperationsEnd.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
}
|
||||
this.textBlockTerminalBerthRemarks.Text = times.BerthInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -240,13 +270,13 @@ namespace BreCalClient
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
// TBD
|
||||
}
|
||||
|
||||
private void buttonEditShipcall_Click(object? sender, RoutedEventArgs? e)
|
||||
{
|
||||
if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD))
|
||||
this.EditRequested?.Invoke(this);
|
||||
this.EditRequested?.Invoke(this);
|
||||
}
|
||||
|
||||
private void Image_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
@ -255,58 +285,39 @@ namespace BreCalClient
|
||||
}
|
||||
|
||||
private void labelAgent_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if ((App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) && (App.Participant.Id == _agency?.Id)) ||
|
||||
(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD) && (_agency != null) && _agency.IsFlagSet(Extensions.ParticipantFlag.ALLOW_BSMD)))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
||||
this.EditAgencyRequested?.Invoke(this, times);
|
||||
}
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
||||
this.EditAgencyRequested?.Invoke(this, times);
|
||||
}
|
||||
|
||||
private void labelMooring_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) && (App.Participant.Id == _mooring?.Id))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.MOORING);
|
||||
}
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.MOORING);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.MOORING);
|
||||
}
|
||||
|
||||
private void labelPortAuthority_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) && (App.Participant.Id == _port_administration?.Id))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
}
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
}
|
||||
|
||||
private void labelPilot_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT) && (App.Participant.Id == _pilot?.Id))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PILOT);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.PILOT);
|
||||
}
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PILOT);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.PILOT);
|
||||
}
|
||||
|
||||
private void labelTug_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TUG) && (App.Participant.Id == _tug?.Id))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TUG);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.TUG);
|
||||
}
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TUG);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.TUG);
|
||||
}
|
||||
|
||||
private void labelTerminal_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL) && (App.Participant.Id == _terminal?.Id))
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.TERMINAL);
|
||||
}
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.TERMINAL);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.TERMINAL);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -47,7 +47,7 @@ namespace BreCalClient
|
||||
|
||||
public string? Berth { get; set; }
|
||||
|
||||
internal Dictionary<Extensions.ParticipantType, Participant> AssignedParticipants { get; } = new();
|
||||
internal Dictionary<Extensions.ParticipantType, ParticipantAssignment> AssignedParticipants { get; } = new();
|
||||
|
||||
public List<Times> Times { get; set; } = new();
|
||||
|
||||
@ -79,22 +79,14 @@ namespace BreCalClient
|
||||
|
||||
#region public methods
|
||||
|
||||
public void AssignParticipants(List<Participant> participants)
|
||||
public void AssignParticipants()
|
||||
{
|
||||
this.AssignedParticipants.Clear();
|
||||
if (Shipcall != null)
|
||||
{
|
||||
foreach (int participantId in Shipcall.Participants)
|
||||
foreach (ParticipantAssignment participantAssignment in Shipcall.Participants)
|
||||
{
|
||||
Participant? participant = participants.Find((x) => x.Id == participantId);
|
||||
if (participant != null)
|
||||
{
|
||||
foreach(Extensions.ParticipantType participantType in Enum.GetValues(typeof(Extensions.ParticipantType)))
|
||||
{
|
||||
if(participant.IsTypeFlagSet(participantType))
|
||||
AssignedParticipants[participantType] = participant;
|
||||
}
|
||||
}
|
||||
AssignedParticipants[(Extensions.ParticipantType)participantAssignment.Type] = participantAssignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -103,7 +95,7 @@ namespace BreCalClient
|
||||
{
|
||||
|
||||
if (AssignedParticipants.ContainsKey(type)) {
|
||||
int participantId = AssignedParticipants[type].Id;
|
||||
int participantId = AssignedParticipants[type].ParticipantId;
|
||||
foreach (Times times in this.Times)
|
||||
{
|
||||
if ((times.ParticipantId == participantId) && (times.ParticipantType == (int) type))
|
||||
@ -145,11 +137,9 @@ namespace BreCalClient
|
||||
|
||||
internal Participant? GetParticipantForType(Extensions.ParticipantType participantType)
|
||||
{
|
||||
foreach(Participant p in AssignedParticipants.Values)
|
||||
{
|
||||
if (p.IsTypeFlagSet(participantType))
|
||||
return p;
|
||||
}
|
||||
if(AssignedParticipants.ContainsKey(participantType) && BreCalLists.ParticipantLookupDict.ContainsKey(AssignedParticipants[participantType].ParticipantId))
|
||||
return BreCalLists.ParticipantLookupDict[AssignedParticipants[participantType].ParticipantId];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -22,9 +22,11 @@ def GetShipcalls(options):
|
||||
"anchored, moored_lock, canceled, evaluation, evaluation_message, created, modified FROM shipcall WHERE eta IS NULL OR eta >= DATE(NOW() - INTERVAL 2 DAY) " +
|
||||
"ORDER BY eta", model=model.Shipcall)
|
||||
for shipcall in data:
|
||||
participant_query = "SELECT participant_id FROM shipcall_participant_map WHERE shipcall_id=?shipcall_id?";
|
||||
participant_query = "SELECT participant_id, type FROM shipcall_participant_map WHERE shipcall_id=?shipcall_id?";
|
||||
for record in commands.query(participant_query, model=dict, param={"shipcall_id" : shipcall.id}, buffered=False):
|
||||
shipcall.participants.append(record["participant_id"])
|
||||
# model.Participant_Assignment = model.Participant_Assignment()
|
||||
pa = model.Participant_Assignment(record["participant_id"], record["type"])
|
||||
shipcall.participants.append(pa)
|
||||
|
||||
pooledConnection.close()
|
||||
|
||||
@ -82,6 +84,10 @@ def PostShipcalls(schemaModel):
|
||||
continue
|
||||
if key == "modified":
|
||||
continue
|
||||
if key == "evaluation":
|
||||
continue
|
||||
if key == "evaluation_message":
|
||||
continue
|
||||
if isNotFirst:
|
||||
query += ","
|
||||
isNotFirst = True
|
||||
@ -92,11 +98,9 @@ def PostShipcalls(schemaModel):
|
||||
new_id = commands.execute_scalar("select last_insert_id()")
|
||||
|
||||
# add participant assignments
|
||||
# TODO: make sure there are not two participants of the same type
|
||||
|
||||
pquery = "INSERT INTO shipcall_participant_map (shipcall_id, participant_id) VALUES (?shipcall_id?, ?participant_id?)"
|
||||
for participant_id in schemaModel["participants"]:
|
||||
commands.execute(pquery, param={"shipcall_id" : new_id, "participant_id" : participant_id})
|
||||
pquery = "INSERT INTO shipcall_participant_map (shipcall_id, participant_id, type) VALUES (?shipcall_id?, ?participant_id?, ?type?)"
|
||||
for participant_assignment in schemaModel["participants"]:
|
||||
commands.execute(pquery, param={"shipcall_id" : new_id, "participant_id" : participant_assignment["participant_id"], "type" : participant_assignment["type"]})
|
||||
|
||||
pooledConnection.close()
|
||||
|
||||
@ -153,27 +157,26 @@ def PutShipcalls(schemaModel):
|
||||
query += "WHERE id = ?id?"
|
||||
affected_rows = commands.execute(query, param=schemaModel)
|
||||
|
||||
pquery = "SELECT id, participant_id FROM shipcall_participant_map where shipcall_id = ?id?"
|
||||
pquery = "SELECT id, participant_id, type FROM shipcall_participant_map where shipcall_id = ?id?"
|
||||
pdata = commands.query(pquery,param={"id" : schemaModel["id"]}) # existing list of assignments
|
||||
|
||||
# loop across passed participant ids, creating entries for those not present in pdata
|
||||
# TODO: make sure there are not two participants of the same type
|
||||
|
||||
for participant_id in schemaModel["participants"]:
|
||||
for participant_assignment in schemaModel["participants"]:
|
||||
found_participant = False
|
||||
for elem in pdata:
|
||||
if elem["participant_id"] == participant_id:
|
||||
if elem["participant_id"] == participant_assignment["participant_id"] and elem["type"] == participant_assignment["type"]:
|
||||
found_participant = True
|
||||
break
|
||||
if not found_participant:
|
||||
nquery = "INSERT INTO shipcall_participant_map (shipcall_id, participant_id) VALUES (?shipcall_id?, ?participant_id?)"
|
||||
commands.execute(nquery, param={"shipcall_id" : schemaModel["id"], "participant_id" : participant_id})
|
||||
nquery = "INSERT INTO shipcall_participant_map (shipcall_id, participant_id, type) VALUES (?shipcall_id?, ?participant_id?, ?type?)"
|
||||
commands.execute(nquery, param={"shipcall_id" : schemaModel["id"], "participant_id" : participant_assignment["participant_id"], "type" : participant_assignment["type"]})
|
||||
|
||||
# loop across existing pdata entries, deleting those not present in participant list
|
||||
for elem in pdata:
|
||||
found_participant = False
|
||||
for participant_id in schemaModel["participants"]:
|
||||
if(participant_id == elem["participant_id"]):
|
||||
for participant_assignment in schemaModel["participants"]:
|
||||
if(participant_assignment["participant_id"] == elem["participant_id"] and participant_assignment["type"] == elem["type"]):
|
||||
found_participant = True
|
||||
break;
|
||||
if not found_participant:
|
||||
|
||||
@ -59,6 +59,10 @@ class Participant(Schema):
|
||||
class ParticipantList(Participant):
|
||||
pass
|
||||
|
||||
class ParticipantAssignmentSchema(Schema):
|
||||
participant_id = fields.Int()
|
||||
type = fields.Int()
|
||||
|
||||
class ShipcallSchema(Schema):
|
||||
def __init__(self):
|
||||
super().__init__(unknown=None)
|
||||
@ -67,7 +71,7 @@ class ShipcallSchema(Schema):
|
||||
id = fields.Int()
|
||||
ship_id = fields.Int()
|
||||
type = fields.Int()
|
||||
eta = fields.DateTime()
|
||||
eta = fields.DateTime(Required = False, allow_none=True)
|
||||
voyage = fields.Str(Required = False, allow_none=True)
|
||||
etd = fields.DateTime(Required = False, allow_none=True)
|
||||
arrival_berth_id = fields.Int(Required = False, allow_none=True)
|
||||
@ -89,10 +93,20 @@ class ShipcallSchema(Schema):
|
||||
canceled = fields.Bool(Required = False, allow_none=True)
|
||||
evaluation = fields.Int(Required = False, allow_none=True)
|
||||
evaluation_message = fields.Str(Required = False, allow_none=True)
|
||||
participants = fields.List(fields.Int)
|
||||
participants = fields.List(fields.Nested(ParticipantAssignmentSchema))
|
||||
created = fields.DateTime(Required = False, allow_none=True)
|
||||
modified = fields.DateTime(Required = False, allow_none=True)
|
||||
|
||||
@dataclass
|
||||
class Participant_Assignment:
|
||||
def __init__(self, participant_id, type):
|
||||
self.participant_id = participant_id
|
||||
self.type = type
|
||||
pass
|
||||
|
||||
participant_id: int
|
||||
type: int
|
||||
|
||||
@dataclass
|
||||
class Shipcall:
|
||||
|
||||
@ -123,7 +137,7 @@ class Shipcall:
|
||||
evaluation_message: str
|
||||
created: datetime
|
||||
modified: datetime
|
||||
participants: List[int] = field(default_factory=list)
|
||||
participants: List[Participant_Assignment] = field(default_factory=list)
|
||||
|
||||
class ShipcallId(Schema):
|
||||
pass
|
||||
|
||||
Loading…
Reference in New Issue
Block a user