Beispiel #1
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetServiceAuthorisationRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetServiceAuthorisationRequest> CustomSetServiceAuthorisationRequestSerializer = null,
                              CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_SetServiceAuthorisationRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   new XElement("EVSEIdType", EVSEId.Format.AsText()),
                                   new XElement("EVSEId", EVSEId.ToString()),

                                   new XElement("userIdType", UserId.Format.AsText()),
                                   new XElement("userId", UserId.ToString()),

                                   new XElement("requestedServiceId", RequestedServiceId.ToString()),
                                   new XElement("authorisationValue", AuthorisationValue.ToString()),
                                   new XElement("intermediateCDRRequested", IntermediateCDRRequested ? "1" : "0"),

                                   PartnerServiceSessionId.HasValue
                              ? new XElement("serviceSessionId", PartnerServiceSessionId.ToString())
                              : null,

                                   UserContractIdAlias.HasValue
                              ? new XElement("userContractIdAlias", UserContractIdAlias.ToString())
                              : null,

                                   MeterLimits.SafeAny()
                              ? new XElement("meterLimitList", MeterLimits.Select(meterreport => meterreport.ToXML(CustomMeterReportSerializer: CustomMeterReportSerializer)))
                              : null,

                                   Parameter.IsNotNullOrEmpty()
                              ? new XElement("parameter", Parameter)
                              : null,

                                   BookingId.HasValue
                              ? new XElement("bookingId", BookingId.ToString())
                              : null,

                                   SalePartnerBookingId.HasValue
                              ? new XElement("salePartnerBookingId", SalePartnerBookingId.ToString())
                              : null

                                   );


            return(CustomSetServiceAuthorisationRequestSerializer != null
                       ? CustomSetServiceAuthorisationRequestSerializer(this, XML)
                       : XML);
        }
Beispiel #2
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomGetChargeDetailRecordsRequestSerializer">A delegate to customize the serialization of GetChargeDetailRecords requests.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <GetChargeDetailRecordsRequest> CustomGetChargeDetailRecordsRequestSerializer = null)
        {
            var XML = new XElement(OICPNS.Authorization + "eRoamingGetChargeDetailRecords",
                                   new XElement(OICPNS.Authorization + "ProviderID", ProviderId.ToString()),
                                   new XElement(OICPNS.Authorization + "From", From.ToIso8601()),
                                   new XElement(OICPNS.Authorization + "To", To.ToIso8601())
                                   );

            return(CustomGetChargeDetailRecordsRequestSerializer != null
                       ? CustomGetChargeDetailRecordsRequestSerializer(this, XML)
                       : XML);
        }
Beispiel #3
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomPullAuthenticationDataRequestSerializer">A delegate to customize the serialization of PullAuthenticationData requests.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <PullAuthenticationDataRequest> CustomPullAuthenticationDataRequestSerializer = null)
        {
            var XML = new XElement(OICPNS.AuthenticationData + "eRoamingPullAuthenticationData",

                                   new XElement(OICPNS.AuthenticationData + "OperatorID", OperatorId.ToString())

                                   );

            return(CustomPullAuthenticationDataRequestSerializer != null
                       ? CustomPullAuthenticationDataRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomMobileRemoteStopRequestSerializer">A delegate to serialize custom MobileRemoteStop XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <MobileRemoteStopRequest> CustomMobileRemoteStopRequestSerializer = null)
        {
            var XML = new XElement(OICPNS.MobileAuthorization + "eRoamingMobileRemoteStop",

                                   new XElement(OICPNS.MobileAuthorization + "SessionID", SessionId.ToString())

                                   );

            return(CustomMobileRemoteStopRequestSerializer != null
                       ? CustomMobileRemoteStopRequestSerializer(this, XML)
                       : XML);
        }
Beispiel #5
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="XName">The XML name to use.</param>
        /// <param name="CustomEVSEStatusRecordSerializer">A delegate to serialize custom EVSEStatusRecord XML elements.</param>
        public XElement ToXML(XName XName = null,
                              CustomXMLSerializerDelegate <EVSEStatusRecord> CustomEVSEStatusRecordSerializer = null)

        {
            var XML = new XElement(XName ?? OICPNS.EVSEStatus + "EvseStatusRecord",
                                   new XElement(OICPNS.EVSEStatus + "EvseID", Id.ToString()),
                                   new XElement(OICPNS.EVSEStatus + "EvseStatus", Status.AsString())
                                   );

            return(CustomEVSEStatusRecordSerializer != null
                       ? CustomEVSEStatusRecordSerializer(this, XML)
                       : XML);
        }
Beispiel #6
0
        /// <summary>
        /// Return a XML representation of this EVSE data record.
        /// </summary>
        /// <param name="XName">The XML name to use.</param>
        /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param>
        public XElement ToXML(XName XName = null,
                              CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null)
        {
            var XML = new XElement(XName ?? "meterReport",
                                   new XElement("meterTypeId", Type.Code),
                                   new XElement("meterValue", Value),
                                   new XElement("meterUnit", Unit)
                                   );

            return(CustomMeterReportSerializer != null
                       ? CustomMeterReportSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizationStopSerializer">A delegate to customize the serialization of AuthorizationStop respones.</param>
        /// <param name="CustomStatusCodeSerializer">A delegate to serialize custom StatusCode XML elements.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <MobileAuthorizationStart> CustomMobileAuthorizationStartSerializer = null,
                              CustomXMLSerializerDelegate <StatusCode> CustomStatusCodeSerializer = null,
                              CustomXMLSerializerDelegate <Address> CustomAddressSerializer       = null)

        {
            var XML = new XElement(OICPNS.MobileAuthorization + "eRoamingMobileAuthorizationStart",

                                   SessionId.HasValue
                              ? new XElement(OICPNS.MobileAuthorization + "SessionID", SessionId.ToString())
                              : null,

                                   new XElement(OICPNS.MobileAuthorization + "AuthorizationStatus", AuthorizationStatus.ToString()),

                                   StatusCode.HasValue
                              ? StatusCode.Value.ToXML(CustomStatusCodeSerializer: CustomStatusCodeSerializer)
                              : null,

                                   TermsOfUse.IsNeitherNullNorEmpty()
                              ? new XElement(OICPNS.MobileAuthorization + "TermsOfUse", TermsOfUse.FirstText())
                              : null,

                                   new XElement(OICPNS.EVSEData + "GeoCoordinates",
                                                new XElement(OICPNS.CommonTypes + "DecimalDegree",                                                                                // Force 0.00... (dot) format!
                                                             new XElement(OICPNS.CommonTypes + "Longitude", GeoCoordinates.Longitude.ToString("{0:0.######}").Replace(",", ".")), // CultureInfo.InvariantCulture.NumberFormat)),
                                                             new XElement(OICPNS.CommonTypes + "Latitude", GeoCoordinates.Latitude.ToString("{0:0.######}").Replace(",", "."))    // CultureInfo.InvariantCulture.NumberFormat))
                                                             )
                                                ),

                                   Address != null
                              ? Address.ToXML(OICPNS.MobileAuthorization + "Address",
                                              CustomAddressSerializer)
                              : null,

                                   AdditionalInfo.IsNeitherNullNorEmpty()
                              ? new XElement(OICPNS.MobileAuthorization + "AdditionalInfo", AdditionalInfo.FirstText())
                              : null,

                                   //AdditionalInfo.IsNotNullOrEmpty() && AdditionalInfo.Count() > 1
                                   //    ? new XElement(OICPNS.MobileAuthorization + "EnAdditionalInfo",      AdditionalInfo.FirstText())
                                   //    : null

                                   ChargingStationName.IsNeitherNullNorEmpty()
                              ? new XElement(OICPNS.MobileAuthorization + "ChargingStationName", ChargingStationName.FirstText())
                              : null

                                   );

            return(CustomMobileAuthorizationStartSerializer != null
                       ? CustomMobileAuthorizationStartSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomPullEVSEStatusByOperatorIdRequestSerializer">A delegate to serialize custom eRoamingPullEvseStatusByOperatorId XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <PullEVSEStatusByOperatorIdRequest> CustomPullEVSEStatusByOperatorIdRequestSerializer = null)
        {
            var XML = new XElement(OICPNS.EVSEStatus + "eRoamingPullEvseStatusByOperatorID",

                                   new XElement(OICPNS.EVSEStatus + "ProviderID", ProviderId.ToString()),

                                   OperatorIds.SafeSelect(evseid => new XElement(OICPNS.EVSEStatus + "OperatorID", evseid.ToString()))

                                   );

            return(CustomPullEVSEStatusByOperatorIdRequestSerializer != null
                       ? CustomPullEVSEStatusByOperatorIdRequestSerializer(this, XML)
                       : XML);
        }
Beispiel #9
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetSessionEventReportResponseSerializer">A delegate to serialize custom Heartbeat response XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetSessionEventReportResponse> CustomSetSessionEventReportResponseSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_FromIOP_SetSessionEventReportResponse",

                                   new XElement("transactionId", TransactionId.ToString()),
                                   new XElement("requestStatus", RequestStatus.ToString())

                                   );


            return(CustomSetSessionEventReportResponseSerializer != null
                       ? CustomSetSessionEventReportResponseSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetChargingConnectorAvailabilityStatusResponseSerializer">A delegate to serialize custom SetChargingConnectorAvailabilityStatus response XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetChargingConnectorAvailabilityStatusResponse> CustomSetChargingConnectorAvailabilityStatusResponseSerializer = null)
        {
            var XML = new XElement(eMIPNS.EVCIDynamic + "eMIP_ToIOP_SetChargingConnectorAvailabilityStatusResponse",

                                   new XElement(eMIPNS.EVCIDynamic + "transactionId", TransactionId.ToString()),
                                   new XElement(eMIPNS.EVCIDynamic + "requestStatus", RequestStatus.ToString())

                                   );


            return(CustomSetChargingConnectorAvailabilityStatusResponseSerializer != null
                       ? CustomSetChargingConnectorAvailabilityStatusResponseSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomPushAuthenticationDataRequestSerializer">A delegate to customize the serialization of PushAuthenticationDataRequest requests.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <PushAuthenticationDataRequest> CustomPushAuthenticationDataRequestSerializer = null)
        {
            var XML = new XElement(OICPNS.AuthenticationData + "eRoamingPushAuthenticationData",

                                   new XElement(OICPNS.AuthenticationData + "ActionType", OICPAction.AsString()),

                                   ProviderAuthenticationData.ToXML()


                                   );

            return(CustomPushAuthenticationDataRequestSerializer != null
                       ? CustomPushAuthenticationDataRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomHeartbeatResponseSerializer">A delegate to serialize custom Heartbeat response XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <HeartbeatResponse> CustomHeartbeatResponseSerializer = null)
        {
            var XML = new XElement(eMIPNS.Default + "eMIP_ToIOP_HeartbeatResponse",

                                   new XElement(eMIPNS.Default + "heartBeatPeriod", HeartbeatPeriod.TotalSeconds.ToString()),
                                   new XElement(eMIPNS.Default + "currentTime", CurrentTime.ToIso8601()),
                                   new XElement(eMIPNS.Default + "transactionId", TransactionId.ToString()),
                                   new XElement(eMIPNS.Default + "requestStatus", RequestStatus.ToString())

                                   );


            return(CustomHeartbeatResponseSerializer != null
                       ? CustomHeartbeatResponseSerializer(this, XML)
                       : XML);
        }
Beispiel #13
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetServiceAuthorisationResponseSerializer">A delegate to serialize custom Heartbeat response XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetServiceAuthorisationResponse> CustomSetServiceAuthorisationResponseSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_FromIOP_SetServiceAuthorisationResponse",

                                   new XElement("transactionId", TransactionId.ToString()),
                                   new XElement("requestStatus", RequestStatus.Code.ToString()),

                                   PartnerServiceSessionId.HasValue
                              ? new XElement("partnerServiceSessionId", PartnerServiceSessionId.ToString())
                              : null

                                   );


            return(CustomSetServiceAuthorisationResponseSerializer != null
                       ? CustomSetServiceAuthorisationResponseSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomGetChargeDetailRecordsResponseSerializer">A delegate to customize the serialization of GetChargeDetailRecords responses.</param>
        /// <param name="CustomChargeDetailRecordSerializer">A delegate to serialize custom ChargeDetailRecord XML elements.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <GetChargeDetailRecordsResponse> CustomGetChargeDetailRecordsResponseSerializer = null,
                              CustomXMLSerializerDelegate <ChargeDetailRecord> CustomChargeDetailRecordSerializer = null,
                              CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer         = null)

        {
            var XML = new XElement(OICPNS.Authorization + "eRoamingChargeDetailRecords",

                                   ChargeDetailRecords.SafeAny()
                                  ? ChargeDetailRecords.Select(cdr => cdr.ToXML(CustomChargeDetailRecordSerializer: CustomChargeDetailRecordSerializer,
                                                                                CustomIdentificationSerializer:     CustomIdentificationSerializer))
                                  : null

                                   );


            return(CustomGetChargeDetailRecordsResponseSerializer != null
                       ? CustomGetChargeDetailRecordsResponseSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom ProviderAuthenticationData XML elements.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <ProviderAuthenticationData> CustomProviderAuthenticationDataSerializer = null,
                              CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer = null)
        {
            var XML = new XElement(OICPNS.AuthenticationData + "ProviderAuthenticationData",

                                   new XElement(OICPNS.AuthenticationData + "ProviderID", ProviderId.ToString()),

                                   AuthorizationIdentifications.
                                   SafeSelect(AuthorizationIdentification => new XElement(
                                                  OICPNS.AuthenticationData + "AuthenticationDataRecord",
                                                  AuthorizationIdentification.ToXML(OICPNS.AuthenticationData + "Identification",
                                                                                    CustomIdentificationSerializer))
                                              )

                                   );

            return(CustomProviderAuthenticationDataSerializer != null
                       ? CustomProviderAuthenticationDataSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomHeartbeatRequestSerializer">A delegate to serialize custom Heartbeat request XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <HeartbeatRequest> CustomHeartbeatRequestSerializer = null)
        {
            var XML = new XElement(eMIPNS.Default + "eMIP_ToIOP_HeartBeatRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString())

                                   );


            return(CustomHeartbeatRequestSerializer != null
                       ? CustomHeartbeatRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomGetServiceAuthorisationResponseSerializer">A delegate to serialize custom Heartbeat response XML elements.</param>
        /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <GetServiceAuthorisationResponse> CustomGetServiceAuthorisationResponseSerializer = null,
                              CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_GetServiceAuthorisationResponse",

                                   new XElement("transactionId", TransactionId.ToString()),

                                   SalesPartnerOperatorId.HasValue
                              ? new XElement("salePartnerOperatorIdType", SalesPartnerOperatorId.Value.Format.AsText())
                              : null,

                                   SalesPartnerOperatorId.HasValue
                              ? new XElement("salePartnerOperatorId", SalesPartnerOperatorId.Value.ToString())
                              : null,

                                   new XElement("authorisationValue", AuthorisationValue.AsNumber()),
                                   new XElement("serviceSessionId", ServiceSessionId.ToString()),
                                   new XElement("intermediateCDRRequested", IntermediateCDRRequested ? "1" : "0"),

                                   UserContractIdAlias.HasValue
                              ? new XElement("userContractIdAlias", UserContractIdAlias.Value.ToString())
                              : null,

                                   MeterLimits.Any()
                              ? new XElement("meterLimitList",
                                             MeterLimits.Select(meterreport => meterreport.ToXML(CustomMeterReportSerializer: CustomMeterReportSerializer))
                                             )
                              : null,

                                   new XElement("parameter", Parameter),

                                   new XElement("requestStatus", RequestStatus.ToString())

                                   );


            return(CustomGetServiceAuthorisationResponseSerializer != null
                       ? CustomGetServiceAuthorisationResponseSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomPushEVSEStatusRequestSerializer">A delegate to customize the serialization of PushEVSEStatus requests.</param>
        /// <param name="OperatorEVSEStatusXName">The OperatorEVSEStatus XML name to use.</param>
        /// <param name="CustomOperatorEVSEStatusSerializer">A delegate to serialize custom OperatorEVSEStatus XML elements.</param>
        /// <param name="EVSEStatusRecordXName">The EVSEStatusRecord XML name to use.</param>
        /// <param name="CustomEVSEStatusRecordSerializer">A delegate to serialize custom EVSEStatusRecord XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <PushEVSEStatusRequest> CustomPushEVSEStatusRequestSerializer = null,
                              XName OperatorEVSEStatusXName = null,
                              CustomXMLSerializerDelegate <OperatorEVSEStatus> CustomOperatorEVSEStatusSerializer = null,
                              XName EVSEStatusRecordXName = null,
                              CustomXMLSerializerDelegate <EVSEStatusRecord> CustomEVSEStatusRecordSerializer = null)

        {
            var XML = new XElement(OICPNS.EVSEStatus + "eRoamingPushEvseStatus",

                                   new XElement(OICPNS.EVSEStatus + "ActionType", Action.AsString()),

                                   OperatorEVSEStatus.ToXML(OperatorEVSEStatusXName,
                                                            CustomOperatorEVSEStatusSerializer,
                                                            EVSEStatusRecordXName,
                                                            CustomEVSEStatusRecordSerializer)

                                   );

            return(CustomPushEVSEStatusRequestSerializer != null
                       ? CustomPushEVSEStatusRequestSerializer(this, XML)
                       : XML);
        }
Beispiel #19
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomEVSEStatusByIdSerializer">A delegate to serialize custom EVSEStatusById XML elements.</param>
        /// <param name="XName">The XML name to use.</param>
        /// <param name="EVSEStatusRecordXName">The EVSEStatusRecord XML name to use.</param>
        /// <param name="CustomEVSEStatusRecordSerializer">A delegate to serialize custom EVSEStatusRecord XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <EVSEStatusById> CustomEVSEStatusByIdSerializer = null,
                              XName XName = null,
                              XName EVSEStatusRecordXName = null,
                              CustomXMLSerializerDelegate <EVSEStatusRecord> CustomEVSEStatusRecordSerializer = null)

        {
            var XML = new XElement(XName ?? OICPNS.EVSEStatus + "eRoamingEvseStatusById",

                                   EVSEStatusRecords.Any()
                              ? EVSEStatusRecords.SafeSelect(record => record.ToXML(EVSEStatusRecordXName,
                                                                                    CustomEVSEStatusRecordSerializer))
                              : null,

                                   StatusCode?.ToXML(OICPNS.EVSEStatus + "StatusCode")

                                   );


            return(CustomEVSEStatusByIdSerializer != null
                       ? CustomEVSEStatusByIdSerializer(this, XML)
                       : XML);
        }
Beispiel #20
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomMobileAuthorizeStartRequestSerializer">A delegate to serialize custom MobileAuthorizeStart XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <MobileAuthorizeStartRequest> CustomMobileAuthorizeStartRequestSerializer = null)
        {
            var XML = new XElement(OICPNS.MobileAuthorization + "eRoamingMobileAuthorizeStart",

                                   new XElement(OICPNS.MobileAuthorization + "EvseID", EVSEId.ToString()),

                                   QRCodeIdentification.ToXML(OICPNS.MobileAuthorization + "QRCodeIdentification"),

                                   PartnerProductId.HasValue
                                          ? new XElement(OICPNS.MobileAuthorization + "PartnerProductID", PartnerProductId.ToString())
                                          : null,

                                   (GetNewSession.HasValue)
                                          ? new XElement(OICPNS.MobileAuthorization + "GetNewSession", GetNewSession.Value ? "true" : "false")
                                          : null

                                   );

            return(CustomMobileAuthorizeStartRequestSerializer != null
                       ? CustomMobileAuthorizeStartRequestSerializer(this, XML)
                       : XML);
        }
Beispiel #21
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomGetServiceAuthorisationRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <GetServiceAuthorisationRequest> CustomGetServiceAuthorisationRequestSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_FromIOP_GetServiceAuthorisationRequest",

                                   new XElement("transactionId", TransactionId.ToString()),

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   new XElement("targetOperatorIdType", TargetOperatorId.Format.AsText()),
                                   new XElement("targetOperatorId", TargetOperatorId.ToString()),

                                   new XElement("EVSEIdType", EVSEId.Format.AsText()),
                                   new XElement("EVSEId", EVSEId.ToString()),

                                   new XElement("userIdType", UserId.Format.AsText()),
                                   new XElement("userId", UserId.ToString()),

                                   new XElement("requestedServiceId", RequestedServiceId.ToString()),

                                   ServiceSessionId.HasValue
                              ? new XElement("serviceSessionId", ServiceSessionId.Value.ToString())
                              : null,

                                   BookingId.HasValue
                              ? new XElement("bookingId", BookingId.Value.ToString())
                              : null

                                   );


            return(CustomGetServiceAuthorisationRequestSerializer != null
                       ? CustomGetServiceAuthorisationRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeRemoteReservationStartRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteReservationStart requests.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <AuthorizeRemoteReservationStartRequest> CustomAuthorizeRemoteReservationStartRequestSerializer = null,
                              CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer = null)

        {
            var XML = new XElement(OICPNS.Reservation + "eRoamingAuthorizeRemoteReservationStart",

                                   SessionId.HasValue
                                           ? new XElement(OICPNS.Reservation + "SessionID", SessionId.ToString())
                                           : null,

                                   CPOPartnerSessionId.HasValue
                                           ? new XElement(OICPNS.Reservation + "CPOPartnerSessionID", CPOPartnerSessionId.ToString())
                                           : null,

                                   EMPPartnerSessionId.HasValue
                                           ? new XElement(OICPNS.Reservation + "EMPPartnerSessionID", EMPPartnerSessionId.ToString())
                                           : null,

                                   new XElement(OICPNS.Reservation + "ProviderID", ProviderId.ToString()),
                                   new XElement(OICPNS.Reservation + "EVSEID", EVSEId.ToString()),

                                   Identification.ToXML(OICPNS.Reservation + "Identification",
                                                        CustomIdentificationSerializer),

                                   PartnerProductId.HasValue
                                           ? new XElement(OICPNS.Reservation + "PartnerProductID", PartnerProductId.ToString())
                                           : null,

                                   Duration.HasValue
                                           ? new XElement(OICPNS.Reservation + "Duration", Convert.ToInt32(Math.Round(Duration.Value.TotalMinutes, 0)))
                                           : null

                                   );

            return(CustomAuthorizeRemoteReservationStartRequestSerializer != null
                       ? CustomAuthorizeRemoteReservationStartRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeRemoteStopRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteStop requests.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <AuthorizeRemoteStopRequest> CustomAuthorizeRemoteStopRequestSerializer = null)
        {
            var XML = new XElement(OICPNS.Authorization + "eRoamingAuthorizeRemoteStop",

                                   new XElement(OICPNS.Authorization + "SessionID", SessionId.ToString()),

                                   CPOPartnerSessionId.HasValue
                                          ? new XElement(OICPNS.Authorization + "CPOPartnerSessionID", CPOPartnerSessionId.ToString())
                                          : null,

                                   EMPPartnerSessionId.HasValue
                                          ? new XElement(OICPNS.Authorization + "EMPPartnerSessionID", EMPPartnerSessionId.ToString())
                                          : null,

                                   new XElement(OICPNS.Authorization + "ProviderID", ProviderId.ToString()),
                                   new XElement(OICPNS.Authorization + "EvseID", EVSEId.ToString())

                                   );

            return(CustomAuthorizeRemoteStopRequestSerializer != null
                       ? CustomAuthorizeRemoteStopRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="OperatorEVSEStatusXName">The OperatorEVSEStatus XML name to use.</param>
        /// <param name="CustomOperatorEVSEStatusSerializer">A delegate to serialize custom OperatorEVSEStatus XML elements.</param>
        /// <param name="EVSEStatusRecordXName">The EVSEStatusRecord XML name to use.</param>
        /// <param name="CustomEVSEStatusRecordSerializer">A delegate to serialize custom EVSEStatusRecord XML elements.</param>
        public XElement ToXML(XName OperatorEVSEStatusXName = null,
                              CustomXMLSerializerDelegate <OperatorEVSEStatus> CustomOperatorEVSEStatusSerializer = null,
                              XName EVSEStatusRecordXName = null,
                              CustomXMLSerializerDelegate <EVSEStatusRecord> CustomEVSEStatusRecordSerializer = null)

        {
            var xml = new XElement(OperatorEVSEStatusXName ?? OICPNS.EVSEStatus + "OperatorEvseStatus",

                                   new XElement(OICPNS.EVSEStatus + "OperatorID", OperatorId.ToString()),

                                   OperatorName.IsNotNullOrEmpty()
                              ? new XElement(OICPNS.EVSEStatus + "OperatorName", OperatorName)
                              : null,

                                   EVSEStatusRecords.Any()
                              ? EVSEStatusRecords.SafeSelect(evsestatusrecord => evsestatusrecord.ToXML(EVSEStatusRecordXName,
                                                                                                        CustomEVSEStatusRecordSerializer))
                              : null);

            return(CustomOperatorEVSEStatusSerializer != null
                       ? CustomOperatorEVSEStatusSerializer(this, xml)
                       : xml);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetServiceAuthorisationResponseSerializer">A delegate to serialize custom Heartbeat response XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetServiceAuthorisationResponse> CustomSetServiceAuthorisationResponseSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_SetServiceAuthorisationResponse",

                                   new XElement("transactionId", TransactionId.ToString()),
                                   new XElement("requestStatus", RequestStatus.Code.ToString()),
                                   new XElement("serviceSessionId", ServiceSessionId.ToString()),

                                   ExecPartnerOperatorId.HasValue
                              ? new XElement("execPartnerOperatorIdType", ExecPartnerOperatorId.Value.Format.AsText())
                              : null,

                                   ExecPartnerOperatorId.HasValue
                              ? new XElement("execPartnerOperatorId", ExecPartnerOperatorId.ToString())
                              : null

                                   );


            return(CustomSetServiceAuthorisationResponseSerializer != null
                       ? CustomSetServiceAuthorisationResponseSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomPushEVSEDataRequestSerializer">A delegate to customize the serialization of PushEVSEData requests.</param>
        /// <param name="OperatorEVSEDataXName">The OperatorEVSEData XML name to use.</param>
        /// <param name="CustomOperatorEVSEDataSerializer">A delegate to serialize custom OperatorEVSEData XML elements.</param>
        /// <param name="EVSEDataRecordXName">The EVSEDataRecord XML name to use.</param>
        /// <param name="IncludeEVSEDataRecordMetadata">Include EVSEDataRecord deltaType and lastUpdate meta data.</param>
        /// <param name="CustomEVSEDataRecordSerializer">A delegate to serialize custom EVSEDataRecord XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <PushEVSEDataRequest> CustomPushEVSEDataRequestSerializer = null,
                              XName OperatorEVSEDataXName = null,
                              CustomXMLSerializerDelegate <OperatorEVSEData> CustomOperatorEVSEDataSerializer = null,
                              XName EVSEDataRecordXName             = null,
                              Boolean IncludeEVSEDataRecordMetadata = true,
                              CustomXMLSerializerDelegate <EVSEDataRecord> CustomEVSEDataRecordSerializer = null)

        {
            var XML = new XElement(OICPNS.EVSEData + "eRoamingPushEvseData",

                                   new XElement(OICPNS.EVSEData + "ActionType", Action.AsString()),

                                   OperatorEVSEData.ToXML(OperatorEVSEDataXName,
                                                          CustomOperatorEVSEDataSerializer,
                                                          EVSEDataRecordXName,
                                                          IncludeEVSEDataRecordMetadata,
                                                          CustomEVSEDataRecordSerializer)

                                   );

            return(CustomPushEVSEDataRequestSerializer != null
                       ? CustomPushEVSEDataRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this EVSE data record.
        /// </summary>
        /// <param name="XName">The XML name to use.</param>
        /// <param name="CustomChargeDetailRecordSerializer">A delegate to serialize custom ChargeDetailRecord XML elements.</param>
        /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param>
        public XElement ToXML(XName XName = null,
                              CustomXMLSerializerDelegate <ChargeDetailRecord> CustomChargeDetailRecordSerializer = null,
                              CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null)
        {
            var XML = new XElement(XName ?? "chargeDetailRecord",

                                   new XElement("CDRNature", CDRNature.AsText()),
                                   new XElement("serviceSessionId", ServiceSessionId.ToString()),

                                   ExecPartnerSessionId.HasValue
                              ? new XElement("execPartnerSessionId", ExecPartnerSessionId.Value.ToString())
                              : null,

                                   ExecPartnerOperatorId.HasValue
                              ? new XElement("execPartnerOperatorIdType", ExecPartnerOperatorId.Value.Format.AsText())
                              : null,

                                   ExecPartnerOperatorId.HasValue
                              ? new XElement("execPartnerOperatorId", ExecPartnerOperatorId.Value.ToString())
                              : null,


                                   SalesPartnerSessionId.HasValue
                              ? new XElement("execPartnerSessionId", ExecPartnerSessionId.Value.ToString())
                              : null,

                                   SalesPartnerOperatorId.HasValue
                              ? new XElement("execPartnerOperatorIdType", ExecPartnerOperatorId.Value.Format.AsText())
                              : null,

                                   SalesPartnerOperatorId.HasValue
                              ? new XElement("execPartnerOperatorId", ExecPartnerOperatorId.Value.ToString())
                              : null,


                                   new XElement("requestedServiceId", RequestedServiceId.ToString()),

                                   new XElement("EVSEIdType", EVSEId.Format.AsText()),
                                   new XElement("EVSEId", EVSEId.ToString()),

                                   new XElement("userContractIdAlias", UserContractIdAlias.ToString()),

                                   new XElement("userIdType", UserId.Format.AsText()),
                                   new XElement("userId", UserId.ToString()),

                                   PartnerProductId.HasValue
                              ? new XElement("partnerProductId", PartnerProductId.Value.ToString())
                              : null,

                                   new XElement("startTime", StartTime.ToIso8601(false)),
                                   new XElement("endTime", EndTime.ToIso8601(false)),

                                   new XElement("meterReportList",
                                                MeterReports.Any()
                                  ? MeterReports.Select(meterreport => meterreport.ToXML(CustomMeterReportSerializer: CustomMeterReportSerializer))
                                  : null
                                                )

                                   );

            return(CustomChargeDetailRecordSerializer != null
                       ? CustomChargeDetailRecordSerializer(this, XML)
                       : XML);
        }