///<summary> ///when users input all data to textBoxes clicked on this button user go to workWindow but before system will checked all data in textBoxes and checked if this user exist ///</summary> private void button_sign_in_Click(object sender, RoutedEventArgs e) { // here you will need to check that a username and password exist in dB it should be done in a separate function which will check it //a function that checks if there is a user with such data entered in the fields // здесь нужно будет проверить что такой логи и пароль существуют в бд это нужно сделать в отдельной фукции которая будет проверять это //функция которая проверяет если есть такой пользователь с такими данными введенными в поля if (InputFieldsManager.CheckPasswordValidity(passwordBox_enter)) { //these functions return a string with the maintained data in their textbooks //данные функции возвращают строку с веденными данными в их текстБоксы string login = InputFieldsManager.ReturnStringFromTextBox(textBox_login), password = InputFieldsManager.ReturnPasswordFromTextBox(passwordBox_enter); //if all is OK, so we go to the Work window long userID = CredentialsManager.Authorize(login, password); if (userID != -1) { using (StreamWriter writer = new StreamWriter("id.txt")) { writer.Write(userID); } GoToWork(LibrarianDataManager.GetUserById(userID)); } else { MessageBox.Show("Error. Can not find user with current login and password"); } } else { MessageBox.Show("Such user doesn't exist"); } }
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(); }
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(); }
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(); } }
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(); } }
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 add_inner_to_db_Click(object sender, RoutedEventArgs e) { if (inner_title_box.Text != null && inner_author_box.Text != null && inner_level_text_box.Text != null && inner_room_text_box.Text != null && inner_type_text_box.Text != null && inner_cover_url_box.Text != null && inner_keywords_text_box.Text != null) { InnerMaterial innerMaterials = new InnerMaterial(InputFieldsManager.ReturnStringFromTextBox(inner_author_box), InputFieldsManager.ReturnStringFromTextBox(inner_title_box), InputFieldsManager.ReturnStringFromTextBox(inner_type_text_box), InputFieldsManager.ReturnStringFromTextBox(inner_keywords_text_box), Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(inner_room_text_box)), Convert.ToInt32(InputFieldsManager.ReturnStringFromTextBox(inner_level_text_box)), InputFieldsManager.ReturnStringFromTextBox(inner_cover_url_box)); LibrarianDataManager.AddInnerMaterial(innerMaterials); this.Close(); } }
private void save_all_Click(object sender, RoutedEventArgs e) { Article journalArticle = new Article(); if (article_keywords_text_box.Text != null && article_coverURL_text_box.Text != null && article_authors_text_box.Text != null && article_title_text_box.Text != null) { journalArticle.JournalId = journalID; journalArticle.Authors = InputFieldsManager.ReturnStringFromTextBox(article_authors_text_box); journalArticle.Title = InputFieldsManager.ReturnStringFromTextBox(article_title_text_box); journalArticle.CoverURL = InputFieldsManager.ReturnStringFromTextBox(article_coverURL_text_box); journalArticle.KeyWords = InputFieldsManager.ReturnStringFromTextBox(article_keywords_text_box); LibrarianDataManager.AddArticle(journalArticle); } article_title_text_box.Clear(); article_keywords_text_box.Clear(); article_coverURL_text_box.Clear(); article_authors_text_box.Clear(); }
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(); } }
private void SecondName_TextChanged(object sender, TextChangedEventArgs e) { SecondName.Text = InputFieldsManager.ReturnStringFromTextBox(SecondName); }
private void save_user_Click(object sender, RoutedEventArgs e) { if (name_of_new_user.Text != null && lastname_of_new_user.Text != null && phone_of_new_user.Text != null && town_of_new_user.Text != null && street_of_new_user.Text != null && house_of_new_user.Text != null && flat_of_new_user.Text != null && InputFieldsManager.CheckPasswordValidity(user_new_password)) { string firstName = InputFieldsManager.ReturnStringFromTextBox(name_of_new_user), secondName = InputFieldsManager.ReturnStringFromTextBox(lastname_of_new_user), phone = InputFieldsManager.ReturnStringFromTextBox(phone_of_new_user), address = InputFieldsManager.ReturnStringFromTextBox(town_of_new_user) + ' ' + InputFieldsManager.ReturnStringFromTextBox(street_of_new_user) + ' ' + InputFieldsManager.ReturnStringFromTextBox(house_of_new_user) + ' ' + InputFieldsManager.ReturnStringFromTextBox(flat_of_new_user) + ' '; string password = InputFieldsManager.ReturnPasswordFromTextBox(user_new_password); string login = firstName.Substring(0, 1) + '.' + secondName; bool IsNewUserAdded = false; if (InstructorCheckBoxType.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddFaculty( new Faculty(firstName, secondName, phone, address, "Instructor"), login, password); } else if (librarianCheckBoxType.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddLibrarian( new Librarian(firstName, secondName, phone, address), login, password); } else if (studentCheckBoxType.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddStudent( new Student(firstName, secondName, phone, address), login, password); } else if (taCheckBoxType.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddFaculty( new Faculty(firstName, secondName, phone, address, "TA"), login, password); } else if (professorCheckBoxType.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddFaculty( new Faculty(firstName, secondName, phone, address, "Professor"), login, password); } else if (visitingProfessorCheckBoxType.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddGuest( new Guest(firstName, secondName, phone, address), login, password); } //if all checks good so open window if (IsNewUserAdded) { using (StreamWriter writer = new StreamWriter("id.txt")) { writer.Write(CredentialsManager.Authorize(login, password)); } } else { MessageBox.Show("Error! Can not create an account."); } } else { MessageBox.Show("Error! Invalid fields."); } this.Close(); }
private void keywords_of_book_TextChanged(object sender, TextChangedEventArgs e) { keywords_of_book.Text = InputFieldsManager.ReturnStringFromTextBox(keywords_of_book); }
private void TextBox_Edition_Changed(object sender, TextChangedEventArgs e) { edition_of_book.Text = InputFieldsManager.ReturnStringFromTextBox(edition_of_book); }
private void publisher_of_book_TextChanged(object sender, TextChangedEventArgs e) { publisher_of_book.Text = InputFieldsManager.ReturnStringFromTextBox(publisher_of_book); }
private void TextBox_titleChanged(object sender, TextChangedEventArgs e) { title_of_book.Text = InputFieldsManager.ReturnStringFromTextBox(title_of_book); }
private void Phone_TextChanged(object sender, TextChangedEventArgs e) { Phone.Text = InputFieldsManager.ReturnStringFromTextBox(Phone); }
private void Address_TextChanged(object sender, TextChangedEventArgs e) { Address.Text = InputFieldsManager.ReturnStringFromTextBox(Address); }
private void button_register_Click(object sender, RoutedEventArgs e) { if (textBox_name.Text != null && textBox_last_name.Text != null && textBox_phone_number.Text != null && textBox_Address_town.Text != null && textBox_Address_street.Text != null && textBox_Address_building.Text != null && textBox_Address_flat.Text != null && InputFieldsManager.CheckPasswordValidity(passwordBox_registration)) { string firstName = InputFieldsManager.ReturnStringFromTextBox(textBox_name), secondName = InputFieldsManager.ReturnStringFromTextBox(textBox_last_name), phone = InputFieldsManager.ReturnStringFromTextBox(textBox_phone_number), address = InputFieldsManager.ReturnStringFromTextBox(textBox_Address_town) + ' ' + InputFieldsManager.ReturnStringFromTextBox(textBox_Address_street) + ' ' + InputFieldsManager.ReturnStringFromTextBox(textBox_Address_building) + ' ' + InputFieldsManager.ReturnStringFromTextBox(textBox_Address_flat) + ' '; string password = InputFieldsManager.ReturnPasswordFromTextBox(passwordBox_registration); string login = firstName.Substring(0, 1) + '.' + secondName; bool IsNewUserAdded = false; if (professor_type.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddFaculty( new Faculty(firstName, secondName, phone, address, Faculty.PROFESSOR_SUBTYPE), login, password); } else if (VP_professor_type.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddGuest( new Guest(firstName, secondName, phone, address), login, password); } else if (TA_type.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddFaculty( new Faculty(firstName, secondName, phone, address, Faculty.TA_SUBTYPE), login, password); } else if (instructor_type.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddFaculty( new Faculty(firstName, secondName, phone, address, Faculty.INSTRUCTOR_SUBTYPE), login, password); } else if (student_type.IsChecked == true) { IsNewUserAdded = LibrarianDataManager.AddStudent( new Student(firstName, secondName, phone, address), login, password); } //if all checks good so open window if (IsNewUserAdded) { WorkWindow workWindow = new WorkWindow(CredentialsManager.Authorize(login, password)); GoToWork(workWindow); } else { MessageBox.Show("Error! Can not create an account."); } } else { MessageBox.Show("Error! Invalid fields."); } }