Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmpt-370-group-project-group26
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eyan Cunningham (esc568)
cmpt-370-group-project-group26
Commits
6030575c
Commit
6030575c
authored
3 years ago
by
Rafi
Browse files
Options
Downloads
Patches
Plain Diff
Added edit shift method to edit shifts in the database.
parent
c0207271
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SchedulerApp/src/main/java/com/example/schedulerapp/Schedule.java
+11
-20
11 additions, 20 deletions
...rApp/src/main/java/com/example/schedulerapp/Schedule.java
with
11 additions
and
20 deletions
SchedulerApp/src/main/java/com/example/schedulerapp/Schedule.java
+
11
−
20
View file @
6030575c
...
...
@@ -31,39 +31,30 @@ public class Schedule {
e
.
printStackTrace
();
}
}
/*
Name: removeShift
Name: removeShift
ByID
Parameters:
int ID: The employees unique ID.
Date: The date as a string in the form of "yyyy-mm-dd".
start: The employees shift start time.
end: The employees shift end time.
Description: Removes the employees shift matching the date, and shift duration.
int shiftID: The shift unique ID.
Description: Removes the employees shift matching the shift date.
Return: none
*/
protected
void
removeShift
(
String
ID
,
String
date
,
int
start
,
int
end
){
Date
newDate
=
Date
.
valueOf
(
date
);
protected
void
removeShiftByID
(
String
shiftID
){
try
{
Statement
myStatement
=
dbConnection
.
createStatement
();
myStatement
.
executeUpdate
(
"DELETE FROM shifts WHERE (employee_id ="
+
ID
+
") "
+
"AND WHERE (date = "
+
newDate
+
") AND WHERE (start_time = "
+
start
+
" ) "
+
"AND WHERE (end_time = "
+
end
+
")"
);
myStatement
.
executeUpdate
(
"DELETE FROM shifts WHERE (shift_id ="
+
shiftID
+
")"
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
/*
Name: removeShiftByID
Parameters:
int shiftID: The shift unique ID.
Description: Removes the employees shift matching the shift date.
Return: none
*/
protected
void
removeShiftByID
(
String
shiftID
){
protected
void
editShift
(
Integer
shift_id
,
String
date
,
String
start
,
String
end
){
Date
newDate
=
Date
.
valueOf
(
date
);
System
.
out
.
println
(
newDate
);
try
{
Statement
myStatement
=
dbConnection
.
createStatement
();
myStatement
.
executeUpdate
(
"DELETE FROM shifts WHERE (shift_id ="
+
shiftID
+
")"
);
myStatement
.
executeUpdate
(
"update shifts set full_date='"
+
newDate
+
"',start_time="
+
start
+
",end_time="
+
end
+
" where shift_id="
+
shift_id
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment