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();
Merci pour votre compréhension.