/// <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 hash = hash * 59 + Id.GetHashCode(); if (EquipmentType != null) { hash = hash * 59 + EquipmentType.GetHashCode(); } if (OwnerName != null) { hash = hash * 59 + OwnerName.GetHashCode(); } if (OwnerId != null) { hash = hash * 59 + OwnerId.GetHashCode(); } hash = hash * 59 + IsHired.GetHashCode(); if (Make != null) { hash = hash * 59 + Make.GetHashCode(); } if (Model != null) { hash = hash * 59 + Model.GetHashCode(); } if (Size != null) { hash = hash * 59 + Size.GetHashCode(); } hash = hash * 59 + AttachmentCount.GetHashCode(); if (LastVerifiedDate != null) { hash = hash * 59 + LastVerifiedDate.GetHashCode(); } hash = hash * 59 + SenioritySortOrder.GetHashCode(); return(hash); } }
internal string Encode() { StringBuilder stringBuilder = new StringBuilder(); if (TransportEvent == TransportEventTypes.Unknown && AttachmentCount > 0) { TransportEvent = TransportEventTypes.Message; } if (TransportEvent != TransportEventTypes.Unknown) { stringBuilder.Append(((int)TransportEvent).ToString()); } if (SocketIOEvent == SocketIOEventTypes.Unknown && AttachmentCount > 0) { SocketIOEvent = SocketIOEventTypes.BinaryEvent; } if (SocketIOEvent != SocketIOEventTypes.Unknown) { stringBuilder.Append(((int)SocketIOEvent).ToString()); } if (SocketIOEvent == SocketIOEventTypes.BinaryEvent || SocketIOEvent == SocketIOEventTypes.BinaryAck) { stringBuilder.Append(AttachmentCount.ToString()); stringBuilder.Append("-"); } bool flag = false; if (Namespace != "/") { stringBuilder.Append(Namespace); flag = true; } if (Id != 0) { if (flag) { stringBuilder.Append(","); flag = false; } stringBuilder.Append(Id.ToString()); } if (!string.IsNullOrEmpty(Payload)) { if (flag) { stringBuilder.Append(","); flag = false; } stringBuilder.Append(Payload); } return(stringBuilder.ToString()); }
/// <summary> /// Returns true if EquipmentViewModel instances are equal /// </summary> /// <param name="other">Instance of EquipmentViewModel to be compared</param> /// <returns>Boolean</returns> public bool Equals(EquipmentViewModel other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( EquipmentType == other.EquipmentType || EquipmentType != null && EquipmentType.Equals(other.EquipmentType) ) && ( OwnerName == other.OwnerName || OwnerName != null && OwnerName.Equals(other.OwnerName) ) && ( OwnerId == other.OwnerId || OwnerId != null && OwnerId.Equals(other.OwnerId) ) && ( IsHired == other.IsHired || IsHired.Equals(other.IsHired) ) && ( SeniorityString == other.SeniorityString || SeniorityString != null && SeniorityString.Equals(other.SeniorityString) ) && ( Make == other.Make || Make != null && Make.Equals(other.Make) ) && ( Model == other.Model || Model != null && Model.Equals(other.Model) ) && ( Size == other.Size || Size != null && Size.Equals(other.Size) ) && ( EquipmentCode == other.EquipmentCode || EquipmentCode != null && EquipmentCode.Equals(other.EquipmentCode) ) && ( AttachmentCount == other.AttachmentCount || AttachmentCount.Equals(other.AttachmentCount) ) && ( LastVerifiedDate == other.LastVerifiedDate || LastVerifiedDate != null && LastVerifiedDate.Equals(other.LastVerifiedDate) ) && ( SenioritySortOrder == other.SenioritySortOrder || SenioritySortOrder.Equals(other.SenioritySortOrder) )); }