/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(AuthorizationStatus.GetHashCode() * 23 ^ GeoCoordinates.GetHashCode() * 19 ^ (ChargingStationName != null ? ChargingStationName.GetHashCode() * 17 : 0) ^ (Address != null ? Address.GetHashCode() * 13 : 0) ^ (SessionId.HasValue ? SessionId.Value.GetHashCode() * 11 : 0) ^ (StatusCode != null ? StatusCode.GetHashCode() * 7 : 0) ^ (TermsOfUse != null ? TermsOfUse.GetHashCode() * 5 : 0) ^ (AdditionalInfo != null ? AdditionalInfo.GetHashCode() * 3 : 0)); } }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomAuthorizationStopSerializer">A delegate to customize the serialization of AuthorizationStop respones.</param> /// <param name="CustomStatusCodeSerializer">A delegate to serialize custom StatusCode XML elements.</param> /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param> public XElement ToXML(CustomXMLSerializerDelegate <MobileAuthorizationStart> CustomMobileAuthorizationStartSerializer = null, CustomXMLSerializerDelegate <StatusCode> CustomStatusCodeSerializer = null, CustomXMLSerializerDelegate <Address> CustomAddressSerializer = null) { var XML = new XElement(OICPNS.MobileAuthorization + "eRoamingMobileAuthorizationStart", SessionId.HasValue ? new XElement(OICPNS.MobileAuthorization + "SessionID", SessionId.ToString()) : null, new XElement(OICPNS.MobileAuthorization + "AuthorizationStatus", AuthorizationStatus.ToString()), StatusCode.HasValue ? StatusCode.Value.ToXML(CustomStatusCodeSerializer: CustomStatusCodeSerializer) : null, TermsOfUse.IsNeitherNullNorEmpty() ? new XElement(OICPNS.MobileAuthorization + "TermsOfUse", TermsOfUse.FirstText()) : null, new XElement(OICPNS.EVSEData + "GeoCoordinates", new XElement(OICPNS.CommonTypes + "DecimalDegree", // Force 0.00... (dot) format! new XElement(OICPNS.CommonTypes + "Longitude", GeoCoordinates.Longitude.ToString("{0:0.######}").Replace(",", ".")), // CultureInfo.InvariantCulture.NumberFormat)), new XElement(OICPNS.CommonTypes + "Latitude", GeoCoordinates.Latitude.ToString("{0:0.######}").Replace(",", ".")) // CultureInfo.InvariantCulture.NumberFormat)) ) ), Address != null ? Address.ToXML(OICPNS.MobileAuthorization + "Address", CustomAddressSerializer) : null, AdditionalInfo.IsNeitherNullNorEmpty() ? new XElement(OICPNS.MobileAuthorization + "AdditionalInfo", AdditionalInfo.FirstText()) : null, //AdditionalInfo.IsNotNullOrEmpty() && AdditionalInfo.Count() > 1 // ? new XElement(OICPNS.MobileAuthorization + "EnAdditionalInfo", AdditionalInfo.FirstText()) // : null ChargingStationName.IsNeitherNullNorEmpty() ? new XElement(OICPNS.MobileAuthorization + "ChargingStationName", ChargingStationName.FirstText()) : null ); return(CustomMobileAuthorizationStartSerializer != null ? CustomMobileAuthorizationStartSerializer(this, XML) : XML); }
/// <summary> /// Compares two mobile authorization start for equality. /// </summary> /// <param name="MobileAuthorizationStart">A mobile authorization start to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public override Boolean Equals(MobileAuthorizationStart MobileAuthorizationStart) { if ((Object)MobileAuthorizationStart == null) { return(false); } return(AuthorizationStatus.Equals(MobileAuthorizationStart.AuthorizationStatus) && GeoCoordinates.Equals(MobileAuthorizationStart.GeoCoordinates) && ((ChargingStationName != null && MobileAuthorizationStart.ChargingStationName != null) || (ChargingStationName == null && MobileAuthorizationStart.ChargingStationName == null && ChargingStationName.Equals(MobileAuthorizationStart.ChargingStationName))) && ((Address != null && MobileAuthorizationStart.Address != null) || (Address == null && MobileAuthorizationStart.Address == null && Address.Equals(MobileAuthorizationStart.Address))) && ((!SessionId.HasValue && !MobileAuthorizationStart.SessionId.HasValue) || (SessionId.HasValue && MobileAuthorizationStart.SessionId.HasValue && SessionId.Value.Equals(MobileAuthorizationStart.SessionId.Value))) && ((StatusCode != null && MobileAuthorizationStart.StatusCode != null) || (StatusCode == null && MobileAuthorizationStart.StatusCode == null && StatusCode.Equals(MobileAuthorizationStart.StatusCode))) && ((TermsOfUse != null && MobileAuthorizationStart.TermsOfUse != null) || (TermsOfUse == null && MobileAuthorizationStart.TermsOfUse == null && TermsOfUse.Equals(MobileAuthorizationStart.TermsOfUse))) && ((AdditionalInfo != null && MobileAuthorizationStart.AdditionalInfo != null) || (AdditionalInfo == null && MobileAuthorizationStart.AdditionalInfo == null && AdditionalInfo.Equals(MobileAuthorizationStart.AdditionalInfo)))); }