public dbConnect ( ) : |
||
return |
public void profilInsert(string adi, string soyadi, string telefon, string mail, string adres, string tcno, string notlar) { if (adi.Equals("") || soyadi.Equals("") || telefon.Equals("") || mail.Equals("") || adres.Equals("") || tcno.Equals("") || notlar.Equals("")) { MessageBox.Show("Lütfen tüm bilgileri doldurunuz."); } else if (!Regex.IsMatch(adi, @"^[ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZQWXabcçdefgğhıijklmnoöprsştuüvyzqwx]+$") || !Regex.IsMatch(soyadi, @"^[ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZQWXabcçdefgğhıijklmnoöprsştuüvyzqwx]+$")) { MessageBox.Show("Lütfen adı soyadı için sadece harf giriniz!"); textBox1.Text = ""; textBox2.Text = ""; textBox1.Focus(); } else if (!Regex.IsMatch(telefon, @"^[0123456789+]+$")) { MessageBox.Show("Telefon numarası için yalnızca sayı giriniz!"); textBox3.Text = ""; textBox3.Focus(); } else if (!IsValidEmail(textBox4.Text)) { MessageBox.Show("Hatalı formatta mail adresi girdiniz!"); textBox4.Text = ""; textBox4.Focus(); } else if (textBox6.TextLength < 11 || textBox6.TextLength > 11) { MessageBox.Show("Tc kimlik numarası hatalı!"); textBox6.Text = ""; textBox6.Focus(); } else { SqlCommand com = new SqlCommand("profilInsert", db.dbConnect()); com.CommandType = CommandType.StoredProcedure; com.Parameters.Add("@adi", SqlDbType.VarChar, 255).Value = adi; com.Parameters.Add("@soyadi", SqlDbType.VarChar, 255).Value = soyadi; com.Parameters.Add("@telefon", SqlDbType.VarChar, 255).Value = telefon; com.Parameters.Add("@mail", SqlDbType.VarChar, 255).Value = mail; com.Parameters.Add("@adres", SqlDbType.VarChar, 500).Value = adres; com.Parameters.Add("tcno", SqlDbType.VarChar, 11).Value = tcno; com.Parameters.Add("notlar", SqlDbType.VarChar, 500).Value = notlar; db.dbConnect(); com.ExecuteNonQuery(); db.dbClose(); li.Clear(); idTut(); MessageBox.Show("Profil Kaydı Yapıldı"); } db.dbConnect(); int i = Convert.ToInt32(li[li.Count - 1]); SqlCommand com1 = new SqlCommand("insert into kullanicilar(profilID) values (@id)", db.dbConnect()); com1.Parameters.AddWithValue("@id", i); com1.ExecuteNonQuery(); db.dbClose(); }
private void button1_Click(object sender, EventArgs e) { int asciId = -1; SqlDataAdapter da = new SqlDataAdapter("select sifre from kullanicilar where sifre ='" + DbProcess.md5Encrypt(textBox2.Text.Trim()) + "' and id = '" + asciId + "'", db.dbConnect()); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count.ToString() == "1") { if (textBox3.Text == textBox4.Text) { db.dbConnect(); SqlCommand cm = new SqlCommand("Update kullanicilar set sifre = '" + DbProcess.md5Encrypt(textBox4.Text.Trim()) + "' where id = '" + asciId + "'", db.dbConnect()); cm.ExecuteNonQuery(); db.dbClose(); MessageBox.Show("Şifre Güncellendi !"); } else { MessageBox.Show("Yeni Şifre İle Yeni Şifre Tekrar Aynı Olmalı !"); } } else { MessageBox.Show("Lütfen Eski Şifrenizi Kontrol Ediniz !"); } }
public void DataGetir() { SqlCommand cm = new SqlCommand("SP_MasaBilgler", db.dbConnect()); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.Add("@id", SqlDbType.Int).Value = gelenID; db.dbConnect(); cm.ExecuteNonQuery(); SqlDataReader rd = cm.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(rd); dataGridView1.DataSource = dt; db.dbClose(); Thread.Sleep(1000); }
public void idSelect() { SqlCommand com = new SqlCommand("select *from profil where id=@id", db.dbConnect()); db.dbConnect(); com.Parameters.Add("@id", SqlDbType.Int).Value = id; SqlDataReader rd = com.ExecuteReader(); while (rd.Read()) { textBox1.Text = rd["adi"].ToString(); textBox2.Text = rd["soyadi"].ToString(); textBox3.Text = rd["telefon"].ToString(); textBox4.Text = rd["mail"].ToString(); textBox5.Text = rd["adres"].ToString(); textBox6.Text = rd["tcno"].ToString(); textBox7.Text = rd["notlar"].ToString(); } db.dbClose(); }
private void dataGetir() { SqlCommand cm = new SqlCommand("urunGetir", db.dbConnect()); cm.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cm); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt; }
public void kulKontrol(string kulAdi, string sifre) { SqlCommand com = new SqlCommand("kulGiris", db.dbConnect()); com.CommandType = CommandType.StoredProcedure; com.Parameters.Add("@kulAdi", SqlDbType.VarChar, 50).Value = kulAdi; com.Parameters.Add("@sifre", SqlDbType.VarChar, 50).Value = sifre; db.dbConnect(); dr = com.ExecuteReader(); if (dr.Read()) { MessageBox.Show("Giriş Başarılı! Hoşgeldiniz " + dr["kulAdi"].ToString()); int id = Convert.ToInt32(dr["id"]); int seviye = Convert.ToInt32(dr["seviye"]); if (seviye == 0) { frmAdminPaneli f = new frmAdminPaneli(id); f.Show(); this.Close(); } else if (seviye == 1) { frmAsci asci = new frmAsci(id); asci.Show(); this.Close(); } else if (seviye == 2) { GarsonEkrani g = new GarsonEkrani(id); g.Show(); this.Close(); } } else { MessageBox.Show("Yönetici girişi başarılı olamadı! Lütfen tekrar deneyiniz"); } }
private void btn_sil_Click(object sender, EventArgs e) { if (cmb_sil.SelectedItem == null) { MessageBox.Show("Lütfen Seçim Yapınız!"); } else { SqlCommand cm = new SqlCommand("kat_sil", db.dbConnect()); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.Add("@id", SqlDbType.Int).Value = katId[cmb_sil.SelectedIndex]; db.dbConnect(); cm.ExecuteNonQuery(); db.dbClose(); cmbDoldur(); katDoldur(); cmb_sil.Text = ""; } }
public void kullaniciGetir() { db.dbConnect(); SqlDataReader reader = db.getData("select adi,soyadi,seviye,p.id from kullanicilar as k inner join profil as p on k.profilID=p.id and p.kategoriID=2"); while (reader.Read()) { comboBox2.Items.Add(reader["adi"].ToString()); id = (Convert.ToInt32(reader["id"])); } db.dbClose(); }
private void button1_Click(object sender, EventArgs e) { fncTcKontrol(); gelenTc = txtTcNo.Text; SqlCommand cmd = new SqlCommand("SPTcNoGuncelle", db.dbConnect()); db.dbConnect(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tcno", SqlDbType.VarChar, 11).Value = txtTcNo.Text; cmd.Parameters.Add("@id", SqlDbType.Int).Value = gelenId;//!Kullanıcının Gelen ID si eklenecek cmd.ExecuteNonQuery(); db.dbClose(); gelenTc = txtTcNo.Text; string mail = txtMail.Text; if (fncTcFormat(gelenTc) == false) { label8.Text = "yanlış tc formatı Lütfen kontrol ediniz"; } if (!fncMailFormat(mail)) { label9.Text = "Mail Adresinizi kontrol ediniz"; } if (!fncSifreKontrol()) { label11.Text = "Girilen Şifreler eşleşmiyor"; } SqlCommand cm = new SqlCommand("SP_GarsonGuncelleme", db.dbConnect()); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.Add("@adi", SqlDbType.VarChar, 50).Value = txt_kulAdı.Text; cm.Parameters.Add("@sifre", SqlDbType.VarChar, 32).Value = txtSifre.Text; cm.Parameters.Add("@tel", SqlDbType.VarChar, 100).Value = txtTel.Text; cm.Parameters.Add("@mail", SqlDbType.VarChar, 255).Value = txtMail.Text; cm.Parameters.Add("@adres", SqlDbType.VarChar, 500).Value = txtAdres.Text; cm.Parameters.Add("@id", SqlDbType.Int).Value = gelenId;//!Kullanıcının Gelen ID si eklenecek db.dbConnect(); cm.ExecuteNonQuery(); db.dbClose(); }
public void kullaniciGetir() { db.dbConnect(); SqlDataReader reader = db.getData("select * from kullanicilar"); while (reader.Read()) { comboBox1.Items.Add(reader["kulAdi"].ToString()); } db.dbClose(); }
public void katIdDoldur() { db.dbConnect(); SqlDataAdapter da = new SqlDataAdapter("select id from kategoriler", db.dbConnect()); DataTable dt = new DataTable(); da.Fill(dt); db.dbClose(); foreach (DataRow item in dt.Rows) { kategoriIdList.Add(Convert.ToInt32(item["id"])); } }