private void btnDegistir_Click(object sender, EventArgs e) { cHavaAlani ha = new cHavaAlani(); ha.HavaAlaniID = Convert.ToInt32(txtHavaAlaniID.Text); ha.HavaAlaniAdi = txtNereden.Text; ha.Kita = txtKita.Text; ha.Ulke = txtUlke.Text; ha.Sehir = txtSehir.Text; bool sonuc = ha.HAlaniGuncelle(ha); if (txtNereden.Text != "" || txtKita.Text != "" || txtUlke.Text != "" || txtSehir.Text != "") { if (ha.HAlaniGuncelle(ha)) { MessageBox.Show("Havaalanı Bilgileri Değiştirildi."); Temizle(); btnDegistir.Enabled = false; btnSil.Enabled = false; ha.HavaalaniGetir(lvHAlani); } else { MessageBox.Show("Bilgiler Değiştirilemedi!"); } } else { MessageBox.Show("Tüm Boşlukları Doldurunuz."); } }
public bool HAlaniGuncelle(cHavaAlani ha) { bool sonuc = false; SqlConnection conn = new SqlConnection(gnl.connStr); SqlCommand comm = new SqlCommand("sp_HavaalaniGuncelle", conn); comm.CommandType = CommandType.StoredProcedure; comm.Parameters.Add("@ID", SqlDbType.Int).Value = ha._havaAlaniID; comm.Parameters.Add("@HAdi", SqlDbType.VarChar).Value = ha._havaAlaniAdi; comm.Parameters.Add("@Kita", SqlDbType.VarChar).Value = ha._kita; comm.Parameters.Add("@Ulke", SqlDbType.VarChar).Value = ha._ulke; comm.Parameters.Add("@Sehir", SqlDbType.VarChar).Value = ha._sehir; if (conn.State == ConnectionState.Closed) { conn.Open(); } try { sonuc = Convert.ToBoolean(comm.ExecuteNonQuery()); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(sonuc); }
private void btnKaydet_Click(object sender, EventArgs e) { cHavaAlani ha = new cHavaAlani(); ha.HavaAlaniAdi = txtNereden.Text; ha.Kita = txtKita.Text; ha.Ulke = txtUlke.Text; ha.Sehir = txtSehir.Text; bool sonuc = ha.HAlaniEkle(ha); if (txtNereden.Text != "" || txtKita.Text != "" || txtUlke.Text != "" || txtSehir.Text != "") { if (sonuc) { MessageBox.Show("Havaalanı Bilgileri Eklendi."); ha.HavaalaniGetir(lvHAlani); Temizle(); } else { MessageBox.Show("Bilgiler Eklenemedi."); } } else { MessageBox.Show("Tüm Boşlukları Doldurunuz."); } }
public void HavaAlaniBilgileriGetirNeredenByUlke(ComboBox liste, string ulke, string kita) { liste.Items.Clear(); SqlConnection conn = new SqlConnection(gnl.connStr); SqlCommand comm = new SqlCommand("select HavaAlaniID,HavaalaniAdi from HavaAlanlari where ulke=@ulke and kita=@kita ", conn); if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlDataReader dr; comm.Parameters.Add("@ulke", SqlDbType.VarChar).Value = ulke; comm.Parameters.Add("@kita", SqlDbType.VarChar).Value = kita; try { dr = comm.ExecuteReader(); while (dr.Read()) { cHavaAlani ha = new cHavaAlani(); ha._havaAlaniID = Convert.ToInt32(dr["HavaAlaniID"]); ha._havaAlaniAdi = dr["HavaalaniAdi"].ToString(); liste.Items.Add(ha); } } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } }
private void lvUlke_DoubleClick(object sender, EventArgs e) { lvHavaalani.Items.Clear(); cHavaAlani ha = new cHavaAlani(); ha.HAlaniGetirByKitaVeUlke(lvKita.SelectedItems[0].SubItems[0].Text, lvUlke.SelectedItems[0].SubItems[0].Text, lvHavaalani); }
private void cbNereye_SelectedIndexChanged(object sender, EventArgs e) { cHavaAlani ha = (cHavaAlani)cbNereye.SelectedItem; txtNereye.Text = ha.HavaAlaniAdi; txtNereyeID.Text = ha.HavaAlaniID.ToString(); ButonKontrol1(); }
private void cbNereye2_SelectedIndexChanged(object sender, EventArgs e) { if (cbNereye2.SelectedIndex >= 0) { cHavaAlani ha = (cHavaAlani)cbNereye2.SelectedItem; } ButonKontrol(); }
private void cbUlke4_SelectedIndexChanged(object sender, EventArgs e) { if (cbUlke4.SelectedIndex >= 0) { cHavaAlani ha = new cHavaAlani(); ha.HavaAlaniBilgileriGetirNeredenByUlke(cbNereye2, cbUlke4.SelectedItem.ToString(), cbKita4.SelectedItem.ToString()); cbNereye2.Enabled = true; } ButonKontrol(); }
private void cbUlke_SelectedIndexChanged(object sender, EventArgs e) { cHavaAlani ha = new cHavaAlani(); ha.HavaAlaniBilgileriGetirNeredenByUlke(cbNerden, cbUlke.SelectedItem.ToString(), cbKita.SelectedItem.ToString()); txtUlke.Text = cbUlke.SelectedItem.ToString(); txtNereden.Clear(); txtNeredenID.Clear(); cbNerden.Enabled = true; ButonKontrol1(); }
//------------------------------------------------------------------- private void cbKita3_SelectedIndexChanged(object sender, EventArgs e) { if (cbKita3.SelectedIndex >= 0) { cHavaAlani ha = new cHavaAlani(); ha.HavaAlaniBilgileriGetirNeredenByKita(cbUlke3, cbKita3.SelectedItem.ToString()); cbUlke3.Enabled = true; cbNereden2.Items.Clear(); cbNereden2.Enabled = false; } ButonKontrol(); }
private void frmHavaAlanları_Load(object sender, EventArgs e) { this.Top = 0; this.Left = 0; tabHavaalani.SelectedIndex = tabindex; cHavaAlani ha = new cHavaAlani(); ha.HavaalaniGetir(lvHAlani); tabHavaalani.SelectedIndex = tabindex; slblKullanici.Text = frmAnaSayfa.logmain.Adsoyad; ha.KitaGetir(lvKita); //ha.HAlaniGetir(lvHavaalani); }
private void cbKita2_SelectedIndexChanged(object sender, EventArgs e) { cHavaAlani ha = new cHavaAlani(); ha.HavaAlaniBilgileriGetirNeredenByKita(cbUlke2, cbKita2.SelectedItem.ToString()); txtKita2.Text = cbKita2.SelectedItem.ToString(); cbUlke2.Enabled = true; cbNereye.Items.Clear(); txtUlke2.Clear(); txtNereye.Clear(); txtNereyeID.Clear(); cbNereye.Enabled = false; ButonKontrol1(); }
private void btnSil_Click(object sender, EventArgs e) { cHavaAlani hava = new cHavaAlani(); if (MessageBox.Show("Silmek İstiyor musunuz?", "SİLİNSİN Mİ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { bool Sonuc = hava.HAlaniSil(Convert.ToInt32(txtHavaAlaniID.Text)); if (Sonuc) { MessageBox.Show("Havaalanı Bilgileri Silindi."); Temizle(); btnDegistir.Enabled = false; btnSil.Enabled = false; hava.HavaalaniGetir(lvHAlani); } else { MessageBox.Show("Bilgiler Silinemedi!"); } } }
public bool HAlaniEkle(cHavaAlani ha) { bool sonuc = false; SqlConnection conn = new SqlConnection(gnl.connStr); SqlCommand comm = new SqlCommand("sp_HavaalaniEkle", conn); comm.CommandType = CommandType.StoredProcedure; comm.Parameters.Add("@HAdi", SqlDbType.VarChar).Value = ha._havaAlaniAdi; comm.Parameters.Add("@Kita", SqlDbType.VarChar).Value = ha._kita; comm.Parameters.Add("@Ulke", SqlDbType.VarChar).Value = ha._ulke; comm.Parameters.Add("@Sehir", SqlDbType.VarChar).Value = ha._sehir; if (conn.State == ConnectionState.Closed) conn.Open(); try { sonuc = Convert.ToBoolean(comm.ExecuteNonQuery()); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return sonuc; }
public void HavaAlaniBilgileriGetirNeredenByUlke(ComboBox liste, string ulke, string kita) { liste.Items.Clear(); SqlConnection conn = new SqlConnection(gnl.connStr); SqlCommand comm = new SqlCommand("select HavaAlaniID,HavaalaniAdi from HavaAlanlari where ulke=@ulke and kita=@kita ", conn); if (conn.State == ConnectionState.Closed) conn.Open(); SqlDataReader dr; comm.Parameters.Add("@ulke", SqlDbType.VarChar).Value = ulke; comm.Parameters.Add("@kita", SqlDbType.VarChar).Value = kita; try { dr = comm.ExecuteReader(); while (dr.Read()) { cHavaAlani ha = new cHavaAlani(); ha._havaAlaniID = Convert.ToInt32(dr["HavaAlaniID"]); ha._havaAlaniAdi = dr["HavaalaniAdi"].ToString(); liste.Items.Add(ha); } } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } }