private void btn_sil_Click(object sender, EventArgs e) { if (lst_personeller.SelectedIndex != -1) { pnl_uyari.Visible = false; string[] adsoyad = lst_personeller.SelectedItem.ToString().Split(' '); for (int i = 0; i < prsnl.Count; i++) { if (prsnl[i][1] == adsoyad[0] && prsnl[i][2] == adsoyad[1]) { pID = prsnl[i][0]; break; } } if (pID != "") { List <string> gelenbilgi = new List <string>() { pID }; for (int j = 0; j < odalar.Count; j++) { List <string> odaKey = new List <string>() { odalar[j][0] }; dbo.Update(sqlConnectionString.odaGuncelle3, sqlConnectionString.odaGuncelleParam3, odaKey); } odalariGetir(pID); for (int i = 0; i < kullanicilar.Count; i++) { if (kullanicilar[i][1] == pID) { dbo.Delete(sqlConnectionString.kullanciSil, sqlConnectionString.kullaniciSilParametreler, gelenbilgi); break; } } dbo.Delete(sqlConnectionString.personelSil, sqlConnectionString.personelSilParametreler, gelenbilgi); panel_uyari(true); lbl_uyari.Text = "Personel silindi."; pnl_uyari.Visible = true; lst_personeller.Items.Clear(); personelGetir(); txt_ad.Text = ""; txt_soyad.Text = ""; lst_odalar.Items.Clear(); if (Convert.ToInt16(pID) == kullaniciID) { login login1 = new login(); login1.Show(); this.Hide(); } else { pID = ""; } } else { panel_uyari(false); lbl_uyari.Text = "Personel silinemedi."; pnl_uyari.Visible = true; } } else { panel_uyari(false); lbl_uyari.Text = "Personel seçilmedi."; pnl_uyari.Visible = true; } }