예제 #1
0
        private void add_book_to_db_Click(object sender, RoutedEventArgs e)
        {
            bool is_best_seller = false;

            if (best_seller_of_book.IsChecked == true)
            {
                is_best_seller = true;
            }
            if (title_of_book.Text != null &&
                author_of_book.Text != null &&
                publisher_of_book.Text != null &&
                edition_of_book.Text != null &&
                year_of_book.Text != null &&
                keywords_of_book.Text != null &&
                price_of_book.Text != null &&
                copy_of_book.Text != null &&
                room_of_book.Text != null &&
                level_of_book.Text != null &&
                book_cover_URL_text_box.Text != null)
            {
                Book book   = new Book(InputFieldsManager.ReturnStringFromTextBox(author_of_book), InputFieldsManager.ReturnStringFromTextBox(title_of_book), InputFieldsManager.ReturnStringFromTextBox(publisher_of_book), InputFieldsManager.ReturnStringFromTextBox(edition_of_book), Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(year_of_book)), is_best_seller, InputFieldsManager.ReturnStringFromTextBox(keywords_of_book), InputFieldsManager.ReturnStringFromTextBox(book_cover_URL_text_box), Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(price_of_book)));
                long bookId = LibrarianDataManager.AddBook(book);

                Copy copy = new Copy();
                int  n    = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(copy_of_book));
                copy.DocumentId = bookId;
                copy.Room       = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(room_of_book));
                copy.Level      = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(level_of_book));
                LibrarianDataManager.AddCopies(n, copy);

                this.Close();
            }
        }
예제 #2
0
        public void D2TC1()
        {
            LibrarianDataManager.ClearAll();
            LibrarianDataManager.AddLibrarian(new Librarian("LibrarianName", "LibrarianSurname", "80000000000", "Address"),
                                              "librarian_1", "12345");
            LibrarianDataManager.AddFaculty(new Faculty("Sergey", "Afonso", "30001", "ViaMargutta, 3", ""),
                                            "patron_1", "12345");
            LibrarianDataManager.AddStudent(new Student("Nadia", "Teixeira", "30002", "Via Sacra, 13"),
                                            "patron_2", "12345");
            LibrarianDataManager.AddStudent(new Student("Elvira", "Espindola", "30003", "Via del Corso, 22"),
                                            "patron_3", "12345");

            LibrarianDataManager.AddBook(new Book("Authors", "Book_1", "Publisher", "Edition", 2018, false, "Keys", "", 100));
            LibrarianDataManager.AddCopies(3, new Copy(1, 1, 1));
            LibrarianDataManager.AddBook(new Book("Authors", "Book_2", "Publisher", "Edition", 2018, false, "Keys", "", 100));
            LibrarianDataManager.AddCopies(2, new Copy(2, 1, 2));
            LibrarianDataManager.AddBook(new Book("Authors", "Book_3", "Publisher", "Edition", 2018, false, "Keys", "", 100));
            LibrarianDataManager.AddCopies(1, new Copy(3, 1, 3));
            LibrarianDataManager.AddAVMaterial(new AVMaterial("Authors", "AVMaterial_1", "Keys", "", 100));
            LibrarianDataManager.AddCopies(1, new Copy(4, 1, 4));
            LibrarianDataManager.AddAVMaterial(new AVMaterial("Authors", "AVMaterial_2", "Keys", "", 100));
            LibrarianDataManager.AddCopies(1, new Copy(5, 1, 5));

            Assert.AreEqual(LibrarianDataManager.GetNumberOfCopies(), 8);
            Assert.AreEqual(LibrarianDataManager.GetNumberOfUsers(), 4);
        }
예제 #3
0
        public void Initialize()
        {
            LibrarianDataManager.ClearAll();

            LibrarianDataManager.AddLibrarian(new Librarian("LibrarianName", "LibrarianSurname", "80000000000", "Address"),
                                              "librarian_1", "12345");
            LibrarianDataManager.AddFaculty(new Faculty("FacultyName", "FacultySurname", "80000000000", "Address", ""),
                                            "patron_1", "12345");
            LibrarianDataManager.AddStudent(new Student("StudentName", "StudentSurname", "80000000000", "Address"),
                                            "patron_2", "12345");
            LibrarianDataManager.AddStudent(new Student("StudentName", "StudentSurname", "80000000000", "Address"),
                                            "patron_3", "12345");

            LibrarianDataManager.AddBook(new Book("Authors", "Book_1", "Publisher", "Edition", 2018, false, "Keys", "", 100));
            LibrarianDataManager.AddCopies(1, new Copy(1, 1, 1));
            LibrarianDataManager.AddBook(new Book("Authors", "Book_2", "Publisher", "Edition", 2018, true, "Keys", "", 50));
            LibrarianDataManager.AddCopies(2, new Copy(2, 1, 1));
            LibrarianDataManager.AddInnerMaterial(new InnerMaterial("Authors", "Book_3", "Book", "Keys", 1, 1, "https://"));
        }
예제 #4
0
        public void Initialization()
        {
            LibrarianDataManager.ClearAll();
            LibrarianDataManager.AddBook(new Book(
                                             "Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein",
                                             "Introduction to Algorithms",
                                             "MIT Press",
                                             "Third edition",
                                             2009,
                                             false,
                                             "Algorithms",
                                             "",
                                             5000
                                             ));
            LibrarianDataManager.AddBook(new Book(
                                             "Erich Gamma, Ralph Johnson, John Vlissides, Richard Helm",
                                             "Design Patterns: Elements of Reusable Object-Oriented Software",
                                             "Addison-Wesley Professional",
                                             "First edition",
                                             2003,
                                             true,
                                             "Algorithms",
                                             "",
                                             1700
                                             ));
            LibrarianDataManager.AddAVMaterial(new AVMaterial(
                                                   "Tony Hoare",
                                                   "Null References: The Billion DollarMistake",
                                                   "",
                                                   "",
                                                   700));
            LibrarianDataManager.AddCopies(3, new Copy(1, 1, 1));
            LibrarianDataManager.AddCopies(3, new Copy(2, 1, 1));
            LibrarianDataManager.AddCopies(2, new Copy(3, 1, 1));

            LibrarianDataManager.AddFaculty(new Faculty(
                                                "Sergey",
                                                "Afonso",
                                                "30001",
                                                "ViaMargutta, 3",
                                                Faculty.PROFESSOR_SUBTYPE
                                                ), "patron_1", "12345");
            LibrarianDataManager.AddFaculty(new Faculty(
                                                "Nadia",
                                                "Teixeira",
                                                "30002",
                                                "Via Sacra, 13",
                                                Faculty.PROFESSOR_SUBTYPE
                                                ), "patron_2", "12345");
            LibrarianDataManager.AddFaculty(new Faculty(
                                                "Elvira",
                                                "Espindola",
                                                "30003",
                                                "Via del Corso, 22",
                                                Faculty.PROFESSOR_SUBTYPE
                                                ), "patron_3", "12345");
            LibrarianDataManager.AddStudent(new Student(
                                                "Andrey",
                                                "Velo",
                                                "30004",
                                                "AvenidaMazatlan 250"
                                                ), "patron_4", "12345");
            LibrarianDataManager.AddGuest(new Guest(
                                              "Veronika",
                                              "Rama",
                                              "30005",
                                              "Stret Atocha, 27"
                                              ), "patron_5", "12345");
            LibrarianDataManager.AddLibrarian(new Librarian(
                                                  "LibrarianName",
                                                  "LibrarianSurname",
                                                  "30006",
                                                  "LibrarianAddress"
                                                  ), "librarian_1", "12345");
        }