Skip to content
Snippets Groups Projects
Commit b24fcc52 authored by Rafi Zereselasie (raz070)'s avatar Rafi Zereselasie (raz070)
Browse files

editShift didn't include changes to the employeeID, now it does.

parent 54d382a2
No related branches found
No related tags found
1 merge request!6Changed update implementation for employees so rather than sending the whole...
......@@ -162,8 +162,8 @@ public class Model {
notifySubscribers();
}
void editShift(int shiftID, String day, int start, int end) {
writer.println("editShift/"+shiftID+"/"+day+"/"+start+"/"+end);
void editShift(int shiftID, String day, int start, int end, Boolean availability, int employeeID) {
writer.println("editShift/"+shiftID+"/"+day+"/"+start+"/"+end+"/"+availability+"/"+employeeID);
notifySubscribers();
}
......
......@@ -76,14 +76,14 @@ public class Schedule {
Description: Edits the time and date of the of a shift if it has the same shift id
Return: none
*/
protected String editShift(Integer shiftID, String date, String start,String end, String available){
protected String editShift(Integer shiftID, String date, String start,String end, String available, int employeeID){
String editedShift = "";
Date newDate = Date.valueOf(date);
System.out.println(newDate);
try {
Statement myStatement = dbConnection.createStatement();
myStatement.executeUpdate("update shifts set full_date='" + newDate + "',start_time=" + start + ",end_time=" + end
+ ",availability=" + available + " where shift_id=" + shiftID);
+ ",availability=" + available +",employee_ID=" + employeeID + " where shift_id=" + shiftID);
ResultSet myRs = myStatement.executeQuery("select * from Shifts where shift_id=" + shiftID);
editedShift = myRs.getString("employee_id" ) + "," + myRs.getString("full_date") +
"," + myRs.getString("start_time") + "," + myRs.getString("end_time") +
......
......@@ -77,7 +77,8 @@ public class UserThread extends Thread {
break;
case "editShift":
try {
String editedShift = dbQuery.schedule.editShift(Integer.parseInt(args[1]), args[2], args[3], args[4], args[5]);
String editedShift = dbQuery.schedule.editShift(Integer.parseInt(args[1]), args[2], args[3],
args[4], args[5], Integer.parseInt(args[6]));
if (!editedShift.isEmpty()) {
server.broadcast("editShift/" + editedShift);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment