Skip to content
Snippets Groups Projects
Commit 7a53aca0 authored by mik586's avatar mik586
Browse files

something

parent dc675092
No related branches found
No related tags found
No related merge requests found
......@@ -78,8 +78,8 @@ public class Model {
return "No Employees";
}
void addShift(int id, String date, int start, int end){
writer.println("addShift/"+id+"/"+date+"/"+start+"/"+end);
void addShift(int id, String date, int start, int end, String shiftType){
writer.println("addShift/"+id+"/"+date+"/"+start+"/"+end+"/"+shiftType);
}
void removeShift(int id, String date, int start, int end){
......
......@@ -21,12 +21,12 @@ public class Schedule {
Return: none
*/
protected void addShift(int ID, String date, int start, int end, String shiftType){
protected void addShift(int ID, String date, int start, int end){
Date newDate = Date.valueOf(date);
try {
Statement myStatement = dbConnection.createStatement();
myStatement.executeUpdate("INSERT INTO shifts (employee_id, full_date, start_time, end_time, shiftType) " +
"VALUES ('" + ID +"', '"+ newDate +"', '"+ start +"', '"+ end +"')'" + shiftType +"'");
myStatement.executeUpdate("INSERT INTO shifts (employee_id, full_date, start_time, end_time) " +
"VALUES ('" + ID +"', '"+ newDate +"', '"+ start +"', '"+ end +"')");
} catch (SQLException e) {
e.printStackTrace();
}
......@@ -60,13 +60,12 @@ public class Schedule {
Description: Returns info for all shifts on a given date.
Return: String
*/
protected String getShifts(String date, String shiftType){
protected String getShifts(String date){
Date newDate = Date.valueOf(date);
String response = "getShifts";
try {
Statement myStatement = dbConnection.createStatement();
ResultSet myRs = myStatement.executeQuery("SELECT FROM shifts WHERE (full_date = " + newDate +")" +
"AND WHERE (shift_type = "+ shiftType +")");
ResultSet myRs = myStatement.executeQuery("SELECT FROM shifts WHERE (full_date = " + newDate +")");
while (myRs.next()) {
response = response + "/" + myRs.getString("full_date") + "." +
myRs.getString("employee_id") + "." + myRs.getString("start_time") +
......@@ -79,14 +78,14 @@ public class Schedule {
return response;
}
protected String getShiftsByWeek(String startDate, String endDate, String shiftType){
protected String getShiftsByWeek(String startDate, String endDate){
Date newStart = Date.valueOf(startDate);
Date newEnd = Date.valueOf(endDate);
String response = "getShiftsByWeek";
try {
Statement myStatement = dbConnection.createStatement();
ResultSet myRs = myStatement.executeQuery("SELECT FROM shifts WHERE (full_date >= " + newStart +")" +
"AND WHERE (full_date <= " + newEnd +")" + "AND WHERE (shift_type = "+ shiftType +")");
"AND WHERE (full_date <= " + newEnd +")");
while (myRs.next()) {
response = response + "/" + myRs.getString("full_date") + "." +
myRs.getString("employee_id") + "." + myRs.getString("start_time") +
......@@ -99,15 +98,14 @@ public class Schedule {
return response;
}
protected String getEmployeeShiftsByWeek(int ID, String startDate, String endDate, String shiftType){
protected String getEmployeeShiftsByWeek(int ID, String startDate, String endDate){
Date newStart = Date.valueOf(startDate);
Date newEnd = Date.valueOf(endDate);
String response = "getEmployeeShiftsByWeek";
try {
Statement myStatement = dbConnection.createStatement();
ResultSet myRs = myStatement.executeQuery("SELECT FROM shifts WHERE (full_date >= " + newStart +")" +
"AND WHERE (full_date <= " + newEnd +") AND WHERE (employee_id = "+ ID + ")" +
"AND WHERE (shift_type = "+ shiftType +")");
"AND WHERE (full_date <= " + newEnd +") AND WHERE (employee_id = "+ ID + ")");
while (myRs.next()) {
response = response + "/" + myRs.getString("full_date") + "." +
myRs.getString("employee_id") + "." + myRs.getString("start_time") +
......
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