/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(ChargingProfileId.GetHashCode() * 31 ^ StackLevel.GetHashCode() * 29 ^ ChargingProfilePurpose.GetHashCode() * 23 ^ ChargingProfileKind.GetHashCode() * 19 ^ ChargingSchedule.GetHashCode() * 17 ^ (TransactionId != null ? TransactionId.GetHashCode() * 13 : 0) ^ (RecurrencyKind.HasValue ? RecurrencyKind.GetHashCode() * 11 : 0) ^ (ValidFrom.HasValue ? ValidFrom.GetHashCode() * 7 : 0) ^ (ValidTo.HasValue ? ValidTo.GetHashCode() * 5 : 0)); } }
/// <summary> /// Compares two id tag infos for equality. /// </summary> /// <param name="ChargingProfile">An id tag info to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public Boolean Equals(ChargingProfile ChargingProfile) { if ((Object)ChargingProfile == null) { return(false); } return(ChargingProfileId.Equals(ChargingProfile.ChargingProfileId) && StackLevel.Equals(ChargingProfile.StackLevel) && ChargingProfilePurpose.Equals(ChargingProfile.ChargingProfilePurpose) && ChargingProfileKind.Equals(ChargingProfile.ChargingProfileKind) && ChargingSchedule.Equals(ChargingProfile.ChargingSchedule) && ((!TransactionId.HasValue && !ChargingProfile.TransactionId.HasValue) || (TransactionId.HasValue && ChargingProfile.TransactionId.HasValue && TransactionId.Value.Equals(ChargingProfile.TransactionId.Value))) && ((!RecurrencyKind.HasValue && !ChargingProfile.RecurrencyKind.HasValue) || (RecurrencyKind.HasValue && ChargingProfile.RecurrencyKind.HasValue && RecurrencyKind.Value.Equals(ChargingProfile.RecurrencyKind.Value))) && ((!ValidFrom.HasValue && !ChargingProfile.ValidFrom.HasValue) || (ValidFrom.HasValue && ChargingProfile.ValidFrom.HasValue && ValidFrom.Value.Equals(ChargingProfile.ValidFrom.Value))) && ((!ValidTo.HasValue && !ChargingProfile.ValidTo.HasValue) || (ValidTo.HasValue && ChargingProfile.ValidTo.HasValue && ValidTo.Value.Equals(ChargingProfile.ValidTo.Value)))); }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="XName">An alternative XML element name [default: "OCPPv1_6_CP:chargingProfile"]</param> public XElement ToXML(XName XName = null) => new XElement(XName ?? OCPPNS.OCPPv1_6_CP + "chargingProfile", new XElement(OCPPNS.OCPPv1_6_CP + "chargingProfileId", ChargingProfileId.ToString()), TransactionId != null ? new XElement(OCPPNS.OCPPv1_6_CP + "transactionId", TransactionId.ToString()) : null, new XElement(OCPPNS.OCPPv1_6_CP + "stackLevel", StackLevel), new XElement(OCPPNS.OCPPv1_6_CP + "chargingProfilePurpose", ChargingProfilePurpose.AsText()), new XElement(OCPPNS.OCPPv1_6_CP + "chargingProfileKind", ChargingProfileKind.AsText()), ValidFrom.HasValue ? new XElement(OCPPNS.OCPPv1_6_CP + "validFrom", ValidFrom.Value.ToIso8601()) : null, ValidTo.HasValue ? new XElement(OCPPNS.OCPPv1_6_CP + "validTo", ValidTo.Value.ToIso8601()) : null, RecurrencyKind.HasValue ? new XElement(OCPPNS.OCPPv1_6_CP + "recurrencyKind", RecurrencyKind.Value.AsText()) : null, ChargingSchedule.ToXML() );
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return((ChargingProfileId != null ? ChargingProfileId.GetHashCode() * 19 : 0) ^ (ConnectorId != null ? ConnectorId.GetHashCode() * 11 : 0) ^ (ChargingProfilePurpose.HasValue ? ChargingProfilePurpose.GetHashCode() * 7 : 0) ^ (StackLevel.HasValue ? StackLevel.GetHashCode() * 5 : 0)); } }
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomChargingProfileSerializer">A delegate to serialize custom charging profiles.</param> /// <param name="CustomChargingScheduleSerializer">A delegate to serialize custom charging schedule requests.</param> /// <param name="CustomChargingSchedulePeriodSerializer">A delegate to serialize custom charging schedule periods.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingProfile> CustomChargingProfileSerializer = null, CustomJObjectSerializerDelegate <ChargingSchedule> CustomChargingScheduleSerializer = null, CustomJObjectSerializerDelegate <ChargingSchedulePeriod> CustomChargingSchedulePeriodSerializer = null) { var JSON = JSONObject.Create( new JProperty("chargingProfileId", ChargingProfileId.ToString()), TransactionId != null ? new JProperty("transactionId", TransactionId.ToString()) : null, new JProperty("stackLevel", StackLevel), new JProperty("chargingProfilePurpose", ChargingProfilePurpose.AsText()), new JProperty("chargingProfileKind", ChargingProfileKind.AsText()), ValidFrom.HasValue ? new JProperty("validFrom", ValidFrom.Value.ToIso8601()) : null, ValidTo.HasValue ? new JProperty("validTo", ValidTo.Value.ToIso8601()) : null, RecurrencyKind.HasValue ? new JProperty("recurrencyKind", RecurrencyKind.Value.AsText()) : null, new JProperty("chargingSchedule", ChargingSchedule.ToJSON(CustomChargingScheduleSerializer, CustomChargingSchedulePeriodSerializer)) ); return(CustomChargingProfileSerializer != null ? CustomChargingProfileSerializer(this, JSON) : JSON); }