Skip to content

Commit

Permalink
THINGS RETURN
Browse files Browse the repository at this point in the history
WOW :squirrel:
  • Loading branch information
clj13001 committed Mar 2, 2017
1 parent 8e9343c commit 9d531f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion WebContent/html/webpages/returnPage.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</table><br>
<form ACTION = "returnComplete.jsp" METHOD = "POST">
<input type = "text" id = "deviceArray" style = "display: none;" name = "devicesToReturn"></input>
<input type = "submit" value = "Submit">Continue</button>
<input type = "submit" value = "Submit">
</form>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/database/MySQLAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public RentedDevice[] getUserDevices(String userID) throws SQLException, ClassNo
Class.forName("com.mysql.jdbc.Driver");
Connection connect = DriverManager.getConnection("jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317", "b372dfe7409692", "74f6e317");
Statement stmt = connect.createStatement();
ResultSet resultSet = stmt.executeQuery("SELECT Device_ID, Device_Name, Device_Description, Ticket_ID, Hardware, Model, Borrow_Date FROM devices WHERE Renter = " + userID);
ResultSet resultSet = stmt.executeQuery("SELECT Device_ID, Device_Name, Device_Description, Ticket_ID, Hardware, Model, Borrow_Date FROM devices WHERE Renter = " + userID + " AND Status <> \"Available\" AND Status <> \"Returning \"");
int counter = 0;

resultSet.last();
Expand Down Expand Up @@ -98,8 +98,9 @@ public void returnDevices(String devices) throws ClassNotFoundException, SQLExce
String[] deviceArray = devices.replaceAll("\\[","").replaceAll("\\]","").replaceAll("\\s","").split(",");
for(int i = 0; i < deviceArray.length; i++){
//update statement
stmt.executeUpdate("UPDATE devices SET Status = \"Available\" WHERE Device_ID = " + deviceArray[i]);
stmt.executeUpdate("UPDATE devices SET Status = \"Returning\" WHERE Device_ID = " + deviceArray[i]);
}
System.out.println("\nUpdates complete\n");
}

public String[][] getResult(){
Expand Down

0 comments on commit 9d531f9

Please sign in to comment.