Example #1
0
        /// <summary>
        /// Return a text representation of this object.
        /// </summary>
        public override String ToString()

        => String.Concat(ConnectorId, " / ",
                         ExpiryDate.ToIso8601(), " / ",
                         IdTag,
                         ParentIdTag.HasValue ? "/" + ParentIdTag.Value : "",
                         " (", ReservationId, ")");
Example #2
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        public XElement ToXML()

        => new XElement(OCPPNS.OCPPv1_6_CP + "reserveNowRequest",

                        new XElement(OCPPNS.OCPPv1_6_CP + "connectorId", ConnectorId.ToString()),
                        new XElement(OCPPNS.OCPPv1_6_CP + "expiryDate", ExpiryDate.ToIso8601()),
                        new XElement(OCPPNS.OCPPv1_6_CP + "idTag", IdTag.ToString()),

                        ParentIdTag.HasValue
                       ? new XElement(OCPPNS.OCPPv1_6_CP + "parentIdTag", ParentIdTag.Value.ToString())
                       : null,

                        new XElement(OCPPNS.OCPPv1_6_CP + "reservationId", ReservationId.ToString())

                        );
Example #3
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomReserveNowRequestSerializer">A delegate to serialize custom reserve now requests.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <ReserveNowRequest> CustomReserveNowRequestSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("connectorId", ConnectorId.ToString()),
                new JProperty("expiryDate", ExpiryDate.ToIso8601()),
                new JProperty("idTag", IdTag.ToString()),
                new JProperty("reservationId", ReservationId.ToString()),

                ParentIdTag.HasValue
                               ? new JProperty("parentIdTag", ParentIdTag.Value.ToString())
                               : null

                );

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