/// <summary>
        /// Compares two charge detail recordes for equality.
        /// </summary>
        /// <param name="ChargeDetailRecord">An charge detail record to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public Boolean Equals(ChargeDetailRecord ChargeDetailRecord)
        {
            if ((Object)ChargeDetailRecord == null)
            {
                return(false);
            }

            return(CDRNature.Equals(ChargeDetailRecord.CDRNature) &&
                   ServiceSessionId.Equals(ChargeDetailRecord.ServiceSessionId) &&
                   RequestedServiceId.Equals(ChargeDetailRecord.RequestedServiceId) &&
                   EVSEId.Equals(ChargeDetailRecord.EVSEId) &&
                   UserContractIdAlias.Equals(ChargeDetailRecord.UserContractIdAlias) &&
                   UserId.Equals(ChargeDetailRecord.UserId) &&
                   StartTime.Equals(ChargeDetailRecord.StartTime) &&
                   EndTime.Equals(ChargeDetailRecord.EndTime) &&
                   MeterReports.Equals(ChargeDetailRecord.MeterReports) &&

                   ((!ExecPartnerSessionId.HasValue && !ChargeDetailRecord.ExecPartnerSessionId.HasValue) ||
                    (ExecPartnerSessionId.HasValue && ChargeDetailRecord.ExecPartnerSessionId.HasValue && ExecPartnerSessionId.Value.Equals(ChargeDetailRecord.ExecPartnerSessionId.Value))) &&

                   ((!ExecPartnerOperatorId.HasValue && !ChargeDetailRecord.ExecPartnerOperatorId.HasValue) ||
                    (ExecPartnerOperatorId.HasValue && ChargeDetailRecord.ExecPartnerOperatorId.HasValue && ExecPartnerOperatorId.Value.Equals(ChargeDetailRecord.ExecPartnerOperatorId.Value))) &&

                   ((!SalesPartnerSessionId.HasValue && !ChargeDetailRecord.SalesPartnerSessionId.HasValue) ||
                    (SalesPartnerSessionId.HasValue && ChargeDetailRecord.SalesPartnerSessionId.HasValue && SalesPartnerSessionId.Value.Equals(ChargeDetailRecord.SalesPartnerSessionId.Value))) &&

                   ((!SalesPartnerOperatorId.HasValue && !ChargeDetailRecord.SalesPartnerOperatorId.HasValue) ||
                    (SalesPartnerOperatorId.HasValue && ChargeDetailRecord.SalesPartnerOperatorId.HasValue && SalesPartnerOperatorId.Value.Equals(ChargeDetailRecord.SalesPartnerOperatorId.Value))) &&

                   ((!PartnerProductId.HasValue && !ChargeDetailRecord.PartnerProductId.HasValue) ||
                    (PartnerProductId.HasValue && ChargeDetailRecord.PartnerProductId.HasValue && PartnerProductId.Value.Equals(ChargeDetailRecord.PartnerProductId.Value))));
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetSessionEventReportRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetSessionEventReportRequest> CustomSetSessionEventReportRequestSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_SetSessionEventReportRequest",

                                   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("serviceSessionId", ServiceSessionId.ToString()),

                                   SessionEvent.ToXML(),

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

                                   );


            return(CustomSetSessionEventReportRequestSerializer != null
                       ? CustomSetSessionEventReportRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(TransactionId.GetHashCode() * 19 ^
                       AuthorisationValue.GetHashCode() * 17 ^
                       ServiceSessionId.GetHashCode() * 13 ^
                       IntermediateCDRRequested.GetHashCode() * 11 ^
                       RequestStatus.GetHashCode() * 7 ^

                       (SalesPartnerOperatorId.HasValue
                            ? SalesPartnerOperatorId.GetHashCode() * 5
                            : 0) ^

                       (UserContractIdAlias.HasValue
                            ? UserContractIdAlias.GetHashCode() * 3
                            : 0) ^

                       // ToDo: Add MeterLimits.GetHashCode()!

                       (Parameter.IsNotNullOrEmpty()
                            ? Parameter.GetHashCode()
                            : 0));
            }
        }
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(CDRNature.GetHashCode() * 41 ^
                       ServiceSessionId.GetHashCode() * 37 ^
                       RequestedServiceId.GetHashCode() * 31 ^
                       EVSEId.GetHashCode() * 27 ^
                       UserContractIdAlias.GetHashCode() * 23 ^
                       UserId.GetHashCode() * 21 ^
                       StartTime.GetHashCode() * 19 ^
                       EndTime.GetHashCode() * 17 ^
                       MeterReports.GetHashCode() * 13 ^

                       (ExecPartnerSessionId.HasValue
                            ? ExecPartnerSessionId.GetHashCode() * 11
                            : 0) ^

                       (ExecPartnerOperatorId.HasValue
                            ? ExecPartnerOperatorId.GetHashCode() * 7
                            : 0) ^

                       (SalesPartnerSessionId.HasValue
                            ? SalesPartnerSessionId.GetHashCode() * 5
                            : 0) ^

                       (SalesPartnerOperatorId.HasValue
                            ? SalesPartnerOperatorId.GetHashCode() * 3
                            : 0) ^

                       (PartnerProductId.HasValue
                            ? PartnerProductId.GetHashCode()
                            : 0));
            }
        }
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="ChargeDetailRecord">An object to compare with.</param>
        public Int32 CompareTo(ChargeDetailRecord ChargeDetailRecord)
        {
            if ((Object)ChargeDetailRecord == null)
            {
                throw new ArgumentNullException(nameof(ChargeDetailRecord), "The given charge detail record must not be null!");
            }

            return(ServiceSessionId.CompareTo(ChargeDetailRecord.ServiceSessionId));
        }
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(TransactionId.GetHashCode() * 7 ^
                RequestStatus.GetHashCode() * 5 ^
                ServiceSessionId.GetHashCode() * 3 ^
                SessionActionId.GetHashCode());
     }
 }
        /// <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;

        }
            /// <summary>
            /// Compares two SetSessionEventReport responses for equality.
            /// </summary>
            /// <param name="SetSessionEventReportResponse">A SetSessionEventReport response to compare with.</param>
            /// <returns>True if both match; False otherwise.</returns>
            public override Boolean Equals(SetSessionEventReportResponse SetSessionEventReportResponse)
            {
                if (SetSessionEventReportResponse is null)
                {
                    return(false);
                }

                return(TransactionId.Equals(SetSessionEventReportResponse.TransactionId) &&
                       RequestStatus.Equals(SetSessionEventReportResponse.RequestStatus) &&
                       ServiceSessionId.Equals(SetSessionEventReportResponse.ServiceSessionId) &&
                       SessionActionId.Equals(SetSessionEventReportResponse.SessionActionId));
            }
