コード例 #1
0
        private void btnSil_Click(object sender, EventArgs e)
        {
            DialogResult cvp = MessageBox.Show("Kayıt Silinecek. Eminminisiniz?", "Silme Onayı", MessageBoxButtons.YesNo, MessageBoxIcon.Question);


            if (cvp == DialogResult.Yes)
            {
                HavaalaniBL hbl = new HavaalaniBL();
                if (hbl.HavaalaniSil(id_havaalani))
                {
                    MessageBox.Show("Silme Başarılı!");
                    Temizle();
                }
                else
                {
                    MessageBox.Show("Silme hatalı!");
                }
                hbl.Dispose();
            }
            else
            {
                MessageBox.Show("İşlem İptal Edildi!");
                Temizle();
            }
        }
コード例 #2
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            HavaalaniBL hbl = new HavaalaniBL();

            foreach (DataRow item in dt.Rows)
            {
                Havaalani h = new Havaalani();
                if (item.RowState != DataRowState.Deleted)
                {
                    h.Id_Yer  = item[0].ToString();
                    h.Yer_Adi = item[2].ToString();
                }

                switch (item.RowState)
                {
                case DataRowState.Added:
                    hbl.HavaalaniKaydet(h);
                    MessageBox.Show("Eklendi");
                    break;

                case DataRowState.Deleted:
                    hbl.HavaalaniSil((string)(item[0, DataRowVersion.Original]));
                    MessageBox.Show("Silindi");
                    break;

                case DataRowState.Modified:
                    h.Id_Yer = item[0].ToString();
                    hbl.HavaalaniGuncelle(h);
                    MessageBox.Show("Guncellendi");
                    break;

                default:
                    break;
                }
            }
        }