private void btn_Sil_Click(object sender, EventArgs e) { frmAnasayfa frm = new frmAnasayfa(this); DialogResult cvp = MessageBox.Show("Kayıt Silinecek. Emin misiniz?", "Silme Onayı", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (cvp == DialogResult.Yes) { OgrenciBL obl = new OgrenciBL(); if (obl.OgrenciSil(ogrenciId)) { MessageBox.Show("Silme Başarılı!"); Temizle(); } else { MessageBox.Show("Silme hatalı!"); } obl.Dispose(); } else { MessageBox.Show("İşlem İptal Edildi"); Temizle(); } }
private void BtnSil_Click(object sender, EventArgs e) { try { DialogResult dialog = MessageBox.Show("Öğrenci ve Veli Bilgilerini Silmek İstediğinizden Emin Misiniz??", "UYARI", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.Yes) { Ogrenci o = new Ogrenci(); o.OgrenciId = Convert.ToInt32(txtogrenciIdGelen.Text); bool sonuc = OgrenciBL.OgrenciSil(o.OgrenciId); if (sonuc) { MessageBox.Show("Öğrenci ve Veli Silme İşlemi başarılı"); OgrenciListele(); Utility.CleanTextBoxes(grpOgrenciBilgileri.Controls); Utility.CleanTextBoxes(grpVeliBilgileri.Controls); pcbOgrenci.Image = Properties.Resources.indir; } else { MessageBox.Show("Öğrenci ve Veli İşlemiş Başarısız!!!"); } } } catch (Exception) { throw; } }
private void BtnKaydet_Click(object sender, EventArgs e) { OgrenciBL ob = new OgrenciBL(); foreach (DataRow item in dt.Rows) { Ogrenci o = new Ogrenci(); if (item.RowState != DataRowState.Deleted) { o.Ad = item[1].ToString(); o.Soyad = item[2].ToString(); o.Numara = Convert.ToInt32(item[3]); o.Sinifid = 1; } switch (item.RowState) { case DataRowState.Added: ob.Kaydet(o); break; case DataRowState.Deleted: ob.OgrenciSil(Convert.ToInt32(item[0, DataRowVersion.Original])); break; case DataRowState.Modified: o.Ogrenciid = Convert.ToInt32(item[0]); ob.Guncelle(o); break; default: break; } } }
private void btnKaydet_Click(object sender, EventArgs e) { OgrenciBL ob = new OgrenciBL(); foreach (DataRow item in dt.Rows) { Ogrenci ogr = new Ogrenci(); if (item.RowState != DataRowState.Deleted) { ogr.ad = item[1].ToString(); ogr.soyad = item[2].ToString(); // ogr.okulId 4 //bölümü 5 //e posta 6 ogr.tc = item[3].ToString(); ogr.anneAd = item[7].ToString(); ogr.anneSoyad = item[8].ToString(); ogr.babaAd = item[9].ToString(); ogr.babaSoyad = item[10].ToString(); //telefon?? } switch (item.RowState) { case DataRowState.Added: ob.Kaydet(ogr); break; case DataRowState.Deleted: ob.OgrenciSil(Convert.ToInt32(item[0, DataRowVersion.Original])); break; case DataRowState.Modified: ogr.ogrenciId = Convert.ToInt32(item[0]); ob.Guncelle(ogr); break; default: break; } } }
public ActionResult OgrenciSil(int?Id) { OgrenciBL.OgrenciSil(Convert.ToInt32(Id)); return(Redirect("/Home/Index")); }