private void jButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: String nomtheatre; String discriptiontheatre; String datetheatre; String adressetheatre; nomtheatre = jTfnomsoiree.getText(); discriptiontheatre = jTAdescrip.getText(); adressetheatre = jTFadresse.getText(); // java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); // datesoiree=jTFdat.getText(); // // String annee=datesoiree.substring(0, 4); // int an=Integer.parseInt(annee); // String month; // month = datesoiree.substring(5, 7); // int mon; // mon = Integer.parseInt(month); // String dd=datesoiree.substring(8, 10); // int day; // day = Integer.parseInt(dd); // Date date=new Date(an-1900, mon-1, day); // if (nomtheatre.equals("") || discriptiontheatre.equals("") || adressetheatre.equals("")) { JOptionPane.showMessageDialog( this, "Ajout erroné!! remplissez les champs de saisie !!!", "Ajout soiree", JOptionPane.ERROR_MESSAGE); } else { Theatre t1 = new Theatre(); t1.setNom_theatre(nomtheatre); t1.setDescription_theatre(discriptiontheatre); Date Datet; Datet = jXDatePickerdatesoiree.getDate(); java.sql.Date sqlDate = new java.sql.Date(Datet.getTime()); t1.setDate_theatre(sqlDate); t1.setAdresse_théatre(adressetheatre); TheatreDAO t1dao = new TheatreDAO(); t1dao.inserttheatre(t1); JOptionPane.showMessageDialog(this, "Ajout effectuée avec succée :"); } } // GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: if (jTfnomsoiree.getText().equals("")) { JOptionPane.showMessageDialog( this, "Ajout erroné!! remplissez les champs de saisie !!!", "Ajout soiree", JOptionPane.ERROR_MESSAGE); } else { TheatreDAO tdao = new TheatreDAO(); Theatre t = new Theatre(); t = tdao.findtheatreBynom(jTfnomsoiree.getText()); t.setCode_theatre(t.getCode_theatre()); t.setAdresse_théatre(jTFadresse.getText()); Date Datet; Datet = jXDatePickerdatesoiree.getDate(); java.sql.Date sqlDate = new java.sql.Date(Datet.getTime()); t.setDate_theatre(sqlDate); t.setDescription_theatre(jTAdescrip.getText()); t.setNom_theatre(jTfnomsoiree.getText()); tdao.updateSoiree(t); } } // GEN-LAST:event_jButton2ActionPerformed