Exemple #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand("valid_email_tele", cn.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@email", SqlDbType.VarChar).Value    = emailbox.Text;
            cmd.Parameters.Add("@tele", SqlDbType.VarChar).Value     = telebox.Text;
            cmd.Parameters.Add("@resultat", SqlDbType.Int).Direction = ParameterDirection.Output;

            cn.conn.Open();
            cmd.ExecuteNonQuery();
            cn.conn.Close();
            int resultat = int.Parse(cmd.Parameters["@resultat"].Value.ToString());

            if (resultat == 1)
            {
                MessageBox.Show("email format invalid");
            }
            else if (resultat == 2)
            {
                MessageBox.Show("numero de telephone format invalid");
            }
            else
            {
                if (cn.execute_query("Update Enseignant set nom_enseignant='" + nombox.Text + "',prenom_enseignant='" + prenombox.Text + "',ens_username='******',ens_password='******',email='" + emailbox.Text + "',portable='" + telebox.Text + "' where id_enseignant='" + idbox.Text + "'"))
                {
                    MessageBox.Show("Bien modifier");

                    refresh();
                }
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (cn.execute_query("insert into Filiere values('" + filierebox.Text + "')"))
     {
         MessageBox.Show("Bien ajouter");
         refresh();
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (cn.execute_query("insert into Salle values('" + nombox.Text + "', '" + capacitebox.Text + "', '" + typebox.Text.ToString() + "')"))
     {
         MessageBox.Show("salle bien ajouter");
         refresh();
     }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Sure", "Etes-vous sûr de vouloir supprimer ? ", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                if (cn.execute_query("Delete ChefDpt where id_chef='" + idbox.Text + "'"))
                {
                    MessageBox.Show("Bien supprimer");
                    refresh();
                }
            }
        }