/// <summary> /// 获取拼接好的上课时间数据 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间:2018-11-02 </para> /// </summary> /// <param name="classId">编辑编号</param> /// <returns>获取上课时间字符串</returns> private static string GetSchoolTime(long classId) { // 1、根据班级编号,获取班级中的上课时间编号 List <long> schoolTimeIds = new TimClassTimeService(classId).GetSchoolTimeIds(); // 2、根据上课时间段编号,获取上课时间表 List <TblDatSchoolTime> schoolTimeList = SchoolTimeService.GetBySchoolTimeIds(schoolTimeIds).Select(m => new TblDatSchoolTime { WeekDay = m.WeekDay, BeginTime = m.BeginTime, EndTime = m.EndTime }).ToList(); // 星期 string week = string.Join("、", schoolTimeList.Select(m => EnumName.GetDescription(typeof(Week), m.WeekDay)).Distinct()); schoolTimeList = schoolTimeList.Where((x, i) => schoolTimeList.FindIndex(z => z.BeginTime == x.BeginTime) == i).ToList(); string classTime = string.Empty; foreach (TblDatSchoolTime s in schoolTimeList) { classTime += $"{s.BeginTime}-{s.EndTime},"; } classTime = $"{week}({classTime.TrimEnd(',')})"; return(classTime); }
/// <summary> ///描述: 获取班级上课的时间段 ///<para>作者:瞿琦</para> ///<para>创建时间:2019-3-16</para> /// </summary> /// <param name="classId">班级Id</param> /// <returns>上课时间段列表</returns> private List <TblDatSchoolTime> GetClassTimesList(long classId) { //班级上课时间 var classTimesList = new TimClassTimeService(classId).GetSchoolTimeIds(); var schoolTimeList = SchoolTimeService.GetBySchoolTimeIds(classTimesList); return(schoolTimeList); }
/// <summary> /// 根据班级编号,获取班级上课时间信息 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间:2018-11-02 </para> /// </summary> /// <param name="classId">班级编号</param> /// <returns>返回班级上课信息集合</returns> private static List <SchoolTime> GetDatSchoolTimeInfo(long classId) { List <SchoolTime> tiems = new List <SchoolTime>(); //1、根据班级编号,获取班级上课时间表中的上课时间段 List <long> schoolTimeIds = new TimClassTimeService(classId).GetSchoolTimeIds(); //2、根据上课时间段编号,获取上课时间表 List <TblDatSchoolTime> schoolTimeList = SchoolTimeService.GetBySchoolTimeIds(schoolTimeIds); //3、返回数据 foreach (TblDatSchoolTime s in schoolTimeList) { SchoolTime time = new SchoolTime(); time.SchoolTimeId = s.SchoolTimeId; time.WeekDay = s.WeekDay; time.BeginTime = s.BeginTime; time.EndTime = s.EndTime; tiems.Add(time); } return(tiems); }