private void PctTemizle_Click(object sender, EventArgs e) { TxtAd.Clear(); TxtSoyad.Clear(); MskTelefon.Clear(); MslTc.Clear(); TxtMail.Clear(); CmbBranş.Text = " "; CmbIl.Text = " "; CmbIlce.Text = " "; radioButton1.Checked = false; radioButton2.Checked = false; TxtSifre.Clear(); }
private void BtnSil_Click(object sender, EventArgs e) { try { SqlCommand command = new SqlCommand("delete from Admin where YoneticiId=@p1", conn.connect()); command.Parameters.AddWithValue("@p1", TxtYoneticiId.Text); command.ExecuteNonQuery(); conn.connect().Close(); MessageBox.Show("Silme İşlemi Gerçekleştirildi."); this.adminTableAdapter.Fill(this.yurtOtomasyonuDataSet5.Admin); TxtYoneticiId.Clear(); TxtKullaniciAdi.Clear(); TxtSifre.Clear(); } catch (Exception) { MessageBox.Show("Silme İşlemi Yapılırken Hata Oluştu Lütfen Tekrar Deneyiniz."); } }
private void BtnEkle_Click(object sender, EventArgs e) { SqlCommand komutEkle = new SqlCommand("insert into Tbl_Doktor (DoktorAd,DoktorSoyad,DoktorBrans,DoktorTC,DoktorSifre) values (@dr1,@dr2,@dr3,@dr4,@dr5)", bgl.baglanti()); komutEkle.Parameters.AddWithValue("@dr1", TxtAd.Text); komutEkle.Parameters.AddWithValue("@dr2", TxtSoyad.Text); komutEkle.Parameters.AddWithValue("@dr3", CmbBrans.Text); komutEkle.Parameters.AddWithValue("@dr4", MskTC.Text); komutEkle.Parameters.AddWithValue("@dr5", TxtSifre.Text); komutEkle.ExecuteNonQuery(); bgl.baglanti().Close(); MessageBox.Show("Successful"); TxtAd.Clear(); TxtSoyad.Clear(); CmbBrans.Items.Clear(); MskTC.Clear(); TxtSifre.Clear(); }
// GİRİŞ private void BtnGiris_Click(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("Select * From Admin where YoneticiAd=@p1 and YoneticiSifre=@p2", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", TxtKullaniciAd.Text); komut.Parameters.AddWithValue("@p2", TxtSifre.Text); SqlDataReader oku = komut.ExecuteReader(); if (oku.Read()) { FrmAnaForm fr = new FrmAnaForm(); fr.Show(); // Ana Formu göster. this.Hide(); // Admin giriş kısmını gizle. } else { MessageBox.Show("Hatalı Giriş! Kullanıcı adı veya şifre hatalı!"); TxtKullaniciAd.Clear(); // Kullanıcı adı kısmını temizler. TxtSifre.Clear(); // Şifre kısmını temizler. TxtKullaniciAd.Focus(); // İmleci Kullanıcı adı kısmına getirir. } bgl.baglanti().Close(); }
private void BtnGirisYap_Click(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("select * from admin where yoneticiad=@p1 and yoneticisifre=@p2", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", TxtKullaniciAd.Text); komut.Parameters.AddWithValue("@p2", TxtSifre.Text); SqlDataReader oku = komut.ExecuteReader(); if (oku.Read()) { FrmAnaForm fr = new FrmAnaForm(); fr.Show(); this.Hide(); } else { MessageBox.Show("Hatalı kullanıcı adı ya da şifre"); TxtKullaniciAd.Clear(); TxtSifre.Clear(); TxtKullaniciAd.Focus(); } bgl.baglanti().Close(); }
private void button1_Click(object sender, EventArgs e) { SqlCommand command = new SqlCommand("select * from Admin where YoneticiAd=@p1 and YoneticiSifre=@p2", conn.connect()); command.Parameters.AddWithValue("@p1", TxtKullaniciAdi.Text); command.Parameters.AddWithValue("@p2", TxtSifre.Text); SqlDataReader read = command.ExecuteReader(); if (read.Read()) { FrmAnaForm fr = new FrmAnaForm(); fr.Show(); this.Hide(); } else { MessageBox.Show("Kullanıcı Adı veya Şifre Hatalı"); TxtKullaniciAdi.Clear(); TxtSifre.Clear(); TxtKullaniciAdi.Focus(); } conn.connect().Close(); }
//Veritabanına eklenen yönetici ad/şifre ile otomasyona giriş yapma private void BtnGirisYap_Click(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("Select * from Admin where YöneticiAd=@p1 and YöneticiŞifre=@p2", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", TxtKullaniciAdi.Text); komut.Parameters.AddWithValue("@p2", TxtSifre.Text); SqlDataReader oku = komut.ExecuteReader(); if (oku.Read()) { FrmAnaForm fr = new FrmAnaForm(); fr.Show(); this.Hide(); } else { MessageBox.Show("Hatalı Kullancı Adı/Şifre Girişi"); TxtKullaniciAdi.Clear(); TxtSifre.Clear(); TxtKullaniciAdi.Focus(); } bgl.baglanti().Close(); }
private void pictureBox1_Click(object sender, EventArgs e) { baglanti.Open(); SqlCommand komut = new SqlCommand("Select * FROM dbo.Giris WHERE KullaniciAdi=@p1 AND Sifre=@p2", baglanti); komut.Parameters.AddWithValue("@p1", TxtKullaniciAdi.Text); komut.Parameters.AddWithValue("@p2", TxtSifre.Text); SqlDataReader oku = komut.ExecuteReader(); if (oku.Read()) { FrmAnaSayfa yeni = new FrmAnaSayfa(); yeni.Show(); this.Hide(); } else { MessageBox.Show("Kullanıcı adı ya da Şifre yanlış"); TxtKullaniciAdi.Clear(); TxtSifre.Clear(); TxtKullaniciAdi.Focus(); } baglanti.Close(); }