/// <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);
        }
Пример #2
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeStartRequestSerializer">A delegate to customize the serialization of AuthorizeStart requests.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <AuthorizeStartRequest> CustomAuthorizeStartRequestSerializer = null,
                              CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer = null)
        {
            var XML = new XElement(OICPNS.Authorization + "eRoamingAuthorizeStart",

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

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

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

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

                                   EVSEId.HasValue
                                           ? new XElement(OICPNS.Authorization + "EvseID", EVSEId.ToString())
                                           : null,

                                   Identification.ToXML(CustomIdentificationSerializer: CustomIdentificationSerializer),

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

                                   );

            return(CustomAuthorizeStartRequestSerializer != null
                       ? CustomAuthorizeStartRequestSerializer(this, XML)
                       : XML);
        }
Пример #3
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);
        }