private void btnSil_Click(object sender, EventArgs e) { if (MessageBox.Show("Seçili olan veriyi silmek istediğinize emin misiniz ?", "Uyarı", MessageBoxButtons.YesNo) == DialogResult.Yes) { string secilen = gridViewKullanici.GetFocusedRowCellValue(colKullaniciAdi).ToString(); Kullanici kullaniciEntity = new Kullanici(); kullaniciDAL.Delete(context, c => c.KullaniciAdi == secilen); kullaniciEntity.Id = -1; kullaniciDAL.Save(context); Guncelle(); } }
private void btnSil_Click(object sender, EventArgs e) { if (GridViewKullanici.RowCount.Equals(0)) { XtraMessageBox.Show("Silinecek Kayıt Bulunamadı."); } else { if (XtraMessageBox.Show("Seçili olan veriyi silmek istediğinize emin misiniz ?", "Uyarı", MessageBoxButtons.YesNo) == DialogResult.Yes) { secilen = Convert.ToInt32(GridViewKullanici.GetFocusedRowCellValue(colId)).ToString(); if (secilen.ToString() == "1") { XtraMessageBox.Show("Yönetici Kullanıcısını Silemezsiniz."); } else { kullaniciDal.Delete(context, c => c.KullaniciID.ToString() == secilen); kullaniciDal.Save(context); Guncelle(); } } } }