/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (AuthorFirstName != null) { hashCode = hashCode * 59 + AuthorFirstName.GetHashCode(); } if (AuthorLastName != null) { hashCode = hashCode * 59 + AuthorLastName.GetHashCode(); } if (Title != null) { hashCode = hashCode * 59 + Title.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } return(hashCode); } }
private bool authorLastNameValidation() { if (AuthorLastName.Equals(string.Empty)) { textBoxAuthorLastName.BackColor = Color.Red; return(false); } else { textBoxAuthorLastName.BackColor = Color.White; return(true); } }
public string AuthorDisplayName(int nameDisplayLength) { if (null == AuthorFirstName) { AuthorFirstName = String.Empty; } if (null == AuthorLastName) { AuthorLastName = String.Empty; } StringBuilder sb = new StringBuilder(); sb.Append(AuthorFirstName).Append(' '); int length = nameDisplayLength > 0 ? Math.Min(nameDisplayLength, AuthorLastName.Length) : AuthorLastName.Length; sb.Append(AuthorLastName.Substring(0, length)); if (length < AuthorLastName.Length) { sb.Append('.'); } return(sb.ToString()); }
/// <summary> /// Returns true if Book instances are equal /// </summary> /// <param name="other">Instance of Book to be compared</param> /// <returns>Boolean</returns> public bool Equals(Book other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( AuthorFirstName == other.AuthorFirstName || AuthorFirstName != null && AuthorFirstName.Equals(other.AuthorFirstName) ) && ( AuthorLastName == other.AuthorLastName || AuthorLastName != null && AuthorLastName.Equals(other.AuthorLastName) ) && ( Title == other.Title || Title != null && Title.Equals(other.Title) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) )); }