private void deleteButtonGanres_Click(object sender, EventArgs e) { try { int id = (int)dGVGanres.CurrentRow.Cells["gidDataGridViewTextBoxColumn"].Value; global::System.Nullable <int> g_count = (int)QTAdapter.CountG_idInSongGanre(id); if (g_count == 0) { ganresBindingSource.RemoveCurrent(); } else { MessageBox.Show("Error. The deleting is impossible! The ganre is connected to songs!", "Error of deleting ganre"); } } catch { MessageBox.Show("Error of deleting information", "Error"); } }
private void deleteButtonCountries_Click(object sender, EventArgs e) { try { int id = (int)dGVCountries.CurrentRow.Cells["cidDataGridViewTextBoxColumn"].Value; global::System.Nullable <int> c_count = (int)QTAdapter.CountC_idInArtists(id); if (c_count == 0) { countriesBindingSource.RemoveCurrent(); } else { MessageBox.Show("Error. The deleting is impossible! The country has artists!", "Error of deleting album"); } } catch { MessageBox.Show("Error of deleting information", "Error"); } }
private void deleteButtonAlbum_Click(object sender, EventArgs e) { try { int id = (int)dGVAlbums.CurrentRow.Cells["aLidDataGridViewTextBoxColumn"].Value; //MessageBox.Show(id.ToString()); global::System.Nullable <int> al_count = QTAdapter.CountAL_idInSongs(id); //MessageBox.Show(a_count.ToString()); if (al_count == 0) { albumsBindingSource.RemoveCurrent(); } else { MessageBox.Show("Error. The deleting is impossible! The album has songs!", "Error of deleting album"); } } catch { MessageBox.Show("Error of deleting information", "Error"); } }
private void deleteButtonArtist_Click(object sender, EventArgs e) { try { int id = (int)dGVArtists.CurrentRow.Cells["aidDataGridViewTextBoxColumn"].Value; //MessageBox.Show(id.ToString()); global::System.Nullable <int> a_count = QTAdapter.CountA_idInAlbums(id); //MessageBox.Show(a_count.ToString()); if (a_count == 0) { global::System.Nullable <int> shouldDelete = artistPlayerTableAdapter.NeedDelete(id); if (shouldDelete > 0) { DialogResult res = MessageBox.Show("Are you sure, you want to delete data, it will be impossible to restore data!", "Warning!", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { artistPlayerTableAdapter.DeleteByArt(id); artistsBindingSource.RemoveCurrent(); artistsTableAdapter.Update(dSMusic.Artists); } } else { artistsBindingSource.RemoveCurrent(); } } else { MessageBox.Show("Error. The deleting is impossible! The artist has albums!", "Error of deleting artist"); } } catch { MessageBox.Show("Error of deleting information", "Error"); } }