Large diffs are not rendered by default.

@@ -1,11 +1,11 @@
======================================================
Project INFS2605 Final Assignment build script updated
======================================================
======================================================
Project INFS2605 Final Assignment build script updated
======================================================

Project build script file jfx-impl.xml in nbproject sub-directory has not been recognized
as compliant with this version of NetBeans JavaFX support module. To ensure correct
and complete functionality within this NetBeans installation the script file has been
backed up to jfx-impl_backup_3.xml and then updated to the currently supported state.
backed up to jfx-impl_backup_4.xml and then updated to the currently supported state.

FX Project build script auto-update may be triggered on project open either after
NetBeans installation update or by manual changes in jfx-impl.xml. Please note that
@@ -20,4 +20,4 @@ javafx.disable.autoupdate.notification=true

Remark: Files nbproject/jfx-impl_backup*.xml and this file nbproject/UPDATED.TXT
are not used when building the project and can be freely deleted.

@@ -327,26 +327,48 @@
<property name="ant-javafx.jar.location" value="${platform.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-probjdk-lib" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.probjdk.lib.has_jre">
<available file="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar"/>
</condition>
<condition property="do.set.ant-javafx.in.probjdk.lib.no_jre">
<available file="${java.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</condition>
<condition property="do.set.ant-javafx.in.probjdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar"/>
<or>
<isset property="do.set.ant-javafx.in.probjdk.lib.has_jre"/>
<isset property="do.set.ant-javafx.in.probjdk.lib.no_jre"/>
</or>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-probjdk-lib" depends="-set-ant-javafx-in-platform-home-tools,-check-ant-javafx-in-probjdk-lib" if="do.set.ant-javafx.in.probjdk.lib">
<property name="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar"/>
<condition property="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar" else="${java.home}${file.separator}lib${file.separator}ant-javafx.jar">
<isset property="do.set.ant-javafx.in.probjdk.lib.has_jre"/>
</condition>
</target>
<target name="-check-ant-javafx-in-probjdk-tools" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.probjdk.tools.has_jre">
<available file="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar"/>
</condition>
<condition property="do.set.ant-javafx.in.probjdk.tools.no_jre">
<available file="${java.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
</condition>
<condition property="do.set.ant-javafx.in.probjdk.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar"/>
<or>
<isset property="do.set.ant-javafx.in.probjdk.tools.has_jre"/>
<isset property="do.set.ant-javafx.in.probjdk.tools.no_jre"/>
</or>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-probjdk-tools" depends="-set-ant-javafx-in-probjdk-lib,-check-ant-javafx-in-probjdk-tools" if="do.set.ant-javafx.in.probjdk.tools">
<property name="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar"/>
<condition property="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar" else="${java.home}${file.separator}tools${file.separator}ant-javafx.jar">
<isset property="do.set.ant-javafx.in.probjdk.tools.has_jre"/>
</condition>
</target>
<target name="-check-ant-javafx-in-macjdk-lib" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.macjdk.lib">
@@ -1825,6 +1847,25 @@
// manifest
var man = jar.createManifest();
var userManifestPath = project.getProperty("manifest.file");
if (userManifestPath) {
var userManifestFile = project.resolveFile(userManifestPath);
if (userManifestFile.isFile()) {
var manifestEncoding = project.getProperty("manifest.encoding");
var userManifestReader = manifestEncoding ?
new java.io.InputStreamReader(
new java.io.FileInputStream(userManifestFile),
manifestEncoding) :
new java.io.InputStreamReader(
new java.io.FileInputStream(userManifestFile));
try {
var userManifest = new org.apache.tools.ant.taskdefs.Manifest(userManifestReader);
man.merge(userManifest);
} finally {
userManifestReader.close();
}
}
}
var a1val = new String(project.getProperty("application.vendor"));
var a1 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
a1.setName("Implementation-Vendor");

Large diffs are not rendered by default.

@@ -7,5 +7,5 @@ javafx.run.inbrowser.path=/usr/bin/open
# Do not modify this property in this configuration. It can be re-generated.
javafx.run.as=embedded
javafx.run.inbrowser=<Default System Browser>
javafx.run.inbrowser.path=/usr/bin/open
javafx.run.inbrowser.path=C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE
>>>>>>> origin/master
@@ -1,11 +1,16 @@
<<<<<<< HEAD
auxiliary.org-netbeans-modules-projectapi.issue214819_5f_fx_5f_enabled=true
compile.on.save=true
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=/Users/adriantsoi/Library/Application Support/NetBeans/8.1/build.properties
=======
auxiliary.org-netbeans-modules-projectapi.issue214819_5f_fx_5f_enabled=true
<<<<<<< Updated upstream
user.properties.file=/Users/sunyifei/Library/Application Support/NetBeans/8.1/build.properties
=======
user.properties.file=/Users/sunyifei/Library/Application Support/NetBeans/8.1/build.properties
user.properties.file=C:\\Users\\Preet\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
>>>>>>> Stashed changes
>>>>>>> origin/master
@@ -1,6 +1,5 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
@@ -30,15 +29,18 @@ dist.jar=${dist.dir}/INFS2605_Final_Assignment.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.h2-1.4.195.jar=h2-1.4.195.jar
includes=**
# Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects
jar.archive.disabled=true
jar.compress=false
javac.classpath=\
${javafx.classpath.extension}
${javafx.classpath.extension}:\
${file.reference.h2-1.4.195.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=false
javac.processorpath=\
${javac.classpath}
javac.source=1.8
@@ -100,6 +102,7 @@ manifest.custom.codebase=*
manifest.custom.permissions=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${dist.jar}:\
@@ -1,56 +1,57 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author Preet
*/
public class Database {

public static Connection con;
public static String database = "jdbc:h2:./MainDatabase;create=true";

public static void setDatabase(String database){
Database.database = database;
}

public static void openConnection(){
try{
con = DriverManager.getConnection(database);
System.out.println("Connected to Database " + database);
}
catch (SQLException ex){
Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
}

}

public static void closeConnection(){
try{
if(con != null){
con.close();
}
System.out.println("Disconnected from Database " + database);
} catch (SQLException ex){
Logger.getLogger(Database.class.getName()).log(Level.SEVERE,null,ex);
}


}




}


/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author Preet
*/
public class Database {

public static Connection con;
public static String database = "jdbc:h2:./INFS2605db;create=true";

public static void setDatabase(String database){
Database.database = database;
}

public static void openConnection(){
try{
con = DriverManager.getConnection(database);
System.out.println("Connected to Database " + database);
}
catch (SQLException ex){
Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
}

}

public static void closeConnection(){
try{
if(con != null){
con.close();
}
System.out.println("Disconnected from Database " + database);
} catch (SQLException ex){
Logger.getLogger(Database.class.getName()).log(Level.SEVERE,null,ex);
}


}




}



18 src/memberLogin2/Login.fxml 100755 → 100644
@@ -1,12 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
@@ -19,7 +12,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>

<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="768.0" prefWidth="1280.0" stylesheets="@dark.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="memberLogin2.LoginController">
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="768.0" prefWidth="1280.0" stylesheets="@dark.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="memberLogin2.LoginController">
<children>
<ImageView fitHeight="788.0" fitWidth="1365.0" pickOnBounds="true" preserveRatio="true">
<image>
@@ -28,7 +21,7 @@
</ImageView>
<Pane layoutX="500.0" layoutY="230.0" prefHeight="262.0" prefWidth="300.0" style="-fx-background-color: #ffffff; -fx-background-radius: 15 15 15 15;">
<children>
<TextField fx:id="email" layoutX="24.0" layoutY="24.0" onAction="#emailAddress" prefHeight="45.0" prefWidth="253.0" promptText="Email Address">
<TextField fx:id="username" layoutX="24.0" layoutY="24.0" onAction="#username" prefHeight="45.0" prefWidth="253.0" promptText="Username">
<font>
<Font size="16.0" />
</font>
@@ -43,7 +36,7 @@
<Font name="Tahoma" size="13.0" />
</font>
</Label>
<PasswordField fx:id="password" layoutX="24.0" layoutY="85.0" onAction="#enterPassword" prefHeight="45.0" prefWidth="253.0" promptText="Password">
<PasswordField fx:id="password" layoutX="24.0" layoutY="85.0" prefHeight="45.0" prefWidth="253.0" promptText="Password">
<font>
<Font size="16.0" />
</font>
@@ -86,10 +79,5 @@
<Font name="System Bold" size="18.0" />
</font>
</Button>
<Button fx:id="register1" layoutX="465.0" layoutY="623.0" onAction="#clickRegister" onMouseClicked="#clickRegister" prefHeight="45.0" prefWidth="370.0" text="Staff Login" textFill="WHITE">
<font>
<Font name="System Bold" size="18.0" />
</font>
</Button>
</children>
</Pane>
214 src/memberLogin2/LoginController.java 100755 → 100644
@@ -1,94 +1,120 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package memberLogin2;



import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import Database.Database;
import static Database.Database.con;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
* FXML Controller class
*
* @author Preet
*/
public class LoginController implements Initializable {

@FXML
private TextField email;
@FXML
private TextField password;
@FXML
private Button signin;
@FXML
private Button register;
@FXML
private Label setLabel;

/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}

@FXML
private void emailAddress(ActionEvent event) {
}

@FXML
private void enterPassword(ActionEvent event) {
}

@FXML
private void clickLogin(ActionEvent event) throws SQLException {
PreparedStatement ps;
Database.openConnection();
ps = con.prepareStatement("SELECT USERNAME,PASSWORD from PUBLIC.USER WHERE USERNAME = ? and PASSWORD = ?;");
ps.setString(1,email.getText());
ps.setString(2,password.getText());
ResultSet result = ps.executeQuery();
if(result.next()){
setLabel.setText("Login Successfully");
}
else {
setLabel.setText("Invalid Username or Password");
}
Database.closeConnection();



}

@FXML
private void clickRegister(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/signup/RegisterPage.fxml"));
Scene scene = new Scene(root);
Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow();
stage.setScene(scene);
stage.show();

}

}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package memberLogin2;



