Esempio n. 1
0
        private void BtnGirisYap_Click(object sender, EventArgs e)
        {
            SqlCommand komut = new SqlCommand("Select * From Tbl_AdminUser where Username=@p1 and Password=@p2", bgl.baglanti());

            komut.Parameters.AddWithValue("@p1", txtKullaniciAdi.Text);
            komut.Parameters.AddWithValue("@p2", TxtSifre.Text);
            SqlDataReader dr = komut.ExecuteReader();

            if (dr.Read())
            {
                Anasayfa frm = new Anasayfa();
                frm.control = "true";
                frm.user    = txtKullaniciAdi.Text;
                frm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Kullanıcı adı veya şifre yanlış");
            }
            bgl.baglanti().Close();
        }
Esempio n. 2
0
        private void AdminBilgi_Load(object sender, EventArgs e)
        {
            Anasayfa frm = new Anasayfa();

            label2.Text = dene;
            if (aorc == "false")
            {
                SqlCommand komut = new SqlCommand("select * from Tbl_Customer where Username=@p1", bgl.baglanti());
                komut.Parameters.AddWithValue("@p1", dene);
                SqlDataReader dr = komut.ExecuteReader();
                while (dr.Read())
                {
                    Txtid.Text       = dr[0].ToString();
                    TxtName.Text     = dr[1].ToString();
                    TxtAddress.Text  = dr[2].ToString();
                    TxtEmail.Text    = dr[3].ToString();
                    TxtUsername.Text = dr[4].ToString();
                    TxtPassword.Text = dr[5].ToString();
                }
                bgl.baglanti().Close();

                pictureBox1.Image = Image.FromFile(Application.StartupPath + @"\Resources\ProfilePictures\admin.png");
            }
            if (aorc == "true")
            {
                SqlCommand komut = new SqlCommand("select * from Tbl_AdminUser where Username=@p1", bgl.baglanti());
                komut.Parameters.AddWithValue("@p1", dene);
                SqlDataReader dr = komut.ExecuteReader();
                while (dr.Read())
                {
                    TxtName.Text     = dr[1].ToString();
                    TxtAddress.Text  = dr[2].ToString();
                    TxtEmail.Text    = dr[3].ToString();
                    TxtUsername.Text = dr[4].ToString();
                    TxtPassword.Text = dr[5].ToString();
                }
                bgl.baglanti().Close();
            }
        }