1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
| package modeles;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Vector;
import exception.Ca_chie;
import fonctions.Metaresult;
public class MdAbonnes {
protected int id_abonne;
protected int id_ville;
protected int id_categorie;
protected String nom;
protected String prenom;
protected long date_naissance;
protected String adresse;
protected String tel_fixe;
protected String tel_port;
protected String mail;
protected int cotisation;
protected int etat;
protected long date_inscription;
private Metaresult meta=null;
public MdAbonnes() {
}
/**
* @param nom
* @param prenom
* @param date_naissance
* @param adresse
* @param tel_fixe
* @param tel_port
* @param mail
* @param cotisation smallint
* @param etat smallint
* @param date_inscription
* @param ville
* @param categorie
* @throws ClassNotFoundException
* @throws SQLException
* @throws Ca_chie
*/
public void ajoute() throws Ca_chie {
String question="INSERT into abonne (nom_abonne,prenom_abonne,date_naiss,adresse_abonne,tel_fixe,tel_port,mail,cotisation,etat,date_inscription,id_ville,id_categorie) values('"+this.nom+"','"+this.prenom+"','"+this.date_naissance+"','"+this.adresse+"', '"+this.tel_fixe+"', '"+this.tel_port+"', '"+this.mail+"', '"+this.cotisation+"', '"+this.etat+"', '"+this.date_inscription+"', '"+this.id_ville+"', '"+this.id_categorie+"')";
meta=new Metaresult();
meta.execute(question);
meta.close();
}
/**
* @return Tous les abonnes
* @throws Ca_chie
* @throws SQLException
* @throws ClassNotFoundException
*/
public Vector<Vector<String>> affiche() throws Ca_chie{
String question="SELECT * from abonne;";
meta=new Metaresult();
meta.execute(question);
meta.close();
return meta.getVecligne();
}
public Vector affabo() throws Ca_chie{
String question="SELECT nom_abonne from abonne;";
meta=new Metaresult();
meta.execute(question);
meta.close();
return meta.getVecligne();
}
public void select() throws Ca_chie{
String question="SELECT * from abonne where id_abonne="+this.id_abonne+";";
meta=new Metaresult();
meta.execute(question);
Vector<String> vec=meta.getVecligne().elementAt(1);
this.nom=vec.elementAt(1);
this.prenom=vec.elementAt(2);
this.date_naissance=new Long(vec.elementAt(3));
this.adresse=vec.elementAt(4);
this.tel_fixe=vec.elementAt(5);
this.tel_port=vec.elementAt(6);
this.mail=vec.elementAt(7);
this.cotisation=new Integer(vec.elementAt(8));
this.date_inscription=new Long(vec.elementAt(9));
this.etat=new Integer(vec.elementAt(10));
this.id_ville=new Integer(vec.elementAt(11));
this.id_categorie=new Integer(vec.elementAt(12));
meta.close();
}
public void select_adresse() throws Ca_chie{
String question="SELECT id_abonne from abonne where nom='"+this.nom+"' and prenom='"+this.prenom+"' and adresse='"+this.adresse+"';";
meta=new Metaresult();
meta.execute(question);
this.id_abonne=new Integer(meta.getVecligne().elementAt(1).elementAt(0));
meta.close();
select();
}
public void select_date() throws Ca_chie{
String question="SELECT id_abonne from abonne where nom='"+this.nom+"' and prenom='"+this.prenom+"' and date_naiss='"+this.date_naissance+"';";
meta=new Metaresult();
meta.execute(question);
this.id_abonne=new Integer(meta.getVecligne().elementAt(1).elementAt(0));
meta.close();
select();
}
public void modifie() throws Ca_chie{
String question="UPDATE abonne set 'nom_abonne'='"+this.nom+"','prenom_abonne'='"+this.prenom+"','date_naiss'='"+this.date_naissance+"','adresse_abonne'='"+this.adresse+"','tel_fixe'='"+this.tel_fixe+"','tel_port'='"+this.tel_port+"','mail'='"+this.mail+"','cotisation'='"+this.cotisation+"','etat'='"+this.etat+"','date_inscription'='"+this.date_inscription+"','id_ville'='"+this.id_ville+"','id_categorie'='"+this.id_categorie+"' where 'id_abonne='"+this.id_abonne+"';";
meta= new Metaresult();
meta.execute(question);
meta.close();
}
public void supprime() throws Ca_chie{
String question="DELETE from abonne where id_abonne="+this.id_abonne+";";
meta=new Metaresult();
meta.execute(question);
meta.close();
}
public int getId_abonne() {
return id_abonne;
}
public void setId_abonne(int id_abonne) {
this.id_abonne = id_abonne;
}
public int getId_ville() {
return id_ville;
}
public void setId_ville(int id_ville) {
this.id_ville = id_ville;
}
public int getId_categorie() {
return id_categorie;
}
public void setId_categorie(int id_categorie) {
this.id_categorie = id_categorie;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public long getDate_naissance() {
return date_naissance;
}
public void setDate_naissance(long date_naissance) {
this.date_naissance = date_naissance;
}
public String getAdresse() {
return adresse;
}
public void setAdresse(String adresse) {
this.adresse = adresse;
}
public String getTel_fixe() {
return tel_fixe;
}
public void setTel_fixe(String tel_fixe) {
this.tel_fixe = tel_fixe;
}
public String getTel_port() {
return tel_port;
}
public void setTel_port(String tel_port) {
this.tel_port = tel_port;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public int isCotisation() {
return cotisation;
}
public void setCotisation(int cotisation) {
this.cotisation = cotisation;
}
public int isEtat() {
return etat;
}
public void setEtat(int etat) {
this.etat = etat;
}
public long getDate_inscription() {
return date_inscription;
}
public void setDate_inscription(long date_inscription) {
this.date_inscription = date_inscription;
}
} |
Partager