private void SaveJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_SaveJButtonMouseClicked
        //Check if the user exisit already
        if(Customer.userExist(newCustomerJPanel.getEmail())){
            JOptionPane.showMessageDialog(mainJFrame,
                "A user already exist with this email address.",
                "User Exist",  JOptionPane.WARNING_MESSAGE);
        }
        else if(Customer.TRNExist(newCustomerJPanel.getTRN())){
            JOptionPane.showMessageDialog(mainJFrame,
                "A user already exist with this trn address.",
                "User Exist",  JOptionPane.WARNING_MESSAGE);
        }
        else{
            try {
                Customer customer = new Customer(
                        this.newCustomerJPanel.getFName(),
                        this.newCustomerJPanel.getLName(),
                        this.newCustomerJPanel.getEmail(),
                        this.newCustomerJPanel.getPssword(),
                        this.newCustomerJPanel.getGender(),
                        this.newCustomerJPanel.getDOB(),
                        this.newCustomerJPanel.getTRN(),
                        this.newCustomerJPanel.getPhone()
                );
                //Customer need to be stored so that it can get a id number for the user
                //The user_id will be used in the creation of the cardAccount if the user is 
                //new.
                customer.store(); 
                
                CardAccount cardAccount = new CardAccount(
                        customer,
                        (new SimpleDateFormat("yyy-MM-dd")).parse(ExpiryDateJTextField.getText()),
                        this.csaUser,
                        Integer.parseInt(pointsEarnedJTextField.getText()),
                        selectLoyaltyProgramJFrame.getSelectedLoyaltyProgram()
                );
                cardAccount.store(); 
                
                JOptionPane.showMessageDialog(mainJFrame,
                    String.format("The card account for %s %s was saved sucessfully.",
                            this.newCustomerJPanel.getFName(),
                            this.newCustomerJPanel.getLName()),
                    "Saved Succesfull",  JOptionPane.INFORMATION_MESSAGE);
                
                mainJFrame.getContentPane().remove(this);
                mainJFrame.getContentPane().add(previousJPanel);

                mainJFrame.getContentPane().invalidate();
                mainJFrame.getContentPane().revalidate();
                mainJFrame.getContentPane().repaint();

                mainJFrame.setTitle(previousTitle);
                
            } catch (SQLException e) {
                System.err.println( e.getClass().getName() + ": " + e.getMessage() );
            }
            catch (ParseException e){
                System.err.println( e.getClass().getName() + ": " + e.getMessage() );
            }
            
        }
        
    }//GEN-LAST:event_SaveJButtonMouseClicked