Compare commits

..

No commits in common. "e39b7469bcd7151c21b82f235e965370f0e74a82" and "c8a8aac2143fa31d148163ba8a5550ef0abaf05f" have entirely different histories.

6 changed files with 79 additions and 305 deletions

View File

@ -0,0 +1,38 @@
/*
* 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 Metier;
/**
*
* @author medhi.rodrigues
*/
public class famille {
/**
* l'identifiant permettant de connaitre la famille du médicament
*/
private String id;
/** LE CONSTRUCTEUR DEFAULT
*
* @param id
*/
public famille(String id) {
this.id = id;
}
// LES SETTEUR
/**
* @return the id
*/
public String getId() {
return id;
}
@Override
public String toString() {
return "famille{" + "id=" + id + '}';
}
}

View File

@ -6,10 +6,8 @@ package acces_aux_donnes;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Vector;
/**
*
@ -24,65 +22,6 @@ public class familleMedocSQL {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
public Vector<String> rechercheFamille(){
Vector<String> famille = new Vector<String>();
try {
stmt = connexionTest.createStatement();
// Accès à la table
result = stmt.executeQuery("SELECT fLibelle FROM FAMILLE;");
while(result.next()) { // Le praticien a été touvé
famille.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 famille;
}
public String rechercheCodeFamille(String libelle){
String code = "";
try {
stmt = connexionTest.createStatement();
// Accès à la table
result = stmt.executeQuery("SELECT fCode FROM FAMILLE WHERE fLibelle ='"+ libelle +"';");
while(result.next()) { // Le praticien a été touvé
code = 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 code;
}
public Vector<String> rechercherMedocFamille(String libelle){
Vector<String> famille = new Vector<String>();
try {
stmt = connexionTest.createStatement();
// Accès à la table
result = stmt.executeQuery("SELECT mNomCommercial FROM MEDICAMENT WHERE fCode ='"+ libelle +"';");
while(result.next()) { // Le praticien a été touvé
famille.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 famille;
}

View File

@ -0,0 +1,13 @@
/*
* 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;
/**
*
* @author emile.lalorcey
*/
public class visiteurMedicalSQL {
}

View File

