Ejemplo n.º 1
0
        private void save_to_db(object sender, RoutedEventArgs e)
        {
            av.Title    = av_title_text_box.Text;
            av.Authors  = authors_av_text_box.Text;
            av.KeyWords = av_key_words_text_box.Text;
            av.Price    = Convert.ToInt32(av_price_text_box.Text);
            av.CoverURL = av_coverUrl_text_box.Text;

            LibrarianDataManager.EditAVMaterial(av);

            Copy copy = new Copy();

            copy.DocumentId = av.Id;

            if (av_room_text_box.Text != "" &&
                av_level_text_box.Text != "" &&
                av_copy_text_box.Text != "")
            {
                copy.Room  = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(av_room_text_box));
                copy.Level = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(av_level_text_box));
                LibrarianDataManager.AddCopies(Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(av_copy_text_box)), copy);
            }
            workWindow.UptadeDataGridAV_material();
            this.Close();
        }
Ejemplo n.º 2
0
        private void add_ja_to_db_Click(object sender, RoutedEventArgs e)
        {
            if (ja_title_text_box.Text != null &&
                ja_publisher_text_box.Text != null &&
                ja_editors_text_box.Text != null &&
                ja_issue_text_box.Text != null &&
                ja_price_text_box.Text != null &&
                ja_room_text_box.Text != null &&
                ja_level_text_box.Text != null &&
                ja_PD_text_box.Text != null &&
                ja_coverURL_text_box.Text != null &&
                ja_countOf_text_box.Text != null &&
                ja_copies_text_box.Text != null)
            {
                Journal journal   = new Journal(InputFieldsManager.ReturnStringFromTextBox(ja_editors_text_box), InputFieldsManager.ReturnStringFromTextBox(ja_title_text_box), InputFieldsManager.ReturnStringFromTextBox(ja_publisher_text_box), Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(ja_issue_text_box)), InputFieldsManager.ReturnStringFromTextBox(ja_PD_text_box), InputFieldsManager.ReturnStringFromTextBox(ja_keywords_text_box), InputFieldsManager.ReturnStringFromTextBox(ja_coverURL_text_box), Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(ja_price_text_box)));
                long    journalId = LibrarianDataManager.AddJournal(journal);

                Copy copy = new Copy();
                int  n    = Convert.ToInt32(ja_copies_text_box.Text);
                copy.DocumentId = journalId;
                copy.Room       = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(ja_room_text_box));
                copy.Level      = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(ja_level_text_box));

                LibrarianDataManager.AddCopies(n, copy);

                AddJournalArticlesToJournal addJournalArticlesToJournal = new AddJournalArticlesToJournal(journalId, this);
                addJournalArticlesToJournal.Owner = this;
                addJournalArticlesToJournal.Show();
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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();
            }
        }
Ejemplo n.º 5
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            journal.Title           = titleTextBox.Text;
            journal.Publisher       = publisherTextBox.Text;
            journal.Issue           = Convert.ToInt32(issueTextBox.Text);
            journal.Authors         = editorsTextBox.Text;
            journal.KeyWords        = keyWordsTextBox.Text;
            journal.CoverURL        = coverUrlTextBox.Text;
            journal.KeyWords        = keyWordsTextBox.Text;
            journal.Price           = Convert.ToInt32(priceTextBox.Text);
            journal.PublicationDate = publicationDateBox.Text;

            LibrarianDataManager.EditJournal(journal);
            Copy copy = new Copy();

            if (roomTextBox.Text != "" &&
                levelTextBox.Text != "" &&
                copiesOfJournalTextBox.Text != "")
            {
                copy.Room  = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(roomTextBox));
                copy.Level = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(levelTextBox));
                LibrarianDataManager.AddCopies(Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(copiesOfJournalTextBox)), copy);
            }
            window.UpdateDataGridBook();
            this.Close();
        }
        private void save_changes_in_db_Click(object sender, RoutedEventArgs e)
        {
            book.Title        = title_of_book.Text;
            book.Authors      = author_of_book.Text;
            book.Publisher    = publisher_of_book.Text;
            book.Edition      = edition_of_book.Text;
            book.Year         = Convert.ToInt32(year_of_book.Text);
            book.KeyWords     = keywords_of_book.Text;
            book.Price        = Convert.ToInt32(price_of_book.Text);
            book.IsBestseller = best_seller_of_book.IsEnabled;

            LibrarianDataManager.EditBook(book);

            Copy copy = new Copy();

            copy.DocumentId = book.Id;

            if (room_of_book.Text != "" &&
                level_of_book.Text != "" &&
                copy_of_book.Text != "")
            {
                copy.Room  = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(room_of_book));
                copy.Level = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(level_of_book));
                LibrarianDataManager.AddCopies(Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(copy_of_book)), copy);
            }
            workWindow.UpdateDataGridBook();
            this.Close();
        }
Ejemplo n.º 7
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://"));
        }
Ejemplo n.º 8
0
        private void av_add_to_db_Click(object sender, RoutedEventArgs e)
        {
            if (av_title_text_box.Text != null &&
                authors_av_text_box.Text != null &&
                av_room_text_box.Text != null &&
                av_level_text_box.Text != null &&
                av_copy_text_box.Text != null &&
                av_key_words_text_box.Text != null &&
                av_price_text_box.Text != null &&
                av_coverURL_text_box.Text != null)
            {
                AVMaterial av_material  = new AVMaterial(InputFieldsManager.ReturnStringFromTextBox(authors_av_text_box), InputFieldsManager.ReturnStringFromTextBox(av_title_text_box), InputFieldsManager.ReturnStringFromTextBox(av_key_words_text_box), InputFieldsManager.ReturnStringFromTextBox(av_coverURL_text_box), Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(av_price_text_box)));
                long       avMaterialId = LibrarianDataManager.AddAVMaterial(av_material);

                Copy copy = new Copy();
                int  n    = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(av_copy_text_box));
                copy.DocumentId = avMaterialId;
                copy.Room       = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(av_room_text_box));
                copy.Level      = Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(av_level_text_box));
                LibrarianDataManager.AddCopies(n, copy);

                this.Close();
            }
        }
Ejemplo n.º 9
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");
        }