Пример #1
0
        private void JO_Btn_Update_Click(object sender, EventArgs e)
        {
            Author oldAuthor = (Author)JO_ListBox_Authors.SelectedItem;
            Author newAuthor = new Author();

            newAuthor.Name     = JO_TextBox_Author.Text;
            newAuthor.YearBorn = JO_TxtBoxYearBorn.Text;

            BiblioQueries.UpdateAuthor(oldAuthor.AuthorID, newAuthor, connection);
            SyncAuthors();
        }
Пример #2
0
        private void JO_DataGrid_Authors_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int rowIndex = e.RowIndex;

            Author author = new Author();

            author.AuthorID = (int)JO_DataGrid_Authors.Rows[rowIndex].Cells["AuthorID"].Value;

            if (JO_DataGrid_Authors.Rows[rowIndex].Cells["Name"].Value == null)
            {
                BiblioQueries.DeleteAuthor(author.AuthorID, connection);
                RefreshGrid();
            }
            else
            {
                author.Name     = JO_DataGrid_Authors.Rows[rowIndex].Cells["Name"].Value.ToString();
                author.YearBorn = JO_DataGrid_Authors.Rows[rowIndex].Cells["Year Born"].Value.ToString();
                BiblioQueries.UpdateAuthor(author.AuthorID, author, connection);
            }
        }