//Kitap Güncellemek için Kitap Getir private void btnKitapGetir_Click(object sender, EventArgs e) { Kitap kitap = new Kitap(); Kitap tmpKitap = new Kitap(); if (txtKitapNoGuncelleme.Text == "") { MessageBox.Show("Lütfen bir kitap numarası giriniz!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { kitap.KITAP_NO = Convert.ToInt32(txtKitapNoGuncelleme.Text); KitapBLL bll = new KitapBLL(); try { kitap = bll.KitapAraNo(kitap); txtAdGuncelle.Text = kitap.KITAP_ADI; txtYazarGuncelle.Text = kitap.KITAP_YAZAR; txtYayineviGuncelle.Text = kitap.KITAP_YAYINEVI; txtBasimYiliGuncelle.Text = kitap.BASIM_YILI; txtSayfaGuncelle.Text = kitap.SAYFA_SAYISI; comboTurGuncelle.SelectedItem = kitap.TUR; if (kitap.KITAP_ADI == null) { MessageBox.Show("Aradığınız kitap bulunamadı!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //Bulunamaz ise Güncelle butonu pasif hale geliyor btnGuncelle.Enabled = false; btnGuncelle.BackColor = Color.Gray; btnGuncelle.ForeColor = Color.DarkGray; btnGuncelle.FlatAppearance.BorderColor = Color.DarkGray; } else { //Bulunur ise Güncelle butonu aktif hale geliyor btnGuncelle.Enabled = true; btnGuncelle.BackColor = Color.Honeydew; btnGuncelle.ForeColor = Color.DarkGreen; btnGuncelle.FlatAppearance.BorderColor = Color.DarkGreen; } } catch (Exception ex) { MessageBox.Show("Lütfen bilgileri kontrol ediniz!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
//Kitap Silmek için Ara private void btnAraSil_Click(object sender, EventArgs e) { try { Kitap kitap = new Kitap(); kitap.KITAP_NO = Convert.ToInt32(txtKitapNoSil.Text); KitapBLL bll = new KitapBLL(); List <Kitap> kitapListe = new List <Kitap>(); kitap = bll.KitapAraNo(kitap); kitapListe.Add(kitap); if (kitap.KITAP_ADI == null) { MessageBox.Show("Aradığınız kitap bulunamadı!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //Bulunamaz ise Sil butonu pasif hale geliyor btnSil.Enabled = false; btnSil.BackColor = Color.Gray; btnSil.ForeColor = Color.DarkGray; btnSil.FlatAppearance.BorderColor = Color.DarkGray; } else { //Bulunur ise Sil butonu aktif hale geliyor dataGridViewSil.DataSource = kitapListe; TabloDuzenle(dataGridViewSil); btnSil.Enabled = true; btnSil.BackColor = Color.MistyRose; btnSil.ForeColor = Color.Red; btnSil.FlatAppearance.BorderColor = Color.Red; } } catch (Exception ex) { MessageBox.Show("Lütfen bilgileri kontrol ediniz!", "Eksik Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }