Example #1
0
        public void insertUsers(ClassRegister reg)
        {
            try
            {
                InitializeConnection();
                string q = "insert into users(nom,telephone,name,password) value(@nom,@telephone,@name,@password)";
                cmd = new MySqlCommand(q, con);
                cmd.Parameters.Add(new MySqlParameter("@nom", reg.Nom));
                cmd.Parameters.Add(new MySqlParameter("@telephone", reg.Telephone));
                cmd.Parameters.Add(new MySqlParameter("@name", reg.Users));
                cmd.Parameters.Add(new MySqlParameter("@password", reg.Users));

                cmd.ExecuteNonQuery();
                MessageBox.Show("Creation de l'utilisateur avec succes");
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        public void modifierUsers(ClassRegister reg)
        {
            try
            {
                InitializeConnection();
                string q = "update users set nom=@nom,telephone=@telephone,name=@name,password=@password where id=@id";
                cmd = new MySqlCommand(q, con);
                cmd.Parameters.Add(new MySqlParameter("@id", reg.Id));
                cmd.Parameters.Add(new MySqlParameter("@nom", reg.Nom));
                cmd.Parameters.Add(new MySqlParameter("@telephone", reg.Telephone));
                cmd.Parameters.Add(new MySqlParameter("@name", reg.Users));
                cmd.Parameters.Add(new MySqlParameter("@password", reg.Users));
                cmd.ExecuteNonQuery();

                MessageBox.Show("Modification avec succes!!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        public void deleteLogin(ClassRegister reg)
        {
            try
            {
                InitializeConnection();
                string q = "delete from users where id=@id";
                cmd = new MySqlCommand(q, con);
                cmd.Parameters.Add(new MySqlParameter("@id", reg.Id));

                DialogResult result = MessageBox.Show("Voulez-vous vraiment excuter cette operation ?", "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    if (cmd.ExecuteNonQuery() == 1)
                    {
                        MessageBox.Show("Suppression avec succes!!");
                    }
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }