// Mise à jour de l'adherent public void MAJ(Adherent a) { //Tout est mis à jour SAUF le numéro d'adhérent this.Nom = a.Nom; this.Prenom = a.Prenom; this.NumeroDeRue = a.NumeroDeRue; this.NomDeRue = a.NomDeRue; this.CodePostal = a.CodePostal; this.Ville = a.Ville; this.Telephone = a.Telephone; this.Mail = a.Mail; this.PerimeLe = a.PerimeLe; this.Password = a.Password; DAO_Adherent.MAJ_Adherent(a); }
//*********************************************************************************************** //******************************************************** //**** Mise a jour des infos d'un adhérent *** //******************************************************** public static bool MAJ_Adherent(Adherent a) { String strSql = "UPDATE ADHERENT SET nomAdherent ='" + a.Nom + "' , prenomAdherent='" + a.Prenom + "' , numRueAdherent='" + a.NumeroDeRue + "' , nomRueAdherent='" + a.NomDeRue + "' , CPAdherent='" + a.CodePostal + "' , villeAdherent='" + a.Ville + "' , teleAdherent='" + a.Telephone + "' , adrMailAdherent='" + a.Mail + "' , perimeLe='" + a.PerimeLe + "' , pwdAdherent='" + a.Password + "' WHERE numAdherent='" + a.NumeroAdherent + "'"; // Cette requête SQL est formuler à la BDD return(DAO.Execute_Ins_Upd_Delete(strSql)); }
//************************************************* //*** Ajout d'un nouvel adherent dans la liste *** //************************************************* public static bool Ajout_Adherent(Adherent a) { String strSql = "INSERT INTO ADHERENT VALUES('" + a.NumeroAdherent + "' , '" + a.Nom + "' , '" + a.Prenom + "' , " + a.NumeroDeRue + " , '" + a.NomDeRue.ToString() + "' , " + a.CodePostal.ToString() + " , '" + a.Ville.ToString() + "' , '" + a.Telephone + "' , '" + a.Mail.ToString() + "' , '" + a.PerimeLe.ToString() + "' , '" + a.Password + "') "; // Cette requête SQL est formuler à la BDD return(DAO.Execute_Ins_Upd_Delete(strSql)); }
//..................................... public Emprunt(string NumAdherent, int NumExemplaire, DateTime Datej, DateTime DateRestitution)//Constructeur d'initialisation { Adherent a = new Adherent(); a.NumeroAdherent = NumAdherent; string retour = a.droit_emprunter(); if (retour == "OK") { _numAdherent = NumAdherent; _numExemplaire = NumExemplaire; _dateJ = Datej; _dateRestitutionEffective = DateRestitution; //Ajout++ _nbEmprunt++; } else { Exception e = new Exception(retour); throw e; } }