import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import Database.Database;
import static Database.Database.con;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.scene.input.MouseEvent;

/**
* FXML Controller class
*
* @author Preet
*/
public class LoginController implements Initializable {


private TextField password;
@FXML
private Button signin;
@FXML
private Button register;
@FXML
private Label setLabel;
@FXML
private TextField username;

/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}

@FXML
private void clickLogin(ActionEvent event) {
PreparedStatement ps;
Database.openConnection();

try {
String user = username.getText();
ps = con.prepareStatement("SELECT MEMBER_USERNAME,MEMBER_PASSWORD from PUBLIC.MEMBERS WHERE MEMBER_USERNAME = ? and MEMBER_PASSWORD = ?;");
ps.setString(1,username.getText());
ps.setString(2,password.getText());
ResultSet result = ps.executeQuery();
if(result.next()){
setLabel.setText("Login Successfully");
ps = con.prepareStatement("SELECT MEMBER_TYPE FROM MEMBERS WHERE MEMBER_USERNAME = ? ");
ps.setString(1,user);
String membertype =null;
ResultSet member = ps.executeQuery();
if (member.next()){
membertype = member.getString(1);
if (membertype.toUpperCase().equals("RIDER")){
//load Rider page here
}
else if (membertype.toUpperCase().equals("DRIVER")){
//load driver page here
}
else if (membertype.toUpperCase().equals("BOTH")){
//load both page here.
}
}
}
else {
setLabel.setText("Invalid Username or Password");
}
} catch (SQLException ex) {
System.out.println(ex);
}

Database.closeConnection();



}

@FXML
private void clickRegister(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/signup/RegisterPage.fxml"));
Scene scene = new Scene(root);
Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow();
stage.setScene(scene);
stage.show();

}

@FXML
private void username(ActionEvent event) {
}

