private void button4_Click(object sender, EventArgs e) { if (Single.Parse(textBox1.Text) == 0) { string kayit2 = "update HesaplarTBL set kullanilabilirBakiye=kullanilabilirBakiye+'" + textBox4.Text + "' where MusteriNo=" + textBox5.Text + "and hesapNo=" + textBox6.Text; string kayit = "update HesaplarTBL set bakiye=bakiye+'" + textBox4.Text + "' where MusteriNo=" + textBox5.Text + "and hesapNo=" + textBox6.Text; if (db.EkleSilGuncelle(kayit) > 0) { } if (db.EkleSilGuncelle(kayit2) > 0) { if (db.EkleSilGuncelle("Insert into IslemlerTBL values('" + textBox6.Text + "','" + 1 + "','" + textBox4.Text + "','" + dateTimePicker2.Text + "')") > 0) { MessageBox.Show("Bakiye Eklendi"); } // MessageBox.Show("islemler Hesap Açıldı"); textBox2.Text = (Single.Parse(textBox2.Text) + Single.Parse(textBox4.Text)).ToString(); textBox3.Text = (Single.Parse(textBox3.Text) + Single.Parse(textBox4.Text)).ToString(); } } else if (Single.Parse(textBox1.Text) < 0) { string kayit = "update HesaplarTBL set ekHesap='" + 0 + "' where MusteriNo=" + textBox5.Text + "and hesapNo=" + textBox6.Text; string kayit2 = "update HesaplarTBL set bakiye=bakiye+'" + (Single.Parse(textBox4.Text) + Single.Parse(textBox1.Text)).ToString() + "' where MusteriNo=" + textBox5.Text + "and hesapNo=" + textBox6.Text; string kayit3 = "update HesaplarTBL set kullanilabilirBakiye=kullanilabilirBakiye+'" + textBox4.Text + "' where MusteriNo=" + textBox5.Text + "and hesapNo=" + textBox6.Text; if (db.EkleSilGuncelle(kayit) > 0) { } if (db.EkleSilGuncelle(kayit2) > 0) { } if (db.EkleSilGuncelle(kayit3) > 0) { if (db.EkleSilGuncelle("Insert into IslemlerTBL values('" + textBox6.Text + "','" + 1 + "','" + textBox4.Text + "','" + dateTimePicker2.Text + "')") > 0) { MessageBox.Show("Bakiye Eklendi"); } //MessageBox.Show("islemler Hesap Açıldı"); textBox2.Text = (Single.Parse(textBox2.Text) + (Single.Parse(textBox4.Text) + Single.Parse(textBox1.Text))).ToString(); textBox3.Text = (Single.Parse(textBox3.Text) + Single.Parse(textBox4.Text)).ToString(); textBox1.Text = "0"; } } }
private void button6_Click(object sender, EventArgs e) { string email = emailtextBox5.Text; Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Match match = regex.Match(email); if (match.Success) { MessageBox.Show(email + " Gecerli "); } else { MessageBox.Show(email + " Gecersiz!! Ekleme Yapılamadı!! "); emailtextBox5.Text = ""; } if (match.Success) { int count = 0; try { SqlCommand komut = new SqlCommand(); komut.Connection = baglanti; komut.CommandText = "Select * from MusteriTBL"; SqlDataReader reader = komut.ExecuteReader(); while (reader.Read()) { if (textBox2.Text == reader.GetInt32(0).ToString()) { adtextBox1.Text = reader.GetString(1); soyadtextBox2.Text = reader.GetString(2); adrestextBox3.Text = reader.GetString(3); telefontextBox4.Text = reader.GetString(4); emailtextBox5.Text = reader.GetString(5); count++; DialogResult result = MessageBox.Show("Hesabınız Bulunmaktadır Yinede Hesap Açmak İstiyormusunuz", "HESAP ONAY", MessageBoxButtons.YesNo);//Kullanıcıya emin misiniz diye sormak için if (result == DialogResult.Yes) { if (db.EkleSilGuncelle("Insert into HesaplarTBL values('" + textBox2.Text + "','" + 0 + "','" + 0 + "','" + 400 + "')") > 0) { MessageBox.Show("Hesap Açıldı"); } break; } } } if (count == 0) { textBox2.Text = ""; if (db.EkleSilGuncelle("Insert into MusteriTBL values('" + adtextBox1.Text + "','" + soyadtextBox2.Text + "','" + adrestextBox3.Text + "','" + telefontextBox4.Text + "','" + emailtextBox5.Text + "')") > 0) { MessageBox.Show("Müşteri Eklendi"); } if (db.EkleSilGuncelle("Insert into HesaplarTBL values((select max(musteriNo) from MusteriTBL) ,0,0,400)") > 0) { MessageBox.Show("Hesap Açıldı"); } } reader.Close(); } catch { MessageBox.Show("Başka Bir hata Var!"); baglanti.Close(); } } }