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

There is a new hashmap that contains position data, key = position and the value = wage.

parent db893721
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ public class Model { ...@@ -15,6 +15,7 @@ public class Model {
protected Map<Integer, Shift> shifts; protected Map<Integer, Shift> shifts;
protected Map<Integer, Employee> employees; protected Map<Integer, Employee> employees;
protected Map<Integer, TimeOff> timeOff; protected Map<Integer, TimeOff> timeOff;
protected Map<String, Float> positions;
protected ArrayList<ModelSubscriber> subscribers; protected ArrayList<ModelSubscriber> subscribers;
static LocalDate date; static LocalDate date;
...@@ -31,6 +32,7 @@ public class Model { ...@@ -31,6 +32,7 @@ public class Model {
this.shifts = new HashMap<>(); this.shifts = new HashMap<>();
this.employees = new HashMap<>(); this.employees = new HashMap<>();
this.timeOff = new HashMap<>(); this.timeOff = new HashMap<>();
this.positions = new HashMap<>();
try { try {
InetAddress ip = InetAddress.getByName(hostname); InetAddress ip = InetAddress.getByName(hostname);
this.socket = new Socket(ip, port); this.socket = new Socket(ip, port);
...@@ -156,11 +158,17 @@ public class Model { ...@@ -156,11 +158,17 @@ public class Model {
return "No Employees"; return "No Employees";
} }
//This sends " " as the position.
void addShift(int id, String date, int start, int end){ void addShift(int id, String date, int start, int end){
writer.println("addShift/"+id+"/"+date+"/"+start+"/"+end); writer.println("addShift/"+id+"/"+date+"/"+start+"/"+end+"/"+" ");
notifySubscribers(); notifySubscribers();
} }
//
void addShift(int id, String date, int start, int end, String position){
writer.println("addShift/"+id+"/"+date+"/"+start+"/"+end+"/"+position);
notifySubscribers();
}
void removeShift(int shiftID){ void removeShift(int shiftID){
writer.println("removeShift/"+shiftID); writer.println("removeShift/"+shiftID);
...@@ -269,12 +277,13 @@ public class Model { ...@@ -269,12 +277,13 @@ public class Model {
writer.println("editShiftAvailability/" + shiftID + "/" + available); writer.println("editShiftAvailability/" + shiftID + "/" + available);
} }
// adds a position if its one of the possible positions in the position table.
void addEmployeePosition(int employeeID, String position) { void addEmployeePosition(int employeeID, String position) {
writer.println("addPosition/" + employeeID + "/" + position); writer.println("addEmployeePosition/" + employeeID + "/" + position);
} }
void removeEmployeePosition(int employeeID, String position) { void removeEmployeePosition(int employeeID, String position) {
writer.println("removePosition/" + employeeID + "/" + position); writer.println("removeEmployeePosition/" + employeeID + "/" + position);
} }
...@@ -295,6 +304,18 @@ public class Model { ...@@ -295,6 +304,18 @@ public class Model {
writer.println("removeTimeOff/" + timeOffID); writer.println("removeTimeOff/" + timeOffID);
} }
void addPosition(String position, float wage) {
writer.println("addPosition/");
}
void editPositionWage(String position, float wage) {
writer.println("editPosition/");
}
void removePosition(String position, float wage) {
writer.println("removePosition/");
}
void logOut() { void logOut() {
writer.println("logout"); writer.println("logout");
try { try {
......
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