@FXML
private void clickRegister(MouseEvent event) {
}

}
118 src/signup/RegisterPage.fxml 100755 → 100644
@@ -3,7 +3,7 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.Glow?>
@@ -18,58 +18,93 @@
<children>
<AnchorPane prefHeight="768.0" prefWidth="1280.0">
<children>
<Text layoutX="123.0" layoutY="191.0" strokeType="OUTSIDE" strokeWidth="0.0" text="SIGN UP" wrappingWidth="138.1725311279297">
<Text layoutX="124.0" layoutY="154.0" strokeType="OUTSIDE" strokeWidth="0.0" text="SIGN UP" wrappingWidth="138.1725311279297">
<font>
<Font size="30.0" />
</font>
</Text>
<TextField fx:id="firstName" layoutX="123.0" layoutY="266.0" prefHeight="35.0" prefWidth="200.0" />
<TextField fx:id="email" layoutX="123.0" layoutY="326.0" prefHeight="35.0" prefWidth="420.0" />
<TextField fx:id="lastName" layoutX="342.0" layoutY="266.0" prefHeight="35.0" prefWidth="200.0" />
<Text layoutX="123.0" layoutY="262.0" strokeType="OUTSIDE" strokeWidth="0.0" text="First Name" />
<Text layoutX="342.0" layoutY="262.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Last Name" />
<Text layoutX="123.0" layoutY="323.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Email Address" />
<Text layoutX="123.0" layoutY="383.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Password" />
<Text layoutX="123.0" layoutY="445.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Confirm Password" />
<TextField fx:id="address" layoutX="123.0" layoutY="570.0" prefHeight="35.0" prefWidth="420.0" />
<Text layoutX="124.0" layoutY="505.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Mobile Number" />
<Text layoutX="125.0" layoutY="566.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Address" />
<TextField fx:id="mobileNo" layoutX="123.0" layoutY="508.0" prefHeight="35.0" prefWidth="420.0" />
<TextField fx:id="Suburb" layoutX="123.0" layoutY="630.0" prefHeight="35.0" prefWidth="120.0" />
<TextField fx:id="postCode" layoutX="273.0" layoutY="630.0" prefHeight="35.0" prefWidth="120.0" />
<ComboBox fx:id="state" layoutX="423.0" layoutY="630.0" prefHeight="35.0" prefWidth="120.0" />
<Text layoutX="125.0" layoutY="626.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Suburb" />
<Text layoutX="273.0" layoutY="626.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Post Code" />
<Text layoutX="423.0" layoutY="626.0" strokeType="OUTSIDE" strokeWidth="0.0" text="State" />
<Text layoutX="123.0" layoutY="229.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Personal Details" wrappingWidth="138.17254638671875">
<TextField fx:id="firstName" layoutX="126.0" layoutY="242.0" prefHeight="35.0" prefWidth="200.0" />
<TextField fx:id="email" layoutX="125.0" layoutY="299.0" prefHeight="35.0" prefWidth="420.0" />
<TextField fx:id="lastName" layoutX="345.0" layoutY="242.0" prefHeight="35.0" prefWidth="200.0" />
<Text layoutX="126.0" layoutY="238.0" strokeType="OUTSIDE" strokeWidth="0.0" text="First Name" />
<Text layoutX="345.0" layoutY="238.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Last Name" />
<Text layoutX="125.0" layoutY="296.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Email Address" />
<Text layoutX="125.0" layoutY="356.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Password" />
<Text layoutX="125.0" layoutY="418.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Confirm Password" />
<TextField fx:id="homeAddress" layoutX="124.0" layoutY="570.0" prefHeight="35.0" prefWidth="420.0" />
<Text layoutX="126.0" layoutY="478.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Mobile Number" />
<Text layoutX="126.0" layoutY="566.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Address" />
<TextField fx:id="mobileNo" layoutX="125.0" layoutY="481.0" prefHeight="35.0" prefWidth="420.0" />
<TextField fx:id="homeSuburb" layoutX="124.0" layoutY="630.0" prefHeight="35.0" prefWidth="120.0" />
<TextField fx:id="homePostCode" layoutX="274.0" layoutY="630.0" prefHeight="35.0" prefWidth="120.0" />
<ComboBox fx:id="homeState" layoutX="424.0" layoutY="630.0" prefHeight="35.0" prefWidth="120.0" />
<Text layoutX="126.0" layoutY="626.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Suburb" />
<Text layoutX="274.0" layoutY="626.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Post Code" />
<Text layoutX="424.0" layoutY="626.0" strokeType="OUTSIDE" strokeWidth="0.0" text="State" />
<Text layoutX="758.0" layoutY="501.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Payment Details" wrappingWidth="271.1725311279297">
<font>
<Font size="18.0" />
<Font name="System Bold" size="18.0" />
</font>
</Text>
<Text layoutX="790.0" layoutY="228.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Payment Details" wrappingWidth="271.1725311279297">
<Text layoutX="758.0" layoutY="526.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Credit Card Number" />
<TextField fx:id="creditNo" layoutX="758.0" layoutY="530.0" prefHeight="35.0" prefWidth="420.0" />
<TextField fx:id="ccCCV" layoutX="1058.0" layoutY="591.0" prefHeight="35.0" prefWidth="120.0" />
<Text layoutX="759.0" layoutY="586.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Expiration Date" />
<Text layoutX="1058.0" layoutY="586.0" strokeType="OUTSIDE" strokeWidth="0.0" text="CCV" wrappingWidth="38.23829159140587" />
<Button fx:id="createAccount" layoutX="988.0" layoutY="686.0" mnemonicParsing="false" onAction="#createAccount" prefHeight="35.0" prefWidth="240.0" text="Create My Account" textFill="WHITE">
<font>
<Font size="18.0" />
<Font name="System Bold" size="16.0" />
</font>
</Button>
<PasswordField fx:id="password" layoutX="124.0" layoutY="360.0" prefHeight="35.0" prefWidth="420.0" />
<PasswordField fx:id="password2" layoutX="124.0" layoutY="422.0" prefHeight="35.0" prefWidth="420.0" />
<Text layoutX="124.0" layoutY="544.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Home Address" wrappingWidth="138.17254638671875">
<font>
<Font name="System Bold" size="18.0" />
</font>
</Text>
<Text layoutX="790.0" layoutY="258.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Credit Card Number" />
<TextField fx:id="creditNo" layoutX="790.0" layoutY="262.0" prefHeight="35.0" prefWidth="420.0" />
<ComboBox fx:id="expiryMonth" layoutX="790.0" layoutY="323.0" prefHeight="35.0" prefWidth="120.0" />
<TextField fx:id="CCV" layoutX="1090.0" layoutY="323.0" prefHeight="35.0" prefWidth="120.0" />
<ComboBox fx:id="expiryYear" layoutX="942.0" layoutY="323.0" prefHeight="35.0" prefWidth="120.0" />
<Text layoutX="791.0" layoutY="318.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Expiration Date (MM/YY)" />
<Text layoutX="1090.0" layoutY="318.0" strokeType="OUTSIDE" strokeWidth="0.0" text="CCV" wrappingWidth="38.23829159140587" />
<Button fx:id="createAccount" layoutX="970.0" layoutY="613.0" mnemonicParsing="false" onAction="#createAccount" prefHeight="35.0" prefWidth="240.0" text="Create My Account" textFill="WHITE">
<TextField fx:id="workAddress" layoutX="759.0" layoutY="380.0" prefHeight="35.0" prefWidth="410.0" />
<Text layoutX="760.0" layoutY="375.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Address" />
<TextField fx:id="workSuburb" layoutX="759.0" layoutY="439.0" prefHeight="35.0" prefWidth="120.0" />
<TextField fx:id="workPostcode" layoutX="903.0" layoutY="439.0" prefHeight="35.0" prefWidth="120.0" />
<ComboBox fx:id="consultancy" layoutX="1022.0" layoutY="304.0" prefHeight="35.0" prefWidth="120.0" />
<Text layoutX="757.0" layoutY="435.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Suburb" />
<Text layoutX="903.0" layoutY="435.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Post Code" />
<Text layoutX="1053.0" layoutY="435.0" strokeType="OUTSIDE" strokeWidth="0.0" text="State" />
<Text layoutX="758.0" layoutY="646.0" strokeType="OUTSIDE" strokeWidth="0.0" text="By creating your account, you agree to pay a standard membership fee of $150 to SUBER for their services." textAlignment="JUSTIFY" wrappingWidth="420.00001461803913" />
<TextField fx:id="username" layoutX="126.0" layoutY="188.0" prefHeight="35.0" prefWidth="200.0" />
<Text layoutX="126.0" layoutY="179.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Username" wrappingWidth="57.076180547475815" />
<Text layoutX="757.0" layoutY="246.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Are you representing a company?" wrappingWidth="291.17254638671875">
<font>
<Font name="System Bold" size="16.0" />
<Font name="System Bold" size="18.0" />
</font>
</Button>
<PasswordField fx:id="password" layoutX="122.0" layoutY="387.0" prefHeight="35.0" prefWidth="420.0" />
<PasswordField fx:id="password2" layoutX="122.0" layoutY="449.0" prefHeight="35.0" prefWidth="420.0" />
<Hyperlink fx:id="makePayment" layoutX="790.0" layoutY="386.0" onAction="#makePayment" prefHeight="38.0" prefWidth="232.0" text="Make your payment now">
</Text>
<Text layoutX="759.0" layoutY="355.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Work Details (Optional)" wrappingWidth="239.99999737739563">
<font>
<Font name="System Bold" size="18.0" />
</font>
</Text>
<Text layoutX="763.0" layoutY="266.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Company Name" wrappingWidth="95.66013205051422" />
<TextField fx:id="companyName" layoutX="758.0" layoutY="271.0" prefHeight="35.0" prefWidth="200.0" />
<Text layoutX="761.0" layoutY="327.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Consultancy requirements? (extra $300 )" wrappingWidth="271.1725247949362">
<font>
<Font size="19.0" />
<Font size="14.0" />
</font>
</Hyperlink>
</Text>
<ComboBox fx:id="workState" layoutX="1048.0" layoutY="439.0" prefHeight="35.0" prefWidth="120.0" />
<ComboBox fx:id="ccMonth" layoutX="758.0" layoutY="591.0" prefHeight="35.0" prefWidth="120.0" promptText="MM" />
<ComboBox fx:id="ccYear" layoutX="908.0" layoutY="591.0" prefHeight="35.0" prefWidth="120.0" promptText="YY" />
<Label fx:id="errorMessage" layoutX="301.0" layoutY="134.0" prefHeight="32.0" prefWidth="428.0" style="-fx-text-fill: #FF0000;">
<font>
<Font size="14.0" />
</font>
</Label>
<Text layoutX="758.0" layoutY="181.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Do you want to be a rider or a sharer?" wrappingWidth="420.0000242218375">
<font>
<Font name="System Bold" size="18.0" />
</font>
</Text>
<ComboBox fx:id="memberType" layoutX="758.0" layoutY="190.0" prefHeight="35.0" prefWidth="120.0" />
</children></AnchorPane>
<ImageView fitHeight="119.0" fitWidth="1289.0" layoutX="-5.0" layoutY="-8.0">
<image>
@@ -93,5 +128,10 @@
</effect>
</ImageView>
<ButtonBar layoutX="804.0" layoutY="28.0" prefHeight="59.0" prefWidth="451.0" />
<Button fx:id="goBack" layoutX="22.0" layoutY="28.0" mnemonicParsing="false" onAction="#goBack" prefHeight="59.0" prefWidth="147.0" text="Go Back" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Button>
</children>
</Pane>
349 src/signup/RegisterPageController.java 100755 → 100644
@@ -1,75 +1,274 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package signup;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;

/**
* FXML Controller class
*
* @author Preet
*/
public class RegisterPageController implements Initializable {

@FXML
private TextField firstName;
@FXML
private TextField email;
@FXML
private TextField lastName;
@FXML
private TextField address;
@FXML
private TextField mobileNo;
@FXML
private TextField Suburb;
@FXML
private TextField postCode;
@FXML
private ComboBox<?> state;
@FXML
private TextField creditNo;
@FXML
private ComboBox<?> expiryMonth;
@FXML
private TextField CCV;
@FXML
private ComboBox<?> expiryYear;
@FXML
private Button createAccount;
@FXML
private PasswordField password;
@FXML
private PasswordField password2;
@FXML
private Hyperlink makePayment;

/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}

@FXML
private void createAccount(ActionEvent event) {
}

@FXML
private void makePayment(ActionEvent event) {
}

}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package signup;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import Database.Database;
import static Database.Database.con;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.scene.control.Label;

/**
* FXML Controller class
*
* @author Preet
*/
public class RegisterPageController implements Initializable {

ObservableList<String> states = FXCollections.observableArrayList("NSW","QLD","SA","WA","NT","VIC","ACT");
ObservableList<String> CompanyConsultancy = FXCollections.observableArrayList("Yes","No");
ObservableList<String> ExpiryMonth = FXCollections.observableArrayList("01","02","03","04","05","06","07","08","09","10","11","12");
ObservableList<String> ExpiryYear = FXCollections.observableArrayList("17","18","19","20","21","22","23","24");
ObservableList<String> memType = FXCollections.observableArrayList("Rider","Sharer","Both");

@FXML
private TextField firstName;
@FXML
private TextField email;
@FXML
private TextField lastName;
@FXML
private TextField mobileNo;
@FXML
private TextField creditNo;
@FXML
private Button createAccount;
@FXML
private PasswordField password;
@FXML
private PasswordField password2;
@FXML
private TextField homeAddress;
@FXML
private TextField homeSuburb;
@FXML
private TextField homePostCode;
@FXML
private ComboBox homeState;
@FXML
private TextField ccCCV;
@FXML
private TextField workAddress;
@FXML
private TextField workSuburb;
@FXML
private TextField workPostcode;
@FXML
private ComboBox consultancy;
@FXML
private TextField username;
@FXML
private TextField companyName;
@FXML
private ComboBox workState;
@FXML
private Button goBack;
@FXML
private ComboBox ccMonth;
@FXML
private ComboBox ccYear;
@FXML
private Label errorMessage;
@FXML
private ComboBox memberType;

/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
homeState.setValue("NSW");
homeState.setItems(states);
consultancy.setValue("Yes");
consultancy.setItems(CompanyConsultancy);
workState.setItems(states);
ccMonth.setValue("01");
ccYear.setValue("17");
ccMonth.setItems(ExpiryMonth);
ccYear.setItems(ExpiryYear);
memberType.setValue("Rider");
memberType.setItems(memType);


}

@FXML
private void createAccount(ActionEvent event) throws SQLException {
try {
boolean check = false;
PreparedStatement insertMember = null;
PreparedStatement usernameCheck= null;
Database.openConnection();
String fname = firstName.getText();
String lname = lastName.getText();
String userName = username.getText();
String emailAddress = email.getText();
String mobileNumber = mobileNo.getText();
String creditNumber = creditNo.getText();

String password1 = password.getText();
String passwordConfirm = password2.getText();
String homeAdd = homeAddress.getText();
String homeSub = homeSuburb.getText();
String homePC = homePostCode.getText();
String homestate = homeState.getSelectionModel().getSelectedItem().toString();
String CreditCardback = ccCCV.getText();
String workAdd = workAddress.getText();
String workSub = workSuburb.getText();
String workPC = workPostcode.getText();
String consult = consultancy.getSelectionModel().getSelectedItem().toString();
String expiryMon = ccMonth.getSelectionModel().getSelectedItem().toString();
String expiryYr = ccYear.getSelectionModel().getSelectedItem().toString();
String companyN = companyName.getText();
String workSte = workState.getSelectionModel().getSelectedItem().toString();
String membType = memberType.getSelectionModel().getSelectedItem().toString();

while (check == false) {
if (userName.equals("")){
errorMessage.setText("Please enter a username");
check =true;
}
else if (fname.equals("")){
errorMessage.setText("Please enter your first name");
check =true;
}
else if (lname.equals("")){
errorMessage.setText("Please enter your last name");
check =true;
}
else if (emailAddress.equals("")){
errorMessage.setText("Please enter your email address");
check =true;
}
else if (password1.equals("")){
errorMessage.setText("Please enter a valid password");
check =true;
}
else if (password2.equals("")){
errorMessage.setText("Please confirm your password");
check =true;
}
else if (mobileNumber.equals("")){
errorMessage.setText("Please enter your mobile number");
check =true;
}
else if (homeAdd.equals("")){
errorMessage.setText("Please enter your home address");
check =true;
}
else if (homeSub.equals("")){
errorMessage.setText("Please enter your home suburb");
check =true;
}
else if (homePC.equals("")){
errorMessage.setText("Please enter your postcode");
check =true;
}

else if (creditNumber.equals("")){
errorMessage.setText("Please enter a valid credit card number");
check =true;
}
else if (CreditCardback.equals("")){
errorMessage.setText("Please enter a CCV number");
check =true;
}
else if (!password1.equals(passwordConfirm)){
errorMessage.setText("Your passwords are not identical. Please try again.");
check =true;
}
else if (password1.equals(passwordConfirm)){
usernameCheck =con.prepareStatement("SELECT MEMBER_USERNAME FROM PUBLIC.MEMBERS WHERE MEMBER_USERNAME = ?");
usernameCheck.setString(1,userName);
ResultSet allUsername = usernameCheck.executeQuery();
if (allUsername.next()){
errorMessage.setText("That username has already been taken. Please choose another one");
}

else {
insertMember = con.prepareStatement("INSERT INTO PUBLIC.MEMBERS(MEMBER_USERNAME,MEMBER_PASSWORD,FIRST_NAME,LAST_NAME,EMAIL_ADDRESS,MOBILE_NO,HOME_ADDRESS,HOME_SUBURB,HOME_POSTCODE,HOME_STATE,WORK_ADDRESS,WORK_SUBURB,WORK_POSTCODE,WORK_STATE,CC_NUMBER,CC_EXPIRY_MONTH,CC_EXPIRY_YEAR,CORPORATE_MEMBER,COMPANY_NAME,MEMBER_TYPE) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
int expMon = Integer.parseInt(expiryMon);
long ccNo = Long.parseLong(creditNumber);
int expYr = Integer.parseInt(expiryYr);
int homepostcode = Integer.parseInt(homePC);
int workpostcode = Integer.parseInt(workPC);
insertMember.setString(1, userName);
insertMember.setString(2, password1);
insertMember.setString(3,fname);
insertMember.setString(4, lname);
insertMember.setString(5,emailAddress);
insertMember.setString(6,mobileNumber);
insertMember.setString(7,homeAdd);
insertMember.setString(8,homeSub);
insertMember.setInt(9,homepostcode);
insertMember.setString(10,homestate);
insertMember.setString(11,workAdd);
insertMember.setString(12,workSub);
insertMember.setInt(13,workpostcode);
insertMember.setString(14,workSte);
insertMember.setLong(15,ccNo);
insertMember.setInt(16,expMon);
insertMember.setInt(17,expYr);
insertMember.setString(18,consult);
insertMember.setString(19, companyN);
insertMember.setString(20,membType);
insertMember.execute();
insertMember.close();
check =true;
}


}

}


} catch (SQLException ex) {
Logger.getLogger(RegisterPageController.class.getName()).log(Level.SEVERE, null, ex);
System.out.println("SQL error");
}

Database.closeConnection();

}

@FXML
private void goBack(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/memberLogin2/Login.fxml"));
Scene scene = new Scene(root);
Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow();
stage.setScene(scene);
stage.show();

}
}