/// <summary> /// Заполнение таблицы /// </summary> public void LoadDataToGrid(string status, string searchBoxText) { try { library = BooksDictionary.Load(libraryPath); dataGrid.Rows.Clear(); foreach (KeyValuePair <string, ILiterature> book in library) { if (statusComboBox.Text == "Показать все книги") { LoadDataLogic(book); } if (book.Value.status == statusComboBox.Text) { LoadDataLogic(book); } } dataGrid.Sort(dataGrid.Columns[0], ListSortDirection.Ascending); } catch { AddEditBook addBook = new AddEditBook(library, "new"); addBook.Owner = this; addBook.ShowDialog(); //ErrorMessage(true, exception.ToString()); } }
/// <summary> /// Открывает форму добавления книги /// </summary> private void OpenAddForm() { try { AddEditBook addBook = new AddEditBook(library); addBook.Owner = this; addBook.ShowDialog(); } catch (Exception exception) { ErrorMessage(true, exception.ToString()); } }
/// <summary> /// Открывает форму редактирования формы /// </summary> private void OpenEditForm() { try { ILiterature book = library.FindBook((string)dataGrid.CurrentRow.Cells[0].Value); AddEditBook addBook = new AddEditBook(library, book); addBook.Owner = this; addBook.ShowDialog(); } catch (Exception exception) { ErrorMessage(true, exception.ToString()); } }