コード例 #1
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomChargingErrorNotificationRequestSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON elements.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingErrorNotificationRequest> CustomChargingErrorNotificationRequestSerializer = null,
                              CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null)
        {
            var JSON = JSONObject.Create(
                new JProperty("Type", Type.AsString()),
                new JProperty("SessionID", SessionId.ToString()),
                new JProperty("EvseID", EVSEId.ToString()),
                new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer: CustomIdentificationSerializer)),
                new JProperty("ErrorType", ErrorType.AsString()),

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

                ErrorAdditionalInfo.IsNotNullOrEmpty()
                               ? new JProperty("ErrorAdditionalInfo", ErrorAdditionalInfo)
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomChargingErrorNotificationRequestSerializer != null
                       ? CustomChargingErrorNotificationRequestSerializer(this, JSON)
                       : JSON);
        }
コード例 #2
0
        /// <summary>
        /// Return a JSON-representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeStopRequestSerializer">A delegate to customize the serialization of AuthorizeStopRequest responses.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeStopRequest> CustomAuthorizeStopRequestSerializer = null,
                              CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer             = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("OperatorID", OperatorId.ToString()),
                new JProperty("SessionID", SessionId.ToString()),
                new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer)),

                EVSEId.HasValue
                               ? new JProperty("EvseID", EVSEId.Value.ToString())
                               : null,

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomAuthorizeStopRequestSerializer != null
                       ? CustomAuthorizeStopRequestSerializer(this, JSON)
                       : JSON);
        }
コード例 #3
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomChargingStartNotificationRequestSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON elements.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingStartNotificationRequest> CustomChargingStartNotificationRequestSerializer = null,
                              CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null)
        {
            var JSON = JSONObject.Create(
                new JProperty("Type", Type.AsString()),
                new JProperty("SessionID", SessionId.ToString()),
                new JProperty("EvseID", EVSEId.ToString()),
                new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer: CustomIdentificationSerializer)),
                new JProperty("ChargingStart", ChargingStart.ToIso8601()),

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

                SessionStart.HasValue
                               ? new JProperty("SessionStart", SessionStart.Value.ToIso8601())
                               : null,

                MeterValueStart.HasValue
                               ? new JProperty("MeterValueStart", String.Format("{0:0.###}", MeterValueStart.Value).Replace(",", "."))
                               : null,

                OperatorId.HasValue
                               ? new JProperty("OperatorID", OperatorId.Value.ToString())
                               : null,

                PartnerProductId.HasValue
                               ? new JProperty("PartnerProductID", PartnerProductId.Value.ToString())
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomChargingStartNotificationRequestSerializer != null
                       ? CustomChargingStartNotificationRequestSerializer(this, JSON)
                       : JSON);
        }
        /// <summary>
        /// Return a JSON-representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeRemoteReservationStartRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteReservationStartRequest responses.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeRemoteReservationStartRequest> CustomAuthorizeRemoteReservationStartRequestSerializer = null,
                              CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("ProviderID", ProviderId.ToString()),
                new JProperty("EvseID", EVSEId.ToString()),
                new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer)),

                SessionId.HasValue
                               ? new JProperty("SessionID", SessionId.Value.ToString())
                               : null,

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

                PartnerProductId.HasValue
                               ? new JProperty("PartnerProductID", PartnerProductId.Value.ToString())
                               : null,

                Duration.HasValue
                               ? new JProperty("Duration", (Int32)Duration.Value.TotalMinutes)
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomAuthorizeRemoteReservationStartRequestSerializer != null
                       ? CustomAuthorizeRemoteReservationStartRequestSerializer(this, JSON)
                       : JSON);
        }
コード例 #5
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomChargingProgressNotificationRequestSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON elements.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingProgressNotificationRequest> CustomChargingProgressNotificationRequestSerializer = null,
                              CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null)
        {
            var JSON = JSONObject.Create(
                new JProperty("Type", Type.AsString()),
                new JProperty("SessionID", SessionId.ToString()),
                new JProperty("EvseID", EVSEId.ToString()),
                new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer: CustomIdentificationSerializer)),
                new JProperty("ChargingStart", ChargingStart.ToIso8601()),
                new JProperty("EventOcurred", EventOcurred.ToIso8601()),

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

                ChargingDuration.HasValue
                               ? new JProperty("ChargingDuration", Convert.ToUInt64(ChargingDuration.Value.TotalMilliseconds))
                               : null,

                SessionStart.HasValue
                               ? new JProperty("SessionStart", SessionStart.Value.ToIso8601())
                               : null,

                ConsumedEnergyProgress.HasValue
                               ? new JProperty("ConsumedEnergyProgress", String.Format("{0:0.###}", ConsumedEnergyProgress.Value).Replace(",", "."))
                               : null,

                MeterValueStart.HasValue
                               ? new JProperty("MeterValueStart", String.Format("{0:0.###}", MeterValueStart.Value).Replace(",", "."))
                               : null,

                MeterValuesInBetween.SafeAny()
                               ? new JProperty("MeterValueInBetween",
                                               new JObject( // OICP is crazy!
                                                   new JProperty("meterValues", new JArray(MeterValuesInBetween.
                                                                                           Select(meterValue => String.Format("{0:0.###}", meterValue).Replace(",", ".")))
                                                                 )
                                                   )
                                               )
                               : null,

                OperatorId.HasValue
                               ? new JProperty("OperatorID", OperatorId.Value.ToString())
                               : null,

                PartnerProductId.HasValue
                               ? new JProperty("PartnerProductID", PartnerProductId.Value.ToString())
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomChargingProgressNotificationRequestSerializer != null
                       ? CustomChargingProgressNotificationRequestSerializer(this, JSON)
                       : JSON);
        }