diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs index d4a06ed..e9d4464 100644 --- a/misc/BreCalApi.cs +++ b/misc/BreCalApi.cs @@ -1,7 +1,7 @@ //---------------------- // -// Generated REST API Client Code Generator v1.8.4.0 on 04.10.2023 07:39:32 +// Generated REST API Client Code Generator v1.8.4.0 on 09.10.2023 17:46:55 // Using the tool OpenAPI Generator v7.0.0 // //---------------------- @@ -51,8 +51,7 @@ using System.Threading.Tasks; */ namespace BreCalClient.misc.Api { - -#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' /// /// Represents a collection of functions to interact with the API endpoints @@ -71,7 +70,7 @@ namespace BreCalClient.misc.Api /// Gets a list of all berths registered /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -89,7 +88,7 @@ namespace BreCalClient.misc.Api /// Returns a JWT session token and user data if successful /// /// - /// + /// /// /// Thrown when fails to make API call /// Login credentials @@ -109,7 +108,7 @@ namespace BreCalClient.misc.Api /// Gets a list of notifications pursuant to a specified participant and ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -129,7 +128,7 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -147,7 +146,7 @@ namespace BreCalClient.misc.Api /// Gets a list of ship calls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -165,7 +164,7 @@ namespace BreCalClient.misc.Api /// Create a new ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -184,7 +183,7 @@ namespace BreCalClient.misc.Api /// Updates a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -202,7 +201,7 @@ namespace BreCalClient.misc.Api /// gets a list of registered shipcalls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -220,7 +219,7 @@ namespace BreCalClient.misc.Api /// Delete a times entry for a ship call. /// /// - /// + /// /// /// Thrown when fails to make API call /// @@ -239,7 +238,7 @@ namespace BreCalClient.misc.Api /// Get all recorded times for a a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -258,7 +257,7 @@ namespace BreCalClient.misc.Api /// Create a new times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -277,7 +276,7 @@ namespace BreCalClient.misc.Api /// Update a times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -296,7 +295,7 @@ namespace BreCalClient.misc.Api /// Update user details (first/last name, phone, password) /// /// - /// + /// /// /// Thrown when fails to make API call /// User details @@ -315,7 +314,7 @@ namespace BreCalClient.misc.Api /// Gets a list of all berths registered /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -326,7 +325,7 @@ namespace BreCalClient.misc.Api /// Gets a list of all berths registered /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -337,7 +336,7 @@ namespace BreCalClient.misc.Api /// Returns a JWT session token and user data if successful /// /// - /// + /// /// /// Thrown when fails to make API call /// Login credentials @@ -349,7 +348,7 @@ namespace BreCalClient.misc.Api /// Returns a JWT session token and user data if successful /// /// - /// + /// /// /// Thrown when fails to make API call /// Login credentials @@ -361,7 +360,7 @@ namespace BreCalClient.misc.Api /// Gets a list of notifications pursuant to a specified participant and ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -374,7 +373,7 @@ namespace BreCalClient.misc.Api /// Gets a list of notifications pursuant to a specified participant and ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -387,7 +386,7 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -399,7 +398,7 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -411,7 +410,7 @@ namespace BreCalClient.misc.Api /// Gets a list of ship calls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -422,7 +421,7 @@ namespace BreCalClient.misc.Api /// Gets a list of ship calls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -433,7 +432,7 @@ namespace BreCalClient.misc.Api /// Create a new ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -445,7 +444,7 @@ namespace BreCalClient.misc.Api /// Create a new ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -457,7 +456,7 @@ namespace BreCalClient.misc.Api /// Updates a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -469,7 +468,7 @@ namespace BreCalClient.misc.Api /// Updates a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -481,7 +480,7 @@ namespace BreCalClient.misc.Api /// gets a list of registered shipcalls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -492,7 +491,7 @@ namespace BreCalClient.misc.Api /// gets a list of registered shipcalls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -503,7 +502,7 @@ namespace BreCalClient.misc.Api /// Delete a times entry for a ship call. /// /// - /// + /// /// /// Thrown when fails to make API call /// @@ -515,7 +514,7 @@ namespace BreCalClient.misc.Api /// Delete a times entry for a ship call. /// /// - /// + /// /// /// Thrown when fails to make API call /// @@ -527,7 +526,7 @@ namespace BreCalClient.misc.Api /// Get all recorded times for a a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -539,7 +538,7 @@ namespace BreCalClient.misc.Api /// Get all recorded times for a a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -551,7 +550,7 @@ namespace BreCalClient.misc.Api /// Create a new times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -563,7 +562,7 @@ namespace BreCalClient.misc.Api /// Create a new times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -575,7 +574,7 @@ namespace BreCalClient.misc.Api /// Update a times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -587,7 +586,7 @@ namespace BreCalClient.misc.Api /// Update a times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -599,7 +598,7 @@ namespace BreCalClient.misc.Api /// Update user details (first/last name, phone, password) /// /// - /// + /// /// /// Thrown when fails to make API call /// User details @@ -611,7 +610,7 @@ namespace BreCalClient.misc.Api /// Update user details (first/last name, phone, password) /// /// - /// + /// /// /// Thrown when fails to make API call /// User details @@ -725,7 +724,7 @@ namespace BreCalClient.misc.Api set { _exceptionFactory = value; } } /// - /// Gets a list of all berths registered + /// Gets a list of all berths registered /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -736,7 +735,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of all berths registered + /// Gets a list of all berths registered /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -780,7 +779,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of all berths registered + /// Gets a list of all berths registered /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -792,7 +791,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of all berths registered + /// Gets a list of all berths registered /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -837,7 +836,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Returns a JWT session token and user data if successful + /// Returns a JWT session token and user data if successful /// /// Thrown when fails to make API call /// Login credentials @@ -849,7 +848,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Returns a JWT session token and user data if successful + /// Returns a JWT session token and user data if successful /// /// Thrown when fails to make API call /// Login credentials @@ -901,7 +900,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Returns a JWT session token and user data if successful + /// Returns a JWT session token and user data if successful /// /// Thrown when fails to make API call /// Login credentials @@ -914,7 +913,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Returns a JWT session token and user data if successful + /// Returns a JWT session token and user data if successful /// /// Thrown when fails to make API call /// Login credentials @@ -967,7 +966,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of notifications pursuant to a specified participant and ship call + /// Gets a list of notifications pursuant to a specified participant and ship call /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -980,7 +979,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of notifications pursuant to a specified participant and ship call + /// Gets a list of notifications pursuant to a specified participant and ship call /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -1028,7 +1027,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of notifications pursuant to a specified participant and ship call + /// Gets a list of notifications pursuant to a specified participant and ship call /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -1042,7 +1041,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of notifications pursuant to a specified participant and ship call + /// Gets a list of notifications pursuant to a specified participant and ship call /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -1091,7 +1090,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// gets a particular participant entry corresponding to user id + /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -1103,7 +1102,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// gets a particular participant entry corresponding to user id + /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -1152,7 +1151,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// gets a particular participant entry corresponding to user id + /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -1165,7 +1164,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// gets a particular participant entry corresponding to user id + /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -1215,7 +1214,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of ship calls + /// Gets a list of ship calls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1226,7 +1225,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of ship calls + /// Gets a list of ship calls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1270,7 +1269,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of ship calls + /// Gets a list of ship calls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1282,7 +1281,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of ship calls + /// Gets a list of ship calls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1327,7 +1326,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Create a new ship call + /// Create a new ship call /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -1339,7 +1338,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Create a new ship call + /// Create a new ship call /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -1391,7 +1390,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Create a new ship call + /// Create a new ship call /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -1404,7 +1403,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Create a new ship call + /// Create a new ship call /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -1457,7 +1456,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Updates a ship call + /// Updates a ship call /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -1469,7 +1468,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Updates a ship call + /// Updates a ship call /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -1521,7 +1520,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Updates a ship call + /// Updates a ship call /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -1534,7 +1533,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Updates a ship call + /// Updates a ship call /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -1587,7 +1586,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// gets a list of registered shipcalls + /// gets a list of registered shipcalls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1598,7 +1597,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// gets a list of registered shipcalls + /// gets a list of registered shipcalls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1642,7 +1641,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// gets a list of registered shipcalls + /// gets a list of registered shipcalls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1654,7 +1653,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// gets a list of registered shipcalls + /// gets a list of registered shipcalls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1699,7 +1698,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Delete a times entry for a ship call. + /// Delete a times entry for a ship call. /// /// Thrown when fails to make API call /// @@ -1710,7 +1709,7 @@ namespace BreCalClient.misc.Api TimesDeleteWithHttpInfo(id); } /// - /// Delete a times entry for a ship call. + /// Delete a times entry for a ship call. /// /// Thrown when fails to make API call /// @@ -1756,7 +1755,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Delete a times entry for a ship call. + /// Delete a times entry for a ship call. /// /// Thrown when fails to make API call /// @@ -1768,7 +1767,7 @@ namespace BreCalClient.misc.Api await TimesDeleteWithHttpInfoAsync(id, operationIndex, cancellationToken).ConfigureAwait(false); } /// - /// Delete a times entry for a ship call. + /// Delete a times entry for a ship call. /// /// Thrown when fails to make API call /// @@ -1815,7 +1814,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Get all recorded times for a a ship call + /// Get all recorded times for a a ship call /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -1827,7 +1826,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Get all recorded times for a a ship call + /// Get all recorded times for a a ship call /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -1876,7 +1875,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Get all recorded times for a a ship call + /// Get all recorded times for a a ship call /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -1889,7 +1888,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Get all recorded times for a a ship call + /// Get all recorded times for a a ship call /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -1939,7 +1938,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Create a new times entry for a ship call + /// Create a new times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -1951,7 +1950,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Create a new times entry for a ship call + /// Create a new times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -2003,7 +2002,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Create a new times entry for a ship call + /// Create a new times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -2016,7 +2015,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Create a new times entry for a ship call + /// Create a new times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -2069,7 +2068,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Update a times entry for a ship call + /// Update a times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -2081,7 +2080,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Update a times entry for a ship call + /// Update a times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -2133,7 +2132,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Update a times entry for a ship call + /// Update a times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -2146,7 +2145,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Update a times entry for a ship call + /// Update a times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -2199,7 +2198,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Update user details (first/last name, phone, password) + /// Update user details (first/last name, phone, password) /// /// Thrown when fails to make API call /// User details @@ -2210,7 +2209,7 @@ namespace BreCalClient.misc.Api UserPutWithHttpInfo(userDetails); } /// - /// Update user details (first/last name, phone, password) + /// Update user details (first/last name, phone, password) /// /// Thrown when fails to make API call /// User details @@ -2262,7 +2261,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Update user details (first/last name, phone, password) + /// Update user details (first/last name, phone, password) /// /// Thrown when fails to make API call /// User details @@ -2274,7 +2273,7 @@ namespace BreCalClient.misc.Api await UserPutWithHttpInfoAsync(userDetails, operationIndex, cancellationToken).ConfigureAwait(false); } /// - /// Update user details (first/last name, phone, password) + /// Update user details (first/last name, phone, password) /// /// Thrown when fails to make API call /// User details @@ -3623,7 +3622,7 @@ namespace BreCalClient.misc.Client /// /// Gets or sets the base path for API access. /// - public virtual string BasePath + public virtual string BasePath { get { return _basePath; } set { _basePath = value; } @@ -3770,7 +3769,7 @@ namespace BreCalClient.misc.Client /// /// ApiKeyPrefix["Authorization"] = "Bearer"; /// - /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// � where ApiKey["Authorization"] would then be used to set the value of your bearer token. /// /// /// OAuth2 workflows should set tokens via AccessToken. @@ -4913,16 +4912,18 @@ namespace BreCalClient.misc.Model /// /// id. /// name. - /// participantId. + /// ownerId. + /// authorityId. /// varLock. /// created. /// modified. /// deleted (default to false). - public Berth(int id = default(int), string name = default(string), int? participantId = default(int?), bool? varLock = default(bool?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?), bool deleted = false) + public Berth(int id = default(int), string name = default(string), int? ownerId = default(int?), int? authorityId = default(int?), bool? varLock = default(bool?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?), bool deleted = false) { this.Id = id; this.Name = name; - this.ParticipantId = participantId; + this.OwnerId = ownerId; + this.AuthorityId = authorityId; this.VarLock = varLock; this.Created = created; this.Modified = modified; @@ -4939,10 +4940,15 @@ namespace BreCalClient.misc.Model [DataMember(Name = "name", EmitDefaultValue = true)] public string Name { get; set; } /// - /// Gets or Sets ParticipantId + /// Gets or Sets OwnerId /// - [DataMember(Name = "participant_id", EmitDefaultValue = true)] - public int? ParticipantId { get; set; } + [DataMember(Name = "owner_id", EmitDefaultValue = true)] + public int? OwnerId { get; set; } + /// + /// Gets or Sets AuthorityId + /// + [DataMember(Name = "authority_id", EmitDefaultValue = true)] + public int? AuthorityId { get; set; } /// /// Gets or Sets VarLock /// @@ -4973,7 +4979,8 @@ namespace BreCalClient.misc.Model sb.Append("class Berth {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n"); + sb.Append(" OwnerId: ").Append(OwnerId).Append("\n"); + sb.Append(" AuthorityId: ").Append(AuthorityId).Append("\n"); sb.Append(" VarLock: ").Append(VarLock).Append("\n"); sb.Append(" Created: ").Append(Created).Append("\n"); sb.Append(" Modified: ").Append(Modified).Append("\n"); @@ -5009,36 +5016,41 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.Name == input.Name || (this.Name != null && this.Name.Equals(input.Name)) - ) && + ) && ( - this.ParticipantId == input.ParticipantId || - (this.ParticipantId != null && - this.ParticipantId.Equals(input.ParticipantId)) - ) && + this.OwnerId == input.OwnerId || + (this.OwnerId != null && + this.OwnerId.Equals(input.OwnerId)) + ) && + ( + this.AuthorityId == input.AuthorityId || + (this.AuthorityId != null && + this.AuthorityId.Equals(input.AuthorityId)) + ) && ( this.VarLock == input.VarLock || (this.VarLock != null && this.VarLock.Equals(input.VarLock)) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && this.Modified.Equals(input.Modified)) - ) && + ) && ( this.Deleted == input.Deleted || this.Deleted.Equals(input.Deleted) @@ -5058,9 +5070,13 @@ namespace BreCalClient.misc.Model { hashCode = (hashCode * 59) + this.Name.GetHashCode(); } - if (this.ParticipantId != null) + if (this.OwnerId != null) { - hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + hashCode = (hashCode * 59) + this.OwnerId.GetHashCode(); + } + if (this.AuthorityId != null) + { + hashCode = (hashCode * 59) + this.AuthorityId.GetHashCode(); } if (this.VarLock != null) { @@ -5188,12 +5204,12 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Username == input.Username || (this.Username != null && this.Username.Equals(input.Username)) - ) && + ) && ( this.Password == input.Password || (this.Password != null && @@ -5313,7 +5329,7 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Message == input.Message || (this.Message != null && @@ -5418,7 +5434,7 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.VarId == input.VarId || this.VarId.Equals(input.VarId) @@ -5575,39 +5591,39 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.ParticipantId == input.ParticipantId || this.ParticipantId.Equals(input.ParticipantId) - ) && + ) && ( this.FirstName == input.FirstName || (this.FirstName != null && this.FirstName.Equals(input.FirstName)) - ) && + ) && ( this.LastName == input.LastName || (this.LastName != null && this.LastName.Equals(input.LastName)) - ) && + ) && ( this.UserName == input.UserName || (this.UserName != null && this.UserName.Equals(input.UserName)) - ) && + ) && ( this.UserPhone == input.UserPhone || (this.UserPhone != null && this.UserPhone.Equals(input.UserPhone)) - ) && + ) && ( this.Exp == input.Exp || this.Exp.Equals(input.Exp) - ) && + ) && ( this.Token == input.Token || (this.Token != null && @@ -5809,37 +5825,37 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.TimesId == input.TimesId || this.TimesId.Equals(input.TimesId) - ) && + ) && ( this.ParticipantId == input.ParticipantId || this.ParticipantId.Equals(input.ParticipantId) - ) && + ) && ( this.NotificationType == input.NotificationType || this.NotificationType.Equals(input.NotificationType) - ) && + ) && ( this.Timestamp == input.Timestamp || (this.Timestamp != null && this.Timestamp.Equals(input.Timestamp)) - ) && + ) && ( this.Acknowledged == input.Acknowledged || this.Acknowledged.Equals(input.Acknowledged) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && @@ -6029,50 +6045,50 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.Name == input.Name || (this.Name != null && this.Name.Equals(input.Name)) - ) && + ) && ( this.Street == input.Street || (this.Street != null && this.Street.Equals(input.Street)) - ) && + ) && ( this.PostalCode == input.PostalCode || (this.PostalCode != null && this.PostalCode.Equals(input.PostalCode)) - ) && + ) && ( this.City == input.City || (this.City != null && this.City.Equals(input.City)) - ) && + ) && ( this.Type == input.Type || this.Type.Equals(input.Type) - ) && + ) && ( this.Flags == input.Flags || (this.Flags != null && this.Flags.Equals(input.Flags)) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && this.Modified.Equals(input.Modified)) - ) && + ) && ( this.Deleted == input.Deleted || this.Deleted.Equals(input.Deleted) @@ -6153,6 +6169,125 @@ namespace BreCalClient.misc.Model } } +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 0.6.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.misc.Model +{ + /// + /// Participant assigned to a shipcall with a given role (type) + /// + [DataContract(Name = "participant_assignment")] + public partial class ParticipantAssignment : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ParticipantAssignment() { } + /// + /// Initializes a new instance of the class. + /// + /// participantId (required). + /// type (required). + public ParticipantAssignment(int participantId = default(int), int type = default(int)) + { + this.ParticipantId = participantId; + this.Type = type; + } + /// + /// Gets or Sets ParticipantId + /// + [DataMember(Name = "participant_id", IsRequired = true, EmitDefaultValue = true)] + public int ParticipantId { get; set; } + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public int Type { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ParticipantAssignment {\n"); + sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ParticipantAssignment); + } + /// + /// Returns true if ParticipantAssignment instances are equal + /// + /// Instance of ParticipantAssignment to be compared + /// Boolean + public bool Equals(ParticipantAssignment input) + { + if (input == null) + { + return false; + } + return + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + /* * Bremen calling API * @@ -6319,65 +6454,65 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.Name == input.Name || (this.Name != null && this.Name.Equals(input.Name)) - ) && + ) && ( this.Imo == input.Imo || (this.Imo != null && this.Imo.Equals(input.Imo)) - ) && + ) && ( this.Callsign == input.Callsign || (this.Callsign != null && this.Callsign.Equals(input.Callsign)) - ) && + ) && ( this.ParticipantId == input.ParticipantId || (this.ParticipantId != null && this.ParticipantId.Equals(input.ParticipantId)) - ) && + ) && ( this.Length == input.Length || (this.Length != null && this.Length.Equals(input.Length)) - ) && + ) && ( this.Width == input.Width || (this.Width != null && this.Width.Equals(input.Width)) - ) && + ) && ( this.IsTug == input.IsTug || this.IsTug.Equals(input.IsTug) - ) && + ) && ( this.BollardPull == input.BollardPull || (this.BollardPull != null && this.BollardPull.Equals(input.BollardPull)) - ) && + ) && ( this.Eni == input.Eni || (this.Eni != null && this.Eni.Equals(input.Eni)) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && this.Modified.Equals(input.Modified)) - ) && + ) && ( this.Deleted == input.Deleted || this.Deleted.Equals(input.Deleted) @@ -6513,11 +6648,16 @@ namespace BreCalClient.misc.Model /// participants. /// created. /// modified. - public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), int? evaluation = default(int?), string evaluationMessage = default(string), List participants = default(List), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) + public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime? eta = default(DateTime?), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), int? evaluation = default(int?), string evaluationMessage = default(string), List participants = default(List), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) { this.Id = id; this.ShipId = shipId; this.Type = type; + // to ensure "eta" is required (not null) + if (eta == null) + { + throw new ArgumentNullException("eta is a required property for Shipcall and cannot be null"); + } this.Eta = eta; this.Voyage = voyage; this.Etd = etd; @@ -6564,7 +6704,7 @@ namespace BreCalClient.misc.Model /// Gets or Sets Eta /// [DataMember(Name = "eta", IsRequired = true, EmitDefaultValue = true)] - public DateTime Eta { get; set; } + public DateTime? Eta { get; set; } /// /// Gets or Sets Voyage /// @@ -6673,9 +6813,8 @@ namespace BreCalClient.misc.Model /// /// Gets or Sets Participants /// - /// [1,5,7] [DataMember(Name = "participants", EmitDefaultValue = true)] - public List Participants { get; set; } + public List Participants { get; set; } /// /// Gets or Sets Created /// @@ -6753,140 +6892,140 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.ShipId == input.ShipId || this.ShipId.Equals(input.ShipId) - ) && + ) && ( this.Type == input.Type || this.Type.Equals(input.Type) - ) && + ) && ( this.Eta == input.Eta || (this.Eta != null && this.Eta.Equals(input.Eta)) - ) && + ) && ( this.Voyage == input.Voyage || (this.Voyage != null && this.Voyage.Equals(input.Voyage)) - ) && + ) && ( this.Etd == input.Etd || (this.Etd != null && this.Etd.Equals(input.Etd)) - ) && + ) && ( this.ArrivalBerthId == input.ArrivalBerthId || (this.ArrivalBerthId != null && this.ArrivalBerthId.Equals(input.ArrivalBerthId)) - ) && + ) && ( this.DepartureBerthId == input.DepartureBerthId || (this.DepartureBerthId != null && this.DepartureBerthId.Equals(input.DepartureBerthId)) - ) && + ) && ( this.TugRequired == input.TugRequired || (this.TugRequired != null && this.TugRequired.Equals(input.TugRequired)) - ) && + ) && ( this.PilotRequired == input.PilotRequired || (this.PilotRequired != null && this.PilotRequired.Equals(input.PilotRequired)) - ) && + ) && ( this.Flags == input.Flags || (this.Flags != null && this.Flags.Equals(input.Flags)) - ) && + ) && ( this.PierSide == input.PierSide || (this.PierSide != null && this.PierSide.Equals(input.PierSide)) - ) && + ) && ( this.Bunkering == input.Bunkering || (this.Bunkering != null && this.Bunkering.Equals(input.Bunkering)) - ) && + ) && ( this.ReplenishingTerminal == input.ReplenishingTerminal || (this.ReplenishingTerminal != null && this.ReplenishingTerminal.Equals(input.ReplenishingTerminal)) - ) && + ) && ( this.ReplenishingLock == input.ReplenishingLock || (this.ReplenishingLock != null && this.ReplenishingLock.Equals(input.ReplenishingLock)) - ) && + ) && ( this.Draft == input.Draft || (this.Draft != null && this.Draft.Equals(input.Draft)) - ) && + ) && ( this.TidalWindowFrom == input.TidalWindowFrom || (this.TidalWindowFrom != null && this.TidalWindowFrom.Equals(input.TidalWindowFrom)) - ) && + ) && ( this.TidalWindowTo == input.TidalWindowTo || (this.TidalWindowTo != null && this.TidalWindowTo.Equals(input.TidalWindowTo)) - ) && + ) && ( this.RainSensitiveCargo == input.RainSensitiveCargo || (this.RainSensitiveCargo != null && this.RainSensitiveCargo.Equals(input.RainSensitiveCargo)) - ) && + ) && ( this.RecommendedTugs == input.RecommendedTugs || (this.RecommendedTugs != null && this.RecommendedTugs.Equals(input.RecommendedTugs)) - ) && + ) && ( this.Anchored == input.Anchored || (this.Anchored != null && this.Anchored.Equals(input.Anchored)) - ) && + ) && ( this.MooredLock == input.MooredLock || (this.MooredLock != null && this.MooredLock.Equals(input.MooredLock)) - ) && + ) && ( this.Canceled == input.Canceled || (this.Canceled != null && this.Canceled.Equals(input.Canceled)) - ) && + ) && ( this.Evaluation == input.Evaluation || (this.Evaluation != null && this.Evaluation.Equals(input.Evaluation)) - ) && + ) && ( this.EvaluationMessage == input.EvaluationMessage || (this.EvaluationMessage != null && this.EvaluationMessage.Equals(input.EvaluationMessage)) - ) && + ) && ( this.Participants == input.Participants || this.Participants != null && input.Participants != null && this.Participants.SequenceEqual(input.Participants) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && @@ -7252,99 +7391,99 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.EtaBerth == input.EtaBerth || (this.EtaBerth != null && this.EtaBerth.Equals(input.EtaBerth)) - ) && + ) && ( this.EtaBerthFixed == input.EtaBerthFixed || (this.EtaBerthFixed != null && this.EtaBerthFixed.Equals(input.EtaBerthFixed)) - ) && + ) && ( this.EtdBerth == input.EtdBerth || (this.EtdBerth != null && this.EtdBerth.Equals(input.EtdBerth)) - ) && + ) && ( this.EtdBerthFixed == input.EtdBerthFixed || (this.EtdBerthFixed != null && this.EtdBerthFixed.Equals(input.EtdBerthFixed)) - ) && + ) && ( this.LockTime == input.LockTime || (this.LockTime != null && this.LockTime.Equals(input.LockTime)) - ) && + ) && ( this.LockTimeFixed == input.LockTimeFixed || (this.LockTimeFixed != null && this.LockTimeFixed.Equals(input.LockTimeFixed)) - ) && + ) && ( this.ZoneEntry == input.ZoneEntry || (this.ZoneEntry != null && this.ZoneEntry.Equals(input.ZoneEntry)) - ) && + ) && ( this.ZoneEntryFixed == input.ZoneEntryFixed || (this.ZoneEntryFixed != null && this.ZoneEntryFixed.Equals(input.ZoneEntryFixed)) - ) && + ) && ( this.OperationsStart == input.OperationsStart || (this.OperationsStart != null && this.OperationsStart.Equals(input.OperationsStart)) - ) && + ) && ( this.OperationsEnd == input.OperationsEnd || (this.OperationsEnd != null && this.OperationsEnd.Equals(input.OperationsEnd)) - ) && + ) && ( this.Remarks == input.Remarks || (this.Remarks != null && this.Remarks.Equals(input.Remarks)) - ) && + ) && ( this.ShipcallId == input.ShipcallId || this.ShipcallId.Equals(input.ShipcallId) - ) && + ) && ( this.ParticipantId == input.ParticipantId || this.ParticipantId.Equals(input.ParticipantId) - ) && + ) && ( this.BerthId == input.BerthId || (this.BerthId != null && this.BerthId.Equals(input.BerthId)) - ) && + ) && ( this.BerthInfo == input.BerthInfo || (this.BerthInfo != null && this.BerthInfo.Equals(input.BerthInfo)) - ) && + ) && ( this.PierSide == input.PierSide || (this.PierSide != null && this.PierSide.Equals(input.PierSide)) - ) && + ) && ( this.ParticipantType == input.ParticipantType || (this.ParticipantType != null && this.ParticipantType.Equals(input.ParticipantType)) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && @@ -7561,31 +7700,31 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.OldPassword == input.OldPassword || (this.OldPassword != null && this.OldPassword.Equals(input.OldPassword)) - ) && + ) && ( this.NewPassword == input.NewPassword || (this.NewPassword != null && this.NewPassword.Equals(input.NewPassword)) - ) && + ) && ( this.FirstName == input.FirstName || (this.FirstName != null && this.FirstName.Equals(input.FirstName)) - ) && + ) && ( this.LastName == input.LastName || (this.LastName != null && this.LastName.Equals(input.LastName)) - ) && + ) && ( this.UserPhone == input.UserPhone || (this.UserPhone != null && @@ -7635,8 +7774,6 @@ namespace BreCalClient.misc.Model yield break; } } - -#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } - diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml index 82a42e3..dedbede 100644 --- a/misc/BreCalApi.yaml +++ b/misc/BreCalApi.yaml @@ -332,6 +332,17 @@ components: shipcallId: description: The unique identifier of a ship call type: integer + participant_assignment: + description: Participant assigned to a shipcall with a given role (type) + type: object + required: + - participant_id + - type + properties: + participant_id: + type: integer + type: + type: integer shipcall: type: object required: @@ -350,6 +361,7 @@ components: eta: type: string format: date-time + nullable: true voyage: type: string maxLength: 16 @@ -421,8 +433,7 @@ components: participants: type: array items: - type: integer - example: [1, 5, 7] + $ref: "#/components/schemas/participant_assignment" created: type: string format: date-time diff --git a/misc/create_schema.sql b/misc/create_schema.sql index 5bdb3e8..adbe508 100644 --- a/misc/create_schema.sql +++ b/misc/create_schema.sql @@ -225,6 +225,7 @@ CREATE TABLE `shipcall_participant_map` ( `id` int NOT NULL AUTO_INCREMENT, `shipcall_id` int unsigned DEFAULT NULL, `participant_id` int unsigned DEFAULT NULL, + `type` int unsigned DEFAULT NULL COMMENT 'Type of participant role', `created` datetime DEFAULT CURRENT_TIMESTAMP, `modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), diff --git a/src/BreCalClient/BreCalClient.csproj b/src/BreCalClient/BreCalClient.csproj index 024ae43..e3eb0f7 100644 --- a/src/BreCalClient/BreCalClient.csproj +++ b/src/BreCalClient/BreCalClient.csproj @@ -8,8 +8,8 @@ True BreCalClient.App ..\..\misc\brecal.snk - 0.7.0.0 - 0.7.0.0 + 0.8.0.0 + 0.8.0.0 Bremen calling client A Windows WPF client for the Bremen calling API. containership.ico diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs index 3c9ef71..acc8fc0 100644 --- a/src/BreCalClient/EditShipcallControl.xaml.cs +++ b/src/BreCalClient/EditShipcallControl.xaml.cs @@ -1,6 +1,6 @@ // Copyright (c) 2023 schick Informatik // Description: Windows dialog to create / edit ship calls -// +// using BreCalClient.misc.Model; using System; @@ -26,11 +26,11 @@ namespace BreCalClient public ShipcallControlModel ShipcallModel { get; set; } = new (); - public Ship? SelectedShip { + public Ship? SelectedShip { get { return this.comboBoxShip.SelectedItem as Ship; - } + } } #endregion @@ -39,10 +39,10 @@ namespace BreCalClient private void Window_Loaded(object sender, RoutedEventArgs e) { - this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent; + this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent; this.comboBoxShip.ItemsSource = BreCalLists.Ships; - this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(Extensions.TypeEnum)); + this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(TypeEnum)); this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths; this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths; @@ -55,13 +55,13 @@ namespace BreCalClient private void buttonOK_Click(object sender, RoutedEventArgs e) { this.CopyToModel(); - this.DialogResult = true; + this.DialogResult = true; this.Close(); } private void buttonCancel_Click(object sender, RoutedEventArgs e) { - this.DialogResult= false; + this.DialogResult= false; this.Close(); } @@ -98,7 +98,7 @@ namespace BreCalClient { this.comboBoxAgency.SelectedIndex = -1; this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.AGENCY); - } + } private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e) { @@ -122,15 +122,23 @@ namespace BreCalClient this.datePickerETA.IsEnabled = true; this.datePickerETD.IsEnabled = false; this.datePickerETD.Value = null; + this.comboBoxDepartureBerth.SelectedIndex = -1; + this.comboBoxDepartureBerth.IsEnabled = false; + this.comboBoxArrivalBerth.IsEnabled = true; break; case TypeEnum.Outgoing: this.datePickerETA.IsEnabled = false; this.datePickerETD.IsEnabled = true; this.datePickerETA.Value = null; + this.comboBoxArrivalBerth.SelectedIndex = -1; + this.comboBoxArrivalBerth.IsEnabled = false; + this.comboBoxDepartureBerth.IsEnabled = true; break; case TypeEnum.Shifting: this.datePickerETA.IsEnabled = true; this.datePickerETD.IsEnabled = true; + this.comboBoxArrivalBerth.IsEnabled = true; + this.comboBoxDepartureBerth.IsEnabled = true; break; } } @@ -145,16 +153,16 @@ namespace BreCalClient if (this.ShipcallModel.Shipcall != null) { this.ShipcallModel.Shipcall.Type = (int)this.comboBoxCategories.SelectedItem; - this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now; - this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1); - + this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value; + this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value; + this.ShipcallModel.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id; this.ShipcallModel.Ship = (Ship)this.comboBoxShip.SelectedItem; this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null; this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null; - - - + + + // remove all and add selected participants this.ShipcallModel.Shipcall.Participants.Clear(); this.ShipcallModel.AssignedParticipants.Clear(); @@ -163,23 +171,42 @@ namespace BreCalClient participant = (Participant?)this.comboBoxAgency.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.AGENCY + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = pa; } - + // BSMD and port authority are always added - foreach (Participant p in BreCalLists.Participants) + + // get port authority from berth + + int? berthId = this.ShipcallModel.Shipcall.ArrivalBerthId; + if (berthId == null) berthId = this.ShipcallModel.Shipcall.DepartureBerthId; + if (berthId != null) { - if (p.Type == (int)Extensions.ParticipantType.PORT_ADMINISTRATION) + Berth? selectedBerth = BreCalLists.Berths.Find((x) => x.Id == berthId); + if (selectedBerth?.AuthorityId != null) { - this.ShipcallModel.Shipcall.Participants.Add(p.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PORT_ADMINISTRATION] = p; + if (BreCalLists.ParticipantLookupDict.ContainsKey(selectedBerth.AuthorityId.Value)) + { + ParticipantAssignment pab = new() + { + ParticipantId = selectedBerth.AuthorityId.Value, + Type = (int)ParticipantType.PORT_ADMINISTRATION + }; + this.ShipcallModel.AssignedParticipants[ParticipantType.PORT_ADMINISTRATION] = pab; + } } - if (p.Type == (int)Extensions.ParticipantType.BSMD) + + ParticipantAssignment pa = new() { - this.ShipcallModel.Shipcall.Participants.Add(p.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.BSMD] = p; - } + ParticipantId = App.Participant.Id, + Type = (int)ParticipantType.BSMD + }; + this.ShipcallModel.AssignedParticipants[ParticipantType.BSMD] = pa; } } } @@ -189,28 +216,31 @@ namespace BreCalClient if (this.ShipcallModel == null) return; if (this.ShipcallModel.Shipcall != null) { - this.comboBoxCategories.SelectedItem = (Extensions.TypeEnum)this.ShipcallModel.Shipcall.Type; + this.comboBoxCategories.SelectedItem = (TypeEnum)this.ShipcallModel.Shipcall.Type; if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue) this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta; // this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage; - this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd; + this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd; this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId; this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId; this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId; - - if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new(); - foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) + if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new(); + + if(this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) { - if (((List)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id; - } + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId)) + { + this.comboBoxAgency.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId; + } + } } } private void EnableControls() { - bool isBsmd = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD); - bool isAgency = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY); + bool isBsmd = App.Participant.IsTypeFlagSet(ParticipantType.BSMD); + bool isAgency = App.Participant.IsTypeFlagSet(ParticipantType.AGENCY); bool editRightGrantedForBSMD = false; @@ -223,7 +253,7 @@ namespace BreCalClient { if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD) && isBsmd) isAgency = true; - if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD)) + if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD)) editRightGrantedForBSMD = true; } } @@ -231,16 +261,16 @@ namespace BreCalClient this.comboBoxAgency.IsEnabled = isBsmd; this.comboBoxArrivalBerth.IsEnabled = isBsmd || isAgency; this.comboBoxCategories.IsEnabled = isBsmd; - this.comboBoxDepartureBerth.IsEnabled = isBsmd || isAgency; - this.comboBoxShip.IsEnabled = isBsmd; + this.comboBoxDepartureBerth.IsEnabled = isBsmd || isAgency; + this.comboBoxShip.IsEnabled = isBsmd; this.datePickerETA.IsEnabled = isAgency || isBsmd; this.datePickerETD.IsEnabled = isAgency; - + this.labelBSMDGranted.Visibility = editRightGrantedForBSMD ? Visibility.Visible : Visibility.Hidden; } #endregion - + } } diff --git a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs index 968923f..1efebed 100644 --- a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs +++ b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Windows; +using static BreCalClient.Extensions; namespace BreCalClient { @@ -43,6 +44,23 @@ namespace BreCalClient this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths; this.CopyToControls(); + + + Participant? p = null; + if(this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) + p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId); + + bool allowBSMD = false; + if (p != null) + { + allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD); + } + + bool enableControls = (this.Times.ParticipantId == App.Participant.Id) || + (App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD); + + this.EnableControls(enableControls); + } private void buttonOK_Click(object sender, RoutedEventArgs e) @@ -98,26 +116,42 @@ namespace BreCalClient Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant; + ParticipantAssignment participantAssignment = new() { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.MOORING + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment; } + participant = (Participant?)this.comboBoxPilot.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.PILOT + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment; } participant = (Participant?)this.comboBoxTerminal.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TERMINAL + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment; } participant = (Participant?)this.comboBoxTug.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TUG + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment; } } } @@ -152,32 +186,83 @@ namespace BreCalClient this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft; this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom; this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo; - this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled; + this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false; - this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored; - this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired; + this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored ?? false; + this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired ?? false; this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs; - this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired; + this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired ?? false; - this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock; + this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false; - this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering; - this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock; - this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal; + this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering ?? false; + this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock ?? false; + this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal ?? false; if(!string.IsNullOrEmpty(this.Times.Remarks)) - this.textBoxRemarks.Text = this.Times.Remarks; + this.textBoxRemarks.Text = this.Times.Remarks; - foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) - { - if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id; - if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id; - if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id; - if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id; + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId)) + { + this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId; + } } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId)) + { + this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId; + } + } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId)) + { + this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId; + } + } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId)) + { + this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId; + } + } + } } + private void EnableControls(bool isEnabled) + { + this.datePickerETA.IsEnabled = isEnabled; + this.comboBoxArrivalBerth.IsEnabled = isEnabled; + this.comboBoxPierside.IsEnabled = isEnabled; + this.textBoxBerthRemarks.IsEnabled = isEnabled; + this.doubleUpDownDraft.IsEnabled = isEnabled; + this.datePickerTidalWindowFrom.IsEnabled = isEnabled; + this.datePickerTidalWindowTo.IsEnabled = isEnabled; + this.checkBoxCanceled.IsEnabled = isEnabled; + + this.checkBoxAnchored.IsEnabled = isEnabled; + this.checkBoxTugRequired.IsEnabled = isEnabled; + this.comboBoxTug.IsEnabled = isEnabled; + this.integerUpDownRecommendedTugs.IsEnabled = isEnabled; + this.checkBoxPilotRequired.IsEnabled = isEnabled; + this.comboBoxPilot.IsEnabled = isEnabled; + this.comboBoxMooring.IsEnabled = isEnabled; + this.checkBoxMooredLock.IsEnabled = isEnabled; + this.comboBoxTerminal.IsEnabled = isEnabled; + this.checkBoxBunkering.IsEnabled = isEnabled; + this.checkBoxReplenishingTerminal.IsEnabled = isEnabled; + this.checkBoxReplenishingLock.IsEnabled = isEnabled; + this.textBoxRemarks.IsEnabled = isEnabled; + } + #endregion #region context menu handlers diff --git a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs index 17ccaf1..eca4860 100644 --- a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs +++ b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Windows; +using static BreCalClient.Extensions; namespace BreCalClient { @@ -44,6 +45,22 @@ namespace BreCalClient this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths; this.CopyToControls(); + + Participant? p = null; + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) + p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId); + + bool allowBSMD = false; + if (p != null) + { + allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD); + } + + bool enableControls = (this.Times.ParticipantId == App.Participant.Id) || + (App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD); + + this.EnableControls(enableControls); + } private void buttonOK_Click(object sender, RoutedEventArgs e) @@ -93,26 +110,42 @@ namespace BreCalClient Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.MOORING + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment; } participant = (Participant?)this.comboBoxPilot.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.PILOT + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment; } participant = (Participant?)this.comboBoxTerminal.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TERMINAL + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment; } participant = (Participant?)this.comboBoxTug.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TUG + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment; } } } @@ -147,27 +180,75 @@ namespace BreCalClient this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft; this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom; this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo; - this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled; + this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false; - this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired; + this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired ?? false; this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs; - this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired; + this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired ?? false; - this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock; - this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo; + this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false; + this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false; if(!string.IsNullOrEmpty(this.Times.Remarks)) this.textBoxRemarks.Text = this.Times.Remarks; - foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING)) { - if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id; - if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id; - if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id; - if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id; + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId)) + { + this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId; + } } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId)) + { + this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId; + } + } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId)) + { + this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId; + } + } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId)) + { + this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId; + } + } + } } + private void EnableControls(bool isEnabled) + { + this.datePickerETD.IsEnabled = isEnabled; + this.comboBoxDepartureBerth.IsEnabled = isEnabled; + this.comboBoxPierside.IsEnabled = isEnabled; + this.textBoxBerthRemarks.IsEnabled = isEnabled; + this.doubleUpDownDraft.IsEnabled = isEnabled; + this.datePickerTidalWindowFrom.IsEnabled = isEnabled; + this.datePickerTidalWindowTo.IsEnabled = isEnabled; + this.checkBoxCanceled.IsEnabled = isEnabled; + + this.checkBoxTugRequired.IsEnabled = isEnabled; + this.comboBoxTug.IsEnabled = isEnabled; + this.integerUpDownRecommendedTugs.IsEnabled = isEnabled; + this.checkBoxPilotRequired.IsEnabled = isEnabled; + this.comboBoxPilot.IsEnabled = isEnabled; + this.comboBoxMooring.IsEnabled = isEnabled; + this.checkBoxMooredLock.IsEnabled = isEnabled; + this.comboBoxTerminal.IsEnabled = isEnabled; + this.checkBoxRainsensitiveCargo.IsEnabled = isEnabled; + this.textBoxRemarks.IsEnabled = isEnabled; + } + #endregion #region context menu handlers diff --git a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs index eaf3478..93fdbfa 100644 --- a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs +++ b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Windows; +using static BreCalClient.Extensions; namespace BreCalClient { @@ -45,6 +46,22 @@ namespace BreCalClient this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths; this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths; this.CopyToControls(); + + Participant? p = null; + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) + p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId); + + bool allowBSMD = false; + if (p != null) + { + allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD); + } + + bool enableControls = (this.Times.ParticipantId == App.Participant.Id) || + (App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD); + + this.EnableControls(enableControls); + } private void buttonOK_Click(object sender, RoutedEventArgs e) @@ -98,26 +115,42 @@ namespace BreCalClient Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.MOORING + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = pa; } participant = (Participant?)this.comboBoxPilot.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.PILOT + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = pa; } participant = (Participant?)this.comboBoxTerminal.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TERMINAL + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = pa; } participant = (Participant?)this.comboBoxTug.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TUG + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = pa; } } } @@ -164,27 +197,76 @@ namespace BreCalClient this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft; this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom; this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo; - this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled; + this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false; - this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired; + this.checkBoxTugRequired.IsChecked = this.ShipcallModel.Shipcall.TugRequired ?? false; this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs; - this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired; + this.checkBoxPilotRequired.IsChecked = this.ShipcallModel.Shipcall.PilotRequired ?? false; - this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock; - this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo; + this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false; + this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false; if(!string.IsNullOrEmpty(this.Times.Remarks)) this.textBoxRemarks.Text = this.Times.Remarks; - foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING)) { - if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id; - if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id; - if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id; - if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id; + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId)) + { + this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId; + } + } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId)) + { + this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId; + } + } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId)) + { + this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId; + } + } + + if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG)) + { + if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId)) + { + this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId; + } } } } + private void EnableControls(bool isEnabled) + { + this.datePickerETD.IsEnabled = isEnabled; + this.comboBoxArrivalBerth.IsEnabled = isEnabled; + this.doubleUpDownDraft.IsEnabled = isEnabled; + this.datePickerTidalWindowFrom.IsEnabled = isEnabled; + this.datePickerTidalWindowTo.IsEnabled = isEnabled; + this.datePickerETA.IsEnabled = isEnabled; + this.comboBoxDepartureBerth.IsEnabled = isEnabled; + this.comboBoxPiersideArrival.IsEnabled = isEnabled; + this.textBoxBerthRemarksArrival.IsEnabled = isEnabled; + this.checkBoxCanceled.IsEnabled = isEnabled; + + this.checkBoxTugRequired.IsEnabled = isEnabled; + this.comboBoxTug.IsEnabled = isEnabled; + this.integerUpDownRecommendedTugs.IsEnabled = isEnabled; + this.checkBoxPilotRequired.IsEnabled = isEnabled; + this.comboBoxPilot.IsEnabled = isEnabled; + this.comboBoxMooring.IsEnabled = isEnabled; + this.checkBoxMooredLock.IsEnabled = isEnabled; + this.comboBoxTerminal.IsEnabled = isEnabled; + this.checkBoxRainsensitiveCargo.IsEnabled = isEnabled; + this.textBoxRemarks.IsEnabled = isEnabled; + } + #endregion #region context menu handlers diff --git a/src/BreCalClient/EditTimesControl.xaml.cs b/src/BreCalClient/EditTimesControl.xaml.cs index c15f1a1..94c26dc 100644 --- a/src/BreCalClient/EditTimesControl.xaml.cs +++ b/src/BreCalClient/EditTimesControl.xaml.cs @@ -36,26 +36,19 @@ namespace BreCalClient private void Window_Loaded(object sender, RoutedEventArgs e) { this.CopyToControls(); - // enable controls according to participant type - this.datePickerETABerth.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) || - App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) || - App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT) || - App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION) || - App.Participant.IsTypeFlagSet(Extensions.ParticipantType.TUG); + bool enableControls = this.Times.ParticipantId == App.Participant.Id; - - this.checkBoxEtaBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled; - this.datePickerETDBerth.IsEnabled = this.datePickerETABerth.IsEnabled; - this.checkBoxEtDBerthFixed.IsEnabled = this.datePickerETABerth.IsEnabled; + this.datePickerETABerth.IsEnabled = enableControls; + this.checkBoxEtaBerthFixed.IsEnabled = enableControls; + this.datePickerETDBerth.IsEnabled = enableControls; + this.checkBoxEtDBerthFixed.IsEnabled = enableControls; + this.datePickerLockTime.IsEnabled = enableControls; + this.checkBoxLockTimeFixed.IsEnabled = enableControls; + this.datePickerZoneEntry.IsEnabled = enableControls; + this.checkBoxZoneEntryFixed.IsEnabled = enableControls; + this.textBoxRemarks.IsEnabled = enableControls; + this.buttonOK.IsEnabled = enableControls; - this.datePickerLockTime.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) || - App.Participant.IsTypeFlagSet(Extensions.ParticipantType.MOORING) || - App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PORT_ADMINISTRATION); - this.checkBoxLockTimeFixed.IsEnabled = this.datePickerLockTime.IsEnabled; - - this.datePickerZoneEntry.IsEnabled = App.Participant.IsTypeFlagSet(Extensions.ParticipantType.AGENCY) || - App.Participant.IsTypeFlagSet(Extensions.ParticipantType.PILOT); - this.checkBoxZoneEntryFixed.IsEnabled = this.datePickerZoneEntry.IsEnabled; } private void buttonOK_Click(object sender, RoutedEventArgs e) diff --git a/src/BreCalClient/EditTimesTerminalControl.xaml.cs b/src/BreCalClient/EditTimesTerminalControl.xaml.cs index 1f626a1..3f2e939 100644 --- a/src/BreCalClient/EditTimesTerminalControl.xaml.cs +++ b/src/BreCalClient/EditTimesTerminalControl.xaml.cs @@ -29,6 +29,15 @@ namespace BreCalClient { this.comboBoxBerth.ItemsSource = BreCalLists.Berths; this.CopyToControls(); + + bool enableControls = this.Times.ParticipantId == App.Participant.Id; + this.datePickerOperationStart.IsEnabled = enableControls; + this.datePickerOperationEnd.IsEnabled = enableControls; + this.comboBoxBerth.IsEnabled = enableControls; + this.comboBoxPierside.IsEnabled = enableControls; + this.textBoxRemarks.IsEnabled = enableControls; + this.textBoxBerthRemarks.IsEnabled = enableControls; + this.buttonOK.IsEnabled = enableControls; } private void contextMenuItemClearOperationStart_Click(object sender, RoutedEventArgs e) diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index dc43dcc..3f7e095 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -16,6 +16,7 @@ using BreCalClient.misc.Client; using BreCalClient.misc.Model; using static BreCalClient.Extensions; +using System.Runtime.Serialization; namespace BreCalClient { @@ -172,6 +173,9 @@ namespace BreCalClient { this.UpdateUI(); + esc.ShipcallModel.Shipcall?.Participants.Clear(); + foreach (ParticipantAssignment pa in esc.ShipcallModel.AssignedParticipants.Values) + esc.ShipcallModel.Shipcall?.Participants.Add(pa); this._api.ShipcallsPost(esc.ShipcallModel.Shipcall); // save new ship call this.AddShipcall(esc.ShipcallModel); @@ -295,12 +299,17 @@ namespace BreCalClient })); } catch (Exception ex) - { + { this.Dispatcher.Invoke(new Action(() => { labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}"; labelStatusBar.Text = ex.Message; })); + + if (ex.Message.Contains("access", StringComparison.OrdinalIgnoreCase)) + { + this.RefreshToken(null); + } } if (shipcalls != null) @@ -365,7 +374,7 @@ namespace BreCalClient scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId]; if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0)) scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name; - scm.AssignParticipants(BreCalLists.Participants); + scm.AssignParticipants(); this.Dispatcher.Invoke(() => { @@ -390,7 +399,7 @@ namespace BreCalClient scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId]; if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0)) scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name; - scm.AssignParticipants(BreCalLists.Participants); + scm.AssignParticipants(); } private void RemoveShipcall(int shipcallId) @@ -485,8 +494,8 @@ namespace BreCalClient { if (x.Shipcall == null) return 0; if (y.Shipcall == null) return 0; - DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta : x.Shipcall.Etd ?? x.Shipcall.Eta; - DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta : y.Shipcall.Etd ?? y.Shipcall.Eta; + DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta ?? DateTime.Now : x.Shipcall.Etd ?? DateTime.Now; + DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta ?? DateTime.Now : y.Shipcall.Etd ?? DateTime.Now; return DateTime.Compare(xDate, yDate); }); break; @@ -533,6 +542,9 @@ namespace BreCalClient { try { + obj.ShipcallControlModel.Shipcall?.Participants.Clear(); + foreach(ParticipantAssignment pa in obj.ShipcallControlModel.AssignedParticipants.Values) + obj.ShipcallControlModel.Shipcall?.Participants.Add(pa); await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall); obj.RefreshData(); _refreshImmediately = true; @@ -548,8 +560,13 @@ namespace BreCalClient private async void Sc_EditTimesRequested(ShipcallControl obj, Times? times, Extensions.ParticipantType participantType) { + + if( obj.ShipcallControlModel == null) { return; } + if (!obj.ShipcallControlModel.AssignedParticipants.ContainsKey(participantType)) return; // no assigment means no dialog my friend + // show a dialog that lets the user create / update times for the given shipcall - IEditTimesControl etc = (participantType == ParticipantType.TERMINAL) ? new EditTimesTerminalControl() : new EditTimesControl(); + IEditTimesControl etc = (participantType == ParticipantType.TERMINAL) ? new EditTimesTerminalControl() : new EditTimesControl(); + bool wasEdit = false; if (times != null) @@ -557,6 +574,13 @@ namespace BreCalClient etc.Times = times; wasEdit = true; } + else + { + if(obj.ShipcallControlModel.AssignedParticipants[participantType].ParticipantId == App.Participant.Id) + { + etc.Times.ParticipantId = App.Participant.Id; // this is my record, so the Participant Id is set that allows editing + } + } // actually we should only do this on create but we have existing data etc.Times.ParticipantType = (int) participantType; @@ -620,7 +644,15 @@ namespace BreCalClient { try { - editControl.Times.ParticipantId = App.Participant.Id; + // always try to be the agent, even if we are BSMD + if (editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) + { + editControl.Times.ParticipantId = editControl.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId; + } + else + { + editControl.Times.ParticipantId = App.Participant.Id; + } if (wasEdit) { @@ -637,6 +669,9 @@ namespace BreCalClient sc.ShipcallControlModel?.Times.Add(editControl.Times); } + editControl.ShipcallModel.Shipcall?.Participants.Clear(); + foreach (ParticipantAssignment pa in editControl.ShipcallModel.AssignedParticipants.Values) + editControl.ShipcallModel.Shipcall?.Participants.Add(pa); await _api.ShipcallsPutAsync(editControl.ShipcallModel.Shipcall); _refreshImmediately = true; _tokenSource.Cancel(); diff --git a/src/BreCalClient/Properties/PublishProfiles/ClickOnceProfile.pubxml b/src/BreCalClient/Properties/PublishProfiles/ClickOnceProfile.pubxml index 2adac28..23f70dc 100644 --- a/src/BreCalClient/Properties/PublishProfiles/ClickOnceProfile.pubxml +++ b/src/BreCalClient/Properties/PublishProfiles/ClickOnceProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 0 - 0.7.0.0 + 0.8.0.0 False Release True diff --git a/src/BreCalClient/Properties/PublishProfiles/ClickOnceTestProfile.pubxml b/src/BreCalClient/Properties/PublishProfiles/ClickOnceTestProfile.pubxml index 3894b6b..3736de8 100644 --- a/src/BreCalClient/Properties/PublishProfiles/ClickOnceTestProfile.pubxml +++ b/src/BreCalClient/Properties/PublishProfiles/ClickOnceTestProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 0 - 0.7.0.0 + 0.8.0.0 False Debug True diff --git a/src/BreCalClient/ShipcallControl.xaml b/src/BreCalClient/ShipcallControl.xaml index 7f2d80c..2df6f15 100644 --- a/src/BreCalClient/ShipcallControl.xaml +++ b/src/BreCalClient/ShipcallControl.xaml @@ -35,7 +35,6 @@ - @@ -72,20 +71,15 @@ - + - + - - - - - - - + + @@ -101,138 +95,122 @@ HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="labelTug" PreviewMouseUp="labelTug_PreviewMouseUp"/>