now the code is compiling. Yaml file documented via description tags.
This commit is contained in:
parent
bd81f01d76
commit
23a903997a
@ -1,7 +1,7 @@
|
||||
|
||||
//----------------------
|
||||
// <auto-generated>
|
||||
// Generated REST API Client Code Generator v1.9.1.0 on 18.12.2023 18:02:05
|
||||
// Generated REST API Client Code Generator v1.9.1.0 on 19.12.2023 07:58:27
|
||||
// Using the tool OpenAPI Generator v7.1.0
|
||||
// </auto-generated>
|
||||
//----------------------
|
||||
@ -5377,9 +5377,9 @@ namespace BreCalClient.misc.Model
|
||||
/// </summary>
|
||||
/// <param name="id">id.</param>
|
||||
/// <param name="name">name.</param>
|
||||
/// <param name="ownerId">ownerId.</param>
|
||||
/// <param name="authorityId">authorityId.</param>
|
||||
/// <param name="varLock">varLock.</param>
|
||||
/// <param name="ownerId">Optional reference to a participant (terminal).</param>
|
||||
/// <param name="authorityId">Optional reference to a participant (port authority).</param>
|
||||
/// <param name="varLock">If true lock must be passed.</param>
|
||||
/// <param name="created">created.</param>
|
||||
/// <param name="modified">modified.</param>
|
||||
/// <param name="deleted">deleted (default to false).</param>
|
||||
@ -5405,18 +5405,21 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "name", EmitDefaultValue = true)]
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets OwnerId
|
||||
/// Optional reference to a participant (terminal)
|
||||
/// </summary>
|
||||
/// <value>Optional reference to a participant (terminal)</value>
|
||||
[DataMember(Name = "owner_id", EmitDefaultValue = true)]
|
||||
public int? OwnerId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets AuthorityId
|
||||
/// Optional reference to a participant (port authority)
|
||||
/// </summary>
|
||||
/// <value>Optional reference to a participant (port authority)</value>
|
||||
[DataMember(Name = "authority_id", EmitDefaultValue = true)]
|
||||
public int? AuthorityId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets VarLock
|
||||
/// If true lock must be passed
|
||||
/// </summary>
|
||||
/// <value>If true lock must be passed</value>
|
||||
[DataMember(Name = "lock", EmitDefaultValue = true)]
|
||||
public bool? VarLock { get; set; }
|
||||
/// <summary>
|
||||
@ -5829,6 +5832,46 @@ namespace BreCalClient.misc.Model
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Bremen calling API
|
||||
*
|
||||
* Administer DEBRE ship calls, times and notifications
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* Contact: info@textbausteine.net
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
namespace BreCalClient.misc.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines EvaluationType
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum EvaluationType
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum Undefined for value: undefined
|
||||
/// </summary>
|
||||
[EnumMember(Value = "undefined")]
|
||||
Undefined = 1,
|
||||
/// <summary>
|
||||
/// Enum Green for value: green
|
||||
/// </summary>
|
||||
[EnumMember(Value = "green")]
|
||||
Green = 2,
|
||||
/// <summary>
|
||||
/// Enum Yellow for value: yellow
|
||||
/// </summary>
|
||||
[EnumMember(Value = "yellow")]
|
||||
Yellow = 3,
|
||||
/// <summary>
|
||||
/// Enum Red for value: red
|
||||
/// </summary>
|
||||
[EnumMember(Value = "red")]
|
||||
Red = 4
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Bremen calling API
|
||||
*
|
||||
@ -6812,12 +6855,12 @@ namespace BreCalClient.misc.Model
|
||||
/// <param name="name">name.</param>
|
||||
/// <param name="imo">imo.</param>
|
||||
/// <param name="callsign">callsign.</param>
|
||||
/// <param name="participantId">participantId.</param>
|
||||
/// <param name="participantId">Optional reference to participant (tug role).</param>
|
||||
/// <param name="length">length.</param>
|
||||
/// <param name="width">width.</param>
|
||||
/// <param name="isTug">isTug (default to false).</param>
|
||||
/// <param name="bollardPull">bollardPull.</param>
|
||||
/// <param name="eni">eni.</param>
|
||||
/// <param name="eni">BSMD internal use.</param>
|
||||
/// <param name="created">created.</param>
|
||||
/// <param name="modified">modified.</param>
|
||||
/// <param name="deleted">deleted (default to false).</param>
|
||||
@ -6858,8 +6901,9 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "callsign", EmitDefaultValue = true)]
|
||||
public string Callsign { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets ParticipantId
|
||||
/// Optional reference to participant (tug role)
|
||||
/// </summary>
|
||||
/// <value>Optional reference to participant (tug role)</value>
|
||||
[DataMember(Name = "participant_id", EmitDefaultValue = true)]
|
||||
public int? ParticipantId { get; set; }
|
||||
/// <summary>
|
||||
@ -6883,8 +6927,9 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "bollard_pull", EmitDefaultValue = true)]
|
||||
public int? BollardPull { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Eni
|
||||
/// BSMD internal use
|
||||
/// </summary>
|
||||
/// <value>BSMD internal use</value>
|
||||
[DataMember(Name = "eni", EmitDefaultValue = true)]
|
||||
public int? Eni { get; set; }
|
||||
/// <summary>
|
||||
@ -7118,6 +7163,11 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)]
|
||||
public ShipcallType Type { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Evaluation
|
||||
/// </summary>
|
||||
[DataMember(Name = "evaluation", EmitDefaultValue = true)]
|
||||
public EvaluationType? Evaluation { get; set; }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Shipcall" /> class.
|
||||
/// </summary>
|
||||
[JsonConstructorAttribute]
|
||||
@ -7153,7 +7203,7 @@ namespace BreCalClient.misc.Model
|
||||
/// <param name="participants">participants.</param>
|
||||
/// <param name="created">Readonly field set by the database.</param>
|
||||
/// <param name="modified">Readonly field set by the database.</param>
|
||||
public Shipcall(int id = default(int), int shipId = default(int), ShipcallType type = default(ShipcallType), 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?))
|
||||
public Shipcall(int id = default(int), int shipId = default(int), ShipcallType type = default(ShipcallType), 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?), EvaluationType? evaluation = default(EvaluationType?), string evaluationMessage = default(string), List<ParticipantAssignment> participants = default(List<ParticipantAssignment>), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
||||
{
|
||||
this.Id = id;
|
||||
this.ShipId = shipId;
|
||||
@ -7296,11 +7346,6 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "canceled", EmitDefaultValue = true)]
|
||||
public bool? Canceled { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets Evaluation
|
||||
/// </summary>
|
||||
[DataMember(Name = "evaluation", EmitDefaultValue = true)]
|
||||
public int? Evaluation { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets EvaluationMessage
|
||||
/// </summary>
|
||||
[DataMember(Name = "evaluation_message", EmitDefaultValue = true)]
|
||||
@ -7504,8 +7549,7 @@ namespace BreCalClient.misc.Model
|
||||
) &&
|
||||
(
|
||||
this.Evaluation == input.Evaluation ||
|
||||
(this.Evaluation != null &&
|
||||
this.Evaluation.Equals(input.Evaluation))
|
||||
this.Evaluation.Equals(input.Evaluation)
|
||||
) &&
|
||||
(
|
||||
this.EvaluationMessage == input.EvaluationMessage ||
|
||||
@ -7621,10 +7665,7 @@ namespace BreCalClient.misc.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.Canceled.GetHashCode();
|
||||
}
|
||||
if (this.Evaluation != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.Evaluation.GetHashCode();
|
||||
}
|
||||
hashCode = (hashCode * 59) + this.Evaluation.GetHashCode();
|
||||
if (this.EvaluationMessage != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.EvaluationMessage.GetHashCode();
|
||||
@ -7656,6 +7697,11 @@ namespace BreCalClient.misc.Model
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Voyage, length must be less than 16.", new [] { "Voyage" });
|
||||
}
|
||||
// EvaluationMessage (string) maxLength
|
||||
if (this.EvaluationMessage != null && this.EvaluationMessage.Length > 512)
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EvaluationMessage, length must be less than 512.", new [] { "EvaluationMessage" });
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@ -7727,13 +7773,13 @@ namespace BreCalClient.misc.Model
|
||||
/// Initializes a new instance of the <see cref="Times" /> class.
|
||||
/// </summary>
|
||||
/// <param name="id">id.</param>
|
||||
/// <param name="etaBerth">etaBerth.</param>
|
||||
/// <param name="etaBerth">Arrival time at berth.</param>
|
||||
/// <param name="etaBerthFixed">currently unused.</param>
|
||||
/// <param name="etdBerth">etdBerth.</param>
|
||||
/// <param name="etdBerth">departure time from berth.</param>
|
||||
/// <param name="etdBerthFixed">currently unused.</param>
|
||||
/// <param name="lockTime">lockTime.</param>
|
||||
/// <param name="lockTime">arrival time at lock.</param>
|
||||
/// <param name="lockTimeFixed">currently unused.</param>
|
||||
/// <param name="zoneEntry">zoneEntry.</param>
|
||||
/// <param name="zoneEntry">currently unused.</param>
|
||||
/// <param name="zoneEntryFixed">currently unused.</param>
|
||||
/// <param name="operationsStart">Start time for terminal operations.</param>
|
||||
/// <param name="operationsEnd">End time for terminal operations.</param>
|
||||
@ -7741,8 +7787,8 @@ namespace BreCalClient.misc.Model
|
||||
/// <param name="shipcallId">Reference to a shipcall id (required).</param>
|
||||
/// <param name="participantId">Reference to a participant id (required).</param>
|
||||
/// <param name="berthId">Reference to a berth id.</param>
|
||||
/// <param name="berthInfo">berthInfo.</param>
|
||||
/// <param name="pierSide">pierSide.</param>
|
||||
/// <param name="berthInfo">Additional info text for berth.</param>
|
||||
/// <param name="pierSide">true if ship is rotated, false otherwise.</param>
|
||||
/// <param name="participantType">participantType.</param>
|
||||
/// <param name="created">Readonly field set by the database.</param>
|
||||
/// <param name="modified">Readonly field set by the database.</param>
|
||||
@ -7775,8 +7821,9 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "id", EmitDefaultValue = true)]
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets EtaBerth
|
||||
/// Arrival time at berth
|
||||
/// </summary>
|
||||
/// <value>Arrival time at berth</value>
|
||||
[DataMember(Name = "eta_berth", EmitDefaultValue = true)]
|
||||
public DateTime? EtaBerth { get; set; }
|
||||
/// <summary>
|
||||
@ -7786,8 +7833,9 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "eta_berth_fixed", EmitDefaultValue = true)]
|
||||
public bool? EtaBerthFixed { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets EtdBerth
|
||||
/// departure time from berth
|
||||
/// </summary>
|
||||
/// <value>departure time from berth</value>
|
||||
[DataMember(Name = "etd_berth", EmitDefaultValue = true)]
|
||||
public DateTime? EtdBerth { get; set; }
|
||||
/// <summary>
|
||||
@ -7797,8 +7845,9 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "etd_berth_fixed", EmitDefaultValue = true)]
|
||||
public bool? EtdBerthFixed { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets LockTime
|
||||
/// arrival time at lock
|
||||
/// </summary>
|
||||
/// <value>arrival time at lock</value>
|
||||
[DataMember(Name = "lock_time", EmitDefaultValue = true)]
|
||||
public DateTime? LockTime { get; set; }
|
||||
/// <summary>
|
||||
@ -7808,8 +7857,9 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "lock_time_fixed", EmitDefaultValue = true)]
|
||||
public bool? LockTimeFixed { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets ZoneEntry
|
||||
/// currently unused
|
||||
/// </summary>
|
||||
/// <value>currently unused</value>
|
||||
[DataMember(Name = "zone_entry", EmitDefaultValue = true)]
|
||||
public DateTime? ZoneEntry { get; set; }
|
||||
/// <summary>
|
||||
@ -7854,13 +7904,15 @@ namespace BreCalClient.misc.Model
|
||||
[DataMember(Name = "berth_id", EmitDefaultValue = true)]
|
||||
public int? BerthId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets BerthInfo
|
||||
/// Additional info text for berth
|
||||
/// </summary>
|
||||
/// <value>Additional info text for berth</value>
|
||||
[DataMember(Name = "berth_info", EmitDefaultValue = true)]
|
||||
public string BerthInfo { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets PierSide
|
||||
/// true if ship is rotated, false otherwise
|
||||
/// </summary>
|
||||
/// <value>true if ship is rotated, false otherwise</value>
|
||||
[DataMember(Name = "pier_side", EmitDefaultValue = true)]
|
||||
public bool? PierSide { get; set; }
|
||||
/// <summary>
|
||||
@ -8129,6 +8181,11 @@ namespace BreCalClient.misc.Model
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Remarks, length must be less than 512.", new [] { "Remarks" });
|
||||
}
|
||||
// BerthInfo (string) maxLength
|
||||
if (this.BerthInfo != null && this.BerthInfo.Length > 512)
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for BerthInfo, length must be less than 512.", new [] { "BerthInfo" });
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@ -8332,6 +8389,36 @@ namespace BreCalClient.misc.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
// OldPassword (string) maxLength
|
||||
if (this.OldPassword != null && this.OldPassword.Length > 128)
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for OldPassword, length must be less than 128.", new [] { "OldPassword" });
|
||||
}
|
||||
// NewPassword (string) maxLength
|
||||
if (this.NewPassword != null && this.NewPassword.Length > 128)
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for NewPassword, length must be less than 128.", new [] { "NewPassword" });
|
||||
}
|
||||
// FirstName (string) maxLength
|
||||
if (this.FirstName != null && this.FirstName.Length > 45)
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FirstName, length must be less than 45.", new [] { "FirstName" });
|
||||
}
|
||||
// LastName (string) maxLength
|
||||
if (this.LastName != null && this.LastName.Length > 45)
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for LastName, length must be less than 45.", new [] { "LastName" });
|
||||
}
|
||||
// UserPhone (string) maxLength
|
||||
if (this.UserPhone != null && this.UserPhone.Length > 128)
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserPhone, length must be less than 128.", new [] { "UserPhone" });
|
||||
}
|
||||
// UserEmail (string) maxLength
|
||||
if (this.UserEmail != null && this.UserEmail.Length > 128)
|
||||
{
|
||||
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserEmail, length must be less than 128.", new [] { "UserEmail" });
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,9 +468,10 @@ components:
|
||||
type: boolean
|
||||
nullable: true
|
||||
evaluation:
|
||||
type: integer
|
||||
$ref: '#/components/schemas/EvaluationType'
|
||||
nullable: true
|
||||
evaluation_message:
|
||||
maxLength: 512
|
||||
type: string
|
||||
nullable: true
|
||||
participants:
|
||||
@ -504,6 +505,7 @@ components:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
description: Arrival time at berth
|
||||
eta_berth_fixed:
|
||||
type: boolean
|
||||
nullable: true
|
||||
@ -512,6 +514,7 @@ components:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
description: departure time from berth
|
||||
etd_berth_fixed:
|
||||
type: boolean
|
||||
nullable: true
|
||||
@ -520,6 +523,7 @@ components:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
description: arrival time at lock
|
||||
lock_time_fixed:
|
||||
type: boolean
|
||||
nullable: true
|
||||
@ -528,6 +532,7 @@ components:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
description: currently unused
|
||||
zone_entry_fixed:
|
||||
type: boolean
|
||||
nullable: true
|
||||
@ -559,7 +564,10 @@ components:
|
||||
berth_info:
|
||||
type: string
|
||||
nullable: true
|
||||
maxLength: 512
|
||||
description: Additional info text for berth
|
||||
pier_side:
|
||||
description: true if ship is rotated, false otherwise
|
||||
type: boolean
|
||||
nullable: true
|
||||
participant_type:
|
||||
@ -592,12 +600,15 @@ components:
|
||||
owner_id:
|
||||
type: integer
|
||||
nullable: true
|
||||
description: Optional reference to a participant (terminal)
|
||||
authority_id:
|
||||
type: integer
|
||||
nullable: true
|
||||
description: Optional reference to a participant (port authority)
|
||||
lock:
|
||||
type: boolean
|
||||
nullable: true
|
||||
description: If true lock must be passed
|
||||
created:
|
||||
type: string
|
||||
format: date-time
|
||||
@ -631,6 +642,7 @@ components:
|
||||
participant_id:
|
||||
type: integer
|
||||
nullable: true
|
||||
description: Optional reference to participant (tug role)
|
||||
length:
|
||||
type: number
|
||||
format: float
|
||||
@ -648,6 +660,7 @@ components:
|
||||
eni:
|
||||
type: integer
|
||||
nullable: true
|
||||
description: BSMD internal use
|
||||
created:
|
||||
type: string
|
||||
format: date-time
|
||||
@ -760,19 +773,25 @@ components:
|
||||
old_password:
|
||||
type: string
|
||||
nullable: true
|
||||
maxLength: 128
|
||||
new_password:
|
||||
type: string
|
||||
nullable: true
|
||||
maxLength: 128
|
||||
first_name:
|
||||
type: string
|
||||
nullable: true
|
||||
maxLength: 45
|
||||
last_name:
|
||||
type: string
|
||||
nullable: true
|
||||
maxLength: 45
|
||||
user_phone:
|
||||
maxLength: 128
|
||||
type: string
|
||||
nullable: true
|
||||
user_email:
|
||||
maxLength: 128
|
||||
type: string
|
||||
nullable: true
|
||||
Id:
|
||||
@ -804,6 +823,13 @@ components:
|
||||
- undefined
|
||||
- email
|
||||
- push
|
||||
EvaluationType:
|
||||
type: string
|
||||
enum:
|
||||
- undefined
|
||||
- green
|
||||
- yellow
|
||||
- red
|
||||
securitySchemes:
|
||||
ApiKey:
|
||||
type: apiKey
|
||||
|
||||
@ -254,7 +254,7 @@ namespace BreCalClient
|
||||
if (this.ShipcallModel == null) return;
|
||||
if (this.ShipcallModel.Shipcall != null)
|
||||
{
|
||||
this.comboBoxCategories.SelectedItem = (TypeEnum)this.ShipcallModel.Shipcall.Type;
|
||||
this.comboBoxCategories.SelectedItem = 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;
|
||||
@ -262,7 +262,7 @@ namespace BreCalClient
|
||||
this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId;
|
||||
this.checkBoxCancelled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
|
||||
|
||||
if (this.ShipcallModel.Shipcall.Type != 3) // incoming, outgoing
|
||||
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
|
||||
{
|
||||
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
|
||||
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
|
||||
|
||||
@ -89,7 +89,7 @@ namespace BreCalClient
|
||||
|
||||
private void EnableControls()
|
||||
{
|
||||
Extensions.ParticipantType pType = (Extensions.ParticipantType) (this.Times.ParticipantType ?? 0);
|
||||
Extensions.ParticipantType pType = (Extensions.ParticipantType) this.Times.ParticipantType;
|
||||
if (this.Times.ParticipantId != App.Participant.Id) return; // if this is not "my" entry, there is no editing!
|
||||
|
||||
switch (pType)
|
||||
@ -97,24 +97,24 @@ namespace BreCalClient
|
||||
case Extensions.ParticipantType.MOORING:
|
||||
case Extensions.ParticipantType.PORT_ADMINISTRATION:
|
||||
case Extensions.ParticipantType.TUG:
|
||||
this.datePickerETABerth.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
|
||||
this.datePickerETABerth.IsEnabled = (CallType == ShipcallType.Arrival);
|
||||
//this.checkBoxEtaBerthFixed.IsEnabled = (CallType == Extensions.TypeEnum.Incoming || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerETDBerth.IsEnabled = (CallType == Extensions.TypeEnum.Outgoing || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerETDBerth.IsEnabled = (CallType == ShipcallType.Departure || CallType == ShipcallType.Shifting);
|
||||
//this.checkBoxEtDBerthFixed.IsEnabled = (CallType == Extensions.TypeEnum.Outgoing || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerLockTime.IsEnabled = (CallType == Extensions.TypeEnum.Incoming || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerLockTime.IsEnabled = (CallType == ShipcallType.Arrival || CallType == ShipcallType.Shifting);
|
||||
//this.checkBoxLockTimeFixed.IsEnabled = (CallType == Extensions.TypeEnum.Incoming || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerZoneEntry.IsEnabled = false;
|
||||
//this.checkBoxZoneEntryFixed.IsEnabled = false;
|
||||
this.textBoxRemarks.IsEnabled = true;
|
||||
break;
|
||||
case Extensions.ParticipantType.PILOT:
|
||||
this.datePickerETABerth.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
|
||||
this.datePickerETABerth.IsEnabled = (CallType == ShipcallType.Arrival);
|
||||
//this.checkBoxEtaBerthFixed.IsEnabled = (CallType == Extensions.TypeEnum.Incoming || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerETDBerth.IsEnabled = (CallType == Extensions.TypeEnum.Outgoing || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerETDBerth.IsEnabled = (CallType == ShipcallType.Departure || CallType == ShipcallType.Shifting);
|
||||
//this.checkBoxEtDBerthFixed.IsEnabled = (CallType == Extensions.TypeEnum.Outgoing || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerLockTime.IsEnabled = (CallType == Extensions.TypeEnum.Incoming || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerLockTime.IsEnabled = (CallType == ShipcallType.Arrival || CallType == ShipcallType.Shifting);
|
||||
//this.checkBoxLockTimeFixed.IsEnabled = (CallType == Extensions.TypeEnum.Incoming || CallType == Extensions.TypeEnum.Shifting);
|
||||
this.datePickerZoneEntry.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
|
||||
this.datePickerZoneEntry.IsEnabled = (CallType == ShipcallType.Arrival);
|
||||
//this.checkBoxZoneEntryFixed.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
|
||||
this.textBoxRemarks.IsEnabled = true;
|
||||
break;
|
||||
|
||||
@ -72,12 +72,12 @@ namespace BreCalClient
|
||||
|
||||
private void CopyToModel()
|
||||
{
|
||||
switch(this.comboBoxPierside.SelectedIndex)
|
||||
this.Times.PierSide = this.comboBoxPierside.SelectedIndex switch
|
||||
{
|
||||
case 0: this.Times.PierSide = true; break;
|
||||
case 1: this.Times.PierSide= false; break;
|
||||
default: this.Times.PierSide = null; break;
|
||||
}
|
||||
0 => true,
|
||||
1 => false,
|
||||
_ => null,
|
||||
};
|
||||
this.Times.OperationsStart = this.datePickerOperationStart.Value;
|
||||
this.Times.OperationsEnd = this.datePickerOperationEnd.Value;
|
||||
this.Times.BerthId = (this.comboBoxBerth.SelectedItem != null) ? ((Berth)this.comboBoxBerth.SelectedItem).Id : null;
|
||||
@ -114,11 +114,11 @@ namespace BreCalClient
|
||||
{
|
||||
if (this.Times.ParticipantId != App.Participant.Id) return;
|
||||
|
||||
this.datePickerOperationStart.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
|
||||
this.datePickerOperationEnd.IsEnabled = (CallType == Extensions.TypeEnum.Outgoing) || (CallType == Extensions.TypeEnum.Shifting);
|
||||
this.comboBoxBerth.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
|
||||
this.comboBoxPierside.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
|
||||
this.textBoxBerthRemarks.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
|
||||
this.datePickerOperationStart.IsEnabled = CallType == ShipcallType.Arrival;
|
||||
this.datePickerOperationEnd.IsEnabled = (CallType == ShipcallType.Departure) || (CallType == ShipcallType.Shifting);
|
||||
this.comboBoxBerth.IsEnabled = CallType == ShipcallType.Arrival;
|
||||
this.comboBoxPierside.IsEnabled = CallType == ShipcallType.Arrival;
|
||||
this.textBoxBerthRemarks.IsEnabled = CallType == ShipcallType.Arrival;
|
||||
this.textBoxRemarks.IsEnabled = true;
|
||||
this.buttonOK.IsEnabled = true;
|
||||
}
|
||||
|
||||
@ -71,15 +71,15 @@ namespace BreCalClient
|
||||
public static string Truncate(this string value, int maxLength)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return value;
|
||||
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
|
||||
return value.Length <= maxLength ? value : value[..maxLength];
|
||||
}
|
||||
|
||||
public static string TruncateDots(this string value, int maxLength)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value)) return value;
|
||||
if (value.Length <= maxLength) return value;
|
||||
if (value.Length > (maxLength + 1)) return $"{value.Substring(0, maxLength)}..";
|
||||
return value.Substring(0, maxLength);
|
||||
if (value.Length > (maxLength + 1)) return $"{value[..maxLength]}..";
|
||||
return value[..maxLength];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2023 schick Informatik
|
||||
// Description: Bremen calling main window
|
||||
//
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -19,6 +19,7 @@ using static BreCalClient.Extensions;
|
||||
using System.Collections.Concurrent;
|
||||
using Newtonsoft.Json;
|
||||
using System.Security.Principal;
|
||||
using System.Net;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -40,9 +41,13 @@ namespace BreCalClient
|
||||
|
||||
private readonly ConcurrentDictionary<int, ShipcallControlModel> _allShipcallsDict = new();
|
||||
private readonly ConcurrentDictionary<int, ShipcallControl> _allShipCallsControlDict = new();
|
||||
private readonly List<ShipcallControlModel> _visibleControlModels = new();
|
||||
private readonly List<ShipcallControlModel> _visibleControlModels = new();
|
||||
|
||||
private readonly ShipcallApi _shipcallApi;
|
||||
private readonly UserApi _userApi;
|
||||
private readonly TimesApi _timesApi;
|
||||
private readonly StaticApi _staticApi;
|
||||
|
||||
private readonly DefaultApi _api;
|
||||
private CancellationTokenSource _tokenSource = new();
|
||||
private LoginResult? _loginResult;
|
||||
private bool _refreshImmediately = false;
|
||||
@ -72,8 +77,14 @@ namespace BreCalClient
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
_api = new DefaultApi(Properties.Settings.Default.API_URL);
|
||||
_api.Configuration.ApiKeyPrefix["Authorization"] = "Bearer";
|
||||
_userApi = new UserApi(Properties.Settings.Default.API_URL);
|
||||
_userApi.Configuration.ApiKeyPrefix["Authorization"] = "Bearer";
|
||||
_shipcallApi = new ShipcallApi(Properties.Settings.Default.API_URL);
|
||||
_shipcallApi.Configuration.ApiKeyPrefix["Authorization"] = "Bearer";
|
||||
_timesApi = new TimesApi(Properties.Settings.Default.API_URL);
|
||||
_timesApi.Configuration.ApiKeyPrefix["Authorization"] = "Bearer";
|
||||
_staticApi = new StaticApi(Properties.Settings.Default.API_URL);
|
||||
_staticApi.Configuration.ApiKeyPrefix["Authorization"] = "Bearer";
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -86,14 +97,14 @@ namespace BreCalClient
|
||||
labelVersion.Text = "V. " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.APP_TITLE))
|
||||
this.Title = Properties.Settings.Default.APP_TITLE;
|
||||
searchFilterControl.SearchFilterChanged += SearchFilterControl_SearchFilterChanged;
|
||||
searchFilterControl.SearchFilterChanged += SearchFilterControl_SearchFilterChanged;
|
||||
searchFilterControl.LogoImageClicked += () =>
|
||||
{
|
||||
Process.Start("explorer", Properties.Settings.Default.LOGO_IMAGE_URL);
|
||||
Process.Start("explorer", Properties.Settings.Default.LOGO_IMAGE_URL);
|
||||
};
|
||||
this.comboBoxSortOrder.ItemsSource = Enum.GetValues(typeof(Extensions.SortOrder));
|
||||
this.comboBoxSortOrder.SelectedIndex = (int)_sortOrder;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
@ -115,13 +126,16 @@ namespace BreCalClient
|
||||
|
||||
try
|
||||
{
|
||||
_loginResult = await _api.LoginPostAsync(_credentials);
|
||||
_loginResult = await _userApi.LoginAsync(_credentials);
|
||||
if (_loginResult != null)
|
||||
{
|
||||
if (_loginResult.Id > 0)
|
||||
{
|
||||
this.busyIndicator.IsBusy = false;
|
||||
this._api.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
this._userApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
this._shipcallApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
this._timesApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
this._staticApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
this.LoadStaticLists();
|
||||
this.labelUsername.Text = $"{_loginResult.FirstName} {_loginResult.LastName}";
|
||||
_timer = new Timer(RefreshToken, null, 4000000, Timeout.Infinite);
|
||||
@ -154,13 +168,16 @@ namespace BreCalClient
|
||||
{
|
||||
try
|
||||
{
|
||||
_loginResult = _api.LoginPost(_credentials);
|
||||
_loginResult = _userApi.Login(_credentials);
|
||||
if (_loginResult != null)
|
||||
{
|
||||
if (_loginResult.Id > 0)
|
||||
{
|
||||
this._api.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
}
|
||||
{
|
||||
this._userApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
this._timesApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
this._shipcallApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
this._staticApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -180,7 +197,7 @@ namespace BreCalClient
|
||||
|
||||
private void buttonNew_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
NewWithModel(null);
|
||||
NewWithModel(null);
|
||||
}
|
||||
|
||||
private void NewWithModel(ShipcallControlModel? model)
|
||||
@ -201,7 +218,7 @@ namespace BreCalClient
|
||||
esc.ShipcallModel.Shipcall?.Participants.Add(pa);
|
||||
try
|
||||
{
|
||||
this._api.ShipcallsPost(esc.ShipcallModel.Shipcall); // save new ship call
|
||||
this._shipcallApi.ShipcallCreate(esc.ShipcallModel.Shipcall); // save new ship call
|
||||
this.AddShipcall(esc.ShipcallModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -256,7 +273,7 @@ namespace BreCalClient
|
||||
};
|
||||
try
|
||||
{
|
||||
await _api.UserPutAsync(ud);
|
||||
await _userApi.UserUpdateAsync(ud);
|
||||
MessageBox.Show(BreCalClient.Resources.Resources.textPasswordChanged, BreCalClient.Resources.Resources.textConfirmation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -297,25 +314,25 @@ namespace BreCalClient
|
||||
this.UpdateUI();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region network operations
|
||||
|
||||
private async void LoadStaticLists()
|
||||
{
|
||||
BreCalLists.InitializeBerths(await _api.BerthsGetAsync());
|
||||
BreCalLists.InitializeShips(await _api.ShipsGetAsync());
|
||||
BreCalLists.InitializeParticipants(await _api.ParticipantsGetAsync());
|
||||
BreCalLists.InitializeBerths(await _staticApi.BerthsGetAsync());
|
||||
BreCalLists.InitializeShips(await _staticApi.ShipsGetAsync());
|
||||
BreCalLists.InitializeParticipants(await _staticApi.ParticipantsGetAsync());
|
||||
|
||||
this.searchFilterControl.SetBerths(BreCalLists.Berths);
|
||||
|
||||
|
||||
foreach (Participant participant in BreCalLists.Participants)
|
||||
{
|
||||
{
|
||||
if (_loginResult?.ParticipantId == participant.Id)
|
||||
{
|
||||
App.Participant = participant;
|
||||
EnableControlsForParticipant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.searchFilterControl.SetAgencies(BreCalLists.Participants_Agent);
|
||||
@ -328,7 +345,7 @@ namespace BreCalClient
|
||||
}
|
||||
|
||||
_ = Task.Run(() => RefreshShipcalls());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RefreshShipcalls()
|
||||
{
|
||||
@ -345,9 +362,9 @@ namespace BreCalClient
|
||||
try
|
||||
{
|
||||
if(this.searchPastDays != 0)
|
||||
shipcalls = await _api.ShipcallsGetAsync(this.searchPastDays);
|
||||
shipcalls = await _shipcallApi.ShipcallsGetAsync(this.searchPastDays);
|
||||
else
|
||||
shipcalls = await _api.ShipcallsGetAsync();
|
||||
shipcalls = await _shipcallApi.ShipcallsGetAsync();
|
||||
|
||||
this.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
@ -356,7 +373,7 @@ namespace BreCalClient
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
this.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
|
||||
@ -374,7 +391,7 @@ namespace BreCalClient
|
||||
foreach (Shipcall shipcall in shipcalls)
|
||||
{
|
||||
// load times for each shipcall
|
||||
List<Times> currentTimes = await _api.TimesGetAsync(shipcall.Id);
|
||||
List<Times> currentTimes = await _timesApi.TimesGetAsync(shipcall.Id);
|
||||
|
||||
if(!_allShipcallsDict.ContainsKey(shipcall.Id))
|
||||
{
|
||||
@ -383,7 +400,7 @@ namespace BreCalClient
|
||||
{
|
||||
Shipcall = shipcall,
|
||||
Times = currentTimes
|
||||
};
|
||||
};
|
||||
this.AddShipcall(scm);
|
||||
}
|
||||
else
|
||||
@ -392,8 +409,8 @@ namespace BreCalClient
|
||||
_allShipcallsDict[shipcall.Id].Shipcall = shipcall;
|
||||
_allShipcallsDict[shipcall.Id].Times = currentTimes;
|
||||
UpdateShipcall(_allShipcallsDict[shipcall.Id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<int> existingIds = new(this._allShipcallsDict.Keys);
|
||||
|
||||
@ -429,7 +446,8 @@ namespace BreCalClient
|
||||
Shipcall shipcall = scm.Shipcall;
|
||||
if (BreCalLists.ShipLookupDict.ContainsKey(shipcall.ShipId))
|
||||
scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId].Ship;
|
||||
if (shipcall.Type == 1)
|
||||
|
||||
if (shipcall.Type == ShipcallType.Arrival)
|
||||
{
|
||||
if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0))
|
||||
scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name;
|
||||
@ -446,7 +464,7 @@ namespace BreCalClient
|
||||
ShipcallControl sc = new()
|
||||
{
|
||||
Height = 120,
|
||||
ShipcallControlModel = scm
|
||||
ShipcallControlModel = scm
|
||||
};
|
||||
sc.EditTimesRequested += Sc_EditTimesRequested;
|
||||
sc.EditRequested += Sc_EditRequested;
|
||||
@ -454,7 +472,7 @@ namespace BreCalClient
|
||||
sc.RefreshData();
|
||||
this._allShipCallsControlDict[scm.Shipcall.Id] = sc;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateShipcall(ShipcallControlModel scm)
|
||||
{
|
||||
@ -462,7 +480,8 @@ namespace BreCalClient
|
||||
Shipcall shipcall = scm.Shipcall;
|
||||
if (BreCalLists.ShipLookupDict.ContainsKey(shipcall.ShipId))
|
||||
scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId].Ship;
|
||||
if (shipcall.Type == 1)
|
||||
|
||||
if (shipcall.Type == ShipcallType.Arrival)
|
||||
{
|
||||
if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0))
|
||||
scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name;
|
||||
@ -486,7 +505,7 @@ namespace BreCalClient
|
||||
_visibleControlModels.Remove(removeModel);
|
||||
|
||||
this._allShipCallsControlDict.Remove(shipcallId, out _);
|
||||
this._allShipcallsDict.Remove(shipcallId, out _);
|
||||
this._allShipcallsDict.Remove(shipcallId, out _);
|
||||
}
|
||||
|
||||
private void FilterShipcalls()
|
||||
@ -530,12 +549,12 @@ namespace BreCalClient
|
||||
return !sfm.Agencies.Contains(agency.Id);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if(sfm.Categories.Count > 0 )
|
||||
{
|
||||
_ = this._visibleControlModels.RemoveAll(x => !sfm.Categories.Contains((x.Shipcall?.Type) ?? -1));
|
||||
_ = this._visibleControlModels.RemoveAll(x => { if (x.Shipcall == null) return false; else return !sfm.Categories.Contains(x.Shipcall.Type); });
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(sfm.SearchString))
|
||||
@ -567,28 +586,28 @@ namespace BreCalClient
|
||||
{
|
||||
_ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false);
|
||||
}
|
||||
|
||||
|
||||
switch(this._sortOrder)
|
||||
{
|
||||
case Extensions.SortOrder.SHIP_NAME:
|
||||
this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); });
|
||||
this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); });
|
||||
break;
|
||||
case Extensions.SortOrder.MODIFIED:
|
||||
this._visibleControlModels.Sort((x, y) => { if (x.Shipcall == null) return 0; if (y.Shipcall == null) return 0; return DateTime.Compare(x.Shipcall.Modified ?? x.Shipcall.Created, y.Shipcall.Modified ?? x.Shipcall.Created); });
|
||||
break;
|
||||
case Extensions.SortOrder.ETA_ETD:
|
||||
this._visibleControlModels.Sort((x, y) =>
|
||||
{
|
||||
{
|
||||
if (x.Shipcall == null) return 0;
|
||||
if (y.Shipcall == null) return 0;
|
||||
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Eta ?? DateTime.Now : x.Etd ?? DateTime.Now;
|
||||
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Eta ?? DateTime.Now : y.Etd ?? DateTime.Now;
|
||||
DateTime xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? x.Eta ?? DateTime.Now : x.Etd ?? DateTime.Now;
|
||||
DateTime yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? y.Eta ?? DateTime.Now : y.Etd ?? DateTime.Now;
|
||||
return DateTime.Compare(xDate, yDate);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -633,7 +652,7 @@ namespace BreCalClient
|
||||
#region control event handler
|
||||
|
||||
private async void Sc_EditRequested(ShipcallControl obj)
|
||||
{
|
||||
{
|
||||
if (obj.ShipcallControlModel != null)
|
||||
{
|
||||
EditShipcallControl esc = new()
|
||||
@ -646,10 +665,10 @@ namespace BreCalClient
|
||||
try
|
||||
{
|
||||
obj.ShipcallControlModel.Shipcall?.Participants.Clear();
|
||||
obj.ShipcallControlModel.UpdateTimesAssignments(this._api);
|
||||
obj.ShipcallControlModel.UpdateTimesAssignments(this._timesApi);
|
||||
foreach(ParticipantAssignment pa in obj.ShipcallControlModel.AssignedParticipants.Values)
|
||||
obj.ShipcallControlModel.Shipcall?.Participants.Add(pa);
|
||||
await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall);
|
||||
await _shipcallApi.ShipcallUpdateAsync(obj.ShipcallControlModel.Shipcall);
|
||||
obj.RefreshData();
|
||||
_refreshImmediately = true;
|
||||
_tokenSource.Cancel();
|
||||
@ -679,7 +698,7 @@ namespace BreCalClient
|
||||
if (times != null)
|
||||
{
|
||||
etc.Times = times;
|
||||
wasEdit = true;
|
||||
wasEdit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -698,7 +717,7 @@ namespace BreCalClient
|
||||
{
|
||||
if (wasEdit)
|
||||
{
|
||||
await _api.TimesPutAsync(etc.Times);
|
||||
await _timesApi.TimesUpdateAsync(etc.Times);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -707,7 +726,7 @@ namespace BreCalClient
|
||||
{
|
||||
etc.Times.ShipcallId = obj.ShipcallControlModel.Shipcall.Id;
|
||||
}
|
||||
Id apiResultId = await _api.TimesPostAsync(etc.Times);
|
||||
Id apiResultId = await _timesApi.TimesCreateAsync(etc.Times);
|
||||
etc.Times.Id = apiResultId.VarId;
|
||||
obj.ShipcallControlModel?.Times.Add(etc.Times);
|
||||
}
|
||||
@ -726,13 +745,13 @@ namespace BreCalClient
|
||||
IEditShipcallTimesControl? editControl = null;
|
||||
switch(sc.ShipcallControlModel?.Shipcall?.Type)
|
||||
{
|
||||
case (int)TypeEnum.Incoming:
|
||||
case ShipcallType.Arrival:
|
||||
editControl = new EditTimesAgencyIncomingControl();
|
||||
break;
|
||||
case (int)TypeEnum.Outgoing:
|
||||
case ShipcallType.Departure:
|
||||
editControl = new EditTimesAgencyOutgoingControl();
|
||||
break;
|
||||
case (int)TypeEnum.Shifting:
|
||||
case ShipcallType.Shifting:
|
||||
editControl = new EditTimesAgencyShiftingControl();
|
||||
break;
|
||||
}
|
||||
@ -745,7 +764,7 @@ namespace BreCalClient
|
||||
{
|
||||
editControl.Times = times;
|
||||
wasEdit = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
@ -756,7 +775,7 @@ namespace BreCalClient
|
||||
{
|
||||
try
|
||||
{
|
||||
sc.ShipcallControlModel?.UpdateTimesAssignments(_api); // if the agent changed the assignment of the participant to another
|
||||
sc.ShipcallControlModel?.UpdateTimesAssignments(_timesApi); // if the agent changed the assignment of the participant to another
|
||||
|
||||
// always try to be the agent, even if we are BSMD
|
||||
if (editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||
@ -770,15 +789,15 @@ namespace BreCalClient
|
||||
|
||||
if (wasEdit)
|
||||
{
|
||||
await _api.TimesPutAsync(editControl.Times);
|
||||
await _timesApi.TimesUpdateAsync(editControl.Times);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if ((sc.ShipcallControlModel != null) && (sc.ShipcallControlModel.Shipcall != null))
|
||||
{
|
||||
editControl.Times.ShipcallId = sc.ShipcallControlModel.Shipcall.Id;
|
||||
}
|
||||
Id resultAPI_Id = await _api.TimesPostAsync(editControl.Times);
|
||||
Id resultAPI_Id = await _timesApi.TimesCreateAsync(editControl.Times);
|
||||
editControl.Times.Id = resultAPI_Id.VarId;
|
||||
|
||||
sc.ShipcallControlModel?.Times.Add(editControl.Times);
|
||||
@ -786,7 +805,7 @@ namespace BreCalClient
|
||||
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);
|
||||
await _shipcallApi.ShipcallUpdateAsync(editControl.ShipcallModel.Shipcall);
|
||||
_refreshImmediately = true;
|
||||
_tokenSource.Cancel();
|
||||
}
|
||||
@ -808,7 +827,7 @@ namespace BreCalClient
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}));
|
||||
}));
|
||||
}
|
||||
|
||||
private void EnableControlsForParticipant()
|
||||
@ -816,7 +835,7 @@ namespace BreCalClient
|
||||
if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD))
|
||||
this.buttonNew.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
|
||||
|
||||
@ -100,8 +100,8 @@ namespace BreCalClient
|
||||
}
|
||||
if(sfm.Categories != null)
|
||||
{
|
||||
foreach(int category in sfm.Categories)
|
||||
this.comboBoxCategories.SelectedItems.Add((Extensions.TypeEnum)category);
|
||||
foreach(ShipcallType category in sfm.Categories)
|
||||
this.comboBoxCategories.SelectedItems.Add(category);
|
||||
}
|
||||
if (sfm.SearchString != null) this.textBoxSearch.Text = sfm.SearchString;
|
||||
this.upDownShiplengthFrom.Value = sfm.ShipLengthFrom;
|
||||
@ -124,7 +124,7 @@ namespace BreCalClient
|
||||
|
||||
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(Extensions.TypeEnum));
|
||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(ShipcallType));
|
||||
}
|
||||
|
||||
private void datePickerETAFrom_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
|
||||
@ -142,7 +142,7 @@ namespace BreCalClient
|
||||
private void comboBoxCategories_ItemSelectionChanged(object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e)
|
||||
{
|
||||
_model.Categories.Clear();
|
||||
foreach(int category in comboBoxCategories.SelectedItems)
|
||||
foreach(ShipcallType category in comboBoxCategories.SelectedItems)
|
||||
_model.Categories.Add(category);
|
||||
|
||||
SearchFilterChanged?.Invoke();
|
||||
|
||||
@ -19,7 +19,7 @@ namespace BreCalClient
|
||||
|
||||
public DateTime? EtaTo { get; set; }
|
||||
|
||||
public List<int> Categories { get; set; } = new();
|
||||
public List<ShipcallType> Categories { get; set; } = new();
|
||||
|
||||
public List<int> Agencies { get; set; } = new();
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2023 schick Informatik
|
||||
// Description: Show general shipcall info
|
||||
//
|
||||
//
|
||||
|
||||
using BreCalClient.misc.Model;
|
||||
using log4net;
|
||||
@ -44,7 +44,7 @@ namespace BreCalClient
|
||||
|
||||
public event Action<ShipcallControl, Times?>? EditAgencyRequested;
|
||||
|
||||
internal event Action<ShipcallControl, Times?, ParticipantType>? EditTimesRequested;
|
||||
internal event Action<ShipcallControl, Times?, Extensions.ParticipantType>? EditTimesRequested;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -53,7 +53,7 @@ namespace BreCalClient
|
||||
/// <summary>
|
||||
/// this is our datasource
|
||||
/// </summary>
|
||||
public ShipcallControlModel? ShipcallControlModel { get; set; }
|
||||
public ShipcallControlModel? ShipcallControlModel { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -131,7 +131,7 @@ namespace BreCalClient
|
||||
{
|
||||
this.labelTerminal.FontWeight = FontWeights.Bold;
|
||||
this.labelTerminal.Foreground = Brushes.LightYellow;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.labelTerminal.FontWeight = FontWeights.Normal;
|
||||
@ -274,7 +274,7 @@ namespace BreCalClient
|
||||
|
||||
this.textBlockBerth.Text = this.ShipcallControlModel?.Berth;
|
||||
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival)
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival)
|
||||
{
|
||||
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta?.ToString("dd.MM. HH:mm");
|
||||
}
|
||||
@ -287,7 +287,7 @@ namespace BreCalClient
|
||||
this.textBlockIMO.Text = this.ShipcallControlModel?.Ship?.Imo.ToString();
|
||||
this.textBlockLengthWidth.Text = $"{this.ShipcallControlModel?.Ship?.Length} / {this.ShipcallControlModel?.Ship?.Width}";
|
||||
|
||||
// rename labels if this is not an incoming
|
||||
// rename labels if this is not an incoming
|
||||
// must be here because there may not be a times record for each participant (yet)
|
||||
|
||||
if (this.ShipcallControlModel?.Shipcall?.Type != ShipcallType.Arrival)
|
||||
@ -301,7 +301,7 @@ namespace BreCalClient
|
||||
}
|
||||
|
||||
if (this.ShipcallControlModel != null)
|
||||
{
|
||||
{
|
||||
|
||||
Times? agencyTimes = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
||||
if (agencyTimes != null)
|
||||
@ -314,7 +314,7 @@ namespace BreCalClient
|
||||
{
|
||||
this.labelAgencyETAETDValue.Content = agencyTimes.EtdBerth.HasValue ? agencyTimes.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no agency times set (yet)
|
||||
@ -408,7 +408,7 @@ namespace BreCalClient
|
||||
this.textBlockTerminalRemarks.Text = "";
|
||||
this.textBlockTerminalBerthRemarks.Text = "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.DataContext = this.ShipcallControlModel;
|
||||
}
|
||||
@ -432,7 +432,7 @@ namespace BreCalClient
|
||||
{
|
||||
if(App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD))
|
||||
this.EditRequested?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void Image_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
@ -440,10 +440,10 @@ namespace BreCalClient
|
||||
}
|
||||
|
||||
private void labelAgent_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
||||
this.EditAgencyRequested?.Invoke(this, times);
|
||||
}
|
||||
this.EditAgencyRequested?.Invoke(this, times);
|
||||
}
|
||||
|
||||
private void labelMooring_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
@ -453,7 +453,7 @@ namespace BreCalClient
|
||||
|
||||
private void labelPortAuthority_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
Times? times = this.ShipcallControlModel?.GetTimesForParticipantType(Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
this.EditTimesRequested?.Invoke(this, times, Extensions.ParticipantType.PORT_ADMINISTRATION);
|
||||
}
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ namespace BreCalClient
|
||||
/// This function updates the assignments for existing times records accordingly and saves them.
|
||||
/// </summary>
|
||||
/// <param name="_api">API reference to PUT eidted times</param>
|
||||
internal async void UpdateTimesAssignments(DefaultApi _api)
|
||||
internal async void UpdateTimesAssignments(TimesApi api)
|
||||
{
|
||||
foreach (Extensions.ParticipantType participantType in this.AssignedParticipants.Keys)
|
||||
{
|
||||
@ -197,7 +197,7 @@ namespace BreCalClient
|
||||
if(times.ParticipantId != this.AssignedParticipants[participantType].ParticipantId)
|
||||
{
|
||||
times.ParticipantId = this.AssignedParticipants[participantType].ParticipantId;
|
||||
await _api.TimesPutAsync(times);
|
||||
await api.TimesUpdateAsync(times);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ namespace BreCalClient
|
||||
|
||||
foreach(Times times in deleteTimes)
|
||||
{
|
||||
_api.TimesDelete(times.Id);
|
||||
api.TimesDelete(times.Id);
|
||||
this.Times.Remove(times);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user