diff --git a/src/main/java/datamodel/Database.java b/src/main/java/datamodel/Database.java index cf9a10e..6e83b95 100755 --- a/src/main/java/datamodel/Database.java +++ b/src/main/java/datamodel/Database.java @@ -20,7 +20,6 @@ public class Database { conn = null; } - /* --- TODO: Change this method to fit your choice of DBMS --- */ /** * Open a connection to the database, using the specified user name * and password. @@ -210,7 +209,6 @@ public Show getShowData(String movie, String date) { ResultSet rs = stmt.executeQuery("SELECT * FROM Users WHERE username = '" + username + "'"); if (rs.next()) { int user_id = rs.getInt("id"); - // rs = stmt.executeQuery("SELECT * FROM Showings JOIN Movies ON Showings.movie_id = Movies.movie_id WHERE name = '" + movie + "' AND show_date = '" + date + "'"); rs = stmt.executeQuery("SELECT * FROM Showings JOIN Movies ON Showings.movie_id = Movies.movie_id WHERE name = '" + movie + "' AND show_date = '" + date + "'"); if (rs.next()) { System.out.println("Adding reservation"); diff --git a/src/main/java/datamodel/Show.java b/src/main/java/datamodel/Show.java index 25be463..872e68e 100755 --- a/src/main/java/datamodel/Show.java +++ b/src/main/java/datamodel/Show.java @@ -1,8 +1,6 @@ package datamodel; // Container for the database data -/* --- TODO: Modify as needed --- */ - public class Show { // attributes associated with database columns private String title; diff --git a/src/main/java/gui/BookingTab.java b/src/main/java/gui/BookingTab.java index 57e7999..1644fda 100755 --- a/src/main/java/gui/BookingTab.java +++ b/src/main/java/gui/BookingTab.java @@ -81,9 +81,6 @@ public class BookingTab { Reservation r = db.addReservation(user, movie, date); fillShow(movie, date); - /* --- TODO: should attempt to book a ticket via the database --- */ - /* --- do not forget to report booking number! --- */ - /* --- update the displayed details (free seats) --- */ report(String.format("Ticket booked for %s on %s. Reservation number: %d", movie, date, r.getBookingId())); }); diff --git a/src/main/java/gui/MainApplication.java b/src/main/java/gui/MainApplication.java index 4d77118..23572c8 100755 --- a/src/main/java/gui/MainApplication.java +++ b/src/main/java/gui/MainApplication.java @@ -39,9 +39,8 @@ public class MainApplication extends Application { primaryStage.setScene(scene); primaryStage.show(); - // opening database connection - /* --- TODO: change xxx to your user name, yyy to your password --- */ - if(!db.openConnection("xxx", "yyy")) { + // Opening database connection to sqlite3 requires no credentials + if(!db.openConnection("", "")) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Database error"); alert.setHeaderText(null); diff --git a/src/main/java/gui/ReservationsTab.java b/src/main/java/gui/ReservationsTab.java index 98ecef1..c1a2d7e 100644 --- a/src/main/java/gui/ReservationsTab.java +++ b/src/main/java/gui/ReservationsTab.java @@ -1,6 +1,5 @@ package gui; -import java.util.Arrays; import java.util.List; import datamodel.Reservation; @@ -56,9 +55,6 @@ public class ReservationsTab { * Refresh the table view, by getting and replacing the tables content. */ public void updateList() { - /* --- TODO: replace with own code using the database object instead --- */ - System.out.println("Update booking list called."); - // Get the list of bookings from the database List bookings = db.getReservations(CurrentUser.instance().getCurrentUserId());