Commit e2006729 authored by 黄奎's avatar 黄奎

页面修改

parent 16993d3e
...@@ -552,8 +552,14 @@ namespace Edu.Module.Course ...@@ -552,8 +552,14 @@ namespace Edu.Module.Course
extModel.ClassPlanId = newId; extModel.ClassPlanId = newId;
flag = newId > 0; flag = newId > 0;
} }
class_TimeRepository.DeleteClassTimeByPlanIdRepository(extModel.ClassPlanId); var oldPlanList= class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel()
if (extModel.PlanTimeList != null && extModel.PlanTimeList.Count > 0) {
ClassId = extModel.ClassId,
ClassPlanId = extModel.ClassPlanId,
});
//原来没有计划
if (oldPlanList == null || (oldPlanList != null && oldPlanList.Count == 0))
{ {
foreach (var item in extModel.PlanTimeList) foreach (var item in extModel.PlanTimeList)
{ {
...@@ -561,14 +567,41 @@ namespace Edu.Module.Course ...@@ -561,14 +567,41 @@ namespace Edu.Module.Course
item.ClassPlanId = extModel.ClassPlanId; item.ClassPlanId = extModel.ClassPlanId;
item.Group_Id = extModel.Group_Id; item.Group_Id = extModel.Group_Id;
item.School_Id = extModel.School_Id; item.School_Id = extModel.School_Id;
if (item.ClassTimeId > 0) item.ClassTimeId = 0;
flag = class_TimeRepository.Insert(item) > 0;
}
}
//以前有计划
else
{
//现在没有设置时间【直接删除以前的时间】
if (extModel.PlanTimeList == null || (extModel.PlanTimeList != null && extModel.PlanTimeList.Count == 0))
{
class_TimeRepository.DeleteClassTimeByPlanIdRepository(extModel.ClassPlanId);
}
//找出差异的数据
var deleteList = oldPlanList.Where(qitem => !extModel.PlanTimeList.Any(oldItem => qitem.ClassTimeId == oldItem.ClassTimeId)).ToList();
foreach (var dItem in deleteList)
{
if (dItem.ClassTimeId > 0)
{ {
flag = class_TimeRepository.Update(item); class_TimeRepository.Delete(dItem.ClassTimeId);
} }
else }
foreach (var item in extModel.PlanTimeList)
{
item.ClassId = extModel.ClassId;
item.ClassPlanId = extModel.ClassPlanId;
item.Group_Id = extModel.Group_Id;
item.School_Id = extModel.School_Id;
if (item.ClassTimeId == 0)
{ {
flag = class_TimeRepository.Insert(item) > 0; flag = class_TimeRepository.Insert(item) > 0;
} }
else
{
flag = class_TimeRepository.Update(item);
}
} }
} }
return flag; return flag;
......
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