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

Client now supports receiving position messages from the server. Cleaned bug...

Client now supports receiving position messages from the server. Cleaned bug that stopped timeOff requests from updating locally.
parent 321296da
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,6 @@ public class ReceiveThread extends Thread {
try {
String response = reader.readLine(); // Waits for messages from the server.
String[] args = response.split("/");
System.out.println(response);
switch (args[0]) {
case "allEmployees" -> allEmployees(args);
case "allShifts" -> allShifts(args);
......@@ -57,6 +56,8 @@ public class ReceiveThread extends Thread {
case "removeTimeOff" -> removeTimeOff(args[1]);
case "setTimeOffApproval" -> setTimeOffApproval(args[1]);
case "allTimeOff" -> allTimeOff(args);
case "addPosition" -> addPosition(args[1], args[2]);
case "removePosition" -> removePosition(args[1], args[2]);
}
} catch (IOException exception) {
......@@ -281,4 +282,38 @@ public class ReceiveThread extends Thread {
}
}
/*
Name: addPosition
Parameters:
String employeeID:
String position:
Description:
Return: void
*/
private void addPosition(String employeeID, String position) {
try {
int id = Integer.parseInt(employeeID);
this.client.getEmployee(id).addPosition(position);
} catch (Exception exception) {
exception.printStackTrace();
}
}
/*
Name: removePosition
Parameters:
String employeeID:
String position:
Description:
Return: void
*/
private void removePosition(String employeeID, String position) {
try {
int id = Integer.parseInt(employeeID);
this.client.getEmployee(id).removePosition(position);
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
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