private static List <KLBook> LoadListFromReader(IDataReader reader) { List <KLBook> KLBookList = new List <KLBook>(); try { while (reader.Read()) { KLBook KLBook = new KLBook(); KLBook.bookID = Convert.ToInt32(reader["BookID"]); KLBook.authorID = Convert.ToInt32(reader["AuthorID"]); KLBook.title = reader["Title"].ToString(); KLBook.image = reader["Image"].ToString(); KLBook.url = reader["Url"].ToString(); KLBook.description = reader["Description"].ToString(); KLBook.isPublish = Convert.ToBoolean(reader["IsPublish"]); KLBook.isDelected = Convert.ToBoolean(reader["IsDelected"]); KLBookList.Add(KLBook); } } finally { reader.Close(); } return(KLBookList); }
/// <summary> /// Compares 2 instances of KLBook. /// </summary> public static int CompareByDescription(KLBook KLBook1, KLBook KLBook2) { return(KLBook1.Description.CompareTo(KLBook2.Description)); }
/// <summary> /// Compares 2 instances of KLBook. /// </summary> public static int CompareByUrl(KLBook KLBook1, KLBook KLBook2) { return(KLBook1.Url.CompareTo(KLBook2.Url)); }
/// <summary> /// Compares 2 instances of KLBook. /// </summary> public static int CompareByImage(KLBook KLBook1, KLBook KLBook2) { return(KLBook1.Image.CompareTo(KLBook2.Image)); }
/// <summary> /// Compares 2 instances of KLBook. /// </summary> public static int CompareByTitle(KLBook KLBook1, KLBook KLBook2) { return(KLBook1.Title.CompareTo(KLBook2.Title)); }
/// <summary> /// Compares 2 instances of KLBook. /// </summary> public static int CompareByAuthorID(KLBook KLBook1, KLBook KLBook2) { return(KLBook1.AuthorID.CompareTo(KLBook2.AuthorID)); }
/// <summary> /// Compares 2 instances of KLBook. /// </summary> public static int CompareByBookID(KLBook KLBook1, KLBook KLBook2) { return(KLBook1.BookID.CompareTo(KLBook2.BookID)); }