Ejemplo n.º 1
0
        /// <summary>
        /// Returns true if NotificationViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of NotificationViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(NotificationViewModel other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     EventId == other.EventId ||
                     EventId != null &&
                     EventId.Equals(other.EventId)
                 ) &&
                 (
                     Event2Id == other.Event2Id ||
                     Event2Id != null &&
                     Event2Id.Equals(other.Event2Id)
                 ) &&
                 (
                     HasBeenViewed == other.HasBeenViewed ||
                     HasBeenViewed != null &&
                     HasBeenViewed.Equals(other.HasBeenViewed)
                 ) &&
                 (
                     IsWatchNotification == other.IsWatchNotification ||
                     IsWatchNotification != null &&
                     IsWatchNotification.Equals(other.IsWatchNotification)
                 ) &&
                 (
                     IsExpired == other.IsExpired ||
                     IsExpired != null &&
                     IsExpired.Equals(other.IsExpired)
                 ) &&
                 (
                     IsAllDay == other.IsAllDay ||
                     IsAllDay != null &&
                     IsAllDay.Equals(other.IsAllDay)
                 ) &&
                 (
                     PriorityCode == other.PriorityCode ||
                     PriorityCode != null &&
                     PriorityCode.Equals(other.PriorityCode)
                 ) &&
                 (
                     UserId == other.UserId ||
                     UserId != null &&
                     UserId.Equals(other.UserId)
                 ));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (EventId != null)
                {
                    hash = hash * 59 + EventId.GetHashCode();
                }

                if (Event2Id != null)
                {
                    hash = hash * 59 + Event2Id.GetHashCode();
                }

                if (HasBeenViewed != null)
                {
                    hash = hash * 59 + HasBeenViewed.GetHashCode();
                }

                if (IsWatchNotification != null)
                {
                    hash = hash * 59 + IsWatchNotification.GetHashCode();
                }

                if (IsExpired != null)
                {
                    hash = hash * 59 + IsExpired.GetHashCode();
                }

                if (IsAllDay != null)
                {
                    hash = hash * 59 + IsAllDay.GetHashCode();
                }

                if (PriorityCode != null)
                {
                    hash = hash * 59 + PriorityCode.GetHashCode();
                }

                if (UserId != null)
                {
                    hash = hash * 59 + UserId.GetHashCode();
                }

                return(hash);
            }
        }