Compare commits

...

2 Commits

Author SHA1 Message Date
4813c5d4af Merge pull request 'medicamentSQL fini' (#17) from jave.Emile into main
Reviewed-on: #17
2025-03-12 17:03:31 +01:00
e4dc4a3603 medicamentSQL fini
jffMedicament début
2025-03-12 17:02:31 +01:00
6 changed files with 292 additions and 8 deletions

View File

@ -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,11 @@ 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");
}

View File

@ -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 idMedoc){
ArrayList<String> infoMedoc = new ArrayList<String>();
try {
stmt = connexionTest.createStatement();
// Accès à la table
result = stmt.executeQuery("SELECT * FROM MEDICAMENT WHERE mDepotLegal ='"+idMedoc+"';");
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;
}
}

View File

@ -4,10 +4,35 @@
*/
package acces_aux_donnes;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
/**
*
* @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");
}
}

View File

@ -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());

View File

@ -23,13 +23,130 @@
<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">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" 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">
<EmptySpace max="-2" 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>

View File

@ -26,17 +26,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();
@ -78,5 +158,13 @@ public class jffInfoMedoc extends javax.swing.JFrame {
}
// 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
}