Commit 9833fb3c authored by 黄奎's avatar 黄奎

新增异步方法

parent 0cb7a2eb
...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment