コード例 #1
0
        private void label6_Click(object sender, EventArgs e)
        {
            satinsecim satinsecim = new satinsecim();

            satinsecim.Show();
            this.Hide();
        }
コード例 #2
0
ファイル: satinsifre.cs プロジェクト: canndurmazz/VERVER
        private void button1_Click(object sender, EventArgs e)
        {
            if (baglanti.State == ConnectionState.Open)
            {
                baglanti.Close();
            }
            baglanti.Open();
            if (string.IsNullOrEmpty(kullanici_ad.Text) == true || string.IsNullOrEmpty(kullanici_sifre.Text) == true)
            {
                MessageBox.Show("Bu Alanlar Boş Bırakılamaz", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                try
                {
                    SqlCommand al = new SqlCommand("Select kullanici_ad,kullanici_sifre from kullanicilar where yetki_id=(select yetki_id from yetki where yetki_ad='Personel') and kullanici_id in (select personel_id from personel where departman_id=(select departman_id from departman where departman_ad='Satın Alma'))", baglanti);
                    al.Parameters.Add("@kullanici_ad", SqlDbType.VarChar, 50).Value     = kullanici_ad.Text;
                    al.Parameters.Add("@kullanici_sifre", SqlDbType.VarChar, 530).Value = kullanici_sifre.Text;

                    SqlDataReader oku = al.ExecuteReader();
                    if (!oku.HasRows)
                    {
                        MessageBox.Show("Böyle Bir Kullanıcı Yok.", "GİRİŞ BAŞARISIZ !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        while (oku.Read())
                        {
                            string ad    = (oku["kullanici_ad"].ToString());
                            string sifre = (oku["kullanici_sifre"].ToString());
                            if (ad == kullanici_ad.Text && sifre == kullanici_sifre.Text)
                            {
                                satinsecim satinsecim = new satinsecim();
                                satinsecim.Show();
                                this.Hide();
                            }
                            else
                            {
                                MessageBox.Show("Hatalı Kullanıcı Adı Veya Şifre", "GİRİŞ BAŞARISIZ !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
                catch (Exception hata)
                {
                    MessageBox.Show(hata.Message);
                }
                finally
                {
                    baglanti.Close();
                }
            }
        }