private void Havayollari_Load(object sender, EventArgs e) { this.Top = 0; this.Left = 0; Havayolu h = new Havayolu(); h.HavayollariniGetir(lvHavayolları); }
private void btnDegistir_Click(object sender, EventArgs e) { if (txtHavayoluAdi.Text.Trim() != "" && txtUlkeAdi.Text.Trim() != "" && txtKisaltmasi.Text.Trim() != "") { Havayolu h = new Havayolu(); if (h.HavayoluVarMi(txtHavayoluAdi.Text, Convert.ToInt32(txtHavayoluKodu.Text), txtKisaltmasi.Text)) { MessageBox.Show("Havayolu firması zaten kayıtlı!"); txtHavayoluAdi.Focus(); } else { h.UlkeID = Convert.ToInt32(txtUlkeKodu.Text); h.HavayoluID = Convert.ToInt32(txtHavayoluKodu.Text); h.HavayoluAdi = txtHavayoluAdi.Text; h.Aciklama = txtAciklama.Text; h.Kisaltmasi = txtKisaltmasi.Text; if (h.HavayoluGuncelle(h)) { MessageBox.Show("Havayolu bilgileri güncellendi."); btnSil.Enabled = false; btnDegistir.Enabled = false; Temizle(); txtUlkeKodu.ReadOnly = true; txtAciklama.ReadOnly = true; txtUlkeAdi.ReadOnly = true; txtHavayoluKodu.ReadOnly = true; txtHavayoluAdi.ReadOnly = true; txtKisaltmasi.ReadOnly = true; h.HavayollariniGetir(lvHavayolları); } else { MessageBox.Show("Havayolu bilgileri güncellenemedi."); txtHavayoluAdi.Focus(); } } } else { MessageBox.Show("Havayolu adı, kısaltması ve ülke adı boş bırakılamaz."); } }
private void btnSil_Click(object sender, EventArgs e) { if (MessageBox.Show("Silmek istediğinizden emin misiniz?", "UYARI", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Havayolu h = new Havayolu(); if (h.HavayoluSil(Convert.ToInt32(txtHavayoluKodu.Text))) { MessageBox.Show("Havayolu Silindi."); h.HavayollariniGetir(lvHavayolları); Temizle(); btnSil.Enabled = false; btnDegistir.Enabled = false; txtUlkeKodu.ReadOnly = true; txtAciklama.ReadOnly = true; txtUlkeAdi.ReadOnly = true; txtHavayoluKodu.ReadOnly = true; txtHavayoluAdi.ReadOnly = true; txtKisaltmasi.ReadOnly = true; } } }
private void btnKaydet_Click(object sender, EventArgs e) { if (txtHavayoluAdi.Text.Trim() != "" && txtUlkeAdi.Text.Trim() != "" && txtKisaltmasi.Text.Trim() != "") { Havayolu h = new Havayolu(); if (h.HavayoluVarMi(txtHavayoluAdi.Text, txtKisaltmasi.Text)) { MessageBox.Show("Havayolu zaten kayıtlı!"); } else { h.Aciklama = txtAciklama.Text; h.UlkeID = Convert.ToInt32(txtUlkeKodu.Text); h.HavayoluAdi = txtHavayoluAdi.Text; h.FotografID = 5; h.Kisaltmasi = txtKisaltmasi.Text; if (h.HavayoluEkle(h)) { MessageBox.Show("Havayolu başarı ile eklendi."); h.HavayollariniGetir(lvHavayolları); Temizle(); btnKaydet.Enabled = false; txtAciklama.ReadOnly = true; txtHavayoluAdi.ReadOnly = true; } else { MessageBox.Show("Havayolu eklenemedi."); } } } else { MessageBox.Show("Havayolu adı, kısaltması ve ülke adı boş bırakılamaz."); } }
private void HavayoluSorgulama_Load(object sender, EventArgs e) { h.HavayollariniGetir(lvHavayollari); }