/*** Methods ***/ /// <summary> /// Checks if two Alarm objects are equal. /// </summary> /// <param name="other">Another alarm instance.</param> /// <returns>True if all values are the same.</returns> public bool Equals(Alarm other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (string.Equals(Id, other.Id) && string.Equals(Subject, other.Subject) && IsFire == other.IsFire && string.Equals(Location, other.Location) && string.Equals(LocationProposition, other.LocationProposition) && string.Equals(MapLocation, other.MapLocation) && string.Equals(AdditionalInformation, other.AdditionalInformation) && StartTime == other.StartTime && LaunchTime == other.LaunchTime && EndTime == other.EndTime && Status == other.Status && string.Equals(AlarmStation, other.AlarmStation) && AlarmLevel == other.AlarmLevel && string.Equals(CallerName, other.CallerName) && string.Equals(CallerTelephoneNumber, other.CallerTelephoneNumber) && string.Equals(SirenProgram, other.SirenProgram) && string.Equals(Caller, other.Caller) && string.Equals(FurtherInformation, other.FurtherInformation) && FireBrigades.SequenceEqual(other.FireBrigades)); }
/// <summary> /// Two WasAlarm objects are equal if each field has the same value. /// </summary> /// <param name="other">The other WasAlarm object.</param> /// <returns>True, if all each field has the same value.</returns> public bool Equals(WasAlarm other) { if (ReferenceEquals(other, null)) { return(false); } // Check the list of fire brigades bool fireBrigades1IsNull = ReferenceEquals(FireBrigades, null); bool fireBrigades2IsNull = ReferenceEquals(other.FireBrigades, null); bool fireBrigadesEqual = fireBrigades1IsNull && fireBrigades2IsNull; if (!fireBrigades1IsNull && !fireBrigades2IsNull) { fireBrigadesEqual = FireBrigades.SequenceEqual(other.FireBrigades); } return (fireBrigadesEqual && string.Equals(Key, other.Key) && string.Equals(AlarmStation, other.AlarmStation) && string.Equals(ReceiveTime, other.ReceiveTime) && string.Equals(Id, other.Id) && AlarmLevel == other.AlarmLevel && string.Equals(CallerName, other.CallerName) && string.Equals(CallerTelephoneNumber, other.CallerTelephoneNumber) && string.Equals(Subject, other.Subject) && string.Equals(Location, other.Location) && string.Equals(AdditionalInformation, other.AdditionalInformation) && string.Equals(StatusText, other.StatusText) && string.Equals(WatchOutTime, other.WatchOutTime) && string.Equals(SirenProgram, other.SirenProgram) && string.Equals(FinishedTime, other.FinishedTime) && Index == other.Index); }
public override int GetHashCode() { unchecked { int hashCode = (Id != null ? Id.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Subject != null ? Subject.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Location != null ? Location.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (LocationProposition != null ? LocationProposition.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AdditionalInformation != null ? AdditionalInformation.GetHashCode() : 0); hashCode = (hashCode * 397) ^ StartTime.GetHashCode(); hashCode = (hashCode * 397) ^ LaunchTime.GetHashCode(); hashCode = (hashCode * 397) ^ EndTime.GetHashCode(); hashCode = (hashCode * 397) ^ Status; hashCode = (hashCode * 397) ^ (AlarmStation != null ? AlarmStation.GetHashCode() : 0); hashCode = (hashCode * 397) ^ AlarmLevel; hashCode = (hashCode * 397) ^ (CallerName != null ? CallerName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CallerTelephoneNumber != null ? CallerTelephoneNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SirenProgram != null ? SirenProgram.GetHashCode() : 0); hashCode = (hashCode * 397) ^ FireBrigades.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = Key != null?Key.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (AlarmStation != null ? AlarmStation.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ReceiveTime != null ? ReceiveTime.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Id != null ? Id.GetHashCode() : 0); hashCode = (hashCode * 397) ^ AlarmLevel; hashCode = (hashCode * 397) ^ (CallerName != null ? CallerName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CallerTelephoneNumber != null ? CallerTelephoneNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Subject != null ? Subject.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Location != null ? Location.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AdditionalInformation != null ? AdditionalInformation.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (StatusText != null ? StatusText.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (WatchOutTime != null ? WatchOutTime.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SirenProgram != null ? SirenProgram.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (FinishedTime != null ? FinishedTime.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (FireBrigades != null ? FireBrigades.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Index; return(hashCode); } }