Compare commits

..

7 Commits

Author SHA1 Message Date
7be498e60d visiteurSql 2025-03-14 09:07:29 +01:00
2e3414be26 visiteurSql 2025-03-14 09:03:04 +01:00
546a6a8717 observation à finir 2025-03-14 08:10:38 +01:00
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
6b89fb950d Merge pull request 'familleMedoc fini' (#23) from jave.Emile into main
Reviewed-on: #23
2025-03-13 13:08:04 +01:00
8 changed files with 86 additions and 16 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

@ -0,0 +1,51 @@
/*
* 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.69","bdgsb","appliGSB","(Uq1XV0Tr01s2H9Z");
}
public ArrayList<String> rechercherVisiteur(String login, String mdp) {
ArrayList<String> visiteurCherche = new ArrayList<String>();
try {
stmt = connexionTest.createStatement();
// Accès à la table
result = stmt.executeQuery("SELECT * FROM VISITEUR WHERE vNom='"+login+
"' AND vMdp='"+mdp + "';");
if (result.next()) { // Le praticien a été touvé
visiteurCherche.add(result.getString(1));
visiteurCherche.add(result.getString(2));
System.out.println(visiteurCherche.add(result.getString(1)));
}
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,7 +5,9 @@
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;
/** /**
* *
@ -157,16 +159,32 @@ 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);
System.out.print("TEST REUSSIE"); if (lePraticien.get(0) != null){
new jffFamilleMedoc().setVisible(true); new jffFamilleMedoc().setVisible(true);
}else { }else {
System.out.print("TEST EMILE RACISTE"); //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 {
leVisiteur.add("12");
//JOptionPane.showMessageDialog(null,"Erreur de connexion, Veuillez recommencer");
}
}
this.setVisible(false);
}//GEN-LAST:event_jBValiderActionPerformed }//GEN-LAST:event_jBValiderActionPerformed
/** /**
@ -199,7 +217,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);
} }
}); });
} }

View File

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

View File

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