Ejemplo n.º 1
0
 public void ScienceFictionHandler(Book b, bool flag)
 {
     Console.ForegroundColor = ConsoleColor.Cyan;
     if (b.BookGenre.Equals("Science fiction") & flag)
         Console.WriteLine(name + ": " + "I want to order the book delivery!");
     if (!b.BookGenre.Equals("Science fiction") & !flag)
         Console.WriteLine(name + ": " + "I'm not going to read it!");
 }
Ejemplo n.º 2
0
        static void Main()
        {
            Book book1 = new Book("The Great Gatsby", "Scott Fitzgerald", "Novel");
            Book book2 = new Book("C# 4.0 The Complete Reference", "Herbert Schildt",
                "Computer literature");
            Book book3 = new Book("Armada", "Ernest Cline", "Science fiction");
            Book book4 = new Book("All We Have Is Now", "Lisa Schroeder", "Science fiction");
            Book book5 = new Book("Rebel Mechanics", "Shanna Swendson", "Science fiction");
            Book book6 = new Book("Java The Complite Reference", "Herbert Schildt",
                "Computer literature");

            Library bookStore = new Library();

            Student st1 = new Student("Oleg");
            Student st2 = new Student("Andrew");

            bookStore.evt += st1.ComputerLiteratureHandler;
            bookStore.evt += st2.ScienceFictionHandler;

            bookStore.AddBook(book1);
            bookStore.AddBook(book2);
            bookStore.AddBook(book3);
            bookStore.AddBook(book4);
            bookStore.AddBook(book5);
            bookStore.AddBook(book6);

            bookStore.PrintAllBooks();

            bookStore.TakeBook("Armada");
            bookStore.PrintAllBooks();

            bookStore.TakeBook("The Great Gatsby");
            bookStore.PrintAllBooks();

            Console.ReadKey();
        }
Ejemplo n.º 3
0
 public void AddBook(Book b)
 {
     booksList.Add(b);
     if (evt != null)
         evt(b, true);
 }
Ejemplo n.º 4
0
 public void ComputerLiteratureHandler(Book b, bool flag)
 {
     Console.ForegroundColor = ConsoleColor.Cyan;
     if (b.BookGenre.Equals("Computer literature") & flag)
         Console.WriteLine(name + ": " + "I'm going to the library!");
 }