Commit e2006729 authored by 黄奎's avatar 黄奎

页面修改

parent 16993d3e
...@@ -552,22 +552,55 @@ namespace Edu.Module.Course ...@@ -552,22 +552,55 @@ namespace Edu.Module.Course
extModel.ClassPlanId = newId; extModel.ClassPlanId = newId;
flag = newId > 0; flag = newId > 0;
} }
var oldPlanList= class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel()
{
ClassId = extModel.ClassId,
ClassPlanId = extModel.ClassPlanId,
});
//原来没有计划
if (oldPlanList == null || (oldPlanList != null && oldPlanList.Count == 0))
{
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;
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); class_TimeRepository.DeleteClassTimeByPlanIdRepository(extModel.ClassPlanId);
if (extModel.PlanTimeList != null && extModel.PlanTimeList.Count > 0) }
//找出差异的数据
var deleteList = oldPlanList.Where(qitem => !extModel.PlanTimeList.Any(oldItem => qitem.ClassTimeId == oldItem.ClassTimeId)).ToList();
foreach (var dItem in deleteList)
{
if (dItem.ClassTimeId > 0)
{ {
class_TimeRepository.Delete(dItem.ClassTimeId);
}
}
foreach (var item in extModel.PlanTimeList) foreach (var item in extModel.PlanTimeList)
{ {
item.ClassId = extModel.ClassId; item.ClassId = extModel.ClassId;
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) if (item.ClassTimeId == 0)
{ {
flag = class_TimeRepository.Update(item); flag = class_TimeRepository.Insert(item) > 0;
} }
else else
{ {
flag = class_TimeRepository.Insert(item) > 0; flag = class_TimeRepository.Update(item);
} }
} }
} }
......
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