static void Main(string[] args)
        {
            Library library = new Library();
            StudentFantast stFantast = new StudentFantast();
            StudentComputerScientist stCompScientist = new StudentComputerScientist();

            library.registerStudent(stFantast);
            library.registerStudent(stCompScientist);

            library.AddBook(new Book("The Lord of the rings", "Peter Jackson", "fantasy"));
            library.AddBook(new Book("Modern operating systems", "Andrew Tanenbaum", "computer science"));
            library.AddBook(new Book("Triumphal arch", "Erich Maria Remarque", "war novel"));

            Book book1 = new Book("The computer science", "The author", "computer science");
            library.AddBook(book1);

            try
            {
                library.TakeBook(book1);
            }
            catch (ArgumentException)
            {

            }

            foreach (Book book in library)
            {
                Console.WriteLine(book.BookName);
            }

            Console.ReadKey();
        }
Exemplo n.º 2
0
 public void NewBookComputerLiterature(Book book)
 {
     if (book.Genre == "ComputerLiterature")
     {        
         Console.WriteLine("В библиотеку пришла комп.литер.Первый студент отправился за Комп.Литертурой");
     }
 }
Exemplo n.º 3
0
 public void RemoveBook(Book book)
 {
     _books.Remove(book);
     removeBook(book);
     NotifyCollectionChangedEventArgs Args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, book);
     CollectionChanged(this, Args);
 }
Exemplo n.º 4
0
 public void NewBookFantastik(Book book)
 {
     if (book.Genre == "Fantastic")
     {     
         Console.WriteLine("В библиотеку пришла фант. литер.Второй студент отправился за Комп.Литертурой");
     }
 }
Exemplo n.º 5
0
 public void AddBook(Book book)
 {
     _library.Add(book);
     if (BookAdded != null)
     {
         BookAdded(this, new BookChangeEventArgs(book));
     }
 }
Exemplo n.º 6
0
        public void AddBook(Book book)
        {
            _books.Add(book);
            addBook(book);

            NotifyCollectionChangedEventArgs Args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,book);
            CollectionChanged(this,Args);

        }
Exemplo n.º 7
0
        public void RemovedBookFromLibrary(Book book)
        {

            if (book.Genre != "Fantastic")
            {
                Console.WriteLine("Я не собирался идти за этой книгой");

            }
        }
Exemplo n.º 8
0
        public void NewBookFantastik(Book book)
        {
            if (book.Genre == "Fantastic")
            {
                Console.WriteLine("LIBRARY HAVE NEW Fantastik");

            }

        }
        public Book TakeBook(Book book)
        {
            if (!_library.Contains(book))
            {
                throw new ArgumentException("There is no book with such name in the library");
            }

            _library.Remove(book);
            return book;
        }
Exemplo n.º 10
0
        public void NewBookComputerLiterature(Book book)
        {

            if (book.Genre == "ComputerLiterature")
            {
                Console.WriteLine("LIBRARY HAVE NEW ComputerLiterature");

            }

        }
Exemplo n.º 11
0
        public void AddBook(Book book)
        {
            if(book == null)
            {
                throw new ArgumentNullException();
            }
            else
            {
                _books.Add(book);

                OnBookAdded(new LibEventArgs(book.Title, book.Genre));
            }
        }
Exemplo n.º 12
0
        public Book TakeBook(Book book)
        {
            if (!_library.Contains(book))
            {
                throw new ArgumentException("There is no book with such name in the library");
            }

            if (BookAdded != null)
            {
                BookTaken(this, new BookChangeEventArgs(book));
                _library.Remove(book);
            }

            return book;
        }
Exemplo n.º 13
0
 public void RemoveBook(Book book)
 {
     lst.Remove(book);
     removeBook(book);
 }
Exemplo n.º 14
0
        public void AddBook(Book book)
        {
            lst.Add(book);
            addBook(book);

        }
 public void AddBook(Book book)
 {
     _library.Add(book);
 }
Exemplo n.º 16
0
 public BookChangeEventArgs(Book book)
 {
     _book = book;
 }