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;
|
conn = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- TODO: Change this method to fit your choice of DBMS --- */
|
|
||||||
/**
|
/**
|
||||||
* Open a connection to the database, using the specified user name
|
* Open a connection to the database, using the specified user name
|
||||||
* and password.
|
* and password.
|
||||||
|
@ -210,7 +209,6 @@ public Show getShowData(String movie, String date) {
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM Users WHERE username = '" + username + "'");
|
ResultSet rs = stmt.executeQuery("SELECT * FROM Users WHERE username = '" + username + "'");
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
int user_id = rs.getInt("id");
|
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 + "'");
|
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()) {
|
if (rs.next()) {
|
||||||
System.out.println("Adding reservation");
|
System.out.println("Adding reservation");
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package datamodel;
|
package datamodel;
|
||||||
|
|
||||||
// Container for the database data
|
// Container for the database data
|
||||||
/* --- TODO: Modify as needed --- */
|
|
||||||
|
|
||||||
public class Show {
|
public class Show {
|
||||||
// attributes associated with database columns
|
// attributes associated with database columns
|
||||||
private String title;
|
private String title;
|
||||||
|
|
|
@ -81,9 +81,6 @@ public class BookingTab {
|
||||||
|
|
||||||
Reservation r = db.addReservation(user, movie, date);
|
Reservation r = db.addReservation(user, movie, date);
|
||||||
fillShow(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()));
|
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.setScene(scene);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
|
||||||
// opening database connection
|
// Opening database connection to sqlite3 requires no credentials
|
||||||
/* --- TODO: change xxx to your user name, yyy to your password --- */
|
if(!db.openConnection("", "")) {
|
||||||
if(!db.openConnection("xxx", "yyy")) {
|
|
||||||
Alert alert = new Alert(AlertType.ERROR);
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
alert.setTitle("Database error");
|
alert.setTitle("Database error");
|
||||||
alert.setHeaderText(null);
|
alert.setHeaderText(null);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import datamodel.Reservation;
|
import datamodel.Reservation;
|
||||||
|
@ -56,9 +55,6 @@ public class ReservationsTab {
|
||||||
* Refresh the table view, by getting and replacing the tables content.
|
* Refresh the table view, by getting and replacing the tables content.
|
||||||
*/
|
*/
|
||||||
public void updateList() {
|
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
|
// Get the list of bookings from the database
|
||||||
List<Reservation> bookings = db.getReservations(CurrentUser.instance().getCurrentUserId());
|
List<Reservation> bookings = db.getReservations(CurrentUser.instance().getCurrentUserId());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue