Ejemplo n.º 1
0
 public void MettreAJourIntervenant(Intervenant intervenant)
 {
     _connexion.Open();
     _requete = new MySqlCommand("UPDATE Intervenant SET nom=@nom, prenom=@prenom, adresse=@adresse, ville=@ville, codePostal=@codePostal, telephone=@telephone, mail=@mail, statut=@statut, presence=@presence, qualite=@qualite, typeLieu=@typeLieu, utilite=@utilite, etat=@etat, etage=@etage, remarque=@remarque, numeroContrat=@numeroContrat, numeroSinistre=@numeroSinistre, idRepresentant=@idRepresentant, idCompagnie=@idCompagnie, idAssureur=@idAssureur, idExpert=@idExpert, idDossier=@idDossier WHERE id=@id ", _connexion);
     _requete.Parameters.Add(new MySqlParameter("@nom", intervenant.Nom));
     _requete.Parameters.Add(new MySqlParameter("@prenom", intervenant.Prenom));
     _requete.Parameters.Add(new MySqlParameter("@adresse", intervenant.Adresse));
     _requete.Parameters.Add(new MySqlParameter("@ville", intervenant.Ville));
     _requete.Parameters.Add(new MySqlParameter("@codePostal", intervenant.CodePostal));
     _requete.Parameters.Add(new MySqlParameter("@telephone", intervenant.Telephone));
     _requete.Parameters.Add(new MySqlParameter("@mail", intervenant.Mail));
     _requete.Parameters.Add(new MySqlParameter("@statut", intervenant.Statut));
     _requete.Parameters.Add(new MySqlParameter("@presence", intervenant.Presence));
     _requete.Parameters.Add(new MySqlParameter("@qualite", intervenant.Qualite));
     _requete.Parameters.Add(new MySqlParameter("@typeLieu", intervenant.TypeLieu));
     _requete.Parameters.Add(new MySqlParameter("@utilite", intervenant.Utilite));
     _requete.Parameters.Add(new MySqlParameter("@etat", intervenant.Etat));
     _requete.Parameters.Add(new MySqlParameter("@etage", intervenant.Etage));
     _requete.Parameters.Add(new MySqlParameter("@remarque", intervenant.Remarque));
     _requete.Parameters.Add(new MySqlParameter("@numeroContrat", intervenant.NumeroContrat));
     _requete.Parameters.Add(new MySqlParameter("@numeroSinistre", intervenant.NumeroSinistre));
     _requete.Parameters.Add(new MySqlParameter("@idRepresentant", intervenant.Representant.Id));
     _requete.Parameters.Add(new MySqlParameter("@idCompagnie", intervenant.Compagnie.Id));
     _requete.Parameters.Add(new MySqlParameter("@idAssureur", intervenant.Assureur.Id));
     _requete.Parameters.Add(new MySqlParameter("@idExpert", intervenant.Expert.Id));
     _requete.Parameters.Add(new MySqlParameter("@idDossier", intervenant.IdDossier));
     _requete.Parameters.Add(new MySqlParameter("@id", intervenant.Id));
     _requete.ExecuteNonQuery();
     _connexion.Close();
 }
Ejemplo n.º 2
0
        public void CreerIntervenant(Intervenant intervenant)
        {
            //
            string[] listeTablesAInsert          = new string[] { "Intervenant", "Compagnie", "Expert", "Representant", "Assureur", "Representant" };
            int[]    idsRetourneesParLesRequetes = new int[listeTablesAInsert.Length];
            for (int k = 0; k < listeTablesAInsert.Length; k++)
            {
                _connexion.Open();
                _requete = new MySqlCommand("INSERT INTO " + listeTablesAInsert[k] + "() VALUES()", _connexion);
                _requete.ExecuteNonQuery();
                _connexion.Close();
                idsRetourneesParLesRequetes[k] = SelectMaxId(listeTablesAInsert[k]);
            }
            intervenant.Id                       = idsRetourneesParLesRequetes[0];
            intervenant.Compagnie.Id             = idsRetourneesParLesRequetes[1];
            intervenant.Expert.Id                = idsRetourneesParLesRequetes[2];
            intervenant.Representant.Id          = idsRetourneesParLesRequetes[3];
            intervenant.Assureur.Id              = idsRetourneesParLesRequetes[4];
            intervenant.Assureur.Representant.Id = idsRetourneesParLesRequetes[5];

            MettreAJourIntervenant(intervenant);
            MettreAJourAssureur(intervenant.Assureur);
        }