now the code is compiling. Yaml file documented via description tags.

This commit is contained in:
Daniel Schick 2023-12-19 08:10:49 +01:00
parent bd81f01d76
commit 23a903997a
11 changed files with 275 additions and 143 deletions

View File

@ -1,7 +1,7 @@
//---------------------- //----------------------
// <auto-generated> // <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 // Using the tool OpenAPI Generator v7.1.0
// </auto-generated> // </auto-generated>
//---------------------- //----------------------
@ -5377,9 +5377,9 @@ namespace BreCalClient.misc.Model
/// </summary> /// </summary>
/// <param name="id">id.</param> /// <param name="id">id.</param>
/// <param name="name">name.</param> /// <param name="name">name.</param>
/// <param name="ownerId">ownerId.</param> /// <param name="ownerId">Optional reference to a participant (terminal).</param>
/// <param name="authorityId">authorityId.</param> /// <param name="authorityId">Optional reference to a participant (port authority).</param>
/// <param name="varLock">varLock.</param> /// <param name="varLock">If true lock must be passed.</param>
/// <param name="created">created.</param> /// <param name="created">created.</param>
/// <param name="modified">modified.</param> /// <param name="modified">modified.</param>
/// <param name="deleted">deleted (default to false).</param> /// <param name="deleted">deleted (default to false).</param>
@ -5405,18 +5405,21 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "name", EmitDefaultValue = true)] [DataMember(Name = "name", EmitDefaultValue = true)]
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// Gets or Sets OwnerId /// Optional reference to a participant (terminal)
/// </summary> /// </summary>
/// <value>Optional reference to a participant (terminal)</value>
[DataMember(Name = "owner_id", EmitDefaultValue = true)] [DataMember(Name = "owner_id", EmitDefaultValue = true)]
public int? OwnerId { get; set; } public int? OwnerId { get; set; }
/// <summary> /// <summary>
/// Gets or Sets AuthorityId /// Optional reference to a participant (port authority)
/// </summary> /// </summary>
/// <value>Optional reference to a participant (port authority)</value>
[DataMember(Name = "authority_id", EmitDefaultValue = true)] [DataMember(Name = "authority_id", EmitDefaultValue = true)]
public int? AuthorityId { get; set; } public int? AuthorityId { get; set; }
/// <summary> /// <summary>
/// Gets or Sets VarLock /// If true lock must be passed
/// </summary> /// </summary>
/// <value>If true lock must be passed</value>
[DataMember(Name = "lock", EmitDefaultValue = true)] [DataMember(Name = "lock", EmitDefaultValue = true)]
public bool? VarLock { get; set; } public bool? VarLock { get; set; }
/// <summary> /// <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 * Bremen calling API
* *
@ -6812,12 +6855,12 @@ namespace BreCalClient.misc.Model
/// <param name="name">name.</param> /// <param name="name">name.</param>
/// <param name="imo">imo.</param> /// <param name="imo">imo.</param>
/// <param name="callsign">callsign.</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="length">length.</param>
/// <param name="width">width.</param> /// <param name="width">width.</param>
/// <param name="isTug">isTug (default to false).</param> /// <param name="isTug">isTug (default to false).</param>
/// <param name="bollardPull">bollardPull.</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="created">created.</param>
/// <param name="modified">modified.</param> /// <param name="modified">modified.</param>
/// <param name="deleted">deleted (default to false).</param> /// <param name="deleted">deleted (default to false).</param>
@ -6858,8 +6901,9 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "callsign", EmitDefaultValue = true)] [DataMember(Name = "callsign", EmitDefaultValue = true)]
public string Callsign { get; set; } public string Callsign { get; set; }
/// <summary> /// <summary>
/// Gets or Sets ParticipantId /// Optional reference to participant (tug role)
/// </summary> /// </summary>
/// <value>Optional reference to participant (tug role)</value>
[DataMember(Name = "participant_id", EmitDefaultValue = true)] [DataMember(Name = "participant_id", EmitDefaultValue = true)]
public int? ParticipantId { get; set; } public int? ParticipantId { get; set; }
/// <summary> /// <summary>
@ -6883,8 +6927,9 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "bollard_pull", EmitDefaultValue = true)] [DataMember(Name = "bollard_pull", EmitDefaultValue = true)]
public int? BollardPull { get; set; } public int? BollardPull { get; set; }
/// <summary> /// <summary>
/// Gets or Sets Eni /// BSMD internal use
/// </summary> /// </summary>
/// <value>BSMD internal use</value>
[DataMember(Name = "eni", EmitDefaultValue = true)] [DataMember(Name = "eni", EmitDefaultValue = true)]
public int? Eni { get; set; } public int? Eni { get; set; }
/// <summary> /// <summary>
@ -7118,6 +7163,11 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)]
public ShipcallType Type { get; set; } public ShipcallType Type { get; set; }
/// <summary> /// <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. /// Initializes a new instance of the <see cref="Shipcall" /> class.
/// </summary> /// </summary>
[JsonConstructorAttribute] [JsonConstructorAttribute]
@ -7153,7 +7203,7 @@ namespace BreCalClient.misc.Model
/// <param name="participants">participants.</param> /// <param name="participants">participants.</param>
/// <param name="created">Readonly field set by the database.</param> /// <param name="created">Readonly field set by the database.</param>
/// <param name="modified">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.Id = id;
this.ShipId = shipId; this.ShipId = shipId;
@ -7296,11 +7346,6 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "canceled", EmitDefaultValue = true)] [DataMember(Name = "canceled", EmitDefaultValue = true)]
public bool? Canceled { get; set; } public bool? Canceled { get; set; }
/// <summary> /// <summary>
/// Gets or Sets Evaluation
/// </summary>
[DataMember(Name = "evaluation", EmitDefaultValue = true)]
public int? Evaluation { get; set; }
/// <summary>
/// Gets or Sets EvaluationMessage /// Gets or Sets EvaluationMessage
/// </summary> /// </summary>
[DataMember(Name = "evaluation_message", EmitDefaultValue = true)] [DataMember(Name = "evaluation_message", EmitDefaultValue = true)]
@ -7504,8 +7549,7 @@ namespace BreCalClient.misc.Model
) && ) &&
( (
this.Evaluation == input.Evaluation || this.Evaluation == input.Evaluation ||
(this.Evaluation != null && this.Evaluation.Equals(input.Evaluation)
this.Evaluation.Equals(input.Evaluation))
) && ) &&
( (
this.EvaluationMessage == input.EvaluationMessage || this.EvaluationMessage == input.EvaluationMessage ||
@ -7621,10 +7665,7 @@ namespace BreCalClient.misc.Model
{ {
hashCode = (hashCode * 59) + this.Canceled.GetHashCode(); 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) if (this.EvaluationMessage != null)
{ {
hashCode = (hashCode * 59) + this.EvaluationMessage.GetHashCode(); 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" }); 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; yield break;
} }
} }
@ -7727,13 +7773,13 @@ namespace BreCalClient.misc.Model
/// Initializes a new instance of the <see cref="Times" /> class. /// Initializes a new instance of the <see cref="Times" /> class.
/// </summary> /// </summary>
/// <param name="id">id.</param> /// <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="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="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="lockTimeFixed">currently unused.</param>
/// <param name="zoneEntry">zoneEntry.</param> /// <param name="zoneEntry">currently unused.</param>
/// <param name="zoneEntryFixed">currently unused.</param> /// <param name="zoneEntryFixed">currently unused.</param>
/// <param name="operationsStart">Start time for terminal operations.</param> /// <param name="operationsStart">Start time for terminal operations.</param>
/// <param name="operationsEnd">End 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="shipcallId">Reference to a shipcall id (required).</param>
/// <param name="participantId">Reference to a participant id (required).</param> /// <param name="participantId">Reference to a participant id (required).</param>
/// <param name="berthId">Reference to a berth id.</param> /// <param name="berthId">Reference to a berth id.</param>
/// <param name="berthInfo">berthInfo.</param> /// <param name="berthInfo">Additional info text for berth.</param>
/// <param name="pierSide">pierSide.</param> /// <param name="pierSide">true if ship is rotated, false otherwise.</param>
/// <param name="participantType">participantType.</param> /// <param name="participantType">participantType.</param>
/// <param name="created">Readonly field set by the database.</param> /// <param name="created">Readonly field set by the database.</param>
/// <param name="modified">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)] [DataMember(Name = "id", EmitDefaultValue = true)]
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// Gets or Sets EtaBerth /// Arrival time at berth
/// </summary> /// </summary>
/// <value>Arrival time at berth</value>
[DataMember(Name = "eta_berth", EmitDefaultValue = true)] [DataMember(Name = "eta_berth", EmitDefaultValue = true)]
public DateTime? EtaBerth { get; set; } public DateTime? EtaBerth { get; set; }
/// <summary> /// <summary>
@ -7786,8 +7833,9 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "eta_berth_fixed", EmitDefaultValue = true)] [DataMember(Name = "eta_berth_fixed", EmitDefaultValue = true)]
public bool? EtaBerthFixed { get; set; } public bool? EtaBerthFixed { get; set; }
/// <summary> /// <summary>
/// Gets or Sets EtdBerth /// departure time from berth
/// </summary> /// </summary>
/// <value>departure time from berth</value>
[DataMember(Name = "etd_berth", EmitDefaultValue = true)] [DataMember(Name = "etd_berth", EmitDefaultValue = true)]
public DateTime? EtdBerth { get; set; } public DateTime? EtdBerth { get; set; }
/// <summary> /// <summary>
@ -7797,8 +7845,9 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "etd_berth_fixed", EmitDefaultValue = true)] [DataMember(Name = "etd_berth_fixed", EmitDefaultValue = true)]
public bool? EtdBerthFixed { get; set; } public bool? EtdBerthFixed { get; set; }
/// <summary> /// <summary>
/// Gets or Sets LockTime /// arrival time at lock
/// </summary> /// </summary>
/// <value>arrival time at lock</value>
[DataMember(Name = "lock_time", EmitDefaultValue = true)] [DataMember(Name = "lock_time", EmitDefaultValue = true)]
public DateTime? LockTime { get; set; } public DateTime? LockTime { get; set; }
/// <summary> /// <summary>
@ -7808,8 +7857,9 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "lock_time_fixed", EmitDefaultValue = true)] [DataMember(Name = "lock_time_fixed", EmitDefaultValue = true)]
public bool? LockTimeFixed { get; set; } public bool? LockTimeFixed { get; set; }
/// <summary> /// <summary>
/// Gets or Sets ZoneEntry /// currently unused
/// </summary> /// </summary>
/// <value>currently unused</value>
[DataMember(Name = "zone_entry", EmitDefaultValue = true)] [DataMember(Name = "zone_entry", EmitDefaultValue = true)]
public DateTime? ZoneEntry { get; set; } public DateTime? ZoneEntry { get; set; }
/// <summary> /// <summary>
@ -7854,13 +7904,15 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "berth_id", EmitDefaultValue = true)] [DataMember(Name = "berth_id", EmitDefaultValue = true)]
public int? BerthId { get; set; } public int? BerthId { get; set; }
/// <summary> /// <summary>
/// Gets or Sets BerthInfo /// Additional info text for berth
/// </summary> /// </summary>
/// <value>Additional info text for berth</value>
[DataMember(Name = "berth_info", EmitDefaultValue = true)] [DataMember(Name = "berth_info", EmitDefaultValue = true)]
public string BerthInfo { get; set; } public string BerthInfo { get; set; }
/// <summary> /// <summary>
/// Gets or Sets PierSide /// true if ship is rotated, false otherwise
/// </summary> /// </summary>
/// <value>true if ship is rotated, false otherwise</value>
[DataMember(Name = "pier_side", EmitDefaultValue = true)] [DataMember(Name = "pier_side", EmitDefaultValue = true)]
public bool? PierSide { get; set; } public bool? PierSide { get; set; }
/// <summary> /// <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" }); 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; yield break;
} }
} }
@ -8332,6 +8389,36 @@ namespace BreCalClient.misc.Model
/// <returns>Validation Result</returns> /// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) 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; yield break;
} }
} }

View File

@ -468,9 +468,10 @@ components:
type: boolean type: boolean
nullable: true nullable: true
evaluation: evaluation:
type: integer $ref: '#/components/schemas/EvaluationType'
nullable: true nullable: true
evaluation_message: evaluation_message:
maxLength: 512
type: string type: string
nullable: true nullable: true
participants: participants:
@ -504,6 +505,7 @@ components:
type: string type: string
format: date-time format: date-time
nullable: true nullable: true
description: Arrival time at berth
eta_berth_fixed: eta_berth_fixed:
type: boolean type: boolean
nullable: true nullable: true
@ -512,6 +514,7 @@ components:
type: string type: string
format: date-time format: date-time
nullable: true nullable: true
description: departure time from berth
etd_berth_fixed: etd_berth_fixed:
type: boolean type: boolean
nullable: true nullable: true
@ -520,6 +523,7 @@ components:
type: string type: string
format: date-time format: date-time
nullable: true nullable: true
description: arrival time at lock
lock_time_fixed: lock_time_fixed:
type: boolean type: boolean
nullable: true nullable: true
@ -528,6 +532,7 @@ components:
type: string type: string
format: date-time format: date-time
nullable: true nullable: true
description: currently unused
zone_entry_fixed: zone_entry_fixed:
type: boolean type: boolean
nullable: true nullable: true
@ -559,7 +564,10 @@ components:
berth_info: berth_info:
type: string type: string
nullable: true nullable: true
maxLength: 512
description: Additional info text for berth
pier_side: pier_side:
description: true if ship is rotated, false otherwise
type: boolean type: boolean
nullable: true nullable: true
participant_type: participant_type:
@ -592,12 +600,15 @@ components:
owner_id: owner_id:
type: integer type: integer
nullable: true nullable: true
description: Optional reference to a participant (terminal)
authority_id: authority_id:
type: integer type: integer
nullable: true nullable: true
description: Optional reference to a participant (port authority)
lock: lock:
type: boolean type: boolean
nullable: true nullable: true
description: If true lock must be passed
created: created:
type: string type: string
format: date-time format: date-time
@ -631,6 +642,7 @@ components:
participant_id: participant_id:
type: integer type: integer
nullable: true nullable: true
description: Optional reference to participant (tug role)
length: length:
type: number type: number
format: float format: float
@ -648,6 +660,7 @@ components:
eni: eni:
type: integer type: integer
nullable: true nullable: true
description: BSMD internal use
created: created:
type: string type: string
format: date-time format: date-time
@ -760,19 +773,25 @@ components:
old_password: old_password:
type: string type: string
nullable: true nullable: true
maxLength: 128
new_password: new_password:
type: string type: string
nullable: true nullable: true
maxLength: 128
first_name: first_name:
type: string type: string
nullable: true nullable: true
maxLength: 45
last_name: last_name:
type: string type: string
nullable: true nullable: true
maxLength: 45
user_phone: user_phone:
maxLength: 128
type: string type: string
nullable: true nullable: true
user_email: user_email:
maxLength: 128
type: string type: string
nullable: true nullable: true
Id: Id:
@ -804,6 +823,13 @@ components:
- undefined - undefined
- email - email
- push - push
EvaluationType:
type: string
enum:
- undefined
- green
- yellow
- red
securitySchemes: securitySchemes:
ApiKey: ApiKey:
type: apiKey type: apiKey

View File

@ -254,7 +254,7 @@ namespace BreCalClient
if (this.ShipcallModel == null) return; if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null) 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) if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta; this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
// this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage; // this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage;
@ -262,7 +262,7 @@ namespace BreCalClient
this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId; this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId;
this.checkBoxCancelled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false; 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.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId; this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;

View File

@ -89,7 +89,7 @@ namespace BreCalClient
private void EnableControls() 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! if (this.Times.ParticipantId != App.Participant.Id) return; // if this is not "my" entry, there is no editing!
switch (pType) switch (pType)
@ -97,24 +97,24 @@ namespace BreCalClient
case Extensions.ParticipantType.MOORING: case Extensions.ParticipantType.MOORING:
case Extensions.ParticipantType.PORT_ADMINISTRATION: case Extensions.ParticipantType.PORT_ADMINISTRATION:
case Extensions.ParticipantType.TUG: 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.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.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.checkBoxLockTimeFixed.IsEnabled = (CallType == Extensions.TypeEnum.Incoming || CallType == Extensions.TypeEnum.Shifting);
this.datePickerZoneEntry.IsEnabled = false; this.datePickerZoneEntry.IsEnabled = false;
//this.checkBoxZoneEntryFixed.IsEnabled = false; //this.checkBoxZoneEntryFixed.IsEnabled = false;
this.textBoxRemarks.IsEnabled = true; this.textBoxRemarks.IsEnabled = true;
break; break;
case Extensions.ParticipantType.PILOT: 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.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.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.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.checkBoxZoneEntryFixed.IsEnabled = (CallType == Extensions.TypeEnum.Incoming);
this.textBoxRemarks.IsEnabled = true; this.textBoxRemarks.IsEnabled = true;
break; break;

View File

@ -72,12 +72,12 @@ namespace BreCalClient
private void CopyToModel() private void CopyToModel()
{ {
switch(this.comboBoxPierside.SelectedIndex) this.Times.PierSide = this.comboBoxPierside.SelectedIndex switch
{ {
case 0: this.Times.PierSide = true; break; 0 => true,
case 1: this.Times.PierSide= false; break; 1 => false,
default: this.Times.PierSide = null; break; _ => null,
} };
this.Times.OperationsStart = this.datePickerOperationStart.Value; this.Times.OperationsStart = this.datePickerOperationStart.Value;
this.Times.OperationsEnd = this.datePickerOperationEnd.Value; this.Times.OperationsEnd = this.datePickerOperationEnd.Value;
this.Times.BerthId = (this.comboBoxBerth.SelectedItem != null) ? ((Berth)this.comboBoxBerth.SelectedItem).Id : null; 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; if (this.Times.ParticipantId != App.Participant.Id) return;
this.datePickerOperationStart.IsEnabled = (CallType == Extensions.TypeEnum.Incoming); this.datePickerOperationStart.IsEnabled = CallType == ShipcallType.Arrival;
this.datePickerOperationEnd.IsEnabled = (CallType == Extensions.TypeEnum.Outgoing) || (CallType == Extensions.TypeEnum.Shifting); this.datePickerOperationEnd.IsEnabled = (CallType == ShipcallType.Departure) || (CallType == ShipcallType.Shifting);
this.comboBoxBerth.IsEnabled = (CallType == Extensions.TypeEnum.Incoming); this.comboBoxBerth.IsEnabled = CallType == ShipcallType.Arrival;
this.comboBoxPierside.IsEnabled = (CallType == Extensions.TypeEnum.Incoming); this.comboBoxPierside.IsEnabled = CallType == ShipcallType.Arrival;
this.textBoxBerthRemarks.IsEnabled = (CallType == Extensions.TypeEnum.Incoming); this.textBoxBerthRemarks.IsEnabled = CallType == ShipcallType.Arrival;
this.textBoxRemarks.IsEnabled = true; this.textBoxRemarks.IsEnabled = true;
this.buttonOK.IsEnabled = true; this.buttonOK.IsEnabled = true;
} }

View File

@ -71,15 +71,15 @@ namespace BreCalClient
public static string Truncate(this string value, int maxLength) public static string Truncate(this string value, int maxLength)
{ {
if (string.IsNullOrEmpty(value)) return value; 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) public static string TruncateDots(this string value, int maxLength)
{ {
if(string.IsNullOrEmpty(value)) return value; if(string.IsNullOrEmpty(value)) return value;
if (value.Length <= maxLength) return value; if (value.Length <= maxLength) return value;
if (value.Length > (maxLength + 1)) return $"{value.Substring(0, maxLength)}.."; if (value.Length > (maxLength + 1)) return $"{value[..maxLength]}..";
return value.Substring(0, maxLength); return value[..maxLength];
} }
#endregion #endregion

View File

@ -19,6 +19,7 @@ using static BreCalClient.Extensions;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Security.Principal; using System.Security.Principal;
using System.Net;
namespace BreCalClient namespace BreCalClient
{ {
@ -42,7 +43,11 @@ namespace BreCalClient
private readonly ConcurrentDictionary<int, ShipcallControl> _allShipCallsControlDict = new(); private readonly ConcurrentDictionary<int, ShipcallControl> _allShipCallsControlDict = new();
private readonly List<ShipcallControlModel> _visibleControlModels = new(); private readonly List<ShipcallControlModel> _visibleControlModels = new();
private readonly DefaultApi _api; private readonly ShipcallApi _shipcallApi;
private readonly UserApi _userApi;
private readonly TimesApi _timesApi;
private readonly StaticApi _staticApi;
private CancellationTokenSource _tokenSource = new(); private CancellationTokenSource _tokenSource = new();
private LoginResult? _loginResult; private LoginResult? _loginResult;
private bool _refreshImmediately = false; private bool _refreshImmediately = false;
@ -72,8 +77,14 @@ namespace BreCalClient
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
_api = new DefaultApi(Properties.Settings.Default.API_URL); _userApi = new UserApi(Properties.Settings.Default.API_URL);
_api.Configuration.ApiKeyPrefix["Authorization"] = "Bearer"; _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 #endregion
@ -115,13 +126,16 @@ namespace BreCalClient
try try
{ {
_loginResult = await _api.LoginPostAsync(_credentials); _loginResult = await _userApi.LoginAsync(_credentials);
if (_loginResult != null) if (_loginResult != null)
{ {
if (_loginResult.Id > 0) if (_loginResult.Id > 0)
{ {
this.busyIndicator.IsBusy = false; 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.LoadStaticLists();
this.labelUsername.Text = $"{_loginResult.FirstName} {_loginResult.LastName}"; this.labelUsername.Text = $"{_loginResult.FirstName} {_loginResult.LastName}";
_timer = new Timer(RefreshToken, null, 4000000, Timeout.Infinite); _timer = new Timer(RefreshToken, null, 4000000, Timeout.Infinite);
@ -154,12 +168,15 @@ namespace BreCalClient
{ {
try try
{ {
_loginResult = _api.LoginPost(_credentials); _loginResult = _userApi.Login(_credentials);
if (_loginResult != null) if (_loginResult != null)
{ {
if (_loginResult.Id > 0) 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 else
@ -201,7 +218,7 @@ namespace BreCalClient
esc.ShipcallModel.Shipcall?.Participants.Add(pa); esc.ShipcallModel.Shipcall?.Participants.Add(pa);
try 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); this.AddShipcall(esc.ShipcallModel);
} }
catch (Exception ex) catch (Exception ex)
@ -256,7 +273,7 @@ namespace BreCalClient
}; };
try try
{ {
await _api.UserPutAsync(ud); await _userApi.UserUpdateAsync(ud);
MessageBox.Show(BreCalClient.Resources.Resources.textPasswordChanged, BreCalClient.Resources.Resources.textConfirmation, MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show(BreCalClient.Resources.Resources.textPasswordChanged, BreCalClient.Resources.Resources.textConfirmation, MessageBoxButton.OK, MessageBoxImage.Information);
} }
catch (Exception ex) catch (Exception ex)
@ -303,9 +320,9 @@ namespace BreCalClient
private async void LoadStaticLists() private async void LoadStaticLists()
{ {
BreCalLists.InitializeBerths(await _api.BerthsGetAsync()); BreCalLists.InitializeBerths(await _staticApi.BerthsGetAsync());
BreCalLists.InitializeShips(await _api.ShipsGetAsync()); BreCalLists.InitializeShips(await _staticApi.ShipsGetAsync());
BreCalLists.InitializeParticipants(await _api.ParticipantsGetAsync()); BreCalLists.InitializeParticipants(await _staticApi.ParticipantsGetAsync());
this.searchFilterControl.SetBerths(BreCalLists.Berths); this.searchFilterControl.SetBerths(BreCalLists.Berths);
@ -345,9 +362,9 @@ namespace BreCalClient
try try
{ {
if(this.searchPastDays != 0) if(this.searchPastDays != 0)
shipcalls = await _api.ShipcallsGetAsync(this.searchPastDays); shipcalls = await _shipcallApi.ShipcallsGetAsync(this.searchPastDays);
else else
shipcalls = await _api.ShipcallsGetAsync(); shipcalls = await _shipcallApi.ShipcallsGetAsync();
this.Dispatcher.Invoke(new Action(() => this.Dispatcher.Invoke(new Action(() =>
{ {
@ -374,7 +391,7 @@ namespace BreCalClient
foreach (Shipcall shipcall in shipcalls) foreach (Shipcall shipcall in shipcalls)
{ {
// load times for each shipcall // 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)) if(!_allShipcallsDict.ContainsKey(shipcall.Id))
{ {
@ -429,7 +446,8 @@ namespace BreCalClient
Shipcall shipcall = scm.Shipcall; Shipcall shipcall = scm.Shipcall;
if (BreCalLists.ShipLookupDict.ContainsKey(shipcall.ShipId)) if (BreCalLists.ShipLookupDict.ContainsKey(shipcall.ShipId))
scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId].Ship; scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId].Ship;
if (shipcall.Type == 1)
if (shipcall.Type == ShipcallType.Arrival)
{ {
if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0)) if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0))
scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name; scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name;
@ -462,7 +480,8 @@ namespace BreCalClient
Shipcall shipcall = scm.Shipcall; Shipcall shipcall = scm.Shipcall;
if (BreCalLists.ShipLookupDict.ContainsKey(shipcall.ShipId)) if (BreCalLists.ShipLookupDict.ContainsKey(shipcall.ShipId))
scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId].Ship; scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId].Ship;
if (shipcall.Type == 1)
if (shipcall.Type == ShipcallType.Arrival)
{ {
if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0)) if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0))
scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name; scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name;
@ -535,7 +554,7 @@ namespace BreCalClient
if(sfm.Categories.Count > 0 ) 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)) if(!string.IsNullOrEmpty(sfm.SearchString))
@ -581,8 +600,8 @@ namespace BreCalClient
{ {
if (x.Shipcall == null) return 0; if (x.Shipcall == null) return 0;
if (y.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 xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? 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 yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? y.Eta ?? DateTime.Now : y.Etd ?? DateTime.Now;
return DateTime.Compare(xDate, yDate); return DateTime.Compare(xDate, yDate);
}); });
break; break;
@ -646,10 +665,10 @@ namespace BreCalClient
try try
{ {
obj.ShipcallControlModel.Shipcall?.Participants.Clear(); obj.ShipcallControlModel.Shipcall?.Participants.Clear();
obj.ShipcallControlModel.UpdateTimesAssignments(this._api); obj.ShipcallControlModel.UpdateTimesAssignments(this._timesApi);
foreach(ParticipantAssignment pa in obj.ShipcallControlModel.AssignedParticipants.Values) foreach(ParticipantAssignment pa in obj.ShipcallControlModel.AssignedParticipants.Values)
obj.ShipcallControlModel.Shipcall?.Participants.Add(pa); obj.ShipcallControlModel.Shipcall?.Participants.Add(pa);
await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall); await _shipcallApi.ShipcallUpdateAsync(obj.ShipcallControlModel.Shipcall);
obj.RefreshData(); obj.RefreshData();
_refreshImmediately = true; _refreshImmediately = true;
_tokenSource.Cancel(); _tokenSource.Cancel();
@ -698,7 +717,7 @@ namespace BreCalClient
{ {
if (wasEdit) if (wasEdit)
{ {
await _api.TimesPutAsync(etc.Times); await _timesApi.TimesUpdateAsync(etc.Times);
} }
else else
{ {
@ -707,7 +726,7 @@ namespace BreCalClient
{ {
etc.Times.ShipcallId = obj.ShipcallControlModel.Shipcall.Id; 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; etc.Times.Id = apiResultId.VarId;
obj.ShipcallControlModel?.Times.Add(etc.Times); obj.ShipcallControlModel?.Times.Add(etc.Times);
} }
@ -726,13 +745,13 @@ namespace BreCalClient
IEditShipcallTimesControl? editControl = null; IEditShipcallTimesControl? editControl = null;
switch(sc.ShipcallControlModel?.Shipcall?.Type) switch(sc.ShipcallControlModel?.Shipcall?.Type)
{ {
case (int)TypeEnum.Incoming: case ShipcallType.Arrival:
editControl = new EditTimesAgencyIncomingControl(); editControl = new EditTimesAgencyIncomingControl();
break; break;
case (int)TypeEnum.Outgoing: case ShipcallType.Departure:
editControl = new EditTimesAgencyOutgoingControl(); editControl = new EditTimesAgencyOutgoingControl();
break; break;
case (int)TypeEnum.Shifting: case ShipcallType.Shifting:
editControl = new EditTimesAgencyShiftingControl(); editControl = new EditTimesAgencyShiftingControl();
break; break;
} }
@ -756,7 +775,7 @@ namespace BreCalClient
{ {
try 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 // always try to be the agent, even if we are BSMD
if (editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) if (editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
@ -770,7 +789,7 @@ namespace BreCalClient
if (wasEdit) if (wasEdit)
{ {
await _api.TimesPutAsync(editControl.Times); await _timesApi.TimesUpdateAsync(editControl.Times);
} }
else else
{ {
@ -778,7 +797,7 @@ namespace BreCalClient
{ {
editControl.Times.ShipcallId = sc.ShipcallControlModel.Shipcall.Id; 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; editControl.Times.Id = resultAPI_Id.VarId;
sc.ShipcallControlModel?.Times.Add(editControl.Times); sc.ShipcallControlModel?.Times.Add(editControl.Times);
@ -786,7 +805,7 @@ namespace BreCalClient
editControl.ShipcallModel.Shipcall?.Participants.Clear(); editControl.ShipcallModel.Shipcall?.Participants.Clear();
foreach (ParticipantAssignment pa in editControl.ShipcallModel.AssignedParticipants.Values) foreach (ParticipantAssignment pa in editControl.ShipcallModel.AssignedParticipants.Values)
editControl.ShipcallModel.Shipcall?.Participants.Add(pa); editControl.ShipcallModel.Shipcall?.Participants.Add(pa);
await _api.ShipcallsPutAsync(editControl.ShipcallModel.Shipcall); await _shipcallApi.ShipcallUpdateAsync(editControl.ShipcallModel.Shipcall);
_refreshImmediately = true; _refreshImmediately = true;
_tokenSource.Cancel(); _tokenSource.Cancel();
} }

View File

@ -100,8 +100,8 @@ namespace BreCalClient
} }
if(sfm.Categories != null) if(sfm.Categories != null)
{ {
foreach(int category in sfm.Categories) foreach(ShipcallType category in sfm.Categories)
this.comboBoxCategories.SelectedItems.Add((Extensions.TypeEnum)category); this.comboBoxCategories.SelectedItems.Add(category);
} }
if (sfm.SearchString != null) this.textBoxSearch.Text = sfm.SearchString; if (sfm.SearchString != null) this.textBoxSearch.Text = sfm.SearchString;
this.upDownShiplengthFrom.Value = sfm.ShipLengthFrom; this.upDownShiplengthFrom.Value = sfm.ShipLengthFrom;
@ -124,7 +124,7 @@ namespace BreCalClient
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e) 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) 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) private void comboBoxCategories_ItemSelectionChanged(object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e)
{ {
_model.Categories.Clear(); _model.Categories.Clear();
foreach(int category in comboBoxCategories.SelectedItems) foreach(ShipcallType category in comboBoxCategories.SelectedItems)
_model.Categories.Add(category); _model.Categories.Add(category);
SearchFilterChanged?.Invoke(); SearchFilterChanged?.Invoke();

View File

@ -19,7 +19,7 @@ namespace BreCalClient
public DateTime? EtaTo { get; set; } 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(); public List<int> Agencies { get; set; } = new();

View File

@ -44,7 +44,7 @@ namespace BreCalClient
public event Action<ShipcallControl, Times?>? EditAgencyRequested; public event Action<ShipcallControl, Times?>? EditAgencyRequested;
internal event Action<ShipcallControl, Times?, ParticipantType>? EditTimesRequested; internal event Action<ShipcallControl, Times?, Extensions.ParticipantType>? EditTimesRequested;
#endregion #endregion

View File

@ -188,7 +188,7 @@ namespace BreCalClient
/// This function updates the assignments for existing times records accordingly and saves them. /// This function updates the assignments for existing times records accordingly and saves them.
/// </summary> /// </summary>
/// <param name="_api">API reference to PUT eidted times</param> /// <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) foreach (Extensions.ParticipantType participantType in this.AssignedParticipants.Keys)
{ {
@ -197,7 +197,7 @@ namespace BreCalClient
if(times.ParticipantId != this.AssignedParticipants[participantType].ParticipantId) if(times.ParticipantId != this.AssignedParticipants[participantType].ParticipantId)
{ {
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) foreach(Times times in deleteTimes)
{ {
_api.TimesDelete(times.Id); api.TimesDelete(times.Id);
this.Times.Remove(times); this.Times.Remove(times);
} }
} }