private void button1_Click(object sender, EventArgs e) { db.dbClose(); gr.Show(); //Button'a týkladýðýmýz zaman garson güncelleme ekranýna geçmesini saðlýyoruz this.Hide(); }
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(); }
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(); }
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"])); } }
public void kullaniciGetir() { db.dbConnect(); SqlDataReader reader = db.getData("select * from kullanicilar"); while (reader.Read()) { comboBox1.Items.Add(reader["kulAdi"].ToString()); } 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(); }
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 !"); } }
private void button2_Click(object sender, EventArgs e) { try { int idd = dataGridView1.SelectedCells[0].RowIndex; //MessageBox.Show("" + idd); SqlDataReader reader = db.getData("update sepet set durum = 3 where id ='" + idd + "'"); db.dbClose(); dataGetir(); MessageBox.Show("Güncelleme İşlemi Başarıyla Gerçekleşti !!!"); } catch (Exception ex) { MessageBox.Show("Lütfen Bir Kolon Seçiniz !!! " + ex); } }
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 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(); }