commit
5ed0a08ca2
@ -1,7 +1,7 @@
|
||||
|
||||
//----------------------
|
||||
// <auto-generated>
|
||||
// Generated REST API Client Code Generator v1.8.4.0 on 04.10.2023 07:39:32
|
||||
// Generated REST API Client Code Generator v1.8.4.0 on 09.10.2023 17:46:55
|
||||
// Using the tool OpenAPI Generator v7.0.0
|
||||
// </auto-generated>
|
||||
//----------------------
|
||||
@ -51,7 +51,6 @@ using System.Threading.Tasks;
|
||||
*/
|
||||
namespace BreCalClient.misc.Api
|
||||
{
|
||||
|
||||
#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null'
|
||||
|
||||
/// <summary>
|
||||
@ -3770,7 +3769,7 @@ namespace BreCalClient.misc.Client
|
||||
/// <example>
|
||||
/// ApiKeyPrefix["Authorization"] = "Bearer";
|
||||
/// </example>
|
||||
/// … where ApiKey["Authorization"] would then be used to set the value of your bearer token.
|
||||
/// <EFBFBD> where ApiKey["Authorization"] would then be used to set the value of your bearer token.
|
||||
///
|
||||
/// <remarks>
|
||||
/// OAuth2 workflows should set tokens via AccessToken.
|
||||
@ -4913,16 +4912,18 @@ namespace BreCalClient.misc.Model
|
||||
/// </summary>
|
||||
/// <param name="id">id.</param>
|
||||
/// <param name="name">name.</param>
|
||||
/// <param name="participantId">participantId.</param>
|
||||
/// <param name="ownerId">ownerId.</param>
|
||||
/// <param name="authorityId">authorityId.</param>
|
||||
/// <param name="varLock">varLock.</param>
|
||||
/// <param name="created">created.</param>
|
||||
/// <param name="modified">modified.</param>
|
||||
/// <param name="deleted">deleted (default to false).</param>
|
||||
public Berth(int id = default(int), string name = default(string), int? participantId = default(int?), bool? varLock = default(bool?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?), bool deleted = false)
|
||||
public Berth(int id = default(int), string name = default(string), int? ownerId = default(int?), int? authorityId = default(int?), bool? varLock = default(bool?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?), bool deleted = false)
|
||||
{
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.ParticipantId = participantId;
|
||||
this.OwnerId = ownerId;
|
||||
this.AuthorityId = authorityId;
|
||||
this.VarLock = varLock;
|
||||
this.Created = created;
|
||||
this.Modified = modified;
|
||||
@ -4939,10 +4940,15 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "name", EmitDefaultValue = true)]
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets ParticipantId
|
||||
/// Gets or Sets OwnerId
|
||||
/// </summary>
|
||||
[DataMember(Name = "participant_id", EmitDefaultValue = true)]
|
||||
public int? ParticipantId { get; set; }
|
||||
[DataMember(Name = "owner_id", EmitDefaultValue = true)]
|
||||
public int? OwnerId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets AuthorityId
|
||||
/// </summary>
|
||||
[DataMember(Name = "authority_id", EmitDefaultValue = true)]
|
||||
public int? AuthorityId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets VarLock
|
||||
/// </summary>
|
||||
@ -4973,7 +4979,8 @@ namespace BreCalClient.misc.Model
|
||||
sb.Append("class Berth {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n");
|
||||
sb.Append(" OwnerId: ").Append(OwnerId).Append("\n");
|
||||
sb.Append(" AuthorityId: ").Append(AuthorityId).Append("\n");
|
||||
sb.Append(" VarLock: ").Append(VarLock).Append("\n");
|
||||
sb.Append(" Created: ").Append(Created).Append("\n");
|
||||
sb.Append(" Modified: ").Append(Modified).Append("\n");
|
||||
@ -5020,9 +5027,14 @@ namespace BreCalClient.misc.Model
|
||||
this.Name.Equals(input.Name))
|
||||
) &&
|
||||
(
|
||||
this.ParticipantId == input.ParticipantId ||
|
||||
(this.ParticipantId != null &&
|
||||
this.ParticipantId.Equals(input.ParticipantId))
|
||||
this.OwnerId == input.OwnerId ||
|
||||
(this.OwnerId != null &&
|
||||
this.OwnerId.Equals(input.OwnerId))
|
||||
) &&
|
||||
(
|
||||
this.AuthorityId == input.AuthorityId ||
|
||||
(this.AuthorityId != null &&
|
||||
this.AuthorityId.Equals(input.AuthorityId))
|
||||
) &&
|
||||
(
|
||||
this.VarLock == input.VarLock ||
|
||||
@ -5058,9 +5070,13 @@ namespace BreCalClient.misc.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.Name.GetHashCode();
|
||||
}
|
||||
if (this.ParticipantId != null)
|
||||
if (this.OwnerId != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode();
|
||||
hashCode = (hashCode * 59) + this.OwnerId.GetHashCode();
|
||||
}
|
||||
if (this.AuthorityId != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AuthorityId.GetHashCode();
|
||||
}
|
||||
if (this.VarLock != null)
|
||||
{
|
||||
@ -6153,6 +6169,125 @@ namespace BreCalClient.misc.Model
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Bremen calling API
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 0.6.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
namespace BreCalClient.misc.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Participant assigned to a shipcall with a given role (type)
|
||||
/// </summary>
|
||||
[DataContract(Name = "participant_assignment")]
|
||||
public partial class ParticipantAssignment : IEquatable<ParticipantAssignment>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParticipantAssignment" /> class.
|
||||
/// </summary>
|
||||
[JsonConstructorAttribute]
|
||||
protected ParticipantAssignment() { }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParticipantAssignment" /> class.
|
||||
/// </summary>
|
||||
/// <param name="participantId">participantId (required).</param>
|
||||
/// <param name="type">type (required).</param>
|
||||
public ParticipantAssignment(int participantId = default(int), int type = default(int))
|
||||
{
|
||||
this.ParticipantId = participantId;
|
||||
this.Type = type;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or Sets ParticipantId
|
||||
/// </summary>
|
||||
[DataMember(Name = "participant_id", IsRequired = true, EmitDefaultValue = true)]
|
||||
public int ParticipantId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Type
|
||||
/// </summary>
|
||||
[DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)]
|
||||
public int Type { get; set; }
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("class ParticipantAssignment {\n");
|
||||
sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n");
|
||||
sb.Append(" Type: ").Append(Type).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public virtual string ToJson()
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object input)
|
||||
{
|
||||
return this.Equals(input as ParticipantAssignment);
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns true if ParticipantAssignment instances are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Instance of ParticipantAssignment to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(ParticipantAssignment input)
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return
|
||||
(
|
||||
this.ParticipantId == input.ParticipantId ||
|
||||
this.ParticipantId.Equals(input.ParticipantId)
|
||||
) &&
|
||||
(
|
||||
this.Type == input.Type ||
|
||||
this.Type.Equals(input.Type)
|
||||
);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hashCode = 41;
|
||||
hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode();
|
||||
hashCode = (hashCode * 59) + this.Type.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Bremen calling API
|
||||
*
|
||||
@ -6513,11 +6648,16 @@ namespace BreCalClient.misc.Model
|
||||
/// <param name="participants">participants.</param>
|
||||
/// <param name="created">created.</param>
|
||||
/// <param name="modified">modified.</param>
|
||||
public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), int? evaluation = default(int?), string evaluationMessage = default(string), List<int> participants = default(List<int>), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
||||
public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime? eta = default(DateTime?), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), int? evaluation = default(int?), string evaluationMessage = default(string), List<ParticipantAssignment> participants = default(List<ParticipantAssignment>), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
||||
{
|
||||
this.Id = id;
|
||||
this.ShipId = shipId;
|
||||
this.Type = type;
|
||||
// to ensure "eta" is required (not null)
|
||||
if (eta == null)
|
||||
{
|
||||
throw new ArgumentNullException("eta is a required property for Shipcall and cannot be null");
|
||||
}
|
||||
this.Eta = eta;
|
||||
this.Voyage = voyage;
|
||||
this.Etd = etd;
|
||||
@ -6564,7 +6704,7 @@ namespace BreCalClient.misc.Model
|
||||
/// Gets or Sets Eta
|
||||
/// </summary>
|
||||
[DataMember(Name = "eta", IsRequired = true, EmitDefaultValue = true)]
|
||||
public DateTime Eta { get; set; }
|
||||
public DateTime? Eta { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Voyage
|
||||
/// </summary>
|
||||
@ -6673,9 +6813,8 @@ namespace BreCalClient.misc.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets Participants
|
||||
/// </summary>
|
||||
/// <example>[1,5,7]</example>
|
||||
[DataMember(Name = "participants", EmitDefaultValue = true)]
|
||||
public List<int> Participants { get; set; }
|
||||
public List<ParticipantAssignment> Participants { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Created
|
||||
/// </summary>
|
||||
@ -7635,8 +7774,6 @@ namespace BreCalClient.misc.Model
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -42,7 +42,7 @@ namespace BreCalClient
|
||||
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;
|
||||
|
||||
@ -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,8 +153,8 @@ 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;
|
||||
@ -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)
|
||||
{
|
||||
this.ShipcallModel.Shipcall.Participants.Add(p.Id);
|
||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.BSMD] = p;
|
||||
}
|
||||
|
||||
ParticipantAssignment pa = new()
|
||||
{
|
||||
ParticipantId = App.Participant.Id,
|
||||
Type = (int)ParticipantType.BSMD
|
||||
};
|
||||
this.ShipcallModel.AssignedParticipants[ParticipantType.BSMD] = pa;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -189,7 +216,7 @@ 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;
|
||||
@ -200,17 +227,20 @@ namespace BreCalClient
|
||||
|
||||
if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();
|
||||
|
||||
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
|
||||
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;
|
||||
|
||||
|
||||
@ -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,30 +186,81 @@ 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;
|
||||
|
||||
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.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
|
||||
|
||||
@ -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,25 +180,73 @@ 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
|
||||
|
||||
@ -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,25 +197,74 @@ 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
|
||||
|
||||
@ -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.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.checkBoxEtaBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled;
|
||||
this.datePickerETDBerth.IsEnabled = this.datePickerETABerth.IsEnabled;
|
||||
this.checkBoxEtDBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled;
|
||||
|
||||
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);
|
||||
|
||||
@ -301,6 +305,11 @@ namespace BreCalClient
|
||||
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,15 +560,27 @@ 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();
|
||||
|
||||
|
||||
bool wasEdit = false;
|
||||
if (times != null)
|
||||
{
|
||||
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;
|
||||
@ -619,8 +643,16 @@ namespace BreCalClient
|
||||
if(editControl.ShowDialog() ?? false)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 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,21 +71,16 @@
|
||||
<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}"/>
|
||||
</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>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="1" Grid.RowSpan="1" FontSize="12" Content="- / -" Foreground="White" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" VerticalAlignment="Stretch"
|
||||
@ -102,7 +96,9 @@
|
||||
<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" />
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="1">
|
||||
<!-- 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*" />
|
||||
@ -110,21 +106,91 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
<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" 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" />
|
||||
<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="2">
|
||||
<!-- 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*" />
|
||||
@ -132,107 +198,19 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="14" />
|
||||
<RowDefinition Height="*" />
|
||||
<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" 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="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="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" />
|
||||
<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>
|
||||
|
||||
@ -60,7 +60,8 @@ namespace BreCalClient
|
||||
|
||||
public void RefreshData()
|
||||
{
|
||||
if (this.ShipcallControlModel == null) return;
|
||||
if (this.ShipcallControlModel != null)
|
||||
{
|
||||
string agentName = "";
|
||||
string? name;
|
||||
_agency = this.ShipcallControlModel.GetParticipantForType(Extensions.ParticipantType.AGENCY);
|
||||
@ -151,7 +152,7 @@ namespace BreCalClient
|
||||
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");
|
||||
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta?.ToString("dd.MM. HH:mm");
|
||||
}
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type == 2)
|
||||
{
|
||||
@ -161,11 +162,20 @@ namespace BreCalClient
|
||||
|
||||
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);
|
||||
|
||||
// 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 != null)
|
||||
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;
|
||||
@ -176,14 +186,14 @@ namespace BreCalClient
|
||||
}
|
||||
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,44 +201,64 @@ 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)
|
||||
{
|
||||
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.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.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.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.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.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.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.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +270,7 @@ namespace BreCalClient
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
// TBD
|
||||
}
|
||||
|
||||
private void buttonEditShipcall_Click(object? sender, RoutedEventArgs? e)
|
||||
@ -255,59 +285,40 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#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