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
| package com.anso.dpicol.model;
import javax.swing.JList;
/**
*
* @author Cool
*/
public class Utilisateur {
private String nom;
private String mdp;
private int drtAn;
private int drtJs;
private int drtAm;
private int drtAdmin;
public String getNom(){
return this.nom;
}
public String getMdp(){
return this.mdp;
}
public int getDrtAn(){
return this.drtAn;
}
public int getDrtJs(){
return this.drtJs;
}
public int getDrtAm(){
return this.drtAm;
}
public int getDrtAdmin(){
return this.drtAdmin;
}
public void setNom(String nom) {
this.nom = nom;
}
public void setMdp(String mdp) {
this.mdp = mdp;
}
public void setDrtAn(int drt1) {
this.drtAn = drt1;
}
public void setDrtJs(int drt2) {
this.drtJs = drt2;
}
public void setDrtAm(int drt3) {
this.drtAm = drt3;
}
public void setDrtAdmin(int drt4) {
this.drtAdmin = drt4;
}
}
package com.anso.dpicol.services;
public class ServicesUtilisateur {
public boolean modifierUtilisateur(Utilisateur user) {
Connection connection = DataBaseConnector.getConnection();
if (connection == null) {
return false;
}
try {
PreparedStatement preparedStatement = connection.prepareStatement("update user set NomUser=?,Pass=?,Acte_Naiss=?,Juge_Sup=?,Acte_Mar=?,Droit_Admin=? where NomUser=? ");
// PreparedStatement prep2 = connection.prepareStatement("UPDATE Annuaire SET noTel = ? WHERE nom = ?");
preparedStatement.setString(1, user.getNom());
preparedStatement.setString(2, user.getMdp());
preparedStatement.setInt(3, user.getDrtAn());
preparedStatement.setInt(4, user.getDrtJs());
preparedStatement.setInt(5, user.getDrtAm());
preparedStatement.setInt(6, user.getDrtAdmin());
//preparedStatement.setString(7, user.getNom());/*j'avais ecris ça mais lui il considere le nom saisi dans le JTextfield*/
preparedStatement.setString(7,com.anso.dpicol.vue.FrmMaj1.jList1.getSelectedValue().toString());/*mon probleme se situe à ce niveau*/
preparedStatement.executeUpdate(); |
Partager