public void MettreAJourRisque(Risque risque) { _connexion.Open(); _requete = new MySqlCommand("UPDATE Risque SET type=@type, dateConstruction=@dateConstruction, anneeConstruction=@anneeConstruction, typeMur=@typeMur, anneeConstructionMur=@anneeConstructionMur, typeCouverture=@typeCouverture, anneeConstructionCouverture=@anneeConstructionCouverture, utilite=@utilite, batimentClasse=@batimentClasse, etat=@etat, piecePrincipaleAuContrat=@piecePrincipaleAuContrat, piecePrincipaleConstatee=@piecePrincialeConstatee, dependanceAuContrat=@dependanceAuContrat, dependanceConstatee=@dependanceConstatee, details=@details, conformite=@conformite, motif=@motif, amiante=@amiante, assuranceDommageOuvrage=@assuranceDommageOuvrage WHERE id=@id ", _connexion); _requete.Parameters.Add(new MySqlParameter("@type", risque.Type)); _requete.Parameters.Add(new MySqlParameter("@dateConstruction", risque.DateConstruction)); _requete.Parameters.Add(new MySqlParameter("@anneeConstruction", risque.AnneeConstruction)); _requete.Parameters.Add(new MySqlParameter("@typeMur", risque.TypeMur)); _requete.Parameters.Add(new MySqlParameter("@anneeConstructionMur", risque.AnneeConstructionMur)); _requete.Parameters.Add(new MySqlParameter("@typeCouverture", risque.TypeCouverture)); _requete.Parameters.Add(new MySqlParameter("@anneeConstructionCouverture", risque.AnneeConstructionCouverture)); _requete.Parameters.Add(new MySqlParameter("@utilite", risque.Utilite)); _requete.Parameters.Add(new MySqlParameter("@batimentClasse", risque.BatimentClasse)); _requete.Parameters.Add(new MySqlParameter("@etat", risque.Etat)); _requete.Parameters.Add(new MySqlParameter("@piecePrincipaleAuContrat", risque.PiecePrincipaleAuContrat)); _requete.Parameters.Add(new MySqlParameter("@piecePrincialeConstatee", risque.PiecePrincipaleConstatee)); _requete.Parameters.Add(new MySqlParameter("@dependanceAuContrat", risque.DependanceAuContrat)); _requete.Parameters.Add(new MySqlParameter("@dependanceConstatee", risque.DependanceConstatee)); _requete.Parameters.Add(new MySqlParameter("@details", risque.Details)); _requete.Parameters.Add(new MySqlParameter("@conformite", risque.Conformite)); _requete.Parameters.Add(new MySqlParameter("@motif", risque.Motif)); _requete.Parameters.Add(new MySqlParameter("@amiante", risque.Amiante)); _requete.Parameters.Add(new MySqlParameter("@assuranceDommageOuvrage", risque.AssuranceDommageOuvrageSouscrite)); _requete.Parameters.Add(new MySqlParameter("@id", risque.Id)); _requete.ExecuteNonQuery(); _connexion.Close(); }
public Dossier(int id, Mission mission, Contrat contrat, Sinistre sinistre, Risque risque, bool estModifiable) { this._id = id; this._estModifiable = estModifiable; this._mission = mission; this._contrat = contrat; this._sinistre = sinistre; this._risque = risque; }
public Dossier() { this._id = 0; this._estModifiable = true; this._mission = new Mission(); this._contrat = new Contrat(); this._sinistre = new Sinistre(); this._risque = new Risque(); this._listeIntervenants = new List <Intervenant>(); }
public Risque RechercherRisqueParId(int id) { Risque risque; AssuranceDommageOuvrage assuranceDommageOuvrage = RechercherAssuranceDommageOuvrageParId(id); _connexion.Open(); _requete = new MySqlCommand("SELECT * FROM Risque WHERE id=@id", _connexion); _requete.Parameters.Add(new MySqlParameter("@id", id)); MySqlDataReader dr = _requete.ExecuteReader(); dr.Read(); risque = new Risque(Convert.ToInt32(dr["id"]), dr["type"].ToString(), dr["dateConstruction"].ToString(), Convert.ToInt32(dr["anneeConstruction"]), dr["typeMur"].ToString(), Convert.ToInt32(dr["anneeConstructionMur"]), dr["typeCouverture"].ToString(), Convert.ToInt32(dr["anneeConstructionCouverture"]), dr["utilite"].ToString(), Convert.ToBoolean(dr["batimentClasse"]), dr["etat"].ToString(), dr["piecePrincipaleAuContrat"].ToString(), dr["piecePrincipaleConstatee"].ToString(), dr["dependanceAuContrat"].ToString(), dr["dependanceConstatee"].ToString(), dr["details"].ToString(), Convert.ToBoolean(dr["conformite"]), dr["motif"].ToString(), dr["amiante"].ToString(), Convert.ToBoolean(dr["assuranceDommageOuvrage"]), assuranceDommageOuvrage); _connexion.Close(); return(risque); }