Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
9833fb3c
Commit
9833fb3c
authored
Jul 01, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增异步方法
parent
0cb7a2eb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
31 deletions
+45
-31
ClassModule.cs
Edu.Module.Course/ClassModule.cs
+45
-31
No files found.
Edu.Module.Course/ClassModule.cs
View file @
9833fb3c
...
@@ -13,6 +13,7 @@ using Edu.Repository.User;
...
@@ -13,6 +13,7 @@ using Edu.Repository.User;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
VT.FW.DB
;
using
VT.FW.DB
;
namespace
Edu.Module.Course
namespace
Edu.Module.Course
...
@@ -429,8 +430,22 @@ namespace Edu.Module.Course
...
@@ -429,8 +430,22 @@ namespace Edu.Module.Course
//班级上课计划列表
//班级上课计划列表
List
<
RB_Class_Plan_ViewModel
>
classPlanList
=
CreateClassPlanList
(
model
,
defaultPlanTimeList
);
List
<
RB_Class_Plan_ViewModel
>
classPlanList
=
CreateClassPlanList
(
model
,
defaultPlanTimeList
);
model
.
ClassPlanList
=
classPlanList
;
model
.
ClassPlanList
=
classPlanList
;
AddClassPlanModule
(
model
);
#
endregion
return
flag
;
}
/// <summary>
/// 添加上课计划
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
void
AddClassPlanModule
(
RB_Class_ViewModel
model
)
{
Task
.
Run
(()
=>
{
if
(
model
.
ClassPlanList
!=
null
&&
model
.
ClassPlanList
.
Count
>
0
)
if
(
model
.
ClassPlanList
!=
null
&&
model
.
ClassPlanList
.
Count
>
0
)
{
{
foreach
(
var
item
in
model
.
ClassPlanList
)
foreach
(
var
item
in
model
.
ClassPlanList
)
...
@@ -456,9 +471,7 @@ namespace Edu.Module.Course
...
@@ -456,9 +471,7 @@ namespace Edu.Module.Course
}
}
}
}
}
}
#
endregion
});
return
flag
;
}
}
/// <summary>
/// <summary>
...
@@ -550,6 +563,7 @@ namespace Edu.Module.Course
...
@@ -550,6 +563,7 @@ namespace Edu.Module.Course
if
(
model
.
ClassHours
>
0
)
if
(
model
.
ClassHours
>
0
)
{
{
var
srartDate
=
model
.
OpenTime
;
var
srartDate
=
model
.
OpenTime
;
var
BasicMinutes
=
class_ConfigRepository
.
GetBasicMinutesRepository
(
model
.
Group_Id
);
//按周排课和按月排课
//按周排课和按月排课
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
||
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
||
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
{
{
...
@@ -581,7 +595,7 @@ namespace Edu.Module.Course
...
@@ -581,7 +595,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
...
@@ -593,7 +607,7 @@ namespace Edu.Module.Course
...
@@ -593,7 +607,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
...
@@ -605,7 +619,7 @@ namespace Edu.Module.Course
...
@@ -605,7 +619,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
...
@@ -617,7 +631,7 @@ namespace Edu.Module.Course
...
@@ -617,7 +631,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
...
@@ -629,7 +643,7 @@ namespace Edu.Module.Course
...
@@ -629,7 +643,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
...
@@ -641,7 +655,7 @@ namespace Edu.Module.Course
...
@@ -641,7 +655,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
...
@@ -653,7 +667,7 @@ namespace Edu.Module.Course
...
@@ -653,7 +667,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
...
@@ -668,7 +682,7 @@ namespace Edu.Module.Course
...
@@ -668,7 +682,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
...
@@ -697,7 +711,7 @@ namespace Edu.Module.Course
...
@@ -697,7 +711,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
{
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
classPlanList
.
Add
(
planModel
);
classPlanList
.
Add
(
planModel
);
}
}
}
}
...
@@ -718,7 +732,7 @@ namespace Edu.Module.Course
...
@@ -718,7 +732,7 @@ namespace Edu.Module.Course
/// <param name="classTimeList"></param>
/// <param name="classTimeList"></param>
/// <param name="model"></param>
/// <param name="model"></param>
/// <returns></returns>
/// <returns></returns>
private
double
CalcDayClassHoursModule
(
List
<
TimeItem
>
timeList
,
List
<
RB_Class_Time_ViewModel
>
classTimeList
,
RB_Class_ViewModel
model
)
private
double
CalcDayClassHoursModule
(
List
<
TimeItem
>
timeList
,
List
<
RB_Class_Time_ViewModel
>
classTimeList
,
RB_Class_ViewModel
model
,
int
BasicMinutes
)
{
{
double
dayClassHours
=
0
;
double
dayClassHours
=
0
;
double
dayMinutes
=
0
;
double
dayMinutes
=
0
;
...
@@ -743,7 +757,7 @@ namespace Edu.Module.Course
...
@@ -743,7 +757,7 @@ namespace Edu.Module.Course
}
}
else
else
{
{
dayClassHours
=
dayMinutes
/
class_ConfigRepository
.
GetBasicMinutesRepository
(
model
.
Group_Id
)
;
dayClassHours
=
dayMinutes
/
BasicMinutes
;
}
}
return
dayClassHours
;
return
dayClassHours
;
}
}
...
...
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