visiteurSql

This commit is contained in:
emile.malcuit 2025-03-14 09:03:04 +01:00
parent 546a6a8717
commit 2e3414be26
6 changed files with 37 additions and 19 deletions

View File

@ -19,7 +19,7 @@ public class MedicamentSQL {
private ResultSet result = null; private ResultSet result = null;
public MedicamentSQL() { public MedicamentSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB"); connexionTest = connexionSQL.getConnect("10.121.38.69","bdgsb","appliGSB","(Uq1XV0Tr01s2H9Z");
} }
public ArrayList<String> rechercherMedicament (String nomCo){ public ArrayList<String> rechercherMedicament (String nomCo){

View File

@ -21,7 +21,7 @@ public class familleMedocSQL {
private ResultSet result = null; private ResultSet result = null;
public familleMedocSQL(){ public familleMedocSQL(){
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB"); connexionTest = connexionSQL.getConnect("10.121.38.69","bdgsb","appliGSB","(Uq1XV0Tr01s2H9Z");
} }
public Vector<String> rechercheFamille(){ public Vector<String> rechercheFamille(){

View File

@ -21,7 +21,7 @@ public class observationSQL {
private ResultSet result = null; private ResultSet result = null;
public observationSQL() { public observationSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB"); connexionTest = connexionSQL.getConnect("10.121.38.69","bdgsb","appliGSB","(Uq1XV0Tr01s2H9Z");
} }
public int compterLignes(){ public int compterLignes(){

View File

@ -20,7 +20,7 @@ public class praticienSQL {
private ResultSet result = null; private ResultSet result = null;
public praticienSQL() { public praticienSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB"); connexionTest = connexionSQL.getConnect("10.121.38.69","bdgsb","appliGSB","(Uq1XV0Tr01s2H9Z");
} }
public ArrayList<String> rechercherPraticien(String login, String mdp) { public ArrayList<String> rechercherPraticien(String login, String mdp) {

View File

@ -20,7 +20,7 @@ public class visiteurSQL {
private ResultSet result = null; private ResultSet result = null;
public visiteurSQL() { public visiteurSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB"); connexionTest = connexionSQL.getConnect("10.121.38.69","bdgsb","appliGSB","(Uq1XV0Tr01s2H9Z");
} }
public ArrayList<String> rechercherVisiteur(String login, String mdp) { public ArrayList<String> rechercherVisiteur(String login, String mdp) {
@ -28,11 +28,14 @@ public class visiteurSQL {
try { try {
stmt = connexionTest.createStatement(); stmt = connexionTest.createStatement();
// Accès à la table // Accès à la table
result = stmt.executeQuery("SELECT * FROM PRATICIENLOG WHERE nom='"+login+
"' AND Mdp='"+mdp + "';"); result = stmt.executeQuery("SELECT * FROM VISITEUR WHERE vNom='"+login+
"' AND vMdp='"+mdp + "';");
if (result.next()) { // Le praticien a été touvé if (result.next()) { // Le praticien a été touvé
visiteurCherche.add(result.getString(1)); visiteurCherche.add(result.getString(1));
visiteurCherche.add(result.getString(2)); visiteurCherche.add(result.getString(2));
System.out.println(visiteurCherche.add(result.getString(1)));
} }
result.close(); result.close();

View File

@ -5,6 +5,7 @@
package presentation; package presentation;
import acces_aux_donnes.praticienSQL; import acces_aux_donnes.praticienSQL;
import acces_aux_donnes.visiteurSQL;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -158,15 +159,30 @@ public class jffConnexion extends javax.swing.JFrame {
}//GEN-LAST:event_jPFmdpActionPerformed }//GEN-LAST:event_jPFmdpActionPerformed
private void jBValiderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBValiderActionPerformed private void jBValiderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBValiderActionPerformed
String identifiant = jTFIdentifiant.getText(); if(this.profession == 0){
String mdp = String.valueOf(jPFmdp.getPassword()); String identifiant = jTFIdentifiant.getText();
praticienSQL testPraticien = new praticienSQL(); String mdp = String.valueOf(jPFmdp.getPassword());
ArrayList<String>lePraticien = testPraticien.rechercherPraticien(identifiant,mdp); praticienSQL testPraticien = new praticienSQL();
if (lePraticien.get(0) != null){ ArrayList<String>lePraticien = testPraticien.rechercherPraticien(identifiant,mdp);
new jffFamilleMedoc().setVisible(true); if (lePraticien.get(0) != null){
}else { new jffFamilleMedoc().setVisible(true);
JOptionPane.showMessageDialog(null,"Erreur de connexion, Veuillez recommencer"); }else {
JOptionPane.showMessageDialog(null,"Erreur de connexion, Veuillez recommencer");
}
}else{
String identifiant = jTFIdentifiant.getText();
String mdp = String.valueOf(jPFmdp.getPassword());
visiteurSQL testVisiteur = new visiteurSQL();
ArrayList<String>leVisiteur = testVisiteur.rechercherVisiteur(identifiant,mdp);
System.out.println(leVisiteur.get(0));
if (leVisiteur.get(0) != null){
new jffFamilleMedoc().setVisible(true);
}else {
JOptionPane.showMessageDialog(null,"Erreur de connexion, Veuillez recommencer");
}
} }
this.setVisible(false);
}//GEN-LAST:event_jBValiderActionPerformed }//GEN-LAST:event_jBValiderActionPerformed
/** /**
@ -199,7 +215,6 @@ public class jffConnexion extends javax.swing.JFrame {
/* Create and display the form */ /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
new jffConnexion(1).setVisible(true);
} }
}); });
} }