コード例 #1
0
        /// <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_FromIOP_GetServiceAuthorisationResponse",

                                   new XElement("transactionId", TransactionId.ToString()),
                                   new XElement("authorisationValue", AuthorisationValue.AsNumber()),
                                   new XElement("partnerServiceSessionId", PartnerServiceSessionId.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);
        }
コード例 #2
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_FromIOP_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("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()),
                          new XElement("serviceSessionId",               ServiceSessionId.             ToString()),
                          new XElement("authorisationValue",             AuthorisationValue.           ToString()),
                          new XElement("intermediateCDRRequested",       IntermediateCDRRequested ? "1" : "0"),

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

                          MeterLimits.Any()
                              ? 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

                      );


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

        }
コード例 #3
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomGetServiceAuthorisationResponseSerializer">A delegate to serialize custom Heartbeat response JSON objects.</param>
        /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <GetServiceAuthorisationResponse> CustomGetServiceAuthorisationResponseSerializer = null,
                              CustomJObjectSerializerDelegate <MeterReport> CustomMeterReportSerializer = null)
        {
            var JSON = JSONObject.Create(

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

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

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

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

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

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

                new JProperty("parameter", Parameter),

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

                );


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