Ejemplo n.º 1
0
        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)//ENTER'A BASARAK GİRİŞ YAPMAK.NORMAL GİRİŞ BUTONUNDAKİ HER ŞEY BURDADA AYNI
        {
            if (e.KeyChar == 13)
            {
                baglanti.Open();
                SqlCommand    komut = new SqlCommand("select * from kullanici where KULLANICIAD='" + textBox1.Text + "'and SIFRE='" + textBox2.Text + "'", baglanti);
                SqlDataReader oku   = komut.ExecuteReader();
                if (oku.Read())
                {
                    ID = Convert.ToInt32(oku["KULLANICIID"].ToString());
                    frm_tanimlar f4 = new frm_tanimlar();
                    f4.Show();
                    this.Hide();

                    if (Convert.ToBoolean(oku["MUSTERILISTE"].ToString()) == false)
                    {
                        f4.button4.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["STOKLISTE"]) == false)
                    {
                        f4.button1.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["DEPOLISTE"]) == false)
                    {
                        f4.button3.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["SATISLISTE"]) == false)
                    {
                        f4.button6.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["SATIS"]) == false)
                    {
                        f4.button2.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["KULLANICILISTE"]) == false)
                    {
                        f4.button5.Enabled = false;
                    }
                }
                // else
                //{
                // HATACAL();
                // MessageBox.Show("Kullanıcı Adı veya Şifre Hatalı");
                // }
                baglanti.Close();

                baglanti.Open();
                SqlCommand    komut1 = new SqlCommand("select * from musteri where MUSTERIAD='" + textBox1.Text + "'and MUSTERISIFRE='" + textBox2.Text + "'", baglanti);
                SqlDataReader oku1   = komut1.ExecuteReader();
                if (oku1.Read())
                {
                    name = textBox1.Text;
                    ID   = Convert.ToInt32(oku1["MUSTERIID"].ToString());
                    Form1 f1 = new Form1();
                    f1.Show();
                    this.Hide();
                }
                baglanti.Close();
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)//GİRİŞ BUTONU
        {
            baglanti.Open();
            SqlCommand    komut = new SqlCommand("select * from kullanici where KULLANICIAD='" + textBox1.Text + "'and SIFRE='" + textBox2.Text + "'", baglanti); //KOMUT OLUŞTURDUK KARŞILAŞTIRMA YAPABİLMEK İÇİN SQL'E BAKACAZ KULLANICI ADI YERİNE GİRİLEN İSİM DATABASEDE VAR MI DİYE VE ŞİFRE İÇİNDE
            SqlDataReader oku   = komut.ExecuteReader();                                                                                                          //SQLDEN VERİLERİ OKUMAK İÇİN

            if (oku.Read())                                                                                                                                       //OKUDUĞUMUZDA ID LER EŞİTSE SQLDEKİ İLE YENİ FORM AÇILACAK.
            {
                ID = Convert.ToInt32(oku["KULLANICIID"].ToString());
                frm_tanimlar f4 = new frm_tanimlar();
                f4.Show();
                this.Hide();

                if (Convert.ToBoolean(oku["MUSTERILISTE"].ToString()) == false)//YETKİLERİ KONTROL ETMEK İÇİN YANİ BİR KULLANICININ HANGİ YETKİSİ VARSA O BUTONLAR AKTİF OLARAK YENİ FORMDA AÇILACAK.
                {
                    f4.button4.Enabled = false;
                }
                if (Convert.ToBoolean(oku["STOKLISTE"]) == false)
                {
                    f4.button1.Enabled = false;
                }
                if (Convert.ToBoolean(oku["DEPOLISTE"]) == false)
                {
                    f4.button3.Enabled = false;
                }
                if (Convert.ToBoolean(oku["SATISLISTE"]) == false)
                {
                    f4.button6.Enabled = false;
                }
                if (Convert.ToBoolean(oku["SATIS"]) == false)
                {
                    f4.button2.Enabled = false;
                }
                if (Convert.ToBoolean(oku["KULLANICILISTE"]) == false)
                {
                    f4.button5.Enabled = false;
                }
            }
            else
            {
                HATACAL();//EĞER ID LER EŞİT DEĞİLSE SES ÇALACAK VE MESAJ GÖZÜKECEK.
                MessageBox.Show("Kullanıcı Adı veya Şifre Hatalı");
            }
            baglanti.Close();

            baglanti.Open();
            SqlCommand    komut1 = new SqlCommand("select * from musteri where MUSTERIAD='" + textBox1.Text + "'and MUSTERISIFRE='" + textBox2.Text + "'", baglanti);
            SqlDataReader oku1   = komut1.ExecuteReader();

            if (oku1.Read())
            {
                name = textBox1.Text;
                ID   = Convert.ToInt32(oku1["MUSTERIID"].ToString());
                Form1 f1 = new Form1();
                f1.Show();
                this.Hide();
            }
            baglanti.Close();
        }
Ejemplo n.º 3
0
        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                baglanti.Open();
                SqlCommand    komut = new SqlCommand("select * from kullanici where KULLANICIAD='" + textBox1.Text + "'and SIFRE='" + textBox2.Text + "'", baglanti);
                SqlDataReader oku   = komut.ExecuteReader();
                if (oku.Read())
                {
                    ID = Convert.ToInt32(oku["KULLANICIID"].ToString());
                    frm_tanimlar f4 = new frm_tanimlar();
                    f4.Show();
                    this.Hide();

                    if (Convert.ToBoolean(oku["MUSTERILISTE"].ToString()) == false)
                    {
                        f4.button4.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["STOKLISTE"]) == false)
                    {
                        f4.button1.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["DEPOLISTE"]) == false)
                    {
                        f4.button3.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["SATISLISTE"]) == false)
                    {
                        f4.button6.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["SATIS"]) == false)
                    {
                        f4.button2.Enabled = false;
                    }
                    if (Convert.ToBoolean(oku["KULLANICILISTE"]) == false)
                    {
                        f4.button5.Enabled = false;
                    }
                }
                else
                {
                    HATACAL();
                    MessageBox.Show("Kullanıcı Adı veya Şifre Hatalı");
                }
                baglanti.Close();
            }
        }