Beispiel #1
0
        private void button_edit_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedCells.Count < 1)
            {
                return;
            }

            int row           = dataGridView1.SelectedCells[0].RowIndex;
            var currentAuthor = new Author
            {
                Id    = new Id(dataGridView1.Rows[row].Cells[0].Value.ToString()),
                Name  = dataGridView1.Rows[row].Cells[1].Value as string,
                Born  = dataGridView1.Rows[row].Cells[2].Value as string,
                Dead  = dataGridView1.Rows[row].Cells[3].Value as string,
                Notes = dataGridView1.Rows[row].Cells[4].Value as string,
            };

            var fe = new FormEditAuthor(currentAuthor);

            if (fe.ShowDialog(this) == DialogResult.OK)
            {
                m_DBService.InsertOrUpdate(fe.Author);

                LoadAuthors();
            }
        }
Beispiel #2
0
        private void button_new_Click(object sender, EventArgs e)
        {
            var fe = new FormEditAuthor();

            fe.ShowDialog();

            if (fe.Author.Id.IsNull)
            {
                return;
            }

            m_DBService.InsertOrUpdate(fe.Author);

            LoadAuthors();
        }