/// <summary> /// 批量添加上课时间段 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间:2018-09-26 </para> /// </summary> /// <param name="list">上课时间段集合</param> /// <param name="toTermId">学期编号</param> /// <returns>返回受影响的行数</returns> internal async Task <int> AddTaskDatSchoolTime(List <TblDatSchoolTime> list, long toTermId) { TblDatSchoolTimeRepository schoolTimeRepository = new TblDatSchoolTimeRepository(); await schoolTimeRepository.DeleteTask(toTermId); //先删除,后添加 return(await schoolTimeRepository.AddTask(list)); }
/// <summary> /// 根据主键删除一条上课时间段 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间:2018-09-07 </para> /// </summary> /// <param name="schoolTimeId">上课时间段主键编号</param> /// <exception cref="AMS.Core.BussinessException"> /// 异常ID:7,上课时间段编号不能为空 /// </exception> public static async Task Remove(long schoolTimeId) { if (schoolTimeId < 1) { throw new BussinessException((byte)ModelType.Datum, 7); } // 1、查询需要数据的删除 TblDatSchoolTimeRepository schoolTimeRepository = new TblDatSchoolTimeRepository(); TblDatSchoolTime schoolTime = await schoolTimeRepository.LoadTask(schoolTimeId); // 2、校验是否可以删除(在课表中被使用的时间段不允许被删除) CanDelete(schoolTimeId, schoolTime.TermId); List <TblDatSchoolTime> schoolTimeList = new List <TblDatSchoolTime>(); schoolTimeList = await SchoolTimeCombinated(schoolTimeRepository, schoolTime, schoolTimeList); await schoolTimeRepository.DeleteTask(schoolTime.TermId, schoolTime.WeekDay, schoolTime.Duration); await schoolTimeRepository.AddTask(schoolTimeList); }