Beispiel #1
0
        private void btnEnregistrer_Click(object sender, EventArgs e)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(Program.strcn))
                {
                    SqlCommand cmd = new SqlCommand("update utilisateur set nom=@nom ,prenom=@prenom,username=@user,pw=@pw,photo=@photo where id=1", cn);

                    cmd.Parameters.AddWithValue("@nom", txtNom.Text);
                    cmd.Parameters.AddWithValue("@prenom", txtPrenom.Text);
                    cmd.Parameters.AddWithValue("@user", txtUser.Text);
                    cmd.Parameters.AddWithValue("@pw", txtPw.Text);

                    cmd.Parameters.AddWithValue("@photo", pictureBoxPhotoUser.ImageLocation);
                    cn.Open();
                    cmd.ExecuteNonQuery();

                    Program.photo = pictureBoxPhotoUser.ImageLocation;

                    MessageBox.Show("Bien Modifier");

                    FormHome f = new FormHome();
                    f.Show();
                    this.Hide();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void buttonEntrer_Click(object sender, EventArgs e)
        {
            using (SqlConnection cn = new SqlConnection(Program.strcn))
            {
                SqlCommand cmd = new SqlCommand("Select count(*) from utilisateur where username=@user and pw=@pw", cn);
                cmd.Parameters.AddWithValue("@user", textBoxUser.Text);
                cmd.Parameters.AddWithValue("@pw", textBoxPw.Text);
                cn.Open();
                int n = (int)cmd.ExecuteScalar();

                if (n > 0)
                {
                    if (chekBoxSave.Checked)
                    {
                        this.Hide();
                        FormHome f = new FormHome();
                        f.Show();
                    }
                    else
                    {
                        this.Hide();
                        FormHome f = new FormHome();
                        f.Show();
                        textBoxUser.Clear();
                        textBoxPw.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("Vérifier Votre informations");
                }
            }
        }
Beispiel #3
0
 private void btnExit_Click(object sender, EventArgs e)
 {
     f.Show();
     this.Close();
 }