/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomRFIDIdentificationSerializer">A delegate to serialize custom RFID identification JSON objects.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <RFIDIdentification> CustomRFIDIdentificationSerializer = null) { var JSON = JSONObject.Create( new JProperty("UID", UID.ToString()), new JProperty("RFID", RFIDType.AsString()), EVCOId.HasValue ? new JProperty("EvcoID", EVCOId.Value.ToString()) : null, PrintedNumber.IsNeitherNullNorEmpty() ? new JProperty("PrintedNumber", PrintedNumber) : null, ExpiryDate.HasValue ? new JProperty("ExpiryDate", ExpiryDate.Value.ToIso8601()) : null, CustomData?.HasValues == true ? new JProperty("CustomData", CustomData) : null ); return(CustomRFIDIdentificationSerializer != null ? CustomRFIDIdentificationSerializer(this, JSON) : JSON); }
/// <summary> /// Return a text-representation of this object. /// </summary> public override String ToString() => String.Concat(UID.ToString(), " (", RFIDType, ") ", PrintedNumber.IsNeitherNullNorEmpty() ? ", '" + PrintedNumber + "'" : "", EVCOId.HasValue ? ", ContractId: '" + EVCOId + "'" : "", ExpiryDate.HasValue ? ", expires: " + ExpiryDate : "");
/// <summary> /// Get the hashcode of this object. /// </summary> public override Int32 GetHashCode() { unchecked { return(EVCOId.GetHashCode() * 11 ^ RFIDType.GetHashCode() * 7 ^ (EVCOId.HasValue ? EVCOId.GetHashCode() * 5 : 0) ^ (PrintedNumber != null ? PrintedNumber.GetHashCode() * 3 : 0) ^ (EVCOId.HasValue ? EVCOId.GetHashCode() : 0)); } }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="XName">The XML name to use.</param> public XElement ToXML(XName XName = null) => new XElement(XName ?? OICPNS.CommonTypes + "RFIDIdentification", new XElement(OICPNS.CommonTypes + "UID", UID.ToString()), EVCOId.HasValue ? new XElement(OICPNS.CommonTypes + "EvcoID", EVCOId.ToString()) : null, new XElement(OICPNS.CommonTypes + "RFIDType", RFIDType.ToString()), PrintedNumber.IsNeitherNullNorEmpty() ? new XElement(OICPNS.CommonTypes + "PrintedNumber", PrintedNumber) : null, ExpiryDate.HasValue ? new XElement(OICPNS.CommonTypes + "ExpiryDate", ExpiryDate.ToString()) : null );