internal void SendReservationCanceled(DateTime Timestamp, Object Sender, ChargingReservation Reservation, ChargingReservationCancellationReason Reason) { OnReservationCanceled?.Invoke(Timestamp, Sender, Reservation, Reason); }
public static JObject ToJSON(this ChargingReservation ChargingReservation) { #region Initial checks if (ChargingReservation == null) { throw new ArgumentNullException(nameof(ChargingReservation), "The given charging reservation must not be null!"); } #endregion var TimeLeft = (UInt32)(ChargingReservation.StartTime + ChargingReservation.Duration - DateTime.UtcNow).TotalSeconds; return(JSONObject.Create( new JProperty("ReservationId", ChargingReservation.Id.ToString()), new JProperty("StartTime", ChargingReservation.StartTime.ToIso8601()), new JProperty("Duration", (UInt32)ChargingReservation.Duration.TotalSeconds), new JProperty("TimeLeft", TimeLeft > 0 ? TimeLeft : 0), new JProperty("Level", ChargingReservation.ReservationLevel.ToString()), ChargingReservation.ChargingPoolId != null ? new JProperty("ChargingPoolId", ChargingReservation.ChargingPoolId.ToString()) : null, ChargingReservation.ChargingStationId != null ? new JProperty("ChargingStationId", ChargingReservation.ChargingStationId.ToString()) : null, ChargingReservation.EVSEId != null ? new JProperty("EVSEId", ChargingReservation.EVSEId.ToString()) : null, (ChargingReservation.AuthTokens.Any() || ChargingReservation.eMAIds.Any() || ChargingReservation.PINs.Any()) ? new JProperty("AuthorizedIds", JSONObject.Create( ChargingReservation.AuthTokens.Any() ? new JProperty("AuthTokens", new JArray(ChargingReservation.AuthTokens.Select(v => v.ToString()))) : null, ChargingReservation.eMAIds.Any() ? new JProperty("eMAIds", new JArray(ChargingReservation.eMAIds.Select(v => v.ToString()))) : null, ChargingReservation.PINs.Any() ? new JProperty("PINs", new JArray(ChargingReservation.PINs.Select(v => v.ToString()))) : null )) : null )); }
public static JProperty ToJSON(this ChargingReservation ChargingReservation, String JPropertyKey) { #region Initial checks if (ChargingReservation == null) { throw new ArgumentNullException(nameof(ChargingReservation), "The given charging reservation must not be null!"); } if (JPropertyKey.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(JPropertyKey), "The given json property key must not be null or empty!"); } #endregion return(new JProperty(JPropertyKey, ChargingReservation.ToJSON())); }
internal void SendNewReservation(DateTime Timestamp, Object Sender, ChargingReservation Reservation) { OnNewReservation?.Invoke(Timestamp, Sender, Reservation); }
/// <summary> /// Return the charging reservation specified by the given identification. /// </summary> /// <param name="ReservationId">The charging reservation identification.</param> /// <param name="Reservation">The charging reservation.</param> public Boolean TryGetChargingReservationById(ChargingReservation_Id ReservationId, out ChargingReservation Reservation) => _Reservations.TryGetValue(ReservationId, out Reservation);
public bool TryGetChargingReservationById(ChargingReservation_Id ReservationId, out ChargingReservation ChargingReservation) { throw new NotImplementedException(); }