src/MainInterface.java
// function for button "search illegal visitor" DONE
function for button "search illegal visitor" DONE
function for button " search illegal visitor " DONE
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
        tempdatefrom = jTextField3.getText();
        tempdateto = jTextField4.getText();
        if ( jTextField3.getText().equals("yyyy-MM-dd"))
        {
            tempdatefrom ="empty";
        }
        if ( jTextField4.getText().equals("yyyy-MM-dd"))
        {
            tempdateto = "empty";
        }        
        if ( JOptionPane.showConfirmDialog(null, "Conduct a search based on the following? " +
                "\nDate From = " + tempdatefrom + tab + "To = " + tempdateto, "SEARCH?", JOptionPane.YES_NO_OPTION)
            == JOptionPane.YES_OPTION)
        {
             String sql = "Select * from illegalvisitor where Date between '"+tempdatefrom+"' and '"+tempdateto+"'";
                        model2.setRowCount(0);
                        try {
                            pst = conn.prepareStatement(sql);
                            rs = pst.executeQuery();
                            Object[] columnData = new Object[9];
                            while (rs.next()) {
                                columnData[0] = rs.getString("IllegalID");
                                columnData[1] = rs.getString("QRCodeContent");
                                columnData[2] = rs.getString("Photo");
                                columnData[3] = rs.getString("Date");
                                columnData[4] = rs.getString("Time");
                                model2.addRow(columnData);
                            }
                        } catch (Exception e) {
                            JOptionPane.showMessageDialog(null, e);
                        }
                        int rows = model2.getRowCount();
                        if ((rows + 1) == 1) {
                            JOptionPane.showMessageDialog(null, "Records Not found \nPlease try again", "Not found", JOptionPane.ERROR_MESSAGE);
                        } else {
                            JOptionPane.showMessageDialog(null, "Records Found!");
                        }
        }
    }
private void jButton4ActionPerformed ( java . awt . event . ActionEvent evt ) { tempdatefrom = jTextField3 . getText ( ) ; tempdateto = jTextField4 . getText ( ) ; if ( jTextField3 . getText ( ) . equals ( "yyyy-MM-dd" ) ) { tempdatefrom = "empty" ; } if ( jTextField4 . getText ( ) . equals ( "yyyy-MM-dd" ) ) { tempdateto = "empty" ; } if ( JOptionPane . showConfirmDialog ( null , "Conduct a search based on the following? " + "\nDate From = " + tempdatefrom + tab + "To = " + tempdateto , "SEARCH?" , JOptionPane . YES_NO_OPTION ) == JOptionPane . YES_OPTION ) { String sql = "Select * from illegalvisitor where Date between '" + tempdatefrom + "' and '" + tempdateto + "'" ; model2 . setRowCount ( 0 ) ; try { pst = conn . prepareStatement ( sql ) ; rs = pst . executeQuery ( ) ; Object [ ] columnData = new Object [ 9 ] ; while ( rs . next ( ) ) { columnData [ 0 ] = rs . getString ( "IllegalID" ) ; columnData [ 1 ] = rs . getString ( "QRCodeContent" ) ; columnData [ 2 ] = rs . getString ( "Photo" ) ; columnData [ 3 ] = rs . getString ( "Date" ) ; columnData [ 4 ] = rs . getString ( "Time" ) ; model2 . addRow ( columnData ) ; } } catch ( Exception e ) { JOptionPane . showMessageDialog ( null , e ) ; } int rows = model2 . getRowCount ( ) ; if ( ( rows + 1 ) == 1 ) { JOptionPane . showMessageDialog ( null , "Records Not found \nPlease try again" , "Not found" , JOptionPane . ERROR_MESSAGE ) ; } else { JOptionPane . showMessageDialog ( null , "Records Found!" ) ; } } }
function for button "search illegal visitor" DONE
function for button " search illegal visitor " DONE
//GEN-FIRST:event_jButton4ActionPerformed