@ -5,7 +5,6 @@
package presentation;
import acces_aux_donnes.praticienSQL;
import javax.swing.JOptionPane;
/**
*
@ -163,9 +162,8 @@ public class jffConnexion extends javax.swing.JFrame {
String [] lePraticien = testPraticien.rechercherPraticien(identifiant,mdp);
if (lePraticien[0] != null){
System.out.print("TEST REUSSIE");
JOptionPane.showMessageDialog(null,"Bienvenue" + lePraticien[1]);
}else {
JOptionPane.showMessageDialog(null, "Erreur d'authentification, veuillez réesayer");
System.out.print("TEST EMILE RACISTE");
}
}//GEN-LAST:event_jBValiderActionPerformed

View File

@ -1,48 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Menu class="javax.swing.JMenuBar" name="jMenuBar1">
<SubComponents>
<Menu class="javax.swing.JMenu" name="jMenu1">
<Properties>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMIAPropos">
<Properties>
<Property name="text" type="java.lang.String" value="&#xe0; propos"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMIAProposActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMIQuitter">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Alt+F4"/>
</Property>
<Property name="text" type="java.lang.String" value="Quitter"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMIQuitterActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu2">
<Properties>
<Property name="text" type="java.lang.String" value="Edit"/>
</Properties>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
@ -61,40 +23,20 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLRecherche" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jTFRecherche" min="-2" pref="80" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="58" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jCBFamille" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="42" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jBRechercheValide" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jCBMedocListe" min="-2" pref="176" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="344" max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Component id="jLRecherche" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jTFRecherche" min="-2" pref="80" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jBRechercheValide" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -108,12 +50,7 @@
<Component id="jTFRecherche" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBRechercheValide" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCBFamille" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCBMedocListe" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="264" max="32767" attributes="0"/>
<EmptySpace pref="227" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -144,41 +81,5 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBRechercheValideActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jCBFamille">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jCBFamilleActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JComboBox" name="jCBMedocListe">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jCBMedocListeActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Form>

View File

@ -6,11 +6,7 @@ package presentation;
import Metier.Medicament;
import acces_aux_donnes.MedicamentSQL;
import acces_aux_donnes.familleMedocSQL;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
/**
*
@ -23,8 +19,6 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
*/
public jffFamilleMedoc() {
initComponents();
familleMedocSQL famille = new familleMedocSQL();
jCBFamille.setModel(new DefaultComboBoxModel(famille.rechercheFamille()));
}
/**
@ -40,13 +34,6 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
jLRecherche = new javax.swing.JLabel();
jTFRecherche = new javax.swing.JTextField();
jBRechercheValide = new javax.swing.JButton();
jCBFamille = new javax.swing.JComboBox<>();
jCBMedocListe = new javax.swing.JComboBox<>();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMIAPropos = new javax.swing.JMenuItem();
jMIQuitter = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
@ -67,74 +54,22 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
}
});
jCBFamille.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jCBFamille.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCBFamilleActionPerformed(evt);
}
});
jCBMedocListe.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jCBMedocListe.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCBMedocListeActionPerformed(evt);
}
});
jMenu1.setText("File");
jMIAPropos.setText("à propos");
jMIAPropos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIAProposActionPerformed(evt);
}
});
jMenu1.add(jMIAPropos);
jMIQuitter.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_DOWN_MASK));
jMIQuitter.setText("Quitter");
jMIQuitter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIQuitterActionPerformed(evt);
}
});
jMenu1.add(jMIQuitter);
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLRecherche)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTFRecherche, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(58, 58, 58))
.addGroup(layout.createSequentialGroup()
.addComponent(jCBFamille, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(42, 42, 42)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jBRechercheValide)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jCBMedocListe, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(344, Short.MAX_VALUE)
.addComponent(jLabel1)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLRecherche)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTFRecherche, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jBRechercheValide)
.addGap(27, 27, 27))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -146,11 +81,7 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
.addComponent(jLRecherche)
.addComponent(jTFRecherche, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jBRechercheValide))
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCBFamille, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCBMedocListe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(264, Short.MAX_VALUE))
.addContainerGap(227, Short.MAX_VALUE))
);
pack();
@ -162,7 +93,6 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
private void jBRechercheValideActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBRechercheValideActionPerformed
String medocRechercher = jTFRecherche.getText();
System.out.println(medocRechercher);
MedicamentSQL medocTest = new MedicamentSQL();
ArrayList<String> rechercheMedoc = new ArrayList<String>();
rechercheMedoc = medocTest.rechercherMedicament(medocRechercher);
@ -178,47 +108,9 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
}else {
JOptionPane.showMessageDialog(null,"Erreur, Veuillez réesayer"); }
}//GEN-LAST:event_jBRechercheValideActionPerformed
private void jCBFamilleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBFamilleActionPerformed
familleMedocSQL famille = new familleMedocSQL();
Vector<String> medocFamille = new Vector<String>();
String libelleFamille = jCBFamille.getSelectedItem().toString();
String codeFamille = famille.rechercheCodeFamille(libelleFamille);
medocFamille = famille.rechercherMedocFamille(codeFamille);
jCBMedocListe.setModel(new DefaultComboBoxModel(medocFamille));
}//GEN-LAST:event_jCBFamilleActionPerformed
private void jCBMedocListeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBMedocListeActionPerformed
String nomMedoc = jCBMedocListe.getSelectedItem().toString();
System.out.println(nomMedoc);
MedicamentSQL medocTest = new MedicamentSQL();
ArrayList<String> rechercheMedoc = new ArrayList<String>();
rechercheMedoc = medocTest.rechercherMedicament(nomMedoc);
System.out.print("TEst");
if (rechercheMedoc.get(0) != null) {
String idTrouve = rechercheMedoc.get(0);
String nomTrouve = rechercheMedoc.get(1);
String compositionTrouve = rechercheMedoc.get(2);
String effetTrouve = rechercheMedoc.get(3);
String contreIndicationTrouve = rechercheMedoc.get(4);
String imgTrouve = idTrouve;
Medicament medocTrouve = new Medicament(idTrouve, nomTrouve , compositionTrouve, effetTrouve, contreIndicationTrouve,imgTrouve);
new jffInfoMedoc(medocTrouve).setVisible(true);
//ajout d'un JoptionPane
}
}//GEN-LAST:event_jCBMedocListeActionPerformed
private void jMIAProposActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIAProposActionPerformed
JOptionPane.showMessageDialog(null,"Fait par Medhi et un Raciste");
}//GEN-LAST:event_jMIAProposActionPerformed
private void jMIQuitterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIQuitterActionPerformed
System.exit(0);
}//GEN-LAST:event_jMIQuitterActionPerformed
}//GEN-LAST:event_jBRechercheValideActionPerformed
/**
* @param args the command line arguments
@ -257,15 +149,8 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBRechercheValide;
private javax.swing.JComboBox<String> jCBFamille;
private javax.swing.JComboBox<String> jCBMedocListe;
private javax.swing.JLabel jLRecherche;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenuItem jMIAPropos;
private javax.swing.JMenuItem jMIQuitter;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JTextField jTFRecherche;
// End of variables declaration//GEN-END:variables
}