Exemplo n.º 1
0
        private void JO_Btn_Delete_Click(object sender, EventArgs e)
        {
            Author author = (Author)JO_ListBox_Authors.SelectedItem;

            //Sync authors list only when DeleteAuthor successfully deleted a record
            if (BiblioQueries.DeleteAuthor(author.AuthorID, connection) == true)
            {
                SyncAuthors();
            }
        }
Exemplo n.º 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);
            }
        }