Beispiel #1
0
        private void btnEditBook_Click(object sender, EventArgs e)
        {
            if (dgvBooks.Rows.Count == 0)
            {
                return;
            }

            var selectedRow = dgvBooks.SelectedRows[0];

            if (selectedRow == null)
            {
                return;
            }

            var bookId = int.Parse(selectedRow.Cells[0].Value.ToString());

            using (var updateBookForm = new InsertOrUpdateBookForm(bookId)) {
                updateBookForm.ShowDialog(this);

                if (updateBookForm.DialogResult == DialogResult.OK)
                {
                    ReloadBooks();
                }
            }
        }
Beispiel #2
0
        private void btnNewBook_Click(object sender, EventArgs e)
        {
            using (var insertBookForm = new InsertOrUpdateBookForm()) {
                insertBookForm.ShowDialog(this);

                if (insertBookForm.DialogResult == DialogResult.OK)
                {
                    ReloadBooks();
                }
            }
        }