Esempio n. 1
0
        /***   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));
        }
Esempio n. 2
0
        /// <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);
        }