private void silToolStripMenuItem_Click(object sender, EventArgs e) { try { int selected = dgvKullanicilar.SelectedRows.Count; if (selected > 0) { KullaniciAl(); if (kullanici.KullaniciID != 0) { if (!(_kullaniciBLL.KullaniciSil(kullanici.KullaniciID))) { throw new Exception("Kullanıcı silinemedi."); } } } else { throw new Exception("Lütfen bir kullanıcı seçiniz."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } FillList(); }
private void silToolStripMenuItem_Click(object sender, EventArgs e) { try { int selected = dgvKullanicilar.SelectedRows.Count; if (selected > 0) { KullaniciAl(); if (kullanici.KullaniciID != 0) { DialogResult result = MessageBox.Show($"{kullanici.Ad + " " + kullanici.Soyad} isimli kullanıcıyı silmek istediğinizden emin misiniz?", "Kullanıcı Sil", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { if (!(_kullaniciBLL.KullaniciSil(kullanici.KullaniciID))) { throw new Exception("Kullanıcı silinemedi."); } } } } else { throw new Exception("Lütfen bir kullanıcı seçiniz."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } FillList(); }