Esempio n. 9
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(TransactionId.GetHashCode() * 7 ^
                       ServiceSessionId.GetHashCode() * 5 ^
                       RequestStatus.GetHashCode() * 3 ^

                       (SalesPartnerOperatorId.HasValue
                            ? SalesPartnerOperatorId.GetHashCode()
                            : 0));
            }
        }
Esempio n. 10
0
            /// <summary>
            /// Compares two SetChargeDetailRecord responses for equality.
            /// </summary>
            /// <param name="SetChargeDetailRecordResponse">A SetChargeDetailRecord response to compare with.</param>
            /// <returns>True if both match; False otherwise.</returns>
            public override Boolean Equals(SetChargeDetailRecordResponse SetChargeDetailRecordResponse)
            {
                if ((Object)SetChargeDetailRecordResponse == null)
                {
                    return(false);
                }

                return(TransactionId.Equals(SetChargeDetailRecordResponse.TransactionId) &&
                       ServiceSessionId.Equals(SetChargeDetailRecordResponse.ServiceSessionId) &&
                       RequestStatus.Equals(SetChargeDetailRecordResponse.RequestStatus) &&

                       ((!SalesPartnerOperatorId.HasValue && !SetChargeDetailRecordResponse.SalesPartnerOperatorId.HasValue) ||
                        (SalesPartnerOperatorId.HasValue && SetChargeDetailRecordResponse.SalesPartnerOperatorId.HasValue && SalesPartnerOperatorId.Value.Equals(SetChargeDetailRecordResponse.SalesPartnerOperatorId.Value))));
            }
            /// <summary>
            /// Compares two SetServiceAuthorisation responses for equality.
            /// </summary>
            /// <param name="SetServiceAuthorisationResponse">A SetServiceAuthorisation response to compare with.</param>
            /// <returns>True if both match; False otherwise.</returns>
            public override Boolean Equals(SetServiceAuthorisationResponse SetServiceAuthorisationResponse)
            {
                if (SetServiceAuthorisationResponse is null)
                {
                    return(false);
                }

                return(TransactionId.Equals(SetServiceAuthorisationResponse.TransactionId) &&
                       RequestStatus.Equals(SetServiceAuthorisationResponse.RequestStatus) &&
                       ServiceSessionId.Equals(SetServiceAuthorisationResponse.ServiceSessionId) &&

                       ((!ExecPartnerOperatorId.HasValue && !SetServiceAuthorisationResponse.ExecPartnerOperatorId.HasValue) ||
                        (ExecPartnerOperatorId.HasValue && SetServiceAuthorisationResponse.ExecPartnerOperatorId.HasValue && ExecPartnerOperatorId.Value.Equals(SetServiceAuthorisationResponse.ExecPartnerOperatorId.Value))));
            }
        /// <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_ToIOP_SetSessionEventReportResponse",

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

                                   );


            return(CustomSetSessionEventReportResponseSerializer != null
                       ? CustomSetSessionEventReportResponseSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return((TransactionId.HasValue
                            ? TransactionId.GetHashCode() * 13
                            : 0) ^

                       PartnerId.GetHashCode() * 11 ^
                       OperatorId.GetHashCode() * 7 ^
                       ServiceSessionId.GetHashCode() * 5 ^
                       SessionEvent.GetHashCode() * 3 ^

                       (ExecPartnerSessionId.HasValue
                            ? ExecPartnerSessionId.GetHashCode()
                            : 0));
            }
        }
        /// <summary>
        /// Compares two heartbeat requests for equality.
        /// </summary>
        /// <param name="SetSessionEventReportRequest">A heartbeat request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(SetSessionEventReportRequest SetSessionEventReportRequest)
        {
            if (SetSessionEventReportRequest is null)
            {
                return(false);
            }

            return(((!TransactionId.HasValue && !SetSessionEventReportRequest.TransactionId.HasValue) ||
                    (TransactionId.HasValue && SetSessionEventReportRequest.TransactionId.HasValue && TransactionId.Value.Equals(SetSessionEventReportRequest.TransactionId.Value))) &&

                   PartnerId.Equals(SetSessionEventReportRequest.PartnerId) &&
                   OperatorId.Equals(SetSessionEventReportRequest.OperatorId) &&
                   ServiceSessionId.Equals(SetSessionEventReportRequest.ServiceSessionId) &&
                   SessionEvent.Equals(SetSessionEventReportRequest.SessionEvent) &&

                   ((!ExecPartnerSessionId.HasValue && !SetSessionEventReportRequest.ExecPartnerSessionId.HasValue) ||
                    (ExecPartnerSessionId.HasValue && SetSessionEventReportRequest.ExecPartnerSessionId.HasValue && ExecPartnerSessionId.Equals(SetSessionEventReportRequest.ExecPartnerSessionId))));
        }
