Compare commits

...

4 Commits

Author SHA1 Message Date
medhi.rodrigues
309bb4117d PAs de doc 2 2025-03-13 10:19:10 +01:00
4813c5d4af Merge pull request 'medicamentSQL fini' () from jave.Emile into main
Reviewed-on: 
2025-03-12 17:03:31 +01:00
e4dc4a3603 medicamentSQL fini
jffMedicament début
2025-03-12 17:02:31 +01:00
fdaace4310 Merge pull request 'MedhiJava' () from MedhiJava into main
Reviewed-on: 
2025-03-12 16:18:15 +01:00
8 changed files with 400 additions and 12 deletions

@ -6,6 +6,7 @@ package TEST;
import acces_aux_donnes.connexionSQL;
import acces_aux_donnes.praticienSQL;
import acces_aux_donnes.MedicamentSQL;
import java.sql.Connection;
/**
@ -25,8 +26,17 @@ public class testMain {
//Connection connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
//Yann
//Connection connexionTest = connexionSQL.getConnect("10.121.38.69","bdgsb","appliGSB","(Uq1XV0Tr01s2H9Z");
praticienSQL a =new praticienSQL();
a.rechercherPraticien("Didier", "1234");
//praticienSQL a =new praticienSQL();
//a.rechercherPraticien("Didier", "1234");
//MedicamentSQL b = new MedicamentSQL();
//b.rechercherMedicament("3MYC7");
String id= "3MYC7";
String imgTrouve = "../img/"+ id +".jpg";
System.out.print(imgTrouve);
}

@ -4,10 +4,60 @@
*/
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 emile.lalorcey
*/
public class MedicamentSQL {
private Connection connexionTest;
private Statement stmt = null;
private ResultSet result = null;
public MedicamentSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
public ArrayList<String> rechercherMedicament (String nomCo){
ArrayList<String> infoMedoc = new ArrayList<String>();
try {
stmt = connexionTest.createStatement();
// Accès à la table
result = stmt.executeQuery("SELECT * FROM MEDICAMENT WHERE mNomCommercial ='"+nomCo+"';");
if(result.next()){
infoMedoc.add(result.getString(1));
infoMedoc.add(result.getString(2));
infoMedoc.add(result.getString(3));
infoMedoc.add(result.getString(4));
infoMedoc.add(result.getString(5));
infoMedoc.add(result.getString(6));
}
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 infoMedoc;
}
}

@ -4,10 +4,36 @@
*/
package acces_aux_donnes;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
/**
*
* @author emile.lalorcey
*/
public class familleMedocSQL {
private Connection connexionTest;
private Statement stmt = null;
private ResultSet result = null;
public familleMedocSQL(){
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
}

@ -34,8 +34,8 @@ public class praticienSQL {
praticienCherche[1] = result.getString(2);
}
result.close();
stmt.close();
result.close();
stmt.close();
} catch (SQLException ex) {
System.out.println("SQLException : " + ex.getMessage());
System.out.println("SQLState : " + ex.getSQLState());

@ -28,6 +28,15 @@
<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">
@ -35,7 +44,13 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="262" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLRecherche" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTFRecherche" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBRechercheValide" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="227" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -48,5 +63,23 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLRecherche">
<Properties>
<Property name="text" type="java.lang.String" value="Recherche m&#xe9;dicament : "/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTFRecherche">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTFRechercheActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jBRechercheValide">
<Properties>
<Property name="text" type="java.lang.String" value="Rechercher"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBRechercheValideActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

@ -4,6 +4,10 @@
*/
package presentation;
import Metier.medicament;
import acces_aux_donnes.MedicamentSQL;
import java.util.ArrayList;
/**
*
* @author emile.lalorcey
@ -27,11 +31,29 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLRecherche = new javax.swing.JLabel();
jTFRecherche = new javax.swing.JTextField();
jBRechercheValide = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/logodetoure.gif"))); // NOI18N
jLRecherche.setText("Recherche médicament : ");
jTFRecherche.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTFRechercheActionPerformed(evt);
}
});
jBRechercheValide.setText("Rechercher");
jBRechercheValide.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBRechercheValideActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@ -40,18 +62,57 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
.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)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addContainerGap(262, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLRecherche)
.addComponent(jTFRecherche, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jBRechercheValide))
.addContainerGap(227, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jTFRechercheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTFRechercheActionPerformed
}//GEN-LAST:event_jTFRechercheActionPerformed
private void jBRechercheValideActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBRechercheValideActionPerformed
String medocRechercher = jTFRecherche.getText();
MedicamentSQL medocTest = new MedicamentSQL();
ArrayList<String> rechercheMedoc = new ArrayList<String>();
rechercheMedoc = medocTest.rechercherMedicament(medocRechercher);
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 = "../img/"+ idTrouve +".jpg";
medicament medocTrouve = new medicament(idTrouve, nomTrouve , compositionTrouve, effetTrouve
, contreIndicationTrouve,imgTrouve);
new jffInfoMedoc(medocTrouve).setVisible(true);
}else {
//ajout d'un JoptionPane
}
}//GEN-LAST:event_jBRechercheValideActionPerformed
/**
* @param args the command line arguments
*/
@ -88,6 +149,9 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBRechercheValide;
private javax.swing.JLabel jLRecherche;
private javax.swing.JLabel jLabel1;
private javax.swing.JTextField jTFRecherche;
// End of variables declaration//GEN-END:variables
}

@ -23,13 +23,129 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPFond" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jPFond" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPFond">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSeparator1" alignment="1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLContrindication" min="-2" pref="265" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLPrix" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLComposition" min="-2" pref="265" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" pref="265" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLImage" min="-2" pref="157" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="26" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="168" max="-2" attributes="0"/>
<Component id="jLNomMedoc" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLNomMedoc" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel1" min="-2" pref="86" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLComposition" min="-2" pref="74" max="-2" attributes="0"/>
</Group>
<Component id="jLImage" max="32767" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace type="unrelated" pref="18" max="32767" attributes="0"/>
<Component id="jLContrindication" min="-2" pref="70" max="-2" attributes="0"/>
<EmptySpace pref="23" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
<Component id="jLPrix" min="-2" pref="26" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
<Component id="jSeparator1" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="169" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLNomMedoc">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Segoe UI Black" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Nom du M&#xe9;doc"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Les effets du m&#xe9;dicament"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLComposition">
<Properties>
<Property name="text" type="java.lang.String" value="Composition du m&#xe9;doc"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLContrindication">
<Properties>
<Property name="text" type="java.lang.String" value="Contrindications du m&#xe9;doc"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLImage">
<Properties>
<Property name="text" type="java.lang.String" value="Image"/>
</Properties>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator1">
</Component>
<Component class="javax.swing.JLabel" name="jLPrix">
<Properties>
<Property name="text" type="java.lang.String" value="Prix :"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

@ -4,6 +4,8 @@
*/
package presentation;
import Metier.medicament;
/**
*
* @author emile.lalorcey
@ -13,7 +15,7 @@ public class jffInfoMedoc extends javax.swing.JFrame {
/**
* Creates new form jffInfoMedoc
*/
public jffInfoMedoc() {
public jffInfoMedoc(medicament medocTrouve) {
initComponents();
}
@ -26,17 +28,97 @@ public class jffInfoMedoc extends javax.swing.JFrame {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPFond = new javax.swing.JPanel();
jLNomMedoc = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLComposition = new javax.swing.JLabel();
jLContrindication = new javax.swing.JLabel();
jLImage = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jLPrix = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLNomMedoc.setFont(new java.awt.Font("Segoe UI Black", 0, 18)); // NOI18N
jLNomMedoc.setText("Nom du Médoc");
jLabel1.setText("Les effets du médicament");
jLComposition.setText("Composition du médoc");
jLContrindication.setText("Contrindications du médoc");
jLImage.setText("Image");
jLPrix.setText("Prix :");
javax.swing.GroupLayout jPFondLayout = new javax.swing.GroupLayout(jPFond);
jPFond.setLayout(jPFondLayout);
jPFondLayout.setHorizontalGroup(
jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPFondLayout.createSequentialGroup()
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPFondLayout.createSequentialGroup()
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPFondLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLContrindication, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLPrix, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPFondLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLComposition, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLImage, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 26, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(jPFondLayout.createSequentialGroup()
.addGap(168, 168, 168)
.addComponent(jLNomMedoc)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPFondLayout.setVerticalGroup(
jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPFondLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLNomMedoc)
.addGap(39, 39, 39)
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPFondLayout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLComposition, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLImage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPFondLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 18, Short.MAX_VALUE)
.addComponent(jLContrindication, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE))
.addGroup(jPFondLayout.createSequentialGroup()
.addGap(35, 35, 35)
.addComponent(jLPrix, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(169, 169, 169))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPFond, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jPFond, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(16, 16, 16))
);
pack();
@ -72,11 +154,18 @@ public class jffInfoMedoc extends javax.swing.JFrame {
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new jffInfoMedoc().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLComposition;
private javax.swing.JLabel jLContrindication;
private javax.swing.JLabel jLImage;
private javax.swing.JLabel jLNomMedoc;
private javax.swing.JLabel jLPrix;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPFond;
private javax.swing.JSeparator jSeparator1;
// End of variables declaration//GEN-END:variables
}