Esempio n. 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     TxtYoneticiId.Clear();
     TxtKullaniciAdi.Clear();
     TxtKulaniciSifre.Clear();
     TxtKullaniciAdi.Focus();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            string          kullaniciadi = TxtKullaniciAdi.Text.ToString();
            string          parola       = TxtParola.Text.ToString();
            OleDbCommand    komut        = new OleDbCommand();
            OleDbCommand    komut1       = new OleDbCommand();
            OleDbConnection baglanti     = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\kutuphaneveritabanı.mdb");

            baglanti.Open();
            komut.Connection  = baglanti;
            komut.CommandText = "SELECT Yetki FROM TblKullanici where KullaniciAdi='" + kullaniciadi + "' AND Parola='" + parola + "'";
            komut1.Connection = baglanti;

            var yetki = komut.ExecuteScalar();

            if (yetki != null)
            {
                if (yetki.ToString() == "Personel")
                {
                    FrmPersonel FrmPersonel = new FrmPersonel();
                    komut1.CommandText = "SELECT Id FROM TblKullanici where KullaniciAdi='" + kullaniciadi + "' AND Parola='" + parola + "'";
                    var personelId = komut1.ExecuteScalar();
                    if (personelId != null)
                    {
                        FrmPersonel.personelId = Convert.ToInt32(personelId);
                    }
                    FrmPersonel.Show();
                }
                else if (yetki.ToString() == "Üye")
                {
                    FrmUye FrmUye = new FrmUye();
                    FrmUye.Show();
                }
            }
            else
            {
                MessageBox.Show("Kullanıcı adı ya da şifre yanlış");
                TxtKullaniciAdi.Clear();
                TxtParola.Clear();
                TxtKullaniciAdi.Focus();
            }



            baglanti.Close();
        }
Esempio n. 3
0
 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.");
     }
 }
Esempio n. 4
0
 private void BtnKaydet_Click(object sender, EventArgs e)
 {
     // Yönetici Ekleme
     try
     {
         SqlCommand komut = new SqlCommand("insert into Admin (YöneticiAd,YöneticiŞifre) values (@p1,@p2)", bgl.baglanti());
         komut.Parameters.AddWithValue("@p1", TxtKullaniciAdi.Text);
         komut.Parameters.AddWithValue("@P2", TxtKulaniciSifre.Text);
         komut.ExecuteNonQuery();
         TxtYoneticiId.Clear();
         TxtKullaniciAdi.Clear();
         TxtKulaniciSifre.Clear();
         TxtKullaniciAdi.Focus();
         bgl.baglanti().Close();
         YoneticiGetir();
         MessageBox.Show("Yönetici Kaydedildi");
     }
     catch (Exception)
     {
         MessageBox.Show("Hatalı Kaydetme İşlemi");
     }
 }
Esempio n. 5
0
        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();
        }
Esempio n. 7
0
        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();
        }
Esempio n. 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            baglanti.Open();
            SqlCommand komut = new SqlCommand("Select * From Admin Where YöneticiAd=@p1 and YöneticiParola=@p2", baglanti);

            komut.Parameters.AddWithValue("@p1", TxtKullaniciAdi.Text);
            komut.Parameters.AddWithValue("@p2", TxtParola.Text);
            SqlDataReader oku = komut.ExecuteReader();

            if (oku.Read())
            {
                AnaForm frm = new AnaForm();
                frm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Hatalı Giriş Yaptınız!!");
                TxtKullaniciAdi.Clear();
                TxtParola.Clear();
                TxtKullaniciAdi.Focus();
            }
            baglanti.Close();
        }