PAs de doc 2
This commit is contained in:
		@@ -29,8 +29,14 @@ public class testMain {
 | 
				
			|||||||
        //praticienSQL a =new praticienSQL();
 | 
					        //praticienSQL a =new praticienSQL();
 | 
				
			||||||
        //a.rechercherPraticien("Didier", "1234");
 | 
					        //a.rechercherPraticien("Didier", "1234");
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        MedicamentSQL b = new MedicamentSQL();
 | 
					        //MedicamentSQL b = new MedicamentSQL();
 | 
				
			||||||
        b.rechercherMedicament("3MYC7");
 | 
					        //b.rechercherMedicament("3MYC7");
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					       String id= "3MYC7";
 | 
				
			||||||
 | 
					       String imgTrouve = "../img/"+ id +".jpg";
 | 
				
			||||||
 | 
					       System.out.print(imgTrouve);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,13 +22,13 @@ public class MedicamentSQL {
 | 
				
			|||||||
        connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
 | 
					        connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public ArrayList<String> rechercherMedicament (String idMedoc){
 | 
					    public ArrayList<String> rechercherMedicament (String nomCo){
 | 
				
			||||||
        ArrayList<String> infoMedoc = new ArrayList<String>();
 | 
					        ArrayList<String> infoMedoc = new ArrayList<String>();
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            stmt = connexionTest.createStatement();
 | 
					            stmt = connexionTest.createStatement();
 | 
				
			||||||
            // Acc<63>s <20> la table 
 | 
					            // Acc<63>s <20> la table 
 | 
				
			||||||
            result = stmt.executeQuery("SELECT * FROM MEDICAMENT WHERE mDepotLegal ='"+idMedoc+"';");
 | 
					            result = stmt.executeQuery("SELECT * FROM MEDICAMENT WHERE mNomCommercial ='"+nomCo+"';");
 | 
				
			||||||
            if(result.next()){
 | 
					            if(result.next()){
 | 
				
			||||||
                infoMedoc.add(result.getString(1));
 | 
					                infoMedoc.add(result.getString(1));
 | 
				
			||||||
                infoMedoc.add(result.getString(2));
 | 
					                infoMedoc.add(result.getString(2));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@ package acces_aux_donnes;
 | 
				
			|||||||
import java.sql.Connection;
 | 
					import java.sql.Connection;
 | 
				
			||||||
import java.sql.ResultSet;
 | 
					import java.sql.ResultSet;
 | 
				
			||||||
import java.sql.Statement;
 | 
					import java.sql.Statement;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,15 @@
 | 
				
			|||||||
              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
 | 
					              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
 | 
				
			||||||
              <EmptySpace max="-2" attributes="0"/>
 | 
					              <EmptySpace max="-2" attributes="0"/>
 | 
				
			||||||
          </Group>
 | 
					          </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>
 | 
					      </Group>
 | 
				
			||||||
    </DimensionLayout>
 | 
					    </DimensionLayout>
 | 
				
			||||||
    <DimensionLayout dim="1">
 | 
					    <DimensionLayout dim="1">
 | 
				
			||||||
@@ -35,7 +44,13 @@
 | 
				
			|||||||
          <Group type="102" alignment="0" attributes="0">
 | 
					          <Group type="102" alignment="0" attributes="0">
 | 
				
			||||||
              <EmptySpace max="-2" attributes="0"/>
 | 
					              <EmptySpace max="-2" attributes="0"/>
 | 
				
			||||||
              <Component id="jLabel1" min="-2" 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>
 | 
				
			||||||
      </Group>
 | 
					      </Group>
 | 
				
			||||||
    </DimensionLayout>
 | 
					    </DimensionLayout>
 | 
				
			||||||
@@ -48,5 +63,23 @@
 | 
				
			|||||||
        </Property>
 | 
					        </Property>
 | 
				
			||||||
      </Properties>
 | 
					      </Properties>
 | 
				
			||||||
    </Component>
 | 
					    </Component>
 | 
				
			||||||
 | 
					    <Component class="javax.swing.JLabel" name="jLRecherche">
 | 
				
			||||||
 | 
					      <Properties>
 | 
				
			||||||
 | 
					        <Property name="text" type="java.lang.String" value="Recherche mé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>
 | 
					  </SubComponents>
 | 
				
			||||||
</Form>
 | 
					</Form>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,10 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
package presentation;
 | 
					package presentation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import Metier.medicament;
 | 
				
			||||||
 | 
					import acces_aux_donnes.MedicamentSQL;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author emile.lalorcey
 | 
					 * @author emile.lalorcey
 | 
				
			||||||
@@ -27,11 +31,29 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
 | 
				
			|||||||
    private void initComponents() {
 | 
					    private void initComponents() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        jLabel1 = new javax.swing.JLabel();
 | 
					        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);
 | 
					        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/logodetoure.gif"))); // NOI18N
 | 
					        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());
 | 
					        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
 | 
				
			||||||
        getContentPane().setLayout(layout);
 | 
					        getContentPane().setLayout(layout);
 | 
				
			||||||
        layout.setHorizontalGroup(
 | 
					        layout.setHorizontalGroup(
 | 
				
			||||||
@@ -40,18 +62,57 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
 | 
				
			|||||||
                .addContainerGap(344, Short.MAX_VALUE)
 | 
					                .addContainerGap(344, Short.MAX_VALUE)
 | 
				
			||||||
                .addComponent(jLabel1)
 | 
					                .addComponent(jLabel1)
 | 
				
			||||||
                .addContainerGap())
 | 
					                .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.setVerticalGroup(
 | 
				
			||||||
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 | 
					            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 | 
				
			||||||
            .addGroup(layout.createSequentialGroup()
 | 
					            .addGroup(layout.createSequentialGroup()
 | 
				
			||||||
                .addContainerGap()
 | 
					                .addContainerGap()
 | 
				
			||||||
                .addComponent(jLabel1)
 | 
					                .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();
 | 
					        pack();
 | 
				
			||||||
    }// </editor-fold>//GEN-END:initComponents
 | 
					    }// </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
 | 
					     * @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
 | 
					    // 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.JLabel jLabel1;
 | 
				
			||||||
 | 
					    private javax.swing.JTextField jTFRecherche;
 | 
				
			||||||
    // End of variables declaration//GEN-END:variables
 | 
					    // End of variables declaration//GEN-END:variables
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,15 +49,14 @@
 | 
				
			|||||||
                  <Group type="103" groupAlignment="0" attributes="0">
 | 
					                  <Group type="103" groupAlignment="0" attributes="0">
 | 
				
			||||||
                      <Component id="jSeparator1" alignment="1" max="32767" attributes="0"/>
 | 
					                      <Component id="jSeparator1" alignment="1" max="32767" attributes="0"/>
 | 
				
			||||||
                      <Group type="102" attributes="0">
 | 
					                      <Group type="102" attributes="0">
 | 
				
			||||||
 | 
					                          <EmptySpace max="-2" attributes="0"/>
 | 
				
			||||||
                          <Group type="103" groupAlignment="0" attributes="0">
 | 
					                          <Group type="103" groupAlignment="0" attributes="0">
 | 
				
			||||||
                              <Group type="102" alignment="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"/>
 | 
					                                  <Component id="jLContrindication" min="-2" pref="265" max="-2" attributes="0"/>
 | 
				
			||||||
                                  <EmptySpace type="separate" max="-2" attributes="0"/>
 | 
					                                  <EmptySpace type="separate" max="-2" attributes="0"/>
 | 
				
			||||||
                                  <Component id="jLPrix" min="-2" pref="100" max="-2" attributes="0"/>
 | 
					                                  <Component id="jLPrix" min="-2" pref="100" max="-2" attributes="0"/>
 | 
				
			||||||
                              </Group>
 | 
					                              </Group>
 | 
				
			||||||
                              <Group type="102" alignment="0" attributes="0">
 | 
					                              <Group type="102" alignment="0" attributes="0">
 | 
				
			||||||
                                  <EmptySpace max="-2" attributes="0"/>
 | 
					 | 
				
			||||||
                                  <Group type="103" groupAlignment="0" attributes="0">
 | 
					                                  <Group type="103" groupAlignment="0" attributes="0">
 | 
				
			||||||
                                      <Component id="jLComposition" min="-2" pref="265" max="-2" 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"/>
 | 
					                                      <Component id="jLabel1" alignment="0" min="-2" pref="265" max="-2" attributes="0"/>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,8 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
package presentation;
 | 
					package presentation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import Metier.medicament;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author emile.lalorcey
 | 
					 * @author emile.lalorcey
 | 
				
			||||||
@@ -13,7 +15,7 @@ public class jffInfoMedoc extends javax.swing.JFrame {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates new form jffInfoMedoc
 | 
					     * Creates new form jffInfoMedoc
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public jffInfoMedoc() {
 | 
					    public jffInfoMedoc(medicament medocTrouve) {
 | 
				
			||||||
        initComponents();
 | 
					        initComponents();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -152,7 +154,6 @@ public class jffInfoMedoc 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 jffInfoMedoc().setVisible(true);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user