private void btnSil_Click(object sender, EventArgs e) { DialogResult cvp = MessageBox.Show("Silmek İstediğinize Emin misiniz?", "Silme Onayı!!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (cvp == DialogResult.No) { return; } TakimBL obl = new TakimBL(); try { if (obl.TakimSil(TAKIMID)) { MessageBox.Show("Silme İşlemi Başarılı"); } else { MessageBox.Show("Silme İşlemi Hatalı!"); } Temizle(); } catch (Exception) { throw; } finally { obl.Dispose(); } }
private void btnKaydet_Click(object sender, EventArgs e) { TakimBL tb = new TakimBL(); foreach (DataRow item in dt.Rows) { Takim tkm = new Takim(); if (item.RowState != DataRowState.Deleted) { tkm.TAKIMADI = item["TAKIMADI"].ToString(); tkm.EYALETADI = item["EYALETADI"].ToString(); tkm.Resim = item["RESIM"].ToString(); } switch (item.RowState) { case DataRowState.Added: tb.TakimEkle(tkm); break; case DataRowState.Deleted: tb.TakimSil(Convert.ToInt32(item[0, DataRowVersion.Original])); break; case DataRowState.Modified: tkm.TAKIMID = (int)item["ID"]; tb.TakimGuncelle(tkm); break; default: break; } } }