Slight cleaning, removing unused dependencies and debug printing
This commit is contained in:
parent
ebc6ec7896
commit
570b0c319b
5 changed files with 2 additions and 14 deletions
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()));
|
||||
});
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Reservation> bookings = db.getReservations(CurrentUser.instance().getCurrentUserId());
|
||||
|
||||
|
|
Loading…
Reference in a new issue