Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stojcheska Teodora
Programming_Project
Commits
752e33ce
Commit
752e33ce
authored
Jun 26, 2021
by
Stojcheska Teodora
Browse files
Clean up.
parent
94282b76
Changes
20
Hide whitespace changes
Inline
Side-by-side
Scheduler/
App.config
→
App.config
View file @
752e33ce
File moved
Scheduler/
Calendar.cs
→
Calendar.cs
View file @
752e33ce
File moved
Scheduler/
Controls/DatePicker.cs
→
Controls/DatePicker.cs
View file @
752e33ce
File moved
Scheduler/
Controls/HintTextBox.cs
→
Controls/HintTextBox.cs
View file @
752e33ce
File moved
Scheduler/
Day.cs
→
Day.cs
View file @
752e33ce
File moved
Scheduler/
Forms/CalendarView.cs
→
Forms/CalendarView.cs
View file @
752e33ce
File moved
Scheduler/
Forms/TaskView.cs
→
Forms/TaskView.cs
View file @
752e33ce
File moved
Scheduler/
NoSpaceForTaskExeption.cs
→
NoSpaceForTaskExeption.cs
View file @
752e33ce
File moved
Scheduler/
Program.cs
→
Program.cs
View file @
752e33ce
File moved
Scheduler/
ProgramData.cs
→
ProgramData.cs
View file @
752e33ce
File moved
Scheduler/
Properties/AssemblyInfo.cs
→
Properties/AssemblyInfo.cs
View file @
752e33ce
File moved
Scheduler/
Properties/Resources.Designer.cs
→
Properties/Resources.Designer.cs
View file @
752e33ce
File moved
Scheduler/
Properties/Resources.resx
→
Properties/Resources.resx
View file @
752e33ce
File moved
Scheduler/
Properties/Settings.Designer.cs
→
Properties/Settings.Designer.cs
View file @
752e33ce
File moved
Scheduler/
Properties/Settings.settings
→
Properties/Settings.settings
View file @
752e33ce
File moved
Scheduler/
Scheduler.csproj
→
Scheduler.csproj
View file @
752e33ce
File moved
Scheduler.sln
View file @
752e33ce
...
...
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31229.75
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scheduler", "Scheduler
\Scheduler
.csproj", "{1F6FE665-3863-440A-97E8-12B5F87E0078}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scheduler", "Scheduler.csproj", "{1F6FE665-3863-440A-97E8-12B5F87E0078}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
...
...
Scheduler/
Settings.cs
→
Settings.cs
View file @
752e33ce
File moved
Scheduler/
Task.cs
→
Task.cs
View file @
752e33ce
File moved
reorderCalendar/Program.cs
deleted
100644 → 0
View file @
94282b76
using
System
;
class
Program
{
static
void
Main
(
string
[]
args
)
{
}
// take tasks from day and shift it either to the next or previous day
void
reorderCalendar
(
Day
day
,
int
hours
,
bool
next
,
Day
returnPoint
)
{
Day
dirDay
;
if
(
next
)
{
dirDay
=
day
.
nextDay
;
}
else
{
dirDay
=
day
.
prevDay
;
}
if
(
dirDay
==
returnPoint
||
dirDay
==
null
)
{
return
;
}
getTasks
(
day
,
hours
);
foreach
(
Task
task
in
tasks
)
{
dirDay
.
addTask
(
task
,
0
);
}
foreach
(
Task
task
in
tasks
)
{
day
.
removeTask
(
task
);
}
reorderCalendar
(
dirDay
,
dirDay
.
hoursToShift
,
next
,
null
);
}
// returns
public
List
<
Task
>
getTasks
(
Day
day
,
int
hours
,
Day
dirDay
){
List
<
Task
>
tasks
=
new
List
<
Task
>();
for
(
int
i
=
day
.
tasks
.
Count
-
1
;
i
>=
0
;
--
i
)
{
if
(
hours
==
0
)
{
break
;
}
Task
curTask
=
day
.
tasks
[
i
];
if
(!
isDateValid
(
dirDay
.
date
,
curTask
.
deadline
))
{
day
.
removeTask
(
curTask
);
// now reverse all action done so far
// should I recursively reverse all action that has been done?
for
(
int
j
=
tasks
.
Count
-
1
;
j
>=
0
;
--
j
)
{
if
(
tasks
[
j
].
name
==
"SPECIAL"
){
// then the task was split and we only played with their hours
// the special task has duration parameter ehich indicates how many hours we need to
// add to the task in daay and remove from the task in dirDay
// we know that the split tasks are the last task in day ad the first task in dirday
// TODO: for delete the + and - should be in reverse order - not comletly sure
day
.
tasks
[
tasks
.
Count
-
1
].
duration
+=
tasks
[
j
].
duration
;
dirDay
.
tasks
[
0
].
duration
-=
tasks
[
j
].
duration
;
}
day
.
addTask
(
tasks
[
j
],
day
.
tasks
.
Count
);
hours
+=
tasks
[
j
].
duration
;
}
throw
new
NoSpaceForTaskExeption
(
"There is no space to add the task, error occured during shifting the tasks"
,
day
,
curTask
,
hours
);
}
// add split tasks to "tasks" so that I can handle it during the exception
if
(
curTask
.
duration
>
hours
)
{
int
additionalHours
=
0
;
if
(
curTask
.
isSplit
)
{
curTask
.
splitTaskPtr
.
duration
+=
hours
;
curTask
.
duration
-=
hours
;
additionalHours
=
curTask
.
splitTaskPtr
.
duration
;
tasks
.
Add
(
new
Task
(
"SPECIAL"
,
null
,
hours
,
null
,
true
));
continue
;
// dirDay.removeTask(curTask.splitTaskPtr);
// merged in curTask which is in day
// curTask.mergeTasks(curTask, curTask.splitTaskPtr);
}
int
[]
splitHours
=
{
curTask
.
duration
-
hours
-
additionalHours
,
hours
+
additionalHours
};
curTask
.
splitTask
(
splitHours
,
0
,
curTask
,
day
);
hours
=
0
;
//day.nextDay.addTask(curTask.splitTaskPtr, 0);
tasks
.
Add
(
curTask
.
splitTaskPtr
);
}
else
{
int
curTaskHours
=
curTask
.
duration
;
if
(
curTask
.
isSplit
)
{
curTask
.
splitTaskPtr
.
duration
+=
curTask
.
duration
;
}
else
{
tasks
.
Add
(
curTask
);
//day.nextDay.addTask(curTask, 0);
}
hours
-=
curTaskHours
;
}
}
return
tasks
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment