Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/ReservationSystem/nbproject/private/
/ReservationSystem/nbproject/private/
/ReservationSystem/build/
13 changes: 12 additions & 1 deletion ReservationSystem/nbproject/build-impl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -997,10 +997,21 @@ exists or setup the property manually. For example like this:
</target>
<target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
<target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
<copyfiles files="${file.reference.commons-fileupload-1.3.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.commons-io-2.4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.cos-multipart.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.itextpdf-5.1.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.mysql-connector-java-5.1.5-bin.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir"/>
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
<copyfiles files="${file.reference.commons-fileupload-1.3.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-io-2.4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.cos-multipart.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.itextpdf-5.1.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.mysql-connector-java-5.1.5-bin.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
<delete dir="${build.web.dir}/WEB-INF/lib"/>
</target>
Expand Down
6 changes: 3 additions & 3 deletions ReservationSystem/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=83e7174b
build.xml.data.CRC32=0896d3b2
build.xml.script.CRC32=19d3180a
build.xml.stylesheet.CRC32=651128d4@1.68.1.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=83e7174b
nbproject/build-impl.xml.script.CRC32=cf5845d7
nbproject/build-impl.xml.data.CRC32=0896d3b2
nbproject/build-impl.xml.script.CRC32=42156f08
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
13 changes: 11 additions & 2 deletions ReservationSystem/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ dist.war=${dist.dir}/${war.name}
endorsed.classpath=\
${libs.javaee-endorsed-api-6.0.classpath}
excludes=
file.reference.commons-fileupload-1.3.1.jar=../../TF-master/lib/commons-fileupload-1.3.1.jar
file.reference.commons-io-2.4.jar=../../TF-master/lib/commons-io-2.4.jar
file.reference.cos-multipart.jar=../../TF-master/lib/cos-multipart.jar
file.reference.itextpdf-5.1.0.jar=../../TF-master/lib/itextpdf-5.1.0.jar
file.reference.mysql-connector-java-5.1.5-bin.jar=../../TF-master/lib/mysql-connector-java-5.1.5-bin.jar
includes=**
j2ee.compile.on.save=true
j2ee.copy.static.files.on.save=true
Expand All @@ -41,7 +46,12 @@ j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.ja
j2ee.platform.wsit.classpath=
j2ee.server.type=gfv3ee6
jar.compress=false
javac.classpath=
javac.classpath=\
${file.reference.commons-fileupload-1.3.1.jar}:\
${file.reference.commons-io-2.4.jar}:\
${file.reference.cos-multipart.jar}:\
${file.reference.itextpdf-5.1.0.jar}:\
${file.reference.mysql-connector-java-5.1.5-bin.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.debug=true
Expand All @@ -68,7 +78,6 @@ javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
lib.dir=${web.docbase.dir}/WEB-INF/lib
no.dependencies=false
persistence.xml.dir=${conf.dir}
platform.active=default_platform
resource.dir=setup
Expand Down
27 changes: 24 additions & 3 deletions ReservationSystem/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,34 @@
<data xmlns="http://www.netbeans.org/ns/web-project/3">
<name>ReservationSystem</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<web-module-libraries/>
<web-module-libraries>
<library dirs="200">
<file>${file.reference.commons-fileupload-1.3.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
<file>${file.reference.commons-io-2.4.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
<file>${file.reference.cos-multipart.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
<file>${file.reference.itextpdf-5.1.0.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
<file>${file.reference.mysql-connector-java-5.1.5-bin.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
<root id="src.dir" name="Source Packages"/>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir" name="Test Packages"/>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
Expand Down
108 changes: 108 additions & 0 deletions ReservationSystem/src/java/Database/DB.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package Database;

import java.sql.SQLException;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.DriverManager;
import javax.swing.JOptionPane;

public class DB{

private String url;
private Connection conn;
private ResultSet rs;
private Statement statement;

public DB(){
url="jdbc:mysql://localhost:3306/reserve?zeroDateTimeBehavior=convertToNull";
}

public boolean connect(){
try{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url,"root","");

conn.setAutoCommit(false);
System.out.println("okey");
return true;
}

catch(SQLException sqlEx){
System.out.println("xxxxxxx!E@@"+sqlEx.getMessage());
return false;
}

catch(ClassNotFoundException classEx){
System.out.println("!@$E@#D@"+classEx.getMessage());
return false;
}
}

public String query(String sql){
try{
if(sql.substring(0, 6).toLowerCase().equals("select")){
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = statement.executeQuery(sql);
System.out.println("sql done");
}
else{
statement = conn.createStatement();
System.out.println("sql:"+sql);
statement.executeUpdate(sql);
conn.commit();
System.out.println("Done");

}
return sql;
}catch(SQLException sqlEx){
System.out.println("error:"+sqlEx.getMessage());

return sqlEx.getMessage();
}
}

public void rollback(){
try{
conn.rollback();
}
catch(SQLException sqlEx){
System.out.println(sqlEx.getMessage());
}
}

public int getNumberOfRows(){
try{
rs.last();

return rs.getRow();
}
catch(SQLException sqlEx){
System.out.println(sqlEx.getMessage());

return 0;
}
}
public String getDataAt(int row, String columnName){
try{
rs.absolute(row+1);

return rs.getString(columnName);
}
catch(SQLException sqlEx){
System.out.println(sqlEx.getMessage());

return null;
}
}
public void close(){
try{
statement.close();
conn.commit();
conn.close();
}
catch(SQLException sqlEx){
System.out.println(sqlEx.getMessage());
}
}
}
100 changes: 100 additions & 0 deletions ReservationSystem/src/java/Model/AccountBean.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* 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 Model;
import Database.DB;
/**
*
* @author JJ
*/
public class AccountBean {
private String pk_id = null;
private String name = null;
private String matric_no = null;
private String password = null;
private String no_tel = null;
private String email = null;
private String type = null;

public String getPk_id() {
return pk_id;
}

public void setPk_id(String pk_id) {
this.pk_id = pk_id;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getMatric_no() {
return matric_no;
}

public void setMatric_no(String matric_no) {
this.matric_no = matric_no;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getNo_tel() {
return no_tel;
}

public void setNo_tel(String no_tel) {
this.no_tel = no_tel;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public boolean verify_login(){

DB db= new DB();
if(db.connect()){
db.query("select * from user where email='"+email+"' and password='"+password+"' ");
matric_no = db.getDataAt( 0,"matric_no");
if(matric_no != null){
type = db.getDataAt(0,"type");
name = db.getDataAt(0,"name");
no_tel = db.getDataAt(0,"no_tel");
pk_id = db.getDataAt(0,"pk_id");

db.close();
return true;
}else{
return false;
}
}else{
return false;
}
}


}
Loading