Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Cwiczenie 9\n");

            BookLibrary lib = new BookLibrary();

            lib.AddBook(new Book("Tytul_1", "Autor1", 12.50, "123", new DateTime(2019, 11, 2)));
            lib.AddBook(new Book("Tytul_2", "Autor2", 22.50, "124", new DateTime(2018, 9, 30)));
            lib.AddBook(new Book("Tytul_3", "Autor3", 13.99, "125", new DateTime(2017, 6, 23)));
            lib.AddBook(new Book("Tytul_4", "Autor1", 6.66, "126", new DateTime(2016, 7, 14)));
            lib.AddBook(new Book("Tytul_5", "Autor2", 77.99, "127", new DateTime(2015, 5, 3)));
            lib.AddBook(new Book("Tytul_6", "Autor3", 12.80, "128", new DateTime(2014, 12, 17)));
            lib.AddBook(new Book("Tytul_7", "Autor1", 17.50, "129", new DateTime(2013, 5, 22)));
            lib.AddBook(new Book("Tytul_8", "Autor2", 2.50, "130", new DateTime(2012, 3, 5)));
            lib.AddBook(new Book("Tytul_9", "Autor3", 13.13, "131", new DateTime(2011, 1, 24)));
            lib.print();

            Console.WriteLine("------------------------------");
            List <Book> BookList = new List <Book>();

            BookList = lib.FindByTitle("Tytul_3");

            for (int i = 0; i < BookList.Count; i++)
            {
                Console.WriteLine();
                BookList[i].print();
            }

            BookList = lib.FindByAuthor("Autor2");

            for (int i = 0; i < BookList.Count; i++)
            {
                Console.WriteLine();
                BookList[i].print();
            }

            BookList = lib.FindByPrice(6.66);

            for (int i = 0; i < BookList.Count; i++)
            {
                Console.WriteLine();
                BookList[i].print();
            }

            BookList = lib.FindByISBN("130");

            for (int i = 0; i < BookList.Count; i++)
            {
                Console.WriteLine();
                BookList[i].print();
            }

            Console.WriteLine("\n{0}", lib.IsExists(new Book("Tytul_9", "Autor3", 13.13, "131", new DateTime(2011, 1, 24))));

            Console.WriteLine("\n-----------------------------\n");

            lib.RemoveBook("125");
            lib.print();
        }