diff --git a/GSBapplication/src/acces_aux_donnes/visiteurSQL.java b/GSBapplication/src/acces_aux_donnes/visiteurSQL.java new file mode 100644 index 0000000..97e1c7f --- /dev/null +++ b/GSBapplication/src/acces_aux_donnes/visiteurSQL.java @@ -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 rechercherVisiteur(String login, String mdp) { + ArrayList visiteurCherche = new ArrayList(); + try { + stmt = connexionTest.createStatement(); + // Accès à la table + result = stmt.executeQuery("SELECT * FROM PRATICIENLOG WHERE nom='"+login+ + "' AND Mdp='"+mdp + "';"); + if (result.next()) { // Le praticien a été touvé + 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; + } + +} diff --git a/GSBapplication/src/presentation/jffFamilleMedoc.java b/GSBapplication/src/presentation/jffFamilleMedoc.java index 58e5c24..128d896 100644 --- a/GSBapplication/src/presentation/jffFamilleMedoc.java +++ b/GSBapplication/src/presentation/jffFamilleMedoc.java @@ -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 diff --git a/GSBapplication/src/presentation/jffProfession.java b/GSBapplication/src/presentation/jffProfession.java index 4756546..360486e 100644 --- a/GSBapplication/src/presentation/jffProfession.java +++ b/GSBapplication/src/presentation/jffProfession.java @@ -15,6 +15,7 @@ public class jffProfession extends javax.swing.JFrame { */ public jffProfession() { initComponents(); + } /**