示例#1
0
文件: Ltr.cs 项目: PashokSy/Ltr
        /// <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());
            }
        }
示例#2
0
文件: Ltr.cs 项目: PashokSy/Ltr
 /// <summary>
 /// Открывает форму добавления книги
 /// </summary>
 private void OpenAddForm()
 {
     try
     {
         AddEditBook addBook = new AddEditBook(library);
         addBook.Owner = this;
         addBook.ShowDialog();
     }
     catch (Exception exception)
     {
         ErrorMessage(true, exception.ToString());
     }
 }
示例#3
0
文件: Ltr.cs 项目: PashokSy/Ltr
 /// <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());
     }
 }