public override bool Equals(Object otherBook) { if (!(otherBook is Book)) { return(false); } else { Book newBook = (Book)otherBook; bool idEquality = newBook.GetId() == this._id; bool titleEquality = newBook.GetTitle() == this._title; return(idEquality && titleEquality); } }
// // public void Delete() // { // MySqlConnection conn = DB.Connection(); // conn.Open(); // MySqlCommand cmd = conn.CreateCommand() as MySqlCommand; // cmd.CommandText = @"delete from book WHERE `book`.`id` = "+_id+";"; // cmd.ExecuteNonQuery(); // conn.Close(); // if (conn != null) // { // conn.Dispose(); // } // } public override bool Equals(System.Object otherBook) { if (!(otherBook is Book)) { return(false); } else { Book newBook = (Book)otherBook; bool idEquality = this.GetId() == newBook.GetId(); bool descriptionEquality = this.GetTitle() == newBook.GetTitle(); return(idEquality && descriptionEquality); } }
public override bool Equals(System.Object otherBook) { if (!(otherBook is Book)) { return(false); } else { Book newBook = (Book)otherBook; bool bookIdEquality = (this.GetId() == newBook.GetId()); bool bookTitleEquality = (this.GetTitle() == newBook.GetTitle()); return(bookIdEquality && bookTitleEquality); } }
public override bool Equals(System.Object otherBook) { if (!(otherBook is Book)) { return(false); } else { Book newBook = (Book)otherBook; bool idEquality = this.GetId() == newBook.GetId(); bool titleEquality = this.GetTitle() == newBook.GetTitle(); bool copiesEquality = this.GetCopies() == newBook.GetCopies(); return(idEquality && titleEquality && copiesEquality); } }
public override bool Equals(System.Object otherItem) { if (!(otherItem is Book)) { return(false); } else { Book newBook = (Book)otherItem; bool idEquality = (this.GetId() == newBook.GetId()); bool titleEq = (this.GetTitle() == newBook.GetTitle()); bool yearEq = (this.GetYear() == newBook.GetYear()); return(idEquality && titleEq && yearEq); } }
public override bool Equals(System.Object otherBook) { if (!(otherBook is Book)) { return(false); } else { Book newBook = (Book)otherBook; bool idEquality = (this.GetId() == newBook.GetId()); bool titleEquality = (this.GetTitle() == newBook.GetTitle()); bool genreEquality = (this.GetGenre() == newBook.GetGenre()); bool inventoryEquality = (this.GetInventory() == newBook.GetInventory()); return(idEquality && titleEquality && genreEquality); } }
public override bool Equals(System.Object otherBook) { if (!(otherBook is Book)) { return(false); } else { Book newBook = (Book)otherBook; bool idEquality = (this.GetId() == newBook.GetId()); bool titleEquality = (this.GetTitle() == newBook.GetTitle()); bool callNumberEquality = (this.GetCallNumber() == newBook.GetCallNumber()); bool tagNumberEquality = (this.GetTagNumber() == newBook.GetTagNumber()); bool checkoutDateEquality = (this.GetCheckoutDate() == newBook.GetCheckoutDate()); bool dueDateEquality = (this.GetDueDate() == newBook.GetDueDate()); bool statusEquality = (this.GetStatus() == newBook.GetStatus()); // return _id == newBook._id && _title == newBook._title && _callNumber == newBook._callNumber && _tagNumber == newBook._tagNumber && _checkoutDate == newBook._checkoutDate && _dueDate == newBook._dueDate && _status == newBook._status; return(idEquality && titleEquality && callNumberEquality && tagNumberEquality && checkoutDateEquality && dueDateEquality && statusEquality); } }