4 Commits

Author SHA1 Message Date
medhi.rodrigues
57de42ffa6 OKOKOK 2025-03-14 08:09:42 +01:00
medhi.rodrigues
5a923ab0f6 OKOKOK 2025-03-13 14:39:55 +01:00
35043c5d54 Merge pull request 'fin fonction' (#24) from jave.Emile into main
Reviewed-on: #24
2025-03-13 13:18:17 +01:00
3eca7c4d6a fin fonction 2025-03-13 13:17:30 +01:00
5 changed files with 62 additions and 9 deletions

View File

@@ -8,6 +8,7 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
/**
*
@@ -22,16 +23,16 @@ public class praticienSQL {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
public String[] rechercherPraticien(String login, String mdp) {
String[] praticienCherche = new String [2];
public ArrayList<String> rechercherPraticien(String login, String mdp) {
ArrayList<String> praticienCherche = new ArrayList<String>();
try {
stmt = connexionTest.createStatement();
// Acc<63>s <20> la table
result = stmt.executeQuery("SELECT * FROM PRATICIENLOG WHERE id='"+login+
"' AND mdp='"+mdp + "';");
if (result.next()) { // Le praticien a <20>t<EFBFBD> touv<75>
praticienCherche[0] = result.getString(1);
praticienCherche[1] = result.getString(2);
praticienCherche.add(result.getString(1));
praticienCherche.add(result.getString(2));
}
result.close();

View File

@@ -0,0 +1,48 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package acces_aux_donnes;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
/**
*
* @author medhi.rodrigues
*/
public class visiteurSQL {
private Connection connexionTest;
private Statement stmt = null;
private ResultSet result = null;
public visiteurSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
public ArrayList<String> rechercherVisiteur(String login, String mdp) {
ArrayList<String> visiteurCherche = new ArrayList<String>();
try {
stmt = connexionTest.createStatement();
// Acc<63>s <20> la table
result = stmt.executeQuery("SELECT * FROM PRATICIENLOG WHERE nom='"+login+
"' AND Mdp='"+mdp + "';");
if (result.next()) { // Le praticien a <20>t<EFBFBD> touv<75>
visiteurCherche.add(result.getString(1));
visiteurCherche.add(result.getString(2));
}
result.close();
stmt.close();
} catch (SQLException ex) {
System.out.println("SQLException : " + ex.getMessage());
System.out.println("SQLState : " + ex.getSQLState());
System.out.println("Code erreur : " + ex.getErrorCode());
}
return visiteurCherche;
}
}

View File

@@ -5,6 +5,8 @@
package presentation;
import acces_aux_donnes.praticienSQL;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
@@ -159,11 +161,11 @@ public class jffConnexion extends javax.swing.JFrame {
String identifiant = jTFIdentifiant.getText();
String mdp = String.valueOf(jPFmdp.getPassword());
praticienSQL testPraticien = new praticienSQL();
String [] lePraticien = testPraticien.rechercherPraticien(identifiant,mdp);
if (lePraticien[0] != null){
System.out.print("TEST REUSSIE");
ArrayList<String>lePraticien = testPraticien.rechercherPraticien(identifiant,mdp);
if (lePraticien.get(0) != null){
new jffFamilleMedoc().setVisible(true);
}else {
System.out.print("TEST EMILE RACISTE");
JOptionPane.showMessageDialog(null,"Erreur de connexion, Veuillez recommencer");
}
}//GEN-LAST:event_jBValiderActionPerformed

View File

@@ -10,6 +10,7 @@ import acces_aux_donnes.familleMedocSQL;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
/**
*
@@ -146,7 +147,7 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
}else {
//ajout d'un JoptionPane
JOptionPane.showMessageDialog(null,"Veuillez choisir un m<>dicament valide");
}
}//GEN-LAST:event_jBRechercheValideActionPerformed

View File

@@ -15,6 +15,7 @@ public class jffProfession extends javax.swing.JFrame {
*/
public jffProfession() {
initComponents();
}
/**