Skip to content
Snippets Groups Projects
Commit 10f82ad7 authored by Rafi's avatar Rafi
Browse files

Added shift/schedule functionality to the client.

parent c362547b
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ public class ReceiveThread extends Thread {
String[] args = response.split("/");
switch (args[0]) {
case "allEmployees" -> this.client.employees = new ArrayList<>(Arrays.asList(args));
case "Shifts" -> this.client.shifts = new ArrayList<>(Arrays.asList(args));
case "allShifts" -> this.client.shifts = new ArrayList<>(Arrays.asList(args));
}
} catch (IOException error) {
......
......@@ -71,6 +71,28 @@ public class ScheduleClient {
return "No Employees";
}
void addShift(int id, String date, int start, int end){
writer.println("addShift/"+id+"/"+date+"/"+start+"/"+end);
}
void removeShift(int id, String date, int start, int end){
writer.println("removeShift/"+id+"/"+date+"/"+start+"/"+end);
}
void printAllShifts() {
System.out.println(this.shifts);
}
//todo
String getShiftsByWeek(){
return "Need to implement";
}
//todo
String getEmployeeShiftsByWeek(){
return "Need to implement";
}
void logOut() {
writer.println("logout");
try {
......@@ -85,7 +107,7 @@ public class ScheduleClient {
int port = 8989; //Rafi's server port is 8989
ScheduleClient client = new ScheduleClient(hostname, port);
System.out.print("Retrieving Data");
while(client.employees.isEmpty()){
while(client.employees.isEmpty() && client.shifts.isEmpty()){
System.out.print(".");
try {
TimeUnit.SECONDS.sleep(1);
......
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