private void jButtonBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBookActionPerformed
        // Checks if the ID field is empty, if it is, there will be a error message(See else)
        if (!jTextFieldID.getText().equals("")) {
            // Formats the jXDatePickerSportDate into a String
            String dato = jXDatePickerSportDate.getEditor().getText();
            // Checks if the Date field is empty, if it is, there will be a error message(See else)
            if (!dato.equals("")) {

                // Initialazing int as boolean for trainer
                int trainer;
                // Gets the typed in data and puts it in String
                String sportsType = (String) jComboBoxSportsBooking.getSelectedItem();
                String Time = (String) jComboBoxTime.getSelectedItem();
                //We only need the first 6 characters of the String Time.
                Time = ":" + Time.substring(0, 5);
                //Sets the dateformat
                DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                jXDatePickerSportDate.setFormats(dateFormat);
                DateFormat sysDate = new SimpleDateFormat("yyyy-MM-dd");
                // Sets the current date, ID and ReservationsNumber in String attributes
                String Date = sysDate.format(jXDatePickerSportDate.getDate());
                String ID = jTextFieldID.getText();
                String reservationsNumber = ID.substring(0, 3);
                // Have to remove (20) from year, because of the database syntax and wildcard
                String Date1 = Date.substring(2, 10);
                // Counter, to see how many booking on a specific date
                int counter = con.countSportsBooking(Date1, ID);
                Date = Date.concat(Time);
                // If more than 4 bookings on a date - Gets error message (See else)
                if (counter < 4) {
                    //Checks if the customer wants a trainer
                    if (jCheckBoxInstructor.isSelected()) {
                        trainer = 1;
                    } else {
                        trainer = 0;
                    }
                    
                    // Running the createNewSPBooking in controller with the attributes from the gui
                    con.createNewSPBooking(reservationsNumber, ID, sportsType, Date, trainer);
                    // Checks the method saveSPBooking if the booking was succesfull, status then turns true
                    boolean status = con.saveSPBooking();
                    // Gives a message to the Gui if succesfull or not
                    if (status) {
                        jLabelSportsBookStatus.setText("Sports booking saved");
                    } else {
                        jLabelSportsBookStatus.setText("Sports booking not saved");
                    }
                } else {
                    JOptionPane.showMessageDialog(rootPane, "You have to many bookings");
                    jLabelSportsBookStatus.setText("Sports booking not saved");
                }
            } else {
                JOptionPane.showMessageDialog(rootPane, "Date box is empty");
                jLabelSportsBookStatus.setText("Sports booking not saved");
            }
        } else {
            JOptionPane.showMessageDialog(rootPane, "ID box is empty");
            jLabelSportsBookStatus.setText("Sports booking not saved");
        }
    }//GEN-LAST:event_jButtonBookActionPerformed