public InventoryBook GetInventoryBookByRemoteBookID(int RemoteBookID) { string query = "SELECT * FROM InventoryBook where BookID == " + RemoteBookID; SQLiteCommand command = new SQLiteCommand(query, dbConnection); SQLiteDataReader rdr = command.ExecuteReader(); InventoryBook toReturn = new InventoryBook(); rdr.Read(); toReturn.AddToStock(rdr.GetInt32(3)); toReturn.SetEnabled(rdr.GetBoolean(4)); toReturn.SetBook(rdr.GetInt32(1)); toReturn.reviews = GetReviews(rdr.GetInt32(0)); toReturn.ibid = rdr.GetInt32(0); rdr.Close(); return(toReturn); }
public List <InventoryBook> GetInventoryBooks() { string query = "SELECT * FROM InventoryBook"; SQLiteCommand command = new SQLiteCommand(query, dbConnection); SQLiteDataReader rdr = command.ExecuteReader(); List <InventoryBook> toReturn = new List <InventoryBook>(); while (rdr.Read()) { InventoryBook book = new InventoryBook(); book.AddToStock(rdr.GetInt32(3)); book.SetEnabled(rdr.GetBoolean(4)); book.SetBook(rdr.GetInt32(1)); book.reviews = GetReviews(rdr.GetInt32(1)); toReturn.Add(book); } return(toReturn); }