private void btnEnvoi_Click(object sender, EventArgs e) { if (cboMateriel1.SelectedIndex != -1) { sql msql = new sql("INSERT INTO dbo.Numero_Materiel VALUES (" + (cboParticipant.SelectedIndex + 1) + "," + (cboMateriel1.SelectedIndex + 1) + "," + nUDMateriel1.Value.ToString() + ")", "A18_Sim_Eq07"); msql.executeNonQuery(); } if (cboMateriel2.SelectedIndex != -1) { sql msql = new sql("INSERT INTO dbo.Numero_Materiel VALUES (" + (cboParticipant.SelectedIndex + 1) + "," + (cboMateriel2.SelectedIndex + 1) + "," + nUDMateriel12.Value.ToString() + ")", "A18_Sim_Eq07"); msql.executeNonQuery(); } if (cboMateriel3.SelectedIndex != -1) { sql msql = new sql("INSERT INTO dbo.Numero_Materiel VALUES (" + (cboParticipant.SelectedIndex + 1) + "," + (cboMateriel3.SelectedIndex + 1) + "," + nUDMateriel13.Value.ToString() + ")", "A18_Sim_Eq07"); msql.executeNonQuery(); } if (cboMateriel4.SelectedIndex != -1) { sql msql = new sql("INSERT INTO dbo.Numero_Materiel VALUES (" + (cboParticipant.SelectedIndex + 1) + "," + (cboMateriel4.SelectedIndex + 1) + "," + nUDMateriel14.Value.ToString() + ")", "A18_Sim_Eq07"); msql.executeNonQuery(); } if (cboMateriel5.SelectedIndex != -1) { sql msql = new sql("INSERT INTO dbo.Numero_Materiel VALUES (" + (cboParticipant.SelectedIndex + 1) + "," + (cboMateriel5.SelectedIndex + 1) + "," + nUDMateriel15.Value.ToString() + ")", "A18_Sim_Eq07"); msql.executeNonQuery(); } MessageBox.Show("Envoyé!"); }
private void btnInscrire_Click(object sender, EventArgs e) { if (txtNom.Text != "" && txtPrenom.Text != "" && txtCourriel.Text != "" && cmbCategorie.SelectedIndex != -1 && cmbCegep.SelectedIndex != -1) { foreach (Personne personne in m_listPersonnes) { if (personne.Nom == txtNom.Text && personne.Prenom == txtPrenom.Text) { return; } } sql insertionPersonneSQL = new sql("INSERT INTO [dbo].[Personne] VALUES ('" + txtPrenom.Text + "', '" + txtNom.Text + "', '" + txtCourriel.Text + "', " + "123123" + ")", "A18_Sim_Eq07"); insertionPersonneSQL.executeNonQuery(); //sql insertioInscriptionnSQL = new sql("INSERT INTO [dbo].[Inscription] VALUES ()", "A18_Sim_Eq07"); //insertioInscriptionnSQL.executeNonQuery(); // Ajouter à la liste locale m_objPersonne = new Personne(txtNom.Text, txtPrenom.Text, txtCourriel.Text); if (cmbGroupesExistants.SelectedIndex != -1) { foreach (Participant participant in m_listParticipant) { if (participant.Nom == txtGroupe.Text) { participant.Ajouter(m_objPersonne); } } } else { m_objParticipant = new Participant(txtGroupe.Text); m_listParticipant.Add(m_objParticipant); m_objParticipant.Ajouter(m_objPersonne); } MessageBox.Show("Vous avez bien étés enrigistrés"); } }