Enums, work in progress
This commit is contained in:
parent
c50f82354f
commit
c6b16c4fa7
1027
misc/BreCalApi.cs
1027
misc/BreCalApi.cs
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
|||||||
openapi: "3.0.0"
|
openapi: "3.1.0"
|
||||||
info:
|
info:
|
||||||
version: "0.6.0"
|
version: "1.1.0"
|
||||||
title: "Bremen calling API"
|
title: "Bremen calling API"
|
||||||
description: Administer DEBRE ship calls, times and notifications
|
description: Administer DEBRE ship calls, times and notifications
|
||||||
termsOfService: "https://www.bsmd.de/" # url to terms page
|
termsOfService: "https://www.bsmd.de/" # TBD: url to terms page
|
||||||
contact:
|
contact:
|
||||||
name: "Bremen calling API"
|
name: "Bremen calling API"
|
||||||
url: "https://www.textbausteine.net"
|
url: "https://www.textbausteine.net"
|
||||||
@ -13,8 +13,8 @@ info:
|
|||||||
url: "https://www.bsmd.de/license"
|
url: "https://www.bsmd.de/license"
|
||||||
|
|
||||||
servers:
|
servers:
|
||||||
- url: "https://brecaltest.bsmd-emswe.eu/"
|
- url: "https://brecaldevel.bsmd-emswe.eu/"
|
||||||
description: "Test server hosted on vcup"
|
description: "Development server hosted on vcup"
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/login:
|
/login:
|
||||||
@ -353,8 +353,7 @@ components:
|
|||||||
ship_id:
|
ship_id:
|
||||||
type: integer
|
type: integer
|
||||||
type:
|
type:
|
||||||
type: integer
|
type: ShipcallType
|
||||||
# TODO: use an enum
|
|
||||||
eta:
|
eta:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
@ -507,8 +506,7 @@ components:
|
|||||||
type: boolean
|
type: boolean
|
||||||
nullable: true
|
nullable: true
|
||||||
participant_type:
|
participant_type:
|
||||||
type: integer
|
type: ParticipantType
|
||||||
nullable: true
|
|
||||||
created:
|
created:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
@ -619,8 +617,7 @@ components:
|
|||||||
participant_id:
|
participant_id:
|
||||||
type: integer
|
type: integer
|
||||||
notification_type:
|
notification_type:
|
||||||
type: string
|
$ref: "#/components/schemas/NotificationType"
|
||||||
enum: [undefined, email, push]
|
|
||||||
timestamp:
|
timestamp:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
@ -658,7 +655,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
maxLength: 64
|
maxLength: 64
|
||||||
type:
|
type:
|
||||||
type: integer
|
type: ParticipantType
|
||||||
flags:
|
flags:
|
||||||
type: integer
|
type: integer
|
||||||
nullable: true
|
nullable: true
|
||||||
@ -741,6 +738,65 @@ components:
|
|||||||
description: A human readable error message
|
description: A human readable error message
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
ShipcallType:
|
||||||
|
type: string
|
||||||
|
enum: [undefined, arrival, departure, shifting]
|
||||||
|
|
||||||
|
NotificationType:
|
||||||
|
type: string
|
||||||
|
enum: [undefined, email, push]
|
||||||
|
|
||||||
|
ParticipantType:
|
||||||
|
type: integer
|
||||||
|
enum:
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
- 4
|
||||||
|
- 8
|
||||||
|
- 16
|
||||||
|
- 32
|
||||||
|
- 64
|
||||||
|
x-enumDescriptions:
|
||||||
|
1: bsmd
|
||||||
|
2: terminal
|
||||||
|
4: pilot
|
||||||
|
8: agency
|
||||||
|
16: mooring
|
||||||
|
32: port_authority
|
||||||
|
64: tug
|
||||||
|
|
||||||
|
# this here works only with OpenAPI 3.1
|
||||||
|
# ParticipantType:
|
||||||
|
# type: integer
|
||||||
|
# oneOf:
|
||||||
|
# - const: 1
|
||||||
|
# title: bsmd
|
||||||
|
# description: Bremen Schiffsmeldedienst
|
||||||
|
|
||||||
|
# - const: 2
|
||||||
|
# title: terminal
|
||||||
|
# description: Terminal
|
||||||
|
|
||||||
|
# - const: 4
|
||||||
|
# title: pilot
|
||||||
|
# description: Pilot
|
||||||
|
|
||||||
|
# - const: 8
|
||||||
|
# title: agency
|
||||||
|
# description: Agency
|
||||||
|
|
||||||
|
# - const: 16
|
||||||
|
# title: mooring
|
||||||
|
# description: Mooring
|
||||||
|
|
||||||
|
# - const: 32
|
||||||
|
# title: port_authority
|
||||||
|
# description: Port Authority
|
||||||
|
|
||||||
|
# - const: 64
|
||||||
|
# title: tug
|
||||||
|
# description: Tug
|
||||||
|
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
ApiKey:
|
ApiKey:
|
||||||
type: apiKey
|
type: apiKey
|
||||||
@ -760,7 +816,7 @@ components:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Id"
|
$ref: "#/components/schemas/Id"
|
||||||
400:
|
400:
|
||||||
description: Invalid input
|
description: Bad request
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
@ -771,6 +827,18 @@ components:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Error"
|
$ref: "#/components/schemas/Error"
|
||||||
|
403:
|
||||||
|
description: Forbidden
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Error"
|
||||||
|
404:
|
||||||
|
description: Not found
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Error"
|
||||||
500:
|
500:
|
||||||
description: Unexpected error
|
description: Unexpected error
|
||||||
content:
|
content:
|
||||||
@ -778,7 +846,7 @@ components:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Error"
|
$ref: "#/components/schemas/Error"
|
||||||
503:
|
503:
|
||||||
description: Not available
|
description: Service unavailable
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
|
|||||||
@ -106,7 +106,7 @@
|
|||||||
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
|
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
|
||||||
<PackageReference Include="log4net" Version="2.0.15" />
|
<PackageReference Include="log4net" Version="2.0.15" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Polly" Version="7.2.4" />
|
<PackageReference Include="Polly" Version="8.2.0" />
|
||||||
<PackageReference Include="RestSharp" Version="110.2.0" />
|
<PackageReference Include="RestSharp" Version="110.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ namespace BreCalClient
|
|||||||
this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent;
|
this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent;
|
||||||
|
|
||||||
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
||||||
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(TypeEnum));
|
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(ShipcallType));
|
||||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
||||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
||||||
|
|
||||||
@ -91,12 +91,12 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
|
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
|
||||||
{
|
{
|
||||||
TypeEnum? type = this.comboBoxCategories.SelectedItem as TypeEnum?;
|
ShipcallType? type = this.comboBoxCategories.SelectedItem as ShipcallType?;
|
||||||
if (type != null)
|
if (type != null)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case TypeEnum.Incoming:
|
case ShipcallType.Arrival:
|
||||||
this.datePickerETA.IsEnabled = true;
|
this.datePickerETA.IsEnabled = true;
|
||||||
this.datePickerETD.IsEnabled = false;
|
this.datePickerETD.IsEnabled = false;
|
||||||
this.datePickerETD.Value = null;
|
this.datePickerETD.Value = null;
|
||||||
@ -104,7 +104,7 @@ namespace BreCalClient
|
|||||||
this.comboBoxDepartureBerth.IsEnabled = false;
|
this.comboBoxDepartureBerth.IsEnabled = false;
|
||||||
this.comboBoxArrivalBerth.IsEnabled = true;
|
this.comboBoxArrivalBerth.IsEnabled = true;
|
||||||
break;
|
break;
|
||||||
case TypeEnum.Outgoing:
|
case ShipcallType.Departure:
|
||||||
this.datePickerETA.IsEnabled = false;
|
this.datePickerETA.IsEnabled = false;
|
||||||
this.datePickerETD.IsEnabled = true;
|
this.datePickerETD.IsEnabled = true;
|
||||||
this.datePickerETA.Value = null;
|
this.datePickerETA.Value = null;
|
||||||
@ -112,7 +112,7 @@ namespace BreCalClient
|
|||||||
this.comboBoxArrivalBerth.IsEnabled = false;
|
this.comboBoxArrivalBerth.IsEnabled = false;
|
||||||
this.comboBoxDepartureBerth.IsEnabled = true;
|
this.comboBoxDepartureBerth.IsEnabled = true;
|
||||||
break;
|
break;
|
||||||
case TypeEnum.Shifting:
|
case ShipcallType.Shifting:
|
||||||
this.datePickerETA.IsEnabled = true;
|
this.datePickerETA.IsEnabled = true;
|
||||||
this.datePickerETD.IsEnabled = true;
|
this.datePickerETD.IsEnabled = true;
|
||||||
this.comboBoxArrivalBerth.IsEnabled = true;
|
this.comboBoxArrivalBerth.IsEnabled = true;
|
||||||
@ -150,18 +150,18 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TypeEnum callType = (TypeEnum)comboBoxCategories.SelectedItem;
|
ShipcallType callType = (ShipcallType)comboBoxCategories.SelectedItem;
|
||||||
switch (callType)
|
switch (callType)
|
||||||
{
|
{
|
||||||
case TypeEnum.Outgoing:
|
case ShipcallType.Departure:
|
||||||
isEnabled &= this.comboBoxDepartureBerth.SelectedItem != null;
|
isEnabled &= this.comboBoxDepartureBerth.SelectedItem != null;
|
||||||
isEnabled &= this.datePickerETD.Value.HasValue;
|
isEnabled &= this.datePickerETD.Value.HasValue;
|
||||||
break;
|
break;
|
||||||
case TypeEnum.Incoming:
|
case ShipcallType.Arrival:
|
||||||
isEnabled &= this.comboBoxArrivalBerth.SelectedItem != null;
|
isEnabled &= this.comboBoxArrivalBerth.SelectedItem != null;
|
||||||
isEnabled &= this.datePickerETA.Value.HasValue;
|
isEnabled &= this.datePickerETA.Value.HasValue;
|
||||||
break;
|
break;
|
||||||
case TypeEnum.Shifting:
|
case ShipcallType.Shifting:
|
||||||
isEnabled &= ((this.comboBoxDepartureBerth.SelectedItem != null) && (this.comboBoxArrivalBerth.SelectedItem != null));
|
isEnabled &= ((this.comboBoxDepartureBerth.SelectedItem != null) && (this.comboBoxArrivalBerth.SelectedItem != null));
|
||||||
isEnabled &= this.datePickerETD.Value.HasValue;
|
isEnabled &= this.datePickerETD.Value.HasValue;
|
||||||
isEnabled &= this.datePickerETA.Value.HasValue;
|
isEnabled &= this.datePickerETA.Value.HasValue;
|
||||||
@ -178,7 +178,7 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
if (this.ShipcallModel.Shipcall != null)
|
if (this.ShipcallModel.Shipcall != null)
|
||||||
{
|
{
|
||||||
this.ShipcallModel.Shipcall.Type = (int)this.comboBoxCategories.SelectedItem;
|
this.ShipcallModel.Shipcall.Type = (ShipcallType) this.comboBoxCategories.SelectedItem;
|
||||||
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value;
|
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value;
|
||||||
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value;
|
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value;
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ namespace BreCalClient
|
|||||||
this.ShipcallModel.Ship = ((ShipModel)this.comboBoxShip.SelectedItem).Ship;
|
this.ShipcallModel.Ship = ((ShipModel)this.comboBoxShip.SelectedItem).Ship;
|
||||||
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCancelled.IsChecked;
|
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCancelled.IsChecked;
|
||||||
|
|
||||||
if (this.ShipcallModel.Shipcall.Type != 3) // incoming, outgoing
|
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
|
||||||
{
|
{
|
||||||
this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
|
this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
|
||||||
this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
|
this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
|
||||||
@ -204,6 +204,7 @@ namespace BreCalClient
|
|||||||
ParticipantAssignment pa = new()
|
ParticipantAssignment pa = new()
|
||||||
{
|
{
|
||||||
ParticipantId = participant.Id,
|
ParticipantId = participant.Id,
|
||||||
|
|
||||||
Type = (int)Extensions.ParticipantType.AGENCY
|
Type = (int)Extensions.ParticipantType.AGENCY
|
||||||
};
|
};
|
||||||
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = pa;
|
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = pa;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
public Times Times { get; set; } = new();
|
public Times Times { get; set; } = new();
|
||||||
|
|
||||||
public Extensions.TypeEnum CallType { get; set; }
|
public ShipcallType CallType { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
public Times Times { get; set; } = new();
|
public Times Times { get; set; } = new();
|
||||||
|
|
||||||
public Extensions.TypeEnum CallType { get; set; }
|
public ShipcallType CallType { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
public Times Times { get; set; } = new();
|
public Times Times { get; set; } = new();
|
||||||
|
|
||||||
public Extensions.TypeEnum CallType { get; set; }
|
public ShipcallType CallType { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
public Times Times { get; set; } = new();
|
public Times Times { get; set; } = new();
|
||||||
|
|
||||||
public Extensions.TypeEnum CallType { get; set; }
|
public ShipcallType CallType { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
public Times Times { get; set; } = new();
|
public Times Times { get; set; } = new();
|
||||||
|
|
||||||
public Extensions.TypeEnum CallType { get; set; }
|
public ShipcallType CallType { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -13,30 +13,6 @@ namespace BreCalClient
|
|||||||
|
|
||||||
#region Enum
|
#region Enum
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copied from models clunky I know
|
|
||||||
/// </summary>
|
|
||||||
[Flags]
|
|
||||||
public enum ParticipantType
|
|
||||||
{
|
|
||||||
[Description("not assigned")]
|
|
||||||
NONE = 0,
|
|
||||||
[Description("BSMD")]
|
|
||||||
BSMD = 1,
|
|
||||||
[Description("Terminal")]
|
|
||||||
TERMINAL = 2,
|
|
||||||
[Description("Lotsen")]
|
|
||||||
PILOT = 4,
|
|
||||||
[Description("Agentur")]
|
|
||||||
AGENCY = 8,
|
|
||||||
[Description("Festmacher")]
|
|
||||||
MOORING = 16,
|
|
||||||
[Description("Hafenamt")]
|
|
||||||
PORT_ADMINISTRATION = 32,
|
|
||||||
[Description("Schlepper")]
|
|
||||||
TUG = 64,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Custom participant flags
|
/// Custom participant flags
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -47,16 +23,6 @@ namespace BreCalClient
|
|||||||
ALLOW_BSMD = 1,
|
ALLOW_BSMD = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Should actually be defined in yaml
|
|
||||||
/// </summary>
|
|
||||||
public enum TypeEnum
|
|
||||||
{
|
|
||||||
Incoming = 1,
|
|
||||||
Outgoing = 2,
|
|
||||||
Shifting = 3
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum SortOrder
|
public enum SortOrder
|
||||||
{
|
{
|
||||||
SHIP_NAME,
|
SHIP_NAME,
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
string Title { get; set; }
|
string Title { get; set; }
|
||||||
|
|
||||||
Extensions.TypeEnum CallType { get; set; }
|
ShipcallType CallType { get; set; }
|
||||||
|
|
||||||
bool? ShowDialog();
|
bool? ShowDialog();
|
||||||
|
|
||||||
|
|||||||
@ -662,7 +662,7 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Sc_EditTimesRequested(ShipcallControl obj, Times? times, Extensions.ParticipantType participantType)
|
private async void Sc_EditTimesRequested(ShipcallControl obj, Times? times, ParticipantType participantType)
|
||||||
{
|
{
|
||||||
|
|
||||||
if( obj.ShipcallControlModel == null) { return; }
|
if( obj.ShipcallControlModel == null) { return; }
|
||||||
@ -673,7 +673,7 @@ namespace BreCalClient
|
|||||||
etc.Title = obj.ShipcallControlModel.Title;
|
etc.Title = obj.ShipcallControlModel.Title;
|
||||||
|
|
||||||
if(obj.ShipcallControlModel.Shipcall != null)
|
if(obj.ShipcallControlModel.Shipcall != null)
|
||||||
etc.CallType = (TypeEnum) obj.ShipcallControlModel.Shipcall.Type;
|
etc.CallType = (ShipcallType) obj.ShipcallControlModel.Shipcall.Type;
|
||||||
|
|
||||||
bool wasEdit = false;
|
bool wasEdit = false;
|
||||||
if (times != null)
|
if (times != null)
|
||||||
|
|||||||
@ -44,7 +44,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
public event Action<ShipcallControl, Times?>? EditAgencyRequested;
|
public event Action<ShipcallControl, Times?>? EditAgencyRequested;
|
||||||
|
|
||||||
internal event Action<ShipcallControl, Times?, Extensions.ParticipantType>? EditTimesRequested;
|
internal event Action<ShipcallControl, Times?, ParticipantType>? EditTimesRequested;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Copyright (c) 2023 schick Informatik
|
// Copyright (c) 2023 schick Informatik
|
||||||
// Description: Container model for shipcall related info
|
// Description: Container model for shipcall related info
|
||||||
//
|
//
|
||||||
|
|
||||||
using BreCalClient.misc.Api;
|
using BreCalClient.misc.Api;
|
||||||
using BreCalClient.misc.Model;
|
using BreCalClient.misc.Model;
|
||||||
@ -44,11 +44,11 @@ namespace BreCalClient
|
|||||||
|
|
||||||
public Shipcall? Shipcall { get; set; }
|
public Shipcall? Shipcall { get; set; }
|
||||||
|
|
||||||
public Ship? Ship { get; set; }
|
public Ship? Ship { get; set; }
|
||||||
|
|
||||||
public string? Berth { get; set; }
|
public string? Berth { get; set; }
|
||||||
|
|
||||||
internal Dictionary<Extensions.ParticipantType, ParticipantAssignment> AssignedParticipants { get; } = new();
|
internal Dictionary<ParticipantType, ParticipantAssignment> AssignedParticipants { get; } = new();
|
||||||
|
|
||||||
public List<Times> Times { get; set; } = new();
|
public List<Times> Times { get; set; } = new();
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Times? agencyTimes = this.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
Times? agencyTimes = this.GetTimesForParticipantType(ParticipantType.AGENCY);
|
||||||
if((agencyTimes != null) && (agencyTimes.EtaBerth != null))
|
if((agencyTimes != null) && (agencyTimes.EtaBerth != null))
|
||||||
return agencyTimes.EtaBerth;
|
return agencyTimes.EtaBerth;
|
||||||
return Shipcall?.Eta;
|
return Shipcall?.Eta;
|
||||||
@ -88,7 +88,7 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tlm;
|
return tlm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Title
|
public string Title
|
||||||
@ -112,12 +112,12 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
foreach (ParticipantAssignment participantAssignment in Shipcall.Participants)
|
foreach (ParticipantAssignment participantAssignment in Shipcall.Participants)
|
||||||
{
|
{
|
||||||
AssignedParticipants[(Extensions.ParticipantType)participantAssignment.Type] = participantAssignment;
|
AssignedParticipants[(ParticipantType)participantAssignment.Type] = participantAssignment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Times? GetTimesForParticipantType(Extensions.ParticipantType type)
|
internal Times? GetTimesForParticipantType(ParticipantType type)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (AssignedParticipants.ContainsKey(type)) {
|
if (AssignedParticipants.ContainsKey(type)) {
|
||||||
@ -127,14 +127,14 @@ namespace BreCalClient
|
|||||||
if ((times.ParticipantId == participantId) && (times.ParticipantType == (int) type))
|
if ((times.ParticipantId == participantId) && (times.ParticipantType == (int) type))
|
||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
if(type == Extensions.ParticipantType.AGENCY)
|
if(type == ParticipantType.AGENCY)
|
||||||
{
|
{
|
||||||
// if I am BSMD and no agency entry was found this means we are editing the agency entry
|
// if I am BSMD and no agency entry was found this means we are editing the agency entry
|
||||||
if(App.Participant.Type == (int) Extensions.ParticipantType.BSMD)
|
if(App.Participant.Type == (int) ParticipantType.BSMD)
|
||||||
{
|
{
|
||||||
foreach(Times times in this.Times)
|
foreach(Times times in this.Times)
|
||||||
{
|
{
|
||||||
if ((times.ParticipantId == App.Participant.Id) && (times.ParticipantType == (int) Extensions.ParticipantType.AGENCY))
|
if ((times.ParticipantId == App.Participant.Id) && (times.ParticipantType == (int) ParticipantType.AGENCY))
|
||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,15 +160,15 @@ namespace BreCalClient
|
|||||||
public string? GetBerthText(Times times)
|
public string? GetBerthText(Times times)
|
||||||
{
|
{
|
||||||
string? berthText = null;
|
string? berthText = null;
|
||||||
if ((BreCalLists.AllBerths != null) && times.BerthId.HasValue && (this.Shipcall?.Type != (int)Extensions.TypeEnum.Shifting))
|
if ((BreCalLists.Berths != null) && times.BerthId.HasValue && (this.Shipcall?.Type != ShipcallType.Shifting))
|
||||||
{
|
{
|
||||||
Berth? berth = BreCalLists.AllBerths.Find((x) => x.Id == times.BerthId);
|
Berth? berth = BreCalLists.AllBerths.Find((x) => x.Id == times.BerthId);
|
||||||
berthText = berth?.Name;
|
berthText = berth?.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((berthText == null) && (times.ParticipantType != (int)Extensions.ParticipantType.TERMINAL))
|
if ((berthText == null) && (times.ParticipantType != ParticipantType.TERMINAL))
|
||||||
{
|
{
|
||||||
if (this.Shipcall?.Type == (int)Extensions.TypeEnum.Incoming)
|
if (this.Shipcall?.Type == ShipcallType.Arrival)
|
||||||
{
|
{
|
||||||
Berth? berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.ArrivalBerthId);
|
Berth? berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.ArrivalBerthId);
|
||||||
berthText = berth?.Name;
|
berthText = berth?.Name;
|
||||||
@ -191,7 +191,7 @@ namespace BreCalClient
|
|||||||
/// <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(DefaultApi _api)
|
||||||
{
|
{
|
||||||
foreach (Extensions.ParticipantType participantType in this.AssignedParticipants.Keys)
|
foreach (ParticipantType participantType in this.AssignedParticipants.Keys)
|
||||||
{
|
{
|
||||||
Times? times = this.GetTimesForParticipantType(participantType);
|
Times? times = this.GetTimesForParticipantType(participantType);
|
||||||
if(times == null) continue;
|
if(times == null) continue;
|
||||||
@ -236,11 +236,11 @@ namespace BreCalClient
|
|||||||
|
|
||||||
internal Participant? GetParticipantForType(Extensions.ParticipantType participantType)
|
internal Participant? GetParticipantForType(Extensions.ParticipantType participantType)
|
||||||
{
|
{
|
||||||
if(AssignedParticipants.ContainsKey(participantType) && BreCalLists.ParticipantLookupDict.ContainsKey(AssignedParticipants[participantType].ParticipantId))
|
if(AssignedParticipants.ContainsKey(participantType) && BreCalLists.ParticipantLookupDict.ContainsKey(AssignedParticipants[participantType].ParticipantId))
|
||||||
return BreCalLists.ParticipantLookupDict[AssignedParticipants[participantType].ParticipantId];
|
return BreCalLists.ParticipantLookupDict[AssignedParticipants[participantType].ParticipantId];
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsFlagSet(StatusFlags flag)
|
private bool IsFlagSet(StatusFlags flag)
|
||||||
{
|
{
|
||||||
@ -248,7 +248,7 @@ namespace BreCalClient
|
|||||||
return (this.Shipcall.Flags & (int) flag) != 0;
|
return (this.Shipcall.Flags & (int) flag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user