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
Hide 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;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
VT.FW.DB
;
namespace
Edu.Module.Course
...
...
@@ -429,36 +430,48 @@ namespace Edu.Module.Course
//班级上课计划列表
List
<
RB_Class_Plan_ViewModel
>
classPlanList
=
CreateClassPlanList
(
model
,
defaultPlanTimeList
);
model
.
ClassPlanList
=
classPlanList
;
if
(
model
.
ClassPlanList
!=
null
&&
model
.
ClassPlanList
.
Count
>
0
)
AddClassPlanModule
(
model
);
#
endregion
return
flag
;
}
/// <summary>
/// 添加上课计划
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
void
AddClassPlanModule
(
RB_Class_ViewModel
model
)
{
Task
.
Run
(()
=>
{
foreach
(
var
item
in
model
.
ClassPlanList
)
if
(
model
.
ClassPlanList
!=
null
&&
model
.
ClassPlanList
.
Count
>
0
)
{
item
.
ClassPlanId
=
0
;
if
(!
class_PlanRepository
.
CheckExistsRepository
(
item
))
foreach
(
var
item
in
model
.
ClassPlanList
)
{
//添加班级上课计划
var
newClassPlanId
=
class_PlanRepository
.
Insert
(
item
);
if
(
item
.
PlanTimeList
!=
null
&&
item
.
PlanTimeList
.
Count
>
0
)
item
.
ClassPlanId
=
0
;
if
(!
class_PlanRepository
.
CheckExistsRepository
(
item
))
{
foreach
(
var
subItem
in
item
.
PlanTimeList
)
//添加班级上课计划
var
newClassPlanId
=
class_PlanRepository
.
Insert
(
item
);
if
(
item
.
PlanTimeList
!=
null
&&
item
.
PlanTimeList
.
Count
>
0
)
{
subItem
.
ClassTimeId
=
0
;
subItem
.
ClassPlanId
=
newClassPlanId
;
subItem
.
ClassId
=
model
.
ClassId
;
subItem
.
Group_Id
=
model
.
Group_Id
;
subItem
.
School_Id
=
model
.
School_Id
;
//添加班级上课计划的上课时间
class_TimeRepository
.
Insert
(
subItem
);
foreach
(
var
subItem
in
item
.
PlanTimeList
)
{
subItem
.
ClassTimeId
=
0
;
subItem
.
ClassPlanId
=
newClassPlanId
;
subItem
.
ClassId
=
model
.
ClassId
;
subItem
.
Group_Id
=
model
.
Group_Id
;
subItem
.
School_Id
=
model
.
School_Id
;
//添加班级上课计划的上课时间
class_TimeRepository
.
Insert
(
subItem
);
}
}
}
}
}
}
#
endregion
return
flag
;
});
}
/// <summary>
...
...
@@ -550,6 +563,7 @@ namespace Edu.Module.Course
if
(
model
.
ClassHours
>
0
)
{
var
srartDate
=
model
.
OpenTime
;
var
BasicMinutes
=
class_ConfigRepository
.
GetBasicMinutesRepository
(
model
.
Group_Id
);
//按周排课和按月排课
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
||
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
{
...
...
@@ -581,7 +595,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
...
...
@@ -593,7 +607,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
...
...
@@ -605,7 +619,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
...
...
@@ -617,7 +631,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
...
...
@@ -629,7 +643,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
...
...
@@ -641,7 +655,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
...
...
@@ -653,7 +667,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
...
...
@@ -668,7 +682,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
...
...
@@ -697,7 +711,7 @@ namespace Edu.Module.Course
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
);
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
classPlanList
.
Add
(
planModel
);
}
}
...
...
@@ -718,7 +732,7 @@ namespace Edu.Module.Course
/// <param name="classTimeList"></param>
/// <param name="model"></param>
/// <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
dayMinutes
=
0
;
...
...
@@ -743,7 +757,7 @@ namespace Edu.Module.Course
}
else
{
dayClassHours
=
dayMinutes
/
class_ConfigRepository
.
GetBasicMinutesRepository
(
model
.
Group_Id
)
;
dayClassHours
=
dayMinutes
/
BasicMinutes
;
}
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