Esempio n. 15
0
        /// <summary>
        /// Compares two heartbeat requests for equality.
        /// </summary>
        /// <param name="SetSessionActionRequest">A heartbeat request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(SetSessionActionRequest SetSessionActionRequest)
        {
            if (SetSessionActionRequest is null)
            {
                return(false);
            }

            return(((!TransactionId.HasValue && !SetSessionActionRequest.TransactionId.HasValue) ||
                    (TransactionId.HasValue && SetSessionActionRequest.TransactionId.HasValue && TransactionId.Value.Equals(SetSessionActionRequest.TransactionId.Value))) &&

                   PartnerId.Equals(SetSessionActionRequest.PartnerId) &&
                   OperatorId.Equals(SetSessionActionRequest.OperatorId) &&
                   ServiceSessionId.Equals(SetSessionActionRequest.ServiceSessionId) &&
                   SessionAction.Equals(SetSessionActionRequest.SessionAction) &&

                   ((!SalePartnerSessionId.HasValue && !SetSessionActionRequest.SalePartnerSessionId.HasValue) ||
                    (SalePartnerSessionId.HasValue && SetSessionActionRequest.SalePartnerSessionId.HasValue && SalePartnerSessionId.Equals(SetSessionActionRequest.SalePartnerSessionId))));
        }
            /// <summary>
            /// Compares two GetServiceAuthorisation responses for equality.
            /// </summary>
            /// <param name="GetServiceAuthorisationResponse">A GetServiceAuthorisation response to compare with.</param>
            /// <returns>True if both match; False otherwise.</returns>
            public override Boolean Equals(GetServiceAuthorisationResponse GetServiceAuthorisationResponse)
            {
                if ((Object)GetServiceAuthorisationResponse == null)
                {
                    return(false);
                }

                return(TransactionId.Equals(GetServiceAuthorisationResponse.TransactionId) &&
                       AuthorisationValue.Equals(GetServiceAuthorisationResponse.AuthorisationValue) &&
                       ServiceSessionId.Equals(GetServiceAuthorisationResponse.ServiceSessionId) &&
                       IntermediateCDRRequested.Equals(GetServiceAuthorisationResponse.IntermediateCDRRequested) &&
                       RequestStatus.Equals(GetServiceAuthorisationResponse.RequestStatus) &&

                       ((!SalesPartnerOperatorId.HasValue && !GetServiceAuthorisationResponse.SalesPartnerOperatorId.HasValue) ||
                        (SalesPartnerOperatorId.HasValue && GetServiceAuthorisationResponse.SalesPartnerOperatorId.HasValue && SalesPartnerOperatorId.Value.Equals(GetServiceAuthorisationResponse.SalesPartnerOperatorId.Value))) &&

                       ((!UserContractIdAlias.HasValue && !GetServiceAuthorisationResponse.UserContractIdAlias.HasValue) ||
                        (UserContractIdAlias.HasValue && GetServiceAuthorisationResponse.UserContractIdAlias.HasValue && UserContractIdAlias.Value.Equals(GetServiceAuthorisationResponse.UserContractIdAlias.Value))));

                // ToDo: Compare MeterLimitLists!
            }
Esempio n. 17
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(TransactionId.GetHashCode() * 21 ^
                       PartnerId.GetHashCode() * 19 ^
                       OperatorId.GetHashCode() * 17 ^
                       TargetOperatorId.GetHashCode() * 13 ^
                       EVSEId.GetHashCode() * 11 ^
                       UserId.GetHashCode() * 7 ^
                       RequestedServiceId.GetHashCode() * 5 ^

                       (ServiceSessionId.HasValue
                            ? ServiceSessionId.GetHashCode() * 3
                            : 0) ^

                       (BookingId.HasValue
                            ? BookingId.GetHashCode()
                            : 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);
        }
        /// <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="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>
            /// Compares two charge detail record builder for equality.
            /// </summary>
            /// <param name="ChargeDetailRecordBuilder">A charge detail record builder to compare with.</param>
            /// <returns>True if both match; False otherwise.</returns>
            public Boolean Equals(Builder ChargeDetailRecordBuilder)
            {
                if (ChargeDetailRecordBuilder == null)
                {
                    return(false);
                }

                return(CDRNature.Equals(ChargeDetailRecordBuilder.CDRNature) &&
                       ServiceSessionId.Equals(ChargeDetailRecordBuilder.ServiceSessionId) &&
                       RequestedServiceId.Equals(ChargeDetailRecordBuilder.RequestedServiceId) &&
                       EVSEId.Equals(ChargeDetailRecordBuilder.EVSEId) &&
                       UserContractIdAlias.Equals(ChargeDetailRecordBuilder.UserContractIdAlias) &&
                       UserId.Equals(ChargeDetailRecordBuilder.UserId) &&
                       StartTime.Equals(ChargeDetailRecordBuilder.StartTime) &&
                       EndTime.Equals(ChargeDetailRecordBuilder.EndTime) &&

                       ExecPartnerSessionId.Equals(ChargeDetailRecordBuilder.ExecPartnerSessionId) &&
                       ExecPartnerOperatorId.Equals(ChargeDetailRecordBuilder.ExecPartnerOperatorId) &&
                       SalesPartnerSessionId.Equals(ChargeDetailRecordBuilder.SalesPartnerSessionId) &&
                       SalesPartnerOperatorId.Equals(ChargeDetailRecordBuilder.SalesPartnerOperatorId) &&
                       PartnerProductId.Equals(ChargeDetailRecordBuilder.PartnerProductId) &&
                       MeterReports.Equals(ChargeDetailRecordBuilder.MeterReports));
            }
        /// <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);
        }