Exemple #1
0
        public void AddToStock()
        {
            Book          book = new Book();
            InventoryBook ib   = new InventoryBook();

            ib.AddToStock(5);
            Assert.AreEqual(5, ib.GetStock());
        }
Exemple #2
0
        public void RemoveFromStock()
        {
            Book          book = new Book();
            InventoryBook ib   = new InventoryBook();

            ib.AddToStock(5);
            ib.RemoveFromStock(2);
            Assert.AreEqual(3, ib.GetStock());
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }