public string hesapNoUret() { Baglanti t = new Baglanti(); NpgsqlCommand hesapno = new NpgsqlCommand("select max(hesapno) from hesap", t.getBaglanti()); NpgsqlDataReader dr = hesapno.ExecuteReader(); dr.Read(); string sonHesapno; sonHesapno = dr[0].ToString(); char[] dizi = sonHesapno.ToCharArray(); if (dizi[14] == '9') { dizi[14] = '0'; if (dizi[13] == '9') { dizi[13] = '0'; if (dizi[12] == '9') { dizi[12] = '0'; if (dizi[11] == '9') { dizi[11] = '0'; dizi[10]++; } else { dizi[11]++; } } else { dizi[12]++; } } else { dizi[13]++; } } else { dizi[14]++; } string k = new string(dizi); t.getBaglanti().Close(); return(k); }
public int musterinoUret() { Baglanti t = new Baglanti(); NpgsqlCommand musterino = new NpgsqlCommand("select max(musteri_no) from musteri", t.getBaglanti()); NpgsqlDataReader dr = musterino.ExecuteReader(); dr.Read(); int sonNumara; sonNumara = dr[0].GetHashCode(); sonNumara++; t.getBaglanti().Close(); return(sonNumara); }
public void Hesap_Load(object sender, EventArgs e) { Baglanti t = new Baglanti(); NpgsqlCommand cmdveri = new NpgsqlCommand("Select * from hesap", t.getBaglanti()); NpgsqlDataReader dr = cmdveri.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; btn_save.Visible = false; txt_iban.ReadOnly = true; txt_hesapno.ReadOnly = true; txt_tarih.ReadOnly = true; txt_tarih.Text = DateTime.Now.ToString(); }
public void BankaKartıBilgileri_Load(object sender, EventArgs e) { t = new Baglanti(); btn_save.Visible = false; NpgsqlCommand cmdveri = new NpgsqlCommand("Select * from bankakartı", t.getBaglanti()); NpgsqlDataReader dr = cmdveri.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; txt_sonkullanmatarihi.ReadOnly = true; txt_cvv.ReadOnly = true; txt_bakiye.ReadOnly = true; }
public bool hesapSayısıKontrol() { Baglanti t = new Baglanti(); NpgsqlCommand mnBilgi = new NpgsqlCommand("select count(hesapno) from hesap where musteri_no ='" + txt_musterino.Text + "'", t.getBaglanti()); NpgsqlDataReader dr = mnBilgi.ExecuteReader(); dr.Read(); if (dr[0].ToString() == "1") { return(true); } else { return(false); } }
public bool musteriNoKontrol() { Baglanti t = new Baglanti(); NpgsqlCommand mnBilgi = new NpgsqlCommand("Select * from musteri where musteri_no='" + txt_musterino.Text + "'", t.getBaglanti()); NpgsqlDataReader dr = mnBilgi.ExecuteReader(); if (dr.Read()) { return(true); } else { MessageBox.Show("Böyle Bir Müşteri Numarası Bulunmamaktadır"); t.getBaglanti().Close(); return(false); } }
public bool idKontrol() { Baglanti t = new Baglanti(); NpgsqlCommand mnBilgi = new NpgsqlCommand("Select * from alısveris where av_id='" + txt_av_id.Text + "'", t.getBaglanti()); NpgsqlDataReader dr = mnBilgi.ExecuteReader(); if (dr.Read()) { return(true); } else { MessageBox.Show("Böyle Bir ID Bulunmamaktadır"); t.getBaglanti().Close(); return(false); } }
public void Alısveris_Load(object sender, EventArgs e) { t = new Baglanti(); NpgsqlCommand cmdveri = new NpgsqlCommand("Select * from alısveris", t.getBaglanti()); NpgsqlDataReader dr = cmdveri.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; txt_av_id.ReadOnly = true; txt_urunkodu.ReadOnly = false; txt_urunadi.ReadOnly = false; txt_urunfiyati.ReadOnly = false; txt_kartno.ReadOnly = false; txt_sktarihi.ReadOnly = false; txt_cvv.ReadOnly = false; }
public bool sifreKontrol() { Baglanti t = new Baglanti(); NpgsqlCommand tcBilgi = new NpgsqlCommand("Select sifre from musteri where tcno='" + txt_tcno.Text + "'", t.getBaglanti()); NpgsqlDataReader dr = tcBilgi.ExecuteReader(); dr.Read(); string sifre = dr[0].ToString(); if (sifre == txt_sifre.Text) { return(true); } else { MessageBox.Show("Girilen Şifre Yanlış"); return(false); } }
public string hesapNoCek() { Baglanti t = new Baglanti(); NpgsqlCommand hesapno = new NpgsqlCommand("select hesapno from hesap where musteri_no='" + txt_musterino.Text + "'", t.getBaglanti()); NpgsqlDataReader dr = hesapno.ExecuteReader(); dr.Read(); if (dr.HasRows == false) { MessageBox.Show("Bu Müşteri Numarasına Tanımlı Hesap Bulunamamaktadır"); return(null); } else { string sonHesapNo = dr[0].ToString(); t.getBaglanti().Close(); return(sonHesapNo); } }
public int bakiyeSorgu() { form1 = new Form1(); t = new Baglanti(); hesap = new Hesap(); form1.txt_musterino.Text = txt_musterino.Text; hesap.txt_musterino.Text = txt_musterino.Text; hesap.txt_hesapno.Text = txt_hesapno.Text; if (hesap.hesapSayısıKontrol()) { txt_hesapno.ReadOnly = true; txt_hesapno.Text = form1.hesapNoCek(); NpgsqlCommand bakiyeSorgu = new NpgsqlCommand("select hesapbakiye from hesap where musteri_no='" + txt_musterino.Text + "'", t.getBaglanti()); NpgsqlDataReader dr = bakiyeSorgu.ExecuteReader(); dr.Read(); int bakiye; bakiye = dr[0].GetHashCode(); t.getBaglanti().Close(); return(bakiye); } else { if (txt_hesapno.Text != "") { NpgsqlCommand bakiyeSorgu = new NpgsqlCommand("select hesapbakiye from hesap where musteri_no='" + txt_musterino.Text + "' and hesapno='" + txt_hesapno.Text + "'", t.getBaglanti()); NpgsqlDataReader dr = bakiyeSorgu.ExecuteReader(); dr.Read(); int bakiye; bakiye = dr[0].GetHashCode(); t.getBaglanti().Close(); return(bakiye); } else { MessageBox.Show("Lütfen Hesap Numarası Giriniz"); btn_newkart.Visible = true; txt_sonkullanmatarihi.ReadOnly = true; txt_cvv.ReadOnly = true; return(0); } } }
private void btn_sil_Click(object sender, EventArgs e) { if (txt_musterino.Text == "") { MessageBox.Show("Müşteri Numarası Giriniz"); } else { Baglanti t = new Baglanti(); NpgsqlCommand cmdsil = new NpgsqlCommand("delete from hesap where musteri_no='" + txt_musterino.Text + "'", t.getBaglanti()); cmdsil.ExecuteNonQuery(); MessageBox.Show("SİLME İŞLEMİ BAŞARILI"); } txt_musterino.Text = ""; txt_hesapno.Text = ""; txt_iban.Text = ""; txt_bakiye.Text = ""; txt_tarih.Text = ""; Hesap_Load(sender, e); }
private void btn_sil_Click(object sender, EventArgs e) { if (musteriNoKontrol()) { if (txt_musterino.Text == "") { MessageBox.Show("Müşteri Numarası Giriniz"); } else { Form1 form1 = new Form1(); form1.txt_musterino.Text = txt_musterino.Text; if (form1.hesapSayısıKontrol() == true) { Baglanti t = new Baglanti(); NpgsqlCommand cmdsil = new NpgsqlCommand("delete from hesap where musteri_no='" + txt_musterino.Text + "'", t.getBaglanti()); cmdsil.ExecuteNonQuery(); MessageBox.Show("SİLME İŞLEMİ BAŞARILI"); } else { if (txt_hesapno.Text != "") { Baglanti t = new Baglanti(); NpgsqlCommand cmdsil = new NpgsqlCommand("delete from hesap where hesapno='" + txt_hesapno.Text + "'", t.getBaglanti()); cmdsil.ExecuteNonQuery(); MessageBox.Show("SİLME İŞLEMİ BAŞARILI"); } else { MessageBox.Show("Lütfen Kullanıcıya Ait Silmek İstediğiniz Hesabın Numarasını Giriniz"); } } } } txt_hesapno.Text = ""; txt_iban.Text = ""; txt_bakiye.Text = ""; txt_tarih.Text = ""; Hesap_Load(sender, e); }
private void btn_iptal_Click(object sender, EventArgs e) { if (txt_av_id.Text == "") { MessageBox.Show("Lütfen Silmek İstediğiniz Alışveriş ID'sini Giriniz"); } else { NpgsqlCommand alısveris = new NpgsqlCommand("Select * from alısveris where av_id='" + txt_av_id.Text + "'", t.getBaglanti()); NpgsqlDataReader dr = alısveris.ExecuteReader(); dr.Read(); int fiyat = dr[3].GetHashCode(); t.getBaglanti().Close(); t = new Baglanti(); NpgsqlCommand kartBakiyeGuncelle = new NpgsqlCommand("update bankakartı set hesapbakiye=hesapbakiye + '" + fiyat + "' where kart_no=(select kart_no from alısveris where av_id='" + txt_av_id.Text + "')", t.getBaglanti()); kartBakiyeGuncelle.ExecuteNonQuery(); NpgsqlCommand hesapBakiyeGuncelle = new NpgsqlCommand(" update hesap set hesapbakiye=hesapbakiye + '" + fiyat + "' where hesapno=(select hesapno from bankakartı where kart_no=(select kart_no from alısveris where av_id='" + txt_av_id.Text + "'))", t.getBaglanti()); hesapBakiyeGuncelle.ExecuteNonQuery(); btn_sil_Click(sender, e); } }
public void button1_Click(object sender, EventArgs e)// hesap bilgisi butonu { Baglanti t = new Baglanti(); if (txt_musterino.Text == "") { MessageBox.Show("Lütfen Hesap Bilgilerini Görmek İstediğiniz Müşteri Numarasını Giriniz"); } else { Hesap hesap = new Hesap(); if (musteriNoKontrol()) { if (hesapNoCek() != null) { hesap.txt_musterino.Text = txt_musterino.Text; hesap.txt_musterino.ReadOnly = true; if (hesapSayısıKontrol() == true) { hesap.txt_hesapno.ReadOnly = true; hesap.txt_iban.ReadOnly = true; hesap.txt_hesapno.Text = hesapNoCek(); hesap.txt_iban.Text = ibanNoCek(); hesap.btn_ekle.Visible = false; hesap.ShowDialog(); } else { hesap.txt_hesapno.ReadOnly = false; hesap.txt_iban.ReadOnly = false; hesap.txt_hesapno.Text = ""; hesap.txt_iban.Text = ""; hesap.btn_ekle.Visible = false; hesap.ShowDialog(); } } } } }
private void Form1_Load(object sender, EventArgs e) { t = new Baglanti(); btn_save.Visible = false; btn_ekle.Visible = false; NpgsqlCommand cmdveri = new NpgsqlCommand("Select * from musteri", t.getBaglanti()); NpgsqlDataReader dr = cmdveri.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; txt_musterino.ReadOnly = false; txt_tcno.ReadOnly = true; txt_ad.ReadOnly = true; txt_soyad.ReadOnly = true; txt_telno.ReadOnly = true; txt_email.ReadOnly = true; txt_adres.ReadOnly = true; txt_sifre.ReadOnly = true; }
public void btn_ekle_Click(object sender, EventArgs e) { Baglanti t = new Baglanti(); if (txt_bakiye.Text != "") { NpgsqlCommand cmdekle = new NpgsqlCommand("insert into hesap(musteri_no,hesapno,iban,hesapbakiye,hesapacımtarihi) values ('" + txt_musterino.Text + "','" + hesapNoUret() + "','" + ibanUret() + "','" + txt_bakiye.Text + "','" + txt_tarih.Text + "')", t.getBaglanti()); cmdekle.ExecuteNonQuery(); MessageBox.Show("EKLEME İŞLEMİ BAŞARILI"); } else { MessageBox.Show("EKSİK BİLGİ GİRDİNİZ"); } txt_musterino.Text = ""; txt_hesapno.Text = ""; txt_iban.Text = ""; txt_bakiye.Text = ""; txt_tarih.Text = ""; Hesap_Load(sender, e); }
private void btn_git_Click(object sender, EventArgs e) { Baglanti t = new Baglanti(); Hesap hesap = new Hesap(); Form1 form1 = new Form1(); hesap.txt_musterino.Text = txt_musterino.Text; form1.txt_musterino.Text = txt_musterino.Text; if (txt_musterino.Text != "") { if (hesap.musteriNoKontrol()) { if (form1.hesapSayısıKontrol() == true) { form1.txt_musterino.Text = txt_musterino.Text; hesap.txt_hesapno.Text = form1.hesapNoCek(); hesap.txt_iban.Text = form1.ibanNoCek(); hesap.txt_musterino.ReadOnly = true; hesap.txt_hesapno.ReadOnly = true; hesap.txt_iban.ReadOnly = true; hesap.Hesap_Load(sender, e); hesap.ShowDialog(); } else { form1.txt_musterino.Text = txt_musterino.Text; hesap.txt_musterino.ReadOnly = true; hesap.txt_hesapno.Text = ""; hesap.txt_iban.Text = ""; hesap.Hesap_Load(sender, e); hesap.ShowDialog(); } } } else { MessageBox.Show("Lütfen Müşteri Numarası Giriniz"); } }
private void btn_ekle_Click(object sender, EventArgs e) { Baglanti t = new Baglanti(); t.getBaglanti(); if (txt_urunkodu.Text != "" && txt_urunadi.Text != "" && txt_urunfiyati.Text != "" && txt_kartno.Text != "" && txt_sktarihi.Text != "" && txt_cvv.Text != "") { if (bakiyeKontrol() == true) { if (cvvCek() == txt_cvv.Text && bankaKartSKTCek() == txt_sktarihi.Text) { NpgsqlCommand cmdekle = new NpgsqlCommand("insert into alısveris(urunkodu,urunadi,urunfiyati,kart_no,sonkullanmatarihi,cvv) values ('" + txt_urunkodu.Text + "','" + txt_urunadi.Text + "','" + txt_urunfiyati.Text + "','" + txt_kartno.Text + "','" + txt_sktarihi.Text + "','" + txt_cvv.Text + "')", t.getBaglanti()); cmdekle.ExecuteNonQuery(); MessageBox.Show("Alışveriş Bilgisi Eklendi"); bakiyeGuncelle(); } else { MessageBox.Show("Girilen CVV veya Son Kullanma Tarihi Hatalı"); } } else { MessageBox.Show("Yetersiz Bakiye"); } } else { MessageBox.Show("EKSİK BİLGİ GİRDİNİZ"); } txt_urunkodu.Text = ""; txt_urunadi.Text = ""; txt_urunfiyati.Text = ""; txt_kartno.Text = ""; txt_sktarihi.Text = ""; txt_cvv.Text = ""; Alısveris_Load(sender, e); }
private void btn_ekle_Click_1(object sender, EventArgs e) { t = new Baglanti(); form1 = new Form1(); form1.txt_musterino.Text = txt_musterino.Text; if (txt_musterino.Text != "" && txt_kartno.Text != "") { if (txt_musterino.Text != "" && txt_kartno.Text != "" && txt_donemborcu.Text != "" && txt_asgaritutar.Text != "" && txt_hesapkesimtarihi.Text != "" && txt_sonodemetarihi.Text != "") { ; } { if (form1.musteriNoKontrol()) { NpgsqlCommand cmdekle = new NpgsqlCommand("insert into fatura(musteri_no,kart_no,donemborcu,asgaritutar,hesapkesimtarihi,sonodemetarihi) values ('" + txt_musterino.Text + "','" + txt_kartno.Text + "','" + txt_donemborcu.Text + "','" + txt_asgaritutar.Text + "','" + txt_hesapkesimtarihi.Text + "','" + txt_sonodemetarihi.Text + "')", t.getBaglanti()); cmdekle.ExecuteNonQuery(); MessageBox.Show("Fatura Eklendi"); txt_musterino.Text = ""; txt_kartno.Text = ""; txt_donemborcu.Text = ""; txt_asgaritutar.Text = ""; txt_hesapkesimtarihi.Text = ""; txt_sonodemetarihi.Text = ""; Fatura_Load(sender, e); } else { MessageBox.Show("EKSİK BİLGİ GİRDİNİZ"); } } } else { MessageBox.Show("Müşteri ve Kart Numarası Giriniz"); } }
private void btn_ekle_Click(object sender, EventArgs e) { Baglanti t = new Baglanti(); t.getBaglanti(); if (txt_tcno.Text != "" && txt_ad.Text != "" && txt_soyad.Text != "" && txt_telno.Text != "" && txt_email.Text != "" && txt_adres.Text != "" && txt_sifre.Text != "") { NpgsqlCommand cmdekle = new NpgsqlCommand("insert into musteri(musteri_no,tcno,adi,soyadi,telno,email,adres,sifre) values ('" + txt_musterino.Text + "','" + txt_tcno.Text + "','" + txt_ad.Text + "','" + txt_soyad.Text + "','" + txt_telno.Text + "','" + txt_email.Text + "','" + txt_adres.Text + "','" + txt_sifre.Text + "')", t.getBaglanti()); cmdekle.ExecuteNonQuery(); Hesap hesap = new Hesap(); hesap.txt_musterino.Text = txt_musterino.Text; hesap.txt_hesapno.Text = hesap.hesapNoUret(); hesap.txt_iban.Text = hesap.ibanUret(); hesap.txt_iban.ReadOnly = true; hesap.txt_hesapno.ReadOnly = true; hesap.txt_musterino.ReadOnly = true; hesap.ShowDialog(); btn_yenimusteri.Visible = true; } else { MessageBox.Show("EKSİK BİLGİ GİRDİNİZ"); btn_yenimusteri.Visible = true; } txt_musterino.Text = ""; txt_tcno.Text = ""; txt_ad.Text = ""; txt_soyad.Text = ""; txt_telno.Text = ""; txt_email.Text = ""; txt_adres.Text = ""; txt_sifre.Text = ""; Form1_Load(sender, e); }