12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using System.Data.Entity;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.DataLogic.Common.CalendarManage;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.DataLogic.EducationSchedule;
- using Bowin.Common.Log;
- using EMIS.ViewModel.CalendarManage;
- using EMIS.ViewModel;
- using EMIS.ViewModel.UniversityManage.ClassroomManage;
- using EMIS.Entities;
- using EMIS.CommonLogic.EducationManage;
- using EMIS.ViewModel.EducationManage;
- using EMIS.ViewModel.EducationSchedule;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.DataLogic.UniversityManage.ClassroomManage;
- using EMIS.DataLogic.Common.Cultureplan;
- using EMIS.DataLogic.EducationManage;
- using EMIS.DataLogic.UniversityManage.TeacherManage;
- using EMIS.ViewModel.UniversityManage.TeacherManage;
- using EMIS.Utility;
- using EMIS.CommonLogic.SchedulingManage.ScheduleApproval;
- using EMIS.CommonLogic.SchedulingManage.SchedulingSettings;
- using EMIS.DataLogic.SchedulingManage.SchedulingSettings;
- using EMIS.ViewModel.Students;
- using EMIS.DataLogic.Common.Students;
- using EMIS.ViewModel.SchedulingManage.ScheduleApproval;
- using EMIS.Utility.FormValidate;
- using EMIS.ViewModel.EducationManagement;
- using EMIS.DataLogic.ExaminationManage;
- using EMIS.ViewModel.ExaminationManage;
- using EMIS.ViewModel.UniversityManage.AdministrativeOrgan;
- namespace EMIS.CommonLogic.EducationSchedule
- {
- /// <summary>
- /// 排课服务(前方高能,阅读小心……)
- /// </summary>
- public class ScheduleServices : BaseServices, IScheduleServices
- {
- public CollegeScheduleDAL CollegeScheduleDAL { get; set; }
- public CollegePriorityDAL CollegePriorityDAL { get; set; }
- public ClassroomDAL ClassroomDAL { get; set; }
- public ClassroomExcessiveUseDAL ClassroomExcessiveUseDAL { get; set; }
- public StaffDAL StaffDAL { get; set; }
- public ClassroomScheduleDAL ClassroomScheduleDAL { get; set; }
- public CourseScheduleDAL CourseScheduleDAL { get; set; }
- public CourseTypeScheduleDAL CourseTypeScheduleDAL { get; set; }
- public TeacherScheduleDAL TeacherScheduleDAL { get; set; }
- public ArrangementDAL ArrangementDAL { get; set; }
- public EducationSchedulingDAL EducationSchedulingDAL { get; set; }
- public EducationSchedulingClassDAL EducationSchedulingClassDAL { get; set; }
- public EducationMissionClassDAL EducationMissionClassDAL { get; set; }
- public CoursematerialDAL CoursematerialDAL { get; set; }
- public StudentsDAL StudentsDAL { get; set; }
- public ExaminationPlanDAL ExaminationPlanDAL { get; set; }
- public Lazy<ICoursesTimeServices> CoursesTimeServices { get; set; }
- public Lazy<ISchoolYearServices> SchoolYearServices { get; set; }
- public Lazy<IEducationSchedulingClassServices> EducationSchedulingClassServices { get; set; }
- public Lazy<IParameterServices> ParameterServices { get; set; }
- public Lazy<ICollegeScheduleApprovalServices> CollegeScheduleApprovalServices { get; set; }
- public Lazy<IEducationSchedulingStopServices> EducationSchedulingStopServices { get; set; }
- private int? TeacherScheduleContinuousCount { get; set; }
- private int? ClassScheduleContinuousCount { get; set; }
- private int? ClassCourseScheduleContinuousCount { get; set; }
- private SchoolYearView SchoolYear { get; set; }
- private CalendarView CalendarView { get; set; }
- private List<CollegeView> CollegeList { get; set; }
- private List<ClassroomView> ClassroomList { get; set; }
- private List<CF_Staff> StaffList { get; set; }
- private List<ES_CollegeClassroom> CollegeClassroomList { get; set; }
- private List<ES_CourseTypePriority> CourseTypePriorityList { get; set; }
- private List<CoursesTimeView> CourseTimeList { get; set; }
- private List<ArrangementView> ArrangementList { get; set; }
- private List<ES_CourseScheduleSetting> CourseSchedulingSettingList { get; set; }
- private List<ES_TeacherScheduleSetting> TeacherSchedulingSettingList { get; set; }
- private List<ES_ClassroomScheduleSetting> ClassroomSchedulingSettingList { get; set; }
- private List<EducationSchedulingClassScheduleView> EducationSchedulingClassViewList { get; set; }
- private List<EducationSchedulingClassStudentView> EducationSchedulingClassStudentViewList { get; set; }
- private List<EducationSchedulingView> ScheduledEducationViewList { get; set; }
- private List<EducationSchedulingClassStudentView> ScheduledEducationStudentViewList { get; set; }
- //结果列表
- private List<ES_EducationScheduling> SchedulingResult { get; set; }
- private List<ES_EducationSchedulingWeekNum> SchedulingWeekNumResult { get; set; }
- private List<ES_EducationSchedulingTeacher> SchedulingTeacherResult { get; set; }
- //失败列表
- private List<EducationSchedulingClassScheduleView> NotScheduledList { get; set; }
- private void InitCommonInfo()
- {
- SchedulingResult = new List<ES_EducationScheduling>(); //初始化排课结果
- SchedulingWeekNumResult = new List<ES_EducationSchedulingWeekNum>();
- SchedulingTeacherResult = new List<ES_EducationSchedulingTeacher>();
- NotScheduledList = new List<EducationSchedulingClassScheduleView>();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取学年学期。");
- SchoolYear = SchoolYearServices.Value.GetNextSchoolYear();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取课程时间。");
- CourseTimeList = CoursesTimeServices.Value.GetCoursesTimeViewList(new ConfiguretView(), null);
- CourseTimeList = CourseTimeList.OrderBy(x => x.StartTimes).ToList();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取周工作时间表。");
- ArrangementList = ArrangementDAL.GetArrangementView(x => x.IsOnWork == true).ToList();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取课程可排时间设定。");
- StaffList = StaffDAL.staffRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取教师信息。");
- CourseSchedulingSettingList = CourseScheduleDAL.CourseScheduleSettingRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取教师可排时间设定。");
- TeacherSchedulingSettingList = TeacherScheduleDAL.TeacherScheduleSettingRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取课程类型优先级设置。");
- CourseTypePriorityList = this.CourseTypeScheduleDAL.CourseTypePriorityRepository.Entities.ToList();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取连续上课限制");
- TeacherScheduleContinuousCount = this.ParameterServices.Value.GetParameterValue<int>(CF_ParameterType.TeacherScheduleContinuousCount);
- ClassScheduleContinuousCount = this.ParameterServices.Value.GetParameterValue<int>(CF_ParameterType.ClassScheduleContinuousCount);
- ClassCourseScheduleContinuousCount = this.ParameterServices.Value.GetParameterValue<int>(CF_ParameterType.ClassCourseScheduleContinuousCount);
-
- }
- private void InitScheduleClassInfo()
- {
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取排课" + RSL.Get("College") + "。");
- CollegeList = CollegeScheduleDAL.GetCollegeViewByTime(DateTime.Now).ToList();
- var collegeIDList = CollegeList.Select(x => (Guid?)x.CollegeID).ToList();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取任务班。");
- EducationSchedulingClassViewList = EducationSchedulingClassServices.Value
- .GetEducationSchedulingClassViewList(SchoolYear.SchoolYearID.Value, collegeIDList);
- EducationSchedulingClassStudentViewList = EducationSchedulingClassServices.Value
- .GetEducationSchedulingClassStudentViewList(SchoolYear.SchoolYearID.Value, collegeIDList);
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取本学期已排任务。");
- ScheduledEducationViewList = this.GetEducationScheduleView(new ConfiguretView(), (x => x.SchoolyearID == SchoolYear.SchoolYearID), false).rows;
- var scheduledEducationClassIDList = ScheduledEducationViewList.Select(x => x.EducationSchedulingClassID).Distinct().ToList();
- ScheduledEducationStudentViewList = EducationSchedulingClassDAL
- .GetEducationSchedulingClassStudentViewQueryable(x => scheduledEducationClassIDList.Contains(x.EducationSchedulingClassID))
- .ToList();
- EducationSchedulingClassViewList = (from escv in EducationSchedulingClassViewList
- join sevl in ScheduledEducationViewList on escv.EducationSchedulingClassID equals sevl.EducationSchedulingClassID
- into dsevl
- from esevl in dsevl.DefaultIfEmpty()
- where esevl == null
- select escv).ToList();
-
- }
- private void InitClassroomInfo()
- {
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取可排教室。");
- ClassroomList = ClassroomScheduleDAL.GetAvailableClassroom().ToList();
- var classroomIDList = ClassroomList.Select(x => x.ClassroomID).Distinct().ToList();
- var classroomTypeList = ClassroomDAL.classroomTypeRepository.GetList(x => classroomIDList.Contains(x.ClassroomID)).ToList();
- ClassroomList.ForEach(x => x.ClassroomTypeID = classroomTypeList.Where(w => w.ClassroomID == x.ClassroomID)
- .Select(w => w.ClassroomType ?? -1).ToList());
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取教室可排时间设定。");
- ClassroomSchedulingSettingList = ClassroomScheduleDAL.ClassroomScheduleSettingRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- LogHelper.WriteLog(LogType.ServiceLog, "开始获取" + RSL.Get("College") + "分配教室设置。");
- CollegeClassroomList = ClassroomScheduleDAL.CollegeClassroomRepository.Entities.ToList();
- }
- private void InitSchedule()
- {
- InitCommonInfo();
- InitScheduleClassInfo();
- InitClassroomInfo();
- }
- /// <summary>
- /// 获取所有排课记录的方法
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="exp"></param>
- private IGridResultSet<EducationSchedulingView> GetEducationScheduleView(ConfiguretView configuretView,
- Expression<Func<ES_EducationScheduling, bool>> exp, bool isNeedDataRange = true, int? pageIndex = null, int? pageSize = null)
- {
- var educationScheduleViewQueryable = this.EducationSchedulingDAL.GetEducationSchedulingViewQueryable(exp);
- var educationScheduleWeekNumQueryable = this.EducationSchedulingDAL.GetEducationMissionWeekNumQueryable(exp);
- var classMajorQueryable = this.EducationSchedulingDAL.GetClassmajorQueryable(exp);
- var teacherViewQueryable = this.EducationSchedulingDAL.GetTeacherViewQueryable(exp);
- var courseProcessQueryable = this.EducationSchedulingDAL.GetCourseProcessQueryable(exp);
- var courseProcessTeacherQueryable = this.EducationSchedulingDAL.GetCourseProcessTeacherViewQueryable(exp);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- educationScheduleViewQueryable = educationScheduleViewQueryable
- .DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- }
- if (isNeedDataRange)
- {
- educationScheduleViewQueryable = this.GetQueryByDataRangeByCollege(educationScheduleViewQueryable);
- }
- IGridResultSet<EducationSchedulingView> result;
- List<ES_EducationSchedulingWeekNum> educationScheduleWeekNumList;
- List<EducationMissionClassContainClassView> classMajorList;
- List<EducationSchedulingTeacherListView> teacherViewList;
- List<CourseProcessView> courseProcessList;
- var startStatus = CollegeScheduleApprovalServices.Value.GetStartStatus();
- var collegeScheduleApprovalViewList = new List<CollegeScheduleApprovalView>();
- if (pageIndex.HasValue && pageSize.HasValue)
- {
- result = educationScheduleViewQueryable.OrderBy(x => x.Weekday).ThenBy(x => x.CoursesTime.StartTimes)
- .ToGridResultSet(pageIndex, pageSize);
- //由于分页后数据量较少,可以考虑用Contains方法在数据库端筛选一下,不分页的情况就不要了
- var educationMissionClassIDList = result.rows.Select(x => x.EducationMissionClassID).ToList();
- var educationSchedulingIDList = result.rows.Select(x => (Guid?)x.EducationSchedulingID).ToList();
- collegeScheduleApprovalViewList = CollegeScheduleApprovalServices.Value.GetCollegeScheduleApprovalViewList(
- result.rows.GroupBy(x => new { x.CourseCollegeID, x.SchoolyearID })
- .Select(x => new CollegeSchoolyearView { CollegeID = x.Key.CourseCollegeID.Value, SchoolyearID = x.Key.SchoolyearID.Value }).ToList()
- , isNeedDataRange);
- teacherViewList = teacherViewQueryable.Where(x => educationSchedulingIDList.Contains(x.EducationSchedulingID)).Distinct().ToList();
- classMajorList = classMajorQueryable.Where(x => educationMissionClassIDList.Contains(x.EducationMissionClassID)).Distinct().ToList();
- educationScheduleWeekNumList = educationScheduleWeekNumQueryable
- .Where(x => educationSchedulingIDList.Contains(x.EducationSchedulingID)).Distinct().ToList();
- courseProcessList = courseProcessQueryable.Where(x => educationMissionClassIDList.Contains(x.EducationMissionClassID)).Distinct().ToList();
- var courseProcessTeacherViewList = courseProcessTeacherQueryable.Where(x => educationMissionClassIDList.Contains(x.EducationMissionClassID)).Distinct().ToList();
- courseProcessList.ForEach(x => x.CourseProcessTeacherViewList = courseProcessTeacherViewList.Where(w => w.CourseProcessID == x.CourseProcessID)
- .OrderBy(w => w.TeachingMethod).ThenBy(w => w.Name).ToList());
- }
- else
- {
- var list = educationScheduleViewQueryable.ToList();
- result = new GridResultSet<EducationSchedulingView>() { rows = list, total = list.Count };
- collegeScheduleApprovalViewList = CollegeScheduleApprovalServices.Value.GetCollegeScheduleApprovalViewList(
- result.rows.GroupBy(x => new { x.CourseCollegeID, x.SchoolyearID })
- .Select(x => new CollegeSchoolyearView { CollegeID = x.Key.CourseCollegeID.Value, SchoolyearID = x.Key.SchoolyearID.Value }).ToList()
- , isNeedDataRange);
- teacherViewList = teacherViewQueryable.Distinct().ToList();
- classMajorList = classMajorQueryable.Distinct().ToList();
- educationScheduleWeekNumList = educationScheduleWeekNumQueryable.Distinct().ToList();
- courseProcessList = courseProcessQueryable.Distinct().ToList();
- var courseProcessTeacherViewList = courseProcessTeacherQueryable.Distinct().ToList();
- courseProcessList.ForEach(x => x.CourseProcessTeacherViewList = courseProcessTeacherViewList.Where(w => w.CourseProcessID == x.CourseProcessID)
- .OrderBy(w => w.TeachingMethod).ThenBy(w => w.Name).ToList());
- }
- var submitedCollegeScheduleApprovalViewList = collegeScheduleApprovalViewList.Where(x => x.CollegeScheduleStatusID.HasValue).ToList();
-
- result.rows.ForEach(x =>
- {
- var collegeScheduleApprovalView = submitedCollegeScheduleApprovalViewList.FirstOrDefault(w => w.CollegeID == x.CourseCollegeID && w.SchoolyearID == x.SchoolyearID);
-
- x.TeacherTeachingViewList = teacherViewList
- .Where(w => x.EducationSchedulingID == w.EducationSchedulingID)
- .OrderBy(w => w.TeachingMethod).ThenBy(w => w.Name)
- .Select(w => (BaseTeacherTeachingView)w).ToList();
- x.WeekNumList = educationScheduleWeekNumList.Where(w => x.EducationSchedulingID == w.EducationSchedulingID)
- .Select(w => w.WeekNum).ToList();
- x.ClassMajorIDList = classMajorList.Where(w => x.EducationMissionClassID == w.EducationMissionClassID)
- .Select(w => w.ClassMajor.ClassmajorID).ToList();
- x.CourseProcessViewList = courseProcessList.Where(w => x.EducationMissionClassID == w.EducationMissionClassID)
- .ToList();
- x.IsCanEdit = x.IsCanEdit && (collegeScheduleApprovalView == null || collegeScheduleApprovalView.RecordStatus == startStatus);
- });
- return result;
- }
- private List<EducationSchedulingClassScheduleView> GetOrderedEducationSchedulingClassViewList(
- IList<EducationSchedulingClassScheduleView> educationSchedulingClassViewList)
- {
- var result = (from escv in educationSchedulingClassViewList
- select new {
- EducationSchedulingClassView = escv,
- //课程类型优先级
- CourseTypeOrderID = this.CourseTypePriorityList.Where(x => x.CourseTypeID == escv.CourseTypeID)
- .Select(x => x.Priority).FirstOrDefault(),
- //上课周数优先级(总上课周数大的不好排,要优先安排)
- WeekCountOrderID = escv.WeeklyNumList.Count,
- //涉及学籍班多的不好排,要先排
- ClassmajorCount = (escv.ClassMajorIDList == null) ? 0 : escv.ClassMajorIDList.Count,
- //指定教室优先级
- AssignClassroomOrderID = (escv.ClassroomID.HasValue ? 1 : 0),
- //涉及学生多的不好排,要先排
- StudentNum = escv.StudentNum
- }).OrderBy(x => x.CourseTypeOrderID)
- .ThenBy(x => x.EducationSchedulingClassView.CoursematerialName)
- .ThenBy(x => x.EducationSchedulingClassView.EducationMissionClassOrderNo)
- //.ThenBy(x => x.EducationSchedulingClassView.EducationMissionClassName)
- .ThenByDescending(x => x.ClassmajorCount)
- .ThenByDescending(x => x.AssignClassroomOrderID)
- .ThenByDescending(x => x.StudentNum)
- .ThenByDescending(x => x.WeekCountOrderID)
- .Select(x => x.EducationSchedulingClassView).ToList();
- return result;
- }
- private List<ClassroomView> GetCurrentClassroomViewList(int weekday, CoursesTimeView courseTime, IList<int?> schedulingWeekList)
- {
- var fullSchedulingResult = (from sr in this.SchedulingResult
- from swnr in sr.ES_EducationSchedulingWeekNum
- select new
- {
- SchedulingResult = sr,
- SchedulingWeekNumResult = swnr
- });
- //两个条件:1、当前时间点可排,2:当前时间点未被使用
- var result = (from r in this.ClassroomList
- join css in this.ClassroomSchedulingSettingList
- on new { r.ClassroomID, Weekday = (int?)weekday, courseTime.CoursesTimeID } equals
- new { css.ClassroomID, css.Weekday, css.CoursesTimeID }
- into dcss
- from ecss in dcss.DefaultIfEmpty()
- where (ecss == null || ecss.IsOnWork == true) //当前时间点可排
- && !this.ScheduledEducationViewList.Any(x => x.Weekday == weekday
- && x.CoursesTimeID == courseTime.CoursesTimeID
- && x.WeekNumList.Any(w => schedulingWeekList.Contains(w))
- && x.ClassroomID == r.ClassroomID)
- && !fullSchedulingResult.Any(x => x.SchedulingResult.Weekday == weekday
- && x.SchedulingResult.CoursesTimeID == courseTime.CoursesTimeID
- && schedulingWeekList.Contains(x.SchedulingWeekNumResult.WeekNum)
- && x.SchedulingResult.ClassroomID == r.ClassroomID) //当前时间点未被使用
- select r);
- return result.ToList();
- }
- private List<ClassroomView> GetOrderedClassroomViewList(List<ClassroomView> classroomViewList, Guid collegeID)
- {
- var result = (from r in classroomViewList
- join ccl in this.CollegeClassroomList
- on new { CollegeID = (Guid?)collegeID, r.ClassroomID } equals
- new { ccl.CollegeID, ccl.ClassroomID }
- where (ccl.CollegeID == collegeID)
- select new
- {
- ClassroomView = r,
- CollegeClassroom = ccl
- })
- .OrderBy(x => x.ClassroomView.Totalseating)
- .ThenBy(x => x.ClassroomView.Name).Select(x => x.ClassroomView);
- return result.ToList();
- }
- private bool IsEducationSchedulingClassCanAddSchedule(EducationSchedulingClassScheduleView currentScheduleClass,
- int weekday, CoursesTimeView courseTime, List<CourseProcessView> courseProcessViewList, List<Guid?> currentStaffIDList,
- Guid? currentClassroomID)
- {
- var weekNumList = courseProcessViewList.Select(x => x.Week);
- //检查课程在该节次是否可以上课
- //(需要在课程时间设置那里将每次保存的全部记录,不管是否勾选都保存起来,否则这个逻辑就会失效,以下其他设置同理)
- var courseSchedulingSettingList = (from css in this.CourseSchedulingSettingList
- where css.CoursematerialID == currentScheduleClass.CoursematerialID
- && css.Weekday == weekday && css.CoursesTimeID == courseTime.CoursesTimeID
- && css.IsOnWork == false
- select css
- ).ToList();
- if (courseSchedulingSettingList.Count > 0)
- {
- return false;
- }
- //检查各任课老师在该节次是否可以上课
- var teacherSchedulingSettingList = (from t in currentStaffIDList
- join tss in this.TeacherSchedulingSettingList
- on new { UserID = t, Weekday = (int?)weekday, courseTime.CoursesTimeID } equals
- new { tss.UserID, tss.Weekday, tss.CoursesTimeID }
- where tss.IsOnWork == false
- select t
- ).ToList();
- if (teacherSchedulingSettingList.Count > 0)
- {
- return false;
- }
- //检查指定教室在该节次是否可以上课
- if (currentClassroomID.HasValue)
- {
- var classroomSchedulingSettingList = (from css in this.ClassroomSchedulingSettingList
- where css.ClassroomID == currentClassroomID
- && css.Weekday == weekday && css.CoursesTimeID == courseTime.CoursesTimeID
- && css.IsOnWork == false
- select css
- ).ToList();
- if (classroomSchedulingSettingList.Count > 0)
- {
- return false;
- }
- }
- //教师是否忙
- //第一步
- //从排课结果数组(SchedulingResult)中获取除自身外的其他排课班,并带出它们的教师列表,
- // 检测是否有和目前周次有交集的,排课班上课周次取排课结果的周次数组(SchedulingWeekNumResult)
- //从之前已有的排课记录(ScheduledEducationViewList)中获取排课班,并带出它们的教师列表,
- // 检测是否有和目前周次有交集的,排课班上课周次取排课表中的周次(ScheduledEducationViewList.WeekNumList)
- //这一步结束后并未确定教师冲突,只是获取出同一周次所有教师的班表
- var teacherWorkTimeList = (
- from sr in SchedulingResult
- .Where(x => x.EducationSchedulingClassID != currentScheduleClass.EducationSchedulingClassID)
- join srs in SchedulingTeacherResult on sr.EducationSchedulingID equals srs.EducationSchedulingID
- where SchedulingWeekNumResult.Where(x => x.EducationSchedulingID == sr.EducationSchedulingID).Select(x => x.WeekNum)
- .Intersect(weekNumList).Count() > 0
- select new { sr.Weekday, sr.CoursesTimeID, srs.UserID }
- ).Concat(
- from esv in this.ScheduledEducationViewList
- .Where(x => x.EducationSchedulingClassID != currentScheduleClass.EducationSchedulingClassID)
- from ttvl in esv.TeacherTeachingViewList
- where esv.WeekNumList.Intersect(weekNumList).Count() > 0
- select new { esv.Weekday, esv.CoursesTimeID, UserID = (Guid?)ttvl.UserID }
- ).ToList();
- //第二步
- //从第一步的结果中找出具体星期几第几节都和本任务相同的记录,如果有则可以确定教师时间冲突
- var teacherUsedList = (from srttvl in teacherWorkTimeList
- join csid in currentStaffIDList
- on srttvl.UserID equals csid
- where srttvl.Weekday == weekday && srttvl.CoursesTimeID == courseTime.CoursesTimeID
- select srttvl).ToList();
- if (teacherUsedList.Count > 0)
- {
- return false;
- }
- //学生是否忙
- var studentUsedList = (from c in (
- (from sr in SchedulingResult
- .Where(x => x.EducationSchedulingClassID != currentScheduleClass.EducationSchedulingClassID)
- join escv in EducationSchedulingClassViewList
- on sr.EducationSchedulingClassID equals escv.EducationSchedulingClassID
- join s in EducationSchedulingClassStudentViewList on sr.EducationSchedulingClassID equals s.EducationSchedulingClassID
- where SchedulingWeekNumResult.Where(x => x.EducationSchedulingID == sr.EducationSchedulingID)
- .Select(x => x.WeekNum)
- .Intersect(weekNumList).Count() > 0
- select new { sr.Weekday, sr.CoursesTimeID, UserID = s.UserID }
- ).Concat(
- from esv in this.ScheduledEducationViewList
- .Where(x => x.EducationSchedulingClassID != currentScheduleClass.EducationSchedulingClassID)
- join s in ScheduledEducationStudentViewList on esv.EducationSchedulingClassID equals s.EducationSchedulingClassID
- where esv.WeekNumList.Intersect(weekNumList).Count() > 0
- select new { esv.Weekday, esv.CoursesTimeID, UserID = s.UserID })
- )
- join cc in EducationSchedulingClassStudentViewList.Where(x => x.EducationSchedulingClassID == currentScheduleClass.EducationSchedulingClassID)
- on c.UserID equals cc.UserID
- where c.Weekday == weekday && c.CoursesTimeID == courseTime.CoursesTimeID
- select c).ToList();
- if (studentUsedList.Count > 0)
- {
- return false;
- }
- #region 检查指定教室的冲突(没有指定就跳过)
- if (currentClassroomID.HasValue)
- {
- var currentClassroom = this.ClassroomList.FirstOrDefault(x => x.ClassroomID == currentClassroomID);
- //一般会找不到都是因为指定的教室被预留了,这种情况不能排
- if (currentClassroom == null)
- {
- return false;
- }
- if (currentClassroom.IsConcurrentUse != true)
- {
- var classroomScheduleList = (from c in
- (
- (from sr in SchedulingResult
- .Where(x => x.EducationSchedulingClassID != currentScheduleClass.EducationSchedulingClassID)
- join escv in EducationSchedulingClassViewList
- on sr.EducationSchedulingClassID equals escv.EducationSchedulingClassID
- where SchedulingWeekNumResult.Where(x => x.EducationSchedulingID == sr.EducationSchedulingID)
- .Select(x => x.WeekNum)
- .Intersect(weekNumList).Count() > 0
- select new { sr.Weekday, sr.CoursesTimeID, sr.ClassroomID }
- ).Concat(
- from esv in this.ScheduledEducationViewList
- .Where(x => x.EducationSchedulingClassID != currentScheduleClass.EducationSchedulingClassID)
- from c in esv.ClassMajorIDList
- where esv.WeekNumList.Intersect(weekNumList).Count() > 0
- && esv.ClassMajorIDList.Count == 0
- select new { esv.Weekday, esv.CoursesTimeID, esv.ClassroomID })
- )
- where c.Weekday == weekday && c.CoursesTimeID == courseTime.CoursesTimeID
- && c.ClassroomID == currentClassroomID
- select c).ToList();
- if (classroomScheduleList.Count > 0)
- {
- return false;
- }
- }
- }
- #endregion
- //是否有连续上课超限
- #region 判断教师连续上课超限
- var teacherContinuousList = (from sr in teacherWorkTimeList
- join ct in CourseTimeList on sr.CoursesTimeID equals ct.CoursesTimeID
- join csid in currentStaffIDList on sr.UserID equals csid
- where sr.Weekday == weekday
- group ct by sr.UserID into g
- select new { UserID = g.Key, Count = g.Sum(x => x.Workhours) + courseTime.Workhours })
- .Where(x => x.Count > TeacherScheduleContinuousCount).ToList();
- if (teacherContinuousList.Count > 0)
- {
- return false;
- }
- #endregion
- return true;
- }
- private bool IsClassScheduleContinuousExcessed(EducationSchedulingClassScheduleView currentScheduleClass, int weekday,
- CoursesTimeView courseTime, IList<int?> weeknumList)
- {
- #region 判断班级连续上课超限
- var classContinuousList = (from sc in (
- from sr in SchedulingResult
- join ct in this.CourseTimeList on sr.CoursesTimeID equals ct.CoursesTimeID
- join swn in SchedulingWeekNumResult on sr.EducationSchedulingID equals swn.EducationSchedulingID
- join sc in this.EducationSchedulingClassViewList on sr.EducationSchedulingClassID equals sc.EducationSchedulingClassID
- from c in sc.ClassMajorIDList
- join cc in currentScheduleClass.ClassMajorIDList on c equals cc
- where sr.Weekday == weekday
- && weeknumList.Contains(swn.WeekNum)
- select new { WeekNum = swn.WeekNum, ClassMajorID = c, Times = ct.Workhours, sc }).Concat(
- from esv in ScheduledEducationViewList
- from esvwn in esv.WeekNumList
- join ct in this.CourseTimeList on esv.CoursesTimeID equals ct.CoursesTimeID
- join sc in EducationSchedulingClassViewList on esv.EducationSchedulingClassID equals sc.EducationSchedulingClassID
- from c in esv.ClassMajorIDList
- join cc in currentScheduleClass.ClassMajorIDList on c equals cc
- where esv.Weekday == weekday
- && weeknumList.Contains(esvwn)
- select new { WeekNum = esvwn, ClassMajorID = c, Times = ct.Workhours, sc }
- )
- group sc by new { WeekNum = sc.WeekNum, ClassMajorID = sc.ClassMajorID, sc.sc } into g
- where g.Sum(x => x.Times) + courseTime.Workhours > ClassScheduleContinuousCount
- select new { WeekNum = g.Key.WeekNum, ClassMajorID = g.Key.ClassMajorID, Count = g.Sum(x => x.Times) + courseTime.Workhours });
- if (classContinuousList.Count() > 0)
- {
- return true;
- }
- #endregion
- #region 判断班级相同课程连续上课超限
- var classCourseContinuousList = (from sc in
- (from sr in SchedulingResult
- join ct in this.CourseTimeList on sr.CoursesTimeID equals ct.CoursesTimeID
- join swn in SchedulingWeekNumResult on sr.EducationSchedulingID equals swn.EducationSchedulingID
- join sc in EducationSchedulingClassViewList on sr.EducationSchedulingClassID equals sc.EducationSchedulingClassID
- from c in sc.ClassMajorIDList
- join cc in currentScheduleClass.ClassMajorIDList on
- new { ClassMajorID = c, sc.CoursematerialID } equals
- new { ClassMajorID = cc, CoursematerialID = currentScheduleClass.CoursematerialID }
- where sr.Weekday == weekday
- && weeknumList.Contains(swn.WeekNum)
- select new { WeekNum = swn.WeekNum, ClassMajorID = c, sc.CoursematerialID, Times = ct.Workhours, sc }
- ).Concat(from esv in ScheduledEducationViewList
- from esvwn in esv.WeekNumList
- join ct in this.CourseTimeList on esv.CoursesTimeID equals ct.CoursesTimeID
- join sc in EducationSchedulingClassViewList on esv.EducationSchedulingClassID equals sc.EducationSchedulingClassID
- from c in sc.ClassMajorIDList
- join cc in currentScheduleClass.ClassMajorIDList on
- new { ClassMajorID = c, sc.CoursematerialID } equals
- new { ClassMajorID = cc, CoursematerialID = currentScheduleClass.CoursematerialID }
- where esv.Weekday == weekday
- && weeknumList.Contains(esvwn)
- select new { WeekNum = esvwn, ClassMajorID = c, sc.CoursematerialID, Times = ct.Workhours, sc }
- )
- group sc by new { WeekNum = sc.WeekNum, ClassMajorID = sc.ClassMajorID, sc.CoursematerialID, sc.sc } into g
- where g.Sum(x => x.Times) + courseTime.Workhours > ClassCourseScheduleContinuousCount
- select new
- {
- WeekNum = g.Key.WeekNum,
- ClassMajorID = g.Key.ClassMajorID,
- CoursematerialID = g.Key.CoursematerialID,
- Count = g.Sum(x => x.Times) + courseTime.Workhours
- });
- if (classCourseContinuousList.Count() > 0)
- {
- return true;
- }
- #endregion
- return false;
- }
- private List<int?> GetOrderedWeekdays(EducationSchedulingClassScheduleView currentScheduleClass, IList<int?> weekdayList)
- {
- //计算每周要排多少天课
- var weekCount = ArrangementList.Select(x => (x.Weekday == 0) ? 7 : x.Weekday).Max();
- //获取已经排了的课程
- var allScheduledWeekdays = SchedulingResult.Where(x => x.EducationSchedulingClassID == currentScheduleClass.EducationSchedulingClassID)
- .Join(CourseTimeList, (x => x.CoursesTimeID), (x => x.CoursesTimeID), ((x, y) => new { x.Weekday, y.Workhours }))
- .Concat(
- ScheduledEducationViewList.Where(x => x.EducationSchedulingClassID == currentScheduleClass.EducationSchedulingClassID)
- .Join(CourseTimeList, (x => x.CoursesTimeID), (x => x.CoursesTimeID), ((x, y) => new { x.Weekday, y.Workhours })))
- .ToList();
- //计算已经排过的课程中,最后一课是周几
- var lastScheduledWeekday = allScheduledWeekdays.Max(x => x.Weekday) ?? 0;
- var schedulingWeekList = currentScheduleClass.CourseProcessViewList.Select(x => new { x.Week, x.Times });
- allScheduledWeekdays.ForEach(x => {
- schedulingWeekList = schedulingWeekList.Select(m => new {
- m.Week,
- Times = (x.Weekday == m.Week) ? (m.Times - x.Workhours) : m.Times
- });
- });
- var maxToBeScheduleCount = schedulingWeekList.Where(x => x.Times > 0).Max(x => x.Times);
- //1、((double)weekCount - (double)lastScheduledWeekday)=剩余多少天需要排课
- //2、((double)maxToBeScheduleCount) / (double)ClassCourseScheduleContinuousCount)计算出需要排课的课程时间最多的周次,按照班级课程连续排课限制计算,需要排多少天
- //1/2得出需要间隔开的天数
- //(该逻辑基于自动排课,是按固定周次顺序一直排下来的循环中使用)
- var skipDayCount = Convert.ToInt32(Math.Ceiling(((double)weekCount - (double)lastScheduledWeekday) / ((double)maxToBeScheduleCount) / (double)ClassCourseScheduleContinuousCount));
- //预留排课后又被删掉一天的工作安排的情况
- if (skipDayCount < 0)
- {
- skipDayCount = 0;
- }
- var startWeekday = lastScheduledWeekday == 0 ? weekdayList.Min() : lastScheduledWeekday;
- return weekdayList.OrderBy(x => (
- ((x == 0) ? 7 : x) > lastScheduledWeekday
- && (((x == 0) ? 7 : x) - startWeekday) % (skipDayCount + 1) == 0) ? 0 : 1)
- .ThenBy(x => (x == 0) ? 7 : x).ToList();
- }
- public void GenerateSchedule()
- {
- this.InitSchedule();
- this.GenerateScheduleByInited();
- }
- private void GenerateScheduleByInited()
- {
- var totalScheduleTime = ArrangementList.Select(x => new
- {
- x.Weekday,
- x.CoursesTimeID
- }).ToList();
- var weekdayList = ArrangementList.Select(x => x.Weekday).Distinct().ToList();
- ////自动排课时,保证涉及的院校都是重新排的,所以以前的记录要清掉
- //this.ScheduledEducationViewList = this.ScheduledEducationViewList.Where(x => !CollegeList.Select(w => w.CollegeID).Contains(x.CollegeID)).ToList();
- var allMissionClassIDList = EducationSchedulingClassViewList.Select(x => x.EducationMissionClassID).Distinct().ToList();
- var educationMissionClassList = this.EducationSchedulingClassDAL.EducationMissionClassDAL.Value.
- EducationMissionClassRepository.GetList(x => allMissionClassIDList.Contains(x.EducationMissionClassID)).ToList();
- foreach (var college in CollegeList)
- {
- LogHelper.WriteLog(LogType.ServiceLog, "开始对" + college.Name + "进行排课。");
- var currentScheduleClassList = this.EducationSchedulingClassViewList.Where(c => c.CourseCollegeID == college.CollegeID).ToList();
- //排序
- currentScheduleClassList = this.GetOrderedEducationSchedulingClassViewList(currentScheduleClassList);
- //var skipDayCount = this.GetCommonSkipDays(currentScheduleClassList);
- foreach (var currentScheduleClass in currentScheduleClassList)
- {
- var scheduleClassProcess = (from cpv in currentScheduleClass.CourseProcessViewList
- group cpv by new
- {
- cpv.ClassroomTypeID,
- cpv.ClassroomID,
- teacherKey = string.Join(",", cpv.CourseProcessTeacherViewList
- .OrderBy(x => x.TeacherType).ThenBy(x => x.UserID)
- .Select(x => x.UserID.ToString() + "|" + x.TeacherType.ToString()))
- } into g
- select new
- {
- ClassroomTypeID = g.Key.ClassroomTypeID,
- ClassroomID = g.Key.ClassroomID,
- TeacherViewList = g.FirstOrDefault().CourseProcessTeacherViewList,
- CourseProcessViewList = g.Select(x => x).ToList()
- }).ToList();
- foreach (var classroomAndStaff in scheduleClassProcess)
- {
- var currentTeacherViewList = new List<BaseTeacherTeachingView>();
- int? currentClassroomTypeID = classroomAndStaff.ClassroomTypeID ?? currentScheduleClass.ClassroomTypeID;
- Guid? currentClassroomID = classroomAndStaff.ClassroomID ?? currentScheduleClass.ClassroomID;
- var currentScheduleTimes = 0;
- var maxScheduleTimes = classroomAndStaff.CourseProcessViewList.Max(x => x.Times);
- var courseProcessViewList = classroomAndStaff.CourseProcessViewList.OrderBy(x => x.Times).ToList();
- if (classroomAndStaff.TeacherViewList.Count == 0)
- {
- currentTeacherViewList = currentScheduleClass.TeacherTeachingViewList;
- }
- else
- {
- currentTeacherViewList = classroomAndStaff.TeacherViewList.Select(x => (BaseTeacherTeachingView)x).ToList();
- }
- //需要根据skipDayCount计算出weekday循环的顺序(不一定是1到7)
- weekdayList = GetOrderedWeekdays(currentScheduleClass, weekdayList);
- for (int i = 0; i < weekdayList.Count; i ++)
- {
- var weekday = weekdayList[i] ?? 0;
- if (!totalScheduleTime.Any(w => w.Weekday == weekday))
- {
- continue;
- }
- //这里只需要计算出,参与这节课的老师里面的其中一个人在某个节次上过课就行了
- var staffUsedCourseTime = (from ct in (
- from sr in SchedulingResult
- .Where(x => x.EducationSchedulingClassID != currentScheduleClass.EducationSchedulingClassID)
- join str in SchedulingTeacherResult on sr.EducationSchedulingID equals str.EducationSchedulingID
- join s in currentTeacherViewList on str.UserID equals s.UserID
- select sr.CoursesTimeID)
- .Concat(
- from esv in this.ScheduledEducationViewList
- .Where(x => x.EducationSchedulingClassID != currentScheduleClass.EducationSchedulingClassID)
- from esvs in esv.TeacherTeachingViewList
- where currentTeacherViewList.Select(x => x.UserID).Contains(esvs.UserID)
- select esv.CoursesTimeID
- )
- select ct).Distinct();
- //当前教师之前有排过课的节次往后移,实在排不下才排到那些节次去,保证各个教师的上课时间相对公平些
- var staffCourseTimeList = (from ct in CourseTimeList
- join sr in staffUsedCourseTime on ct.CoursesTimeID equals sr into dsr
- from esr in dsr.DefaultIfEmpty()
- select new { ct, esr })
- .OrderBy(x => (x.esr == null ? 0 : 1))
- .ThenBy(x => x.ct.StartTimes)
- .Select(x => x.ct)
- .ToList();
- foreach (var courseTime in staffCourseTimeList)
- {
- if (!totalScheduleTime.Any(w => w.Weekday == weekday && w.CoursesTimeID == courseTime.CoursesTimeID))
- {
- continue;
- }
- //获取该次排课排的周次
- var tmpScheduleTimes = currentScheduleTimes + (courseTime.EndTimes.Value - courseTime.StartTimes.Value + 1);
- if (tmpScheduleTimes > maxScheduleTimes)
- {
- break;
- }
- var weeknumList = courseProcessViewList.Where(x => x.Times >= tmpScheduleTimes).ToList();
- if (!this.IsEducationSchedulingClassCanAddSchedule(currentScheduleClass, weekday, courseTime, weeknumList, currentTeacherViewList.Select(x => (Guid?)x.UserID).ToList(), currentClassroomID))
- {
- continue;
- }
- if (this.IsClassScheduleContinuousExcessed(currentScheduleClass, weekday, courseTime, weeknumList.Select(x => x.Week).ToList()))
- {
- break;
- }
- //获取该时间点可以使用的教室
- var currentClassroomList = this.GetCurrentClassroomViewList(weekday, courseTime, weeknumList.Select(x => x.Week).ToList());
- //没有教室,就什么都不用排了
- if (currentClassroomList.Count == 0)
- {
- continue;
- }
- //排序
- currentClassroomList = this.GetOrderedClassroomViewList(currentClassroomList, currentScheduleClass.CollegeID.Value);
- if (currentClassroomID.HasValue)
- {
- currentClassroomList = currentClassroomList.Where(x => x.ClassroomID == currentClassroomID).ToList();
- }
- else if (currentClassroomTypeID.HasValue)
- {
- currentClassroomList = currentClassroomList.Where(x => x.ClassroomTypeID.Contains(currentClassroomTypeID.Value)
- && ((x.Totalseating ?? 0) > currentScheduleClass.StudentNum || x.IsConcurrentUse == true)
- ).ToList();
- }
- //筛选完以后再看看还有没有
- if (currentClassroomList.Count == 0)
- {
- continue;
- }
- var currentClassroom = currentClassroomList.First();
- var educationScheduling = new ES_EducationScheduling
- {
- EducationSchedulingID = Guid.NewGuid(),
- SchoolyearID = this.SchoolYear.SchoolYearID,
- EducationSchedulingClassID = currentScheduleClass.EducationSchedulingClassID,
- Weekday = weekday,
- CoursesTimeID = courseTime.CoursesTimeID,
- ClassroomID = currentClassroom.ClassroomID,
- IsAuto = true,
- RecordStatus = (int)SYS_STATUS.USABLE,
- CreateTime = DateTime.Now,
- ModifyTime = DateTime.Now
- };
- //增加排课教师
- var staffList = this.StaffList.Where(x => currentTeacherViewList.Any(w => w.UserID == x.UserID)).ToList();
- staffList.ForEach(x =>
- {
- var educationSchedulingTeacher = new ES_EducationSchedulingTeacher
- {
- EducationSchedulingTeacherID = Guid.NewGuid(),
- EducationSchedulingID = educationScheduling.EducationSchedulingID,
- UserID = x.UserID,
- TeachingMethod = (int)EM_TeachingMethod.Lecturer,
- RecordStatus = (int)SYS_STATUS.USABLE,
- CreateTime = DateTime.Now,
- ModifyTime = DateTime.Now
- };
- this.SchedulingTeacherResult.Add(educationSchedulingTeacher);
- });
- this.SchedulingResult.Add(educationScheduling);
- //确实排课了,这时候才更改currentScheduleTimes的值
- currentScheduleTimes = tmpScheduleTimes;
- weeknumList.ForEach(x =>
- {
- var educationSchedulingWeekNum = new ES_EducationSchedulingWeekNum
- {
- EducationSchedulingWeekNumID = Guid.NewGuid(),
- EducationSchedulingID = educationScheduling.EducationSchedulingID,
- WeekNum = x.Week,
- RecordStatus = (int)SYS_STATUS.USABLE,
- CreateTime = DateTime.Now,
- ModifyTime = DateTime.Now
- };
- this.SchedulingWeekNumResult.Add(educationSchedulingWeekNum);
- });
- var educatiomMissionClass = educationMissionClassList.FirstOrDefault(x => x.EducationMissionClassID == currentScheduleClass.EducationMissionClassID);
- if (educatiomMissionClass != null)
- {
- educatiomMissionClass.RecordStatus = (int)EM_EducationMissionClassStatus.Scheduled;
- }
- }
- }
- }
- }
- LogHelper.WriteLog(LogType.ServiceLog, college.Name + "排课结束。");
- }
- this.UnitOfWork.AddRange(this.SchedulingResult);
- this.UnitOfWork.AddRange(this.SchedulingWeekNumResult);
- this.UnitOfWork.AddRange(this.SchedulingTeacherResult);
- this.UnitOfWork.Commit();
- }
- public void ClearAutoSchedule(Guid schoolYearID, Guid? collegeID, int? standardID, int? year, Guid? classmajorID)
- {
- Expression<Func<ES_EducationScheduling, bool>> exp = (x => x.SchoolyearID == schoolYearID && x.IsAuto == true);
- Expression<Func<ES_EducationSchedulingTeacher, bool>> expTeacher = (x => x.ES_EducationScheduling.SchoolyearID == schoolYearID && x.ES_EducationScheduling.IsAuto == true);
- Expression<Func<ES_EducationSchedulingWeekNum, bool>> expWeekNum = (x => x.ES_EducationScheduling.SchoolyearID == schoolYearID && x.ES_EducationScheduling.IsAuto == true);
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationSchedulingClass.EM_EducationMissionClass.EM_EducationMission.CollegeID == collegeID);
- expTeacher = expTeacher.And(x => x.ES_EducationScheduling.EM_EducationSchedulingClass.EM_EducationMissionClass.EM_EducationMission.CollegeID == collegeID);
- expWeekNum = expWeekNum.And(x => x.ES_EducationScheduling.EM_EducationSchedulingClass.EM_EducationMissionClass.EM_EducationMission.CollegeID == collegeID);
- }
- if (year.HasValue)
- {
- exp = exp.And(x => x.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.CF_Grademajor.GradeID == year));
- expTeacher = expTeacher.And(x => x.ES_EducationScheduling.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.CF_Grademajor.GradeID == year));
- expWeekNum = expWeekNum.And(x => x.ES_EducationScheduling.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.CF_Grademajor.GradeID == year));
- }
- if (standardID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.CF_Grademajor.CF_Facultymajor.StandardID == standardID));
- expTeacher = expTeacher.And(x => x.ES_EducationScheduling.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.CF_Grademajor.CF_Facultymajor.StandardID == standardID));
- expWeekNum = expWeekNum.And(x => x.ES_EducationScheduling.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.CF_Grademajor.CF_Facultymajor.StandardID == standardID));
- }
- if (classmajorID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.ClassmajorID == classmajorID));
- expTeacher = expTeacher.And(x => x.ES_EducationScheduling.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.ClassmajorID == classmajorID));
- expWeekNum = expWeekNum.And(x => x.ES_EducationScheduling.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor.Any(w => w.ClassmajorID == classmajorID));
- }
- var educationSchedulingList = this.EducationSchedulingDAL.EducationSchedulingRepository.GetList(exp, (x => x.EM_EducationSchedulingClass.EM_EducationMissionClass)).ToList();
- educationSchedulingList.ForEach(x => x.EM_EducationSchedulingClass.EM_EducationMissionClass.RecordStatus = (int)EM_EducationMissionClassStatus.Submitted);
- this.UnitOfWork.Remove<ES_EducationSchedulingTeacher>(expTeacher);
- this.UnitOfWork.Remove<ES_EducationSchedulingWeekNum>(expWeekNum);
- this.UnitOfWork.RemoveRange(new HashSet<ES_EducationScheduling>(educationSchedulingList));
- this.UnitOfWork.Commit();
- }
- public void ClearClassmajorSchedule(Guid schoolYearID, Guid classmajorID)
- {
- this.UnitOfWork.Delete<ES_EducationScheduling>(x =>
- x.SchoolyearID == schoolYearID
- && x.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor
- .Any(w => w.ClassmajorID == classmajorID));
- }
- public List<EducationSchedulingView> GetClassmajorSchedule(Guid schoolYearID, Guid classmajorID)
- {
- var classmajorScheduleList = this.GetEducationScheduleView(new ConfiguretView(), (x => x.SchoolyearID == schoolYearID &&
- x.EM_EducationSchedulingClass.EM_EducationMissionClass.CF_Classmajor
- .Any(w => w.ClassmajorID == classmajorID)), false);
- return classmajorScheduleList.rows;
- }
- public List<EducationSchedulingView> GetDepartmentSchedule(Guid schoolYearID, Guid departmentID, IList<int?> handleModeList)
- {
- var departmentScheduleList = this.GetEducationScheduleView(new ConfiguretView(), (x => x.SchoolyearID == schoolYearID
- && x.EM_EducationSchedulingClass.EM_EducationMissionClass.EM_EducationMission.DepartmentID == departmentID
- && handleModeList.Contains(x.EM_EducationSchedulingClass.EM_EducationMissionClass.HandleModeID)), false);
- return departmentScheduleList.rows;
- }
- public List<ClassroomView> GetAvailableClassroomList(Guid collegeID, Guid schoolYearID, IList<int?> schedulingWeekList,
- int weekday, Guid courseTimeID, int? studentNum, int? classroomTypeID = null)
- {
- return ClassroomScheduleDAL.GetAvailableClassroom(collegeID, schoolYearID, schedulingWeekList, weekday,
- courseTimeID, studentNum, classroomTypeID).ToList()
- .OrderBy(x => x.BuildingsInfoName)
- .ThenBy(x => string.Join(",", x.CF_ClassroomType.OrderBy(w => w.ClassroomType).Select(w => w.ClassroomType).ToList()))
- .ThenBy(x => x.Totalseating).ToList();
- }
- public void CheckClassroomIsAvailable(Guid collegeID, Guid schoolYearID, IList<int?> schedulingWeekList,
- int weekday, Guid courseTimeID, Guid classroomID)
- {
- //this.InitClassroomInfo();
- //this.ClassroomList = this.ClassroomList.Where(x => x.ClassroomID == classroomID).ToList();
- var classroom = this.ClassroomScheduleDAL.GetAvailableClassroom().Where(x => x.ClassroomID == classroomID)
- .FirstOrDefault();
- if (classroom == null)
- {
- throw new Exception("指定的教室不可用或被预留。");
- }
- var courseTimeView = this.CoursesTimeServices.Value.GetCoursesTimeView(courseTimeID);
- var cannotScheduleList = this.ClassroomScheduleDAL.ClassroomScheduleSettingRepository.GetList(x =>
- x.ClassroomID == classroomID && x.Weekday == weekday && x.CoursesTimeID == courseTimeID
- && x.IsOnWork == false).ToList();
- if (cannotScheduleList.Count > 0)
- {
- throw new Exception("教室在当前时间点不可以排课,请检查教室可排时间设置。");
- }
- var classroomList = this.ClassroomScheduleDAL.GetAvailableClassroom(schoolYearID,
- schedulingWeekList, weekday, courseTimeID, null)
- .Where(x => x.ClassroomID == classroomID)
- .ToList(); //当前时间点未被使用
- if (classroomList.Count == 0)
- {
- throw new ClassroomConflictException("指定的教室已被其他任务班占用。");
- }
- }
- public void CheckClassroomIsAvailable(Guid schoolYearID, IList<int?> schedulingWeekList,
- int weekday, Guid courseTimeID, Guid classroomID)
- {
- var classroom = this.ClassroomScheduleDAL.GetAvailableClassroom().Where(x => x.ClassroomID == classroomID)
- .FirstOrDefault();
- if (classroom == null)
- {
- throw new Exception("指定的教室不可用或被预留。");
- }
- var courseTimeView = this.CoursesTimeServices.Value.GetCoursesTimeView(courseTimeID);
- var classroomList = this.ClassroomScheduleDAL.GetAvailableClassroom(schoolYearID,
- schedulingWeekList, weekday, courseTimeID, null)
- .Where(x => x.ClassroomID == classroomID)
- .ToList(); //当前时间点未被使用
- if (classroomList.Count == 0)
- {
- throw new ClassroomConflictException("指定的教室已被其他任务班占用。");
- }
- }
- public void CheckEducationSchedulingClassCanAddManualSchedule(
- Guid educationScheduleClassID, IList<SchedulingWeekListView> schedulingWeekList, Guid schoolYearID, int weekday, Guid courseTimeID)
- {
- var schedulingClassView = this.EducationSchedulingClassServices.Value.GetEducationSchedulingClassView(educationScheduleClassID);
- var studentQuery = this.EducationSchedulingClassDAL.GetStudentQueryable(x => x.EducationSchedulingClassID == educationScheduleClassID);
- var teacherWeekList = (from swl in schedulingWeekList
- from ctv in swl.CourseProcessTeacherViewList
- select new { UserID = ctv.UserID, WeekNum = swl.Week }).ToList();
- var weekList = schedulingWeekList.Select(x => x.Week).ToList();
- var teacherIsBusyQuery = (from es in this.EducationSchedulingDAL.EducationSchedulingRepository.GetList(
- x => x.SchoolyearID == schoolYearID && x.EducationSchedulingClassID != educationScheduleClassID)
- from mct in es.ES_EducationSchedulingTeacher
- from eswn in es.ES_EducationSchedulingWeekNum
- where es.Weekday == weekday && es.CoursesTimeID == courseTimeID
- select new { es.EducationSchedulingID, mct.UserID, mct.CF_Staff.Sys_User.Name, eswn.WeekNum });
- var teacherIsBusy = teacherIsBusyQuery.SelectByKeys(teacherWeekList).ToList();
- if (teacherIsBusy.Count > 0)
- {
- var ex = new Exception("教师" + string.Join(",", teacherIsBusy.Select(x => x.Name).Distinct()) + "在其他班级有课,不能上课。");
- teacherIsBusy.GroupBy(x => x.UserID, (x, y) => y.FirstOrDefault()).ToList().ForEach(x => ex.Data.Add(x.UserID, x.Name));
- throw ex;
- }
- var studentIsBusy = (from es in this.EducationSchedulingDAL.EducationSchedulingRepository.GetList(
- x => x.SchoolyearID == schoolYearID && x.EducationSchedulingClassID != educationScheduleClassID)
- from s in es.EM_EducationSchedulingClass.CF_Student
- .Join(studentQuery, (x => x.UserID), (x => x.UserID), (x, y) => x)
- where es.Weekday == weekday && es.CoursesTimeID == courseTimeID
- && es.ES_EducationSchedulingWeekNum.Any(x => weekList.Contains(x.WeekNum))
- select s).Include(x => x.Sys_User).ToList();
- if (studentIsBusy.Count > 0)
- {
- throw new Exception("排课班涉及的部分学生在该时段有课,不能上课。");
- }
- }
- public void CheckCourseIsOnWork(Guid coursematerialID, int weekday, Guid courseTimeID)
- {
- var course = this.CoursematerialDAL.CoursematerialRepository.GetSingle(x => x.CoursematerialID == coursematerialID);
- var courseIsOnWork = this.CourseScheduleDAL.CourseScheduleSettingRepository
- .GetList(x => x.Weekday == weekday && x.CoursesTimeID == courseTimeID
- && x.CoursematerialID == coursematerialID).Select(x => x.IsOnWork)
- .FirstOrDefault();
- //这里的逻辑和自动排课有点不同,自动排课没有设置的话,则按照周工作时间来,但手工排课不需要按照周工作时间的限制排课,
- //如果课程时间没有设置,则默认可排
- if (!(courseIsOnWork ?? true))
- {
- throw new Exception("课程" + course.CourseName + "在该节次不能排课。");
- }
- }
- public void CheckTeacherIsOnWork(Guid educationScheduleClassID, IList<SchedulingWeekListView> schedulingWeekList, int weekday, Guid courseTimeID)
- {
- var weekTeacherList = schedulingWeekList.SelectMany(w => w.CourseProcessTeacherViewList).GroupBy(w => w.UserID)
- .Select(w => w.FirstOrDefault()).ToList();
- var teacherIDList = weekTeacherList.Select(w => (Guid?)w.UserID).Distinct().ToList();
-
- var teacherIsOnWorkList = this.TeacherScheduleDAL.TeacherScheduleSettingRepository
- .GetList(x => x.Weekday == weekday && x.CoursesTimeID == courseTimeID
- && teacherIDList.Contains(x.UserID))
- .Select(x => new { x.UserID, x.IsOnWork }).ToList();
- weekTeacherList.ForEach(x =>
- {
- if (teacherIsOnWorkList.Any(w => w.UserID == x.UserID && w.IsOnWork == false))
- {
- throw new Exception("教师" + x.Name + "在该节次不能排课。");
- }
- });
- }
- public List<TeacherWorkTimeView> GetTeacherContinuousWorkTime(Guid educationScheduleClassID, IList<SchedulingWeekListView> schedulingWeekList,
- Guid schoolYearID, int weekday)
- {
- var weekTeacherList = (from swl in schedulingWeekList
- from ctv in swl.CourseProcessTeacherViewList
- select new { UserID = ctv.UserID, Name = ctv.Name, WeekNum = swl.Week }).ToList();
- var teacherIDList = weekTeacherList.Select(x => x.UserID).Distinct().ToList();
- var teacherWorkTime = this.TeacherScheduleDAL.GetTeacherWorkTimeView(x =>
- x.SchoolyearID == schoolYearID && x.Weekday == weekday,
- (x => teacherIDList.Contains(x.UserID))
- ).ToList();
- return (from t in weekTeacherList
- join tw in teacherWorkTime on new { UserID = t.UserID, WeekNum = t.WeekNum } equals new { UserID = tw.UserID, WeekNum = (int?)tw.WeekNum } into dtw
- from etw in dtw.DefaultIfEmpty()
- select new TeacherWorkTimeView
- {
- UserID = t.UserID,
- Name = t.Name,
- WeekNum = t.WeekNum ?? 0,
- WorkTime = (etw == null ? 0 : etw.WorkTime)
- }).ToList();
- }
- public void AddScheduling(EducationSchedulingView educationSchedulingView, IList<int?> schedulingWeekList, IList<CourseProcessTeacherView> teacherList)
- {
- var educationSchedulingClassWithCourseProcess = this.EducationSchedulingClassDAL.EducationSchedulingClassRepository
- .GetSingle(x => x.EducationSchedulingClassID == educationSchedulingView.EducationSchedulingClassID,
- (x => x.EM_EducationMissionClass),
- (x => x.EM_EducationMissionClass.EM_EducationSchedulingClass.Select(w => w.ES_EducationScheduling.Select(y => y.ES_EducationSchedulingTeacher))),
- (x => x.EM_EducationMissionClass.EM_EducationSchedulingClass.Select(w => w.ES_EducationScheduling.Select(y => y.ES_EducationSchedulingWeekNum))),
- (x => x.EM_EducationMissionClass.EM_CourseProcess),
- (x => x.EM_EducationMissionClass.EM_MissionClassTeacher),
- (x => x.EM_EducationMissionClass.EM_MissionClassTeacher.Select(w => w.CF_Staff)),
- (x => x.EM_EducationMissionClass.EM_CourseProcess.Select(w => w.EM_CourseProcessTeacher)),
- (x => x.EM_EducationMissionClass.EM_CourseProcess.Select(w => w.EM_CourseProcessTeacher.Select(v => v.CF_Staff))));
-
- //var teacherScheduleList = from es in educationSchedulingClassWithCourseProcess.EM_EducationMissionClass.EM_EducationSchedulingClass.SelectMany(x => x.ES_EducationScheduling)
- // from est in es.ES_EducationSchedulingTeacher
- // from esw in es.ES_EducationSchedulingWeekNum
- // from cpt in courseProcessTeacherList.Where(x => x.CourseProcessTeacher.Teachers.Select(w => w.UserID).Contains()
-
- var educationScheduling = new ES_EducationScheduling
- {
- EducationSchedulingID = Guid.NewGuid(),
- SchoolyearID = educationSchedulingView.SchoolyearID,
- EducationSchedulingClassID = educationSchedulingView.EducationSchedulingClassID,
- Weekday = educationSchedulingView.Weekday,
- CoursesTimeID = educationSchedulingView.CoursesTimeID,
- ClassroomID = educationSchedulingView.ClassroomID
- };
- this.SetNewStatus(educationScheduling);
- this.UnitOfWork.Add(educationScheduling);
- teacherList.ToList().ForEach(x =>
- {
- var educationSchedulingTeacher = new ES_EducationSchedulingTeacher
- {
- EducationSchedulingTeacherID = Guid.NewGuid(),
- EducationSchedulingID = educationScheduling.EducationSchedulingID,
- UserID = x.UserID,
- TeachingMethod = x.TeachingMethod
- };
- this.SetNewStatus(educationSchedulingTeacher);
- this.UnitOfWork.Add(educationSchedulingTeacher);
- });
- foreach (var schedulingWeek in schedulingWeekList)
- {
- var educationSchedulingWeekNum = new ES_EducationSchedulingWeekNum
- {
- EducationSchedulingWeekNumID = Guid.NewGuid(),
- EducationSchedulingID = educationScheduling.EducationSchedulingID,
- WeekNum = schedulingWeek
- };
- this.SetNewStatus(educationSchedulingWeekNum);
- this.UnitOfWork.Add(educationSchedulingWeekNum);
- }
- //更改教学任务状态
- var educationSchedulingClass = this.EducationSchedulingClassDAL.EducationSchedulingClassRepository.GetSingle(x => x.EducationSchedulingClassID == educationSchedulingView.EducationSchedulingClassID,
- (x => x.EM_EducationMissionClass.EM_EducationMission),
- (x => x.EM_EducationMissionClass.EM_CourseProcess.Select(w => w.EM_CourseProcessTeacher)));
- var courseProcessList = educationSchedulingClass.EM_EducationMissionClass.EM_CourseProcess.Where(x => schedulingWeekList.Contains(x.Week)
- && string.Join(",", teacherList.Select(w => w.UserID.ToString() + "," + w.TeachingMethod).OrderBy(w => w))
- == string.Join(",", x.EM_CourseProcessTeacher.Select(w => (w.UserID ?? Guid.Empty).ToString() + "," + w.TeachType).OrderBy(w => w)));
-
- educationSchedulingClass.EM_EducationMissionClass.RecordStatus = (int)EM_EducationMissionClassStatus.Scheduled;
- this.UnitOfWork.Commit();
- }
- public void DelScheduling(Guid educationSchedulingID)
- {
- var educationScheduling = this.EducationSchedulingDAL.EducationSchedulingRepository.
- GetSingle(x => x.EducationSchedulingID == educationSchedulingID, (x => x.EM_EducationSchedulingClass.EM_EducationMissionClass));
- var educationSchedulingClass = this.EducationSchedulingClassDAL.EducationSchedulingClassRepository
- .GetSingle((x => x.EducationSchedulingClassID == educationScheduling.EducationSchedulingClassID
- && x.EM_EducationMissionClass.EM_EducationSchedulingClass
- .SelectMany(w => w.ES_EducationScheduling)
- .Where(w => w.EducationSchedulingID != educationSchedulingID).Count() == 0),
- (x => x.EM_EducationMissionClass));
- if (educationSchedulingClass != null)
- {
- educationSchedulingClass.EM_EducationMissionClass.RecordStatus = (int)EM_EducationMissionClassStatus.Submitted;
- }
- this.UnitOfWork.Remove<ES_EducationSchedulingTeacher>(x => x.EducationSchedulingID == educationSchedulingID);
- this.UnitOfWork.Remove<ES_EducationSchedulingWeekNum>(x => x.EducationSchedulingID == educationSchedulingID);
- this.UnitOfWork.Remove(educationScheduling);
- this.UnitOfWork.Commit();
- }
- public void DelWeeks(Guid educationSchedulingID, IList<int?> weekList)
- {
- this.UnitOfWork.Remove<ES_EducationSchedulingWeekNum>(x => x.EducationSchedulingID == educationSchedulingID
- && weekList.Contains(x.WeekNum));
- this.UnitOfWork.Commit();
- }
- public void Submit(Guid collegeID)
- {
- var collegePriority = this.CollegeScheduleDAL.CollegePriorityRepository.GetList(x => x.CollegeID == collegeID).FirstOrDefault();
- if (collegePriority == null)
- {
- collegePriority = new ES_CollegePriority();
- collegePriority.CollegePriorityID = Guid.NewGuid();
- collegePriority.CollegeID = collegeID;
- collegePriority.Priority = 1;
- collegePriority.StartDate = DateTime.Today;
- collegePriority.EndDate = DateTime.Today;
- SetNewStatus(collegePriority);
- this.UnitOfWork.Add(collegePriority);
- }
- collegePriority.ApprovalStatus = (int)CF_ApprovalStatus.Submitted;
- this.UnitOfWork.Commit();
- }
- public List<ScheduleAdjustmentEditView> GetTeacherScheduleAdjustmentViewList(Guid schoolyearID, Guid userID, Guid? coursematerialID,
- Guid? educationMissionClassID, int? weekNum, int? weekday, Guid? courseTimesID, Guid? classroomID)
- {
- Expression<Func<ES_EducationScheduling, bool>> educationSchedulingExp = x => x.SchoolyearID == schoolyearID;
- Expression<Func<EM_EducationMissionClass, bool>> missionClassExp = (x => true);
- Expression<Func<ES_EducationSchedulingWeekNum, bool>> weeknumExp = (x => true);
- var stopApprovedStatus = this.EducationSchedulingStopServices.Value.GetCorrectEndStatus().Value;
- if (coursematerialID.HasValue)
- {
- missionClassExp = missionClassExp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (educationMissionClassID.HasValue)
- {
- missionClassExp = missionClassExp.And(x => x.EducationMissionClassID == educationMissionClassID);
- }
- if (weekNum.HasValue)
- {
- weeknumExp = weeknumExp.And(x => x.WeekNum == weekNum);
- }
- if (weekday.HasValue)
- {
- educationSchedulingExp = educationSchedulingExp.And(x => x.Weekday == weekday);
- }
- if (courseTimesID.HasValue)
- {
- educationSchedulingExp = educationSchedulingExp.And(x => x.CoursesTimeID == courseTimesID);
- }
- if (classroomID.HasValue)
- {
- educationSchedulingExp = educationSchedulingExp.And(x => x.ClassroomID == classroomID);
- }
- var scheduleAdjustmentViewList = this.EducationSchedulingDAL.GetScheduleAdjustmentViewQueryable(
- x => x.UserID == userID,
- educationSchedulingExp, missionClassExp, weeknumExp, stopApprovedStatus).ToList();
- var educationSchedulingIDList = scheduleAdjustmentViewList.Select(x => x.EducationSchedulingID).ToList();
- var teacherList = this.EducationSchedulingDAL.EducationSchedulingTeacherRepository.GetList(x => educationSchedulingIDList.Contains(x.EducationSchedulingID),
- (x => x.CF_Staff.Sys_User)).ToList();
- var result = scheduleAdjustmentViewList.OrderBy(x => x.WeekNum)
- .ThenBy(x => (x.Weekday == 0 ? 7 : x.Weekday)).ThenBy(x => x.TimesSegment).ThenBy(x => x.CoursesTimeName)
- .ThenBy(x => x.EducationMissionClassName).ToList();
- result.ForEach(x => x.TeacherList = teacherList.Where(w => w.EducationSchedulingID == x.EducationSchedulingID)
- .Select(w => new MissionClassTeacherView
- {
- EducationMissionClassID = x.EducationMissionClassID,
- UserID = w.UserID,
- Name = w.CF_Staff.Sys_User.Name,
- TeachingMethod = w.TeachingMethod
- }).ToList());
- return result;
- }
- public List<ScheduleStopEditView> GetTeacherScheduleStopViewList(Guid schoolyearID, Guid userID, Guid? coursematerialID,
- Guid? educationMissionClassID, int? weekNum, int? weekday, Guid? courseTimesID, Guid? classroomID)
- {
- Expression<Func<ES_EducationScheduling, bool>> educationSchedulingExp = x => x.SchoolyearID == schoolyearID;
- Expression<Func<EM_EducationMissionClass, bool>> missionClassExp = (x => true);
- Expression<Func<ES_EducationSchedulingWeekNum, bool>> weeknumExp = (x => true);
- var stopApprovedStatus = this.EducationSchedulingStopServices.Value.GetCorrectEndStatus().Value;
- if (coursematerialID.HasValue)
- {
- missionClassExp = missionClassExp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (educationMissionClassID.HasValue)
- {
- missionClassExp = missionClassExp.And(x => x.EducationMissionClassID == educationMissionClassID);
- }
- if (weekNum.HasValue)
- {
- weeknumExp = weeknumExp.And(x => x.WeekNum == weekNum);
- }
- if (weekday.HasValue)
- {
- educationSchedulingExp = educationSchedulingExp.And(x => x.Weekday == weekday);
- }
- if (courseTimesID.HasValue)
- {
- educationSchedulingExp = educationSchedulingExp.And(x => x.CoursesTimeID == courseTimesID);
- }
- if (classroomID.HasValue)
- {
- educationSchedulingExp = educationSchedulingExp.And(x => x.ClassroomID == classroomID);
- }
- var scheduleStopViewList = this.EducationSchedulingDAL.GetScheduleStopViewQueryable(
- x => x.UserID == userID,
- educationSchedulingExp, missionClassExp, weeknumExp, stopApprovedStatus).ToList();
- var educationSchedulingIDList = scheduleStopViewList.Select(x => x.EducationSchedulingID).ToList();
- var teacherList = this.EducationSchedulingDAL.EducationSchedulingTeacherRepository.GetList(x => educationSchedulingIDList.Contains(x.EducationSchedulingID),
- (x => x.CF_Staff.Sys_User)).ToList();
- var result = scheduleStopViewList.OrderBy(x => x.WeekNum)
- .ThenBy(x => (x.Weekday == 0 ? 7 : x.Weekday)).ThenBy(x => x.TimesSegment).ThenBy(x => x.CoursesTimeName)
- .ThenBy(x => x.EducationMissionClassName).ToList();
- result.ForEach(x => x.TeacherList = teacherList.Where(w => w.EducationSchedulingID == x.EducationSchedulingID)
- .Select(w => new MissionClassTeacherView
- {
- EducationMissionClassID = x.EducationMissionClassID,
- UserID = w.UserID,
- Name = w.CF_Staff.Sys_User.Name,
- TeachingMethod = w.TeachingMethod
- }).ToList());
- return result;
- }
- /// <summary>
- /// 批量调课获取可调课节次
- /// </summary>
- /// <param name="schoolyearID"></param>
- /// <param name="toWeekday"></param>
- /// <param name="courseTimeID"></param>
- /// <param name="toWeekNum"></param>
- /// <param name="teacherID"></param>
- /// <param name="educationSchedulingWeekNumIDList"></param>
- /// <returns></returns>
- public List<CoursesTimeView> GetNotUseCoursesTimeViewListForBatchAdjustment(Guid? schoolyearID, int? toWeekday, int? toWeekNum, Guid? teacherID, List<Guid?> educationSchedulingWeekNumIDList)
- {
- var educationSchedulingWeekNumList = this.EducationSchedulingDAL.EducationSchedulingWeekNumRepository
- .GetList(x => educationSchedulingWeekNumIDList.Contains(x.EducationSchedulingWeekNumID),
- (x => x.ES_EducationScheduling), (x => x.ES_EducationScheduling.ES_EducationSchedulingTeacher)).ToList();
- var weekTeacherList = educationSchedulingWeekNumList.Select(x => new
- {
- SchoolyearID = schoolyearID ?? x.ES_EducationScheduling.SchoolyearID,
- Weekday = toWeekday ?? x.ES_EducationScheduling.Weekday,
- WeekNum = toWeekNum ?? x.WeekNum
- });
- var dateList = weekTeacherList.GroupBy(x => x.SchoolyearID).Select(x =>
- SchoolYearServices.Value.GetDateByCoursesTime(x.Key.Value, x.Select(w => new FullCoursesTimeView
- {
- Weekday = w.Weekday,
- WeekNum = w.WeekNum
- }).ToList())
- ).SelectMany(x => x).Select(x => (DateTime?)x).Distinct().ToList();
- var examinationPlanList = ExaminationPlanDAL.GetExaminationPlanView(x => dateList.Contains(x.ExaminationDate)
- && x.RecordStatus == (int)EX_ExaminationPlanStatus.Submitted).ToList();
- var examinationPlanIDList = examinationPlanList.Select(x => x.ExaminationPlanID).ToList();
- var examinationRoomLayoutViewList = ExaminationPlanDAL.GetExaminationRoomLayoutView(x => examinationPlanIDList.Contains((Guid)x.ExaminationPlanID)).ToList();
- examinationPlanList.ForEach(x => x.ExaminationRoomLayoutView = new HashSet<ExaminationRoomLayoutView>(examinationRoomLayoutViewList.Where(y => y.ExaminationPlanID == x.ExaminationPlanID)));
- List<Guid> teacherList = new List<Guid>();
- List<CoursesTimeView> result = new List<CoursesTimeView>();
- List<CoursesTimeView> allCoursesTimeView = CoursesTimeServices.Value.GetCoursesTimeViewList(new ConfiguretView(), null);
- List<Guid> examinationCourseTimeIDList = new List<Guid>();
- foreach (var educationSchedulingWeekNumID in educationSchedulingWeekNumIDList)
- {
- var EducationSchedulingWeekNum = educationSchedulingWeekNumList.FirstOrDefault(x => x.EducationSchedulingWeekNumID == educationSchedulingWeekNumID);
- List<CoursesTimeView> query = new List<CoursesTimeView>();
- if (!schoolyearID.HasValue)
- {
- schoolyearID = EducationSchedulingWeekNum.ES_EducationScheduling.SchoolyearID;
- }
- if (!toWeekday.HasValue)
- {
- toWeekday = EducationSchedulingWeekNum.ES_EducationScheduling.Weekday;
- }
- if (!toWeekNum.HasValue)
- {
- toWeekNum = EducationSchedulingWeekNum.WeekNum;
- }
- if (!teacherID.HasValue)
- {
- var dbteacherList = EducationSchedulingWeekNum.ES_EducationScheduling.ES_EducationSchedulingTeacher.Select(x => x.UserID).ToList();
- foreach (var id in dbteacherList)
- {
- teacherList.Add(id.Value);
- }
- }
- else
- {
- teacherList.Add(teacherID.Value);
- }
- query = this.EducationSchedulingDAL.GetNotUseCoursesTime(schoolyearID.Value, toWeekday.Value, teacherList, toWeekNum, educationSchedulingWeekNumID.Value).ToList();
- var arrangementsNotWork = EducationSchedulingDAL.ArrangementsRepository.Entities.Where(x => !x.IsOnWork.Value && x.Weekday == toWeekday && x.EM_CoursesTime.RecordStatus == 1).ToList();
- var notWorkCoursesTimeIDList = arrangementsNotWork.Select(x => x.CoursesTimeID).ToList();
- var examinationDate = SchoolYearServices.Value.GetDateByCoursesTime(schoolyearID.Value, new List<FullCoursesTimeView> { new FullCoursesTimeView { Weekday = toWeekday.Value, WeekNum = toWeekNum.Value } }).FirstOrDefault();
- if (examinationDate != null)
- {
- var dateExaminationPlanList = examinationPlanList.Where(x => x.ExaminationDate == examinationDate).ToList();
- examinationCourseTimeIDList.AddRange(query.Where(x => dateExaminationPlanList.Any(w => w.StartTime < new TimeSpan(x.EndHour ?? 0, x.EndMinutes ?? 0, 0).Add(new TimeSpan(0, 1, 0))
- && w.EndTime >= new TimeSpan(x.StartHour ?? 0, x.StartMinutes ?? 0, 0)
- && w.ExaminationRoomLayoutView.SelectMany(v => v.Sys_User).Select(v => v.UserID).Intersect(teacherList).Count() > 0))
- .Select(x => x.CoursesTimeID.Value)
- .ToList());
- }
- result = result.Concat(query.Where(x => !notWorkCoursesTimeIDList.Contains(x.CoursesTimeID))).ToList();
- }
- //var arrangementsNotWork = EducationSchedulingDAL.ArrangementsRepository.Entities.Where(x => !x.IsOnWork.Value && x.Weekday == toWeekday && x.EM_CoursesTime.RecordStatus == (int)SYS_STATUS.USABLE).ToList();
- //var notWorkCoursesTimeIDList = arrangementsNotWork.Select(x => x.CoursesTimeID).ToList();
- var coursesTimeViewList = result.GroupBy(x => x.CoursesTimeID).Select(x => new { x.Key, count = x.Count() }).ToList();
- var coursesTimeIDList = coursesTimeViewList.Where(x => x.count >= educationSchedulingWeekNumIDList.Count).Select(x => x.Key).ToList();
- examinationCourseTimeIDList = examinationCourseTimeIDList.Distinct().ToList();
- result = allCoursesTimeView.Where(x => coursesTimeIDList.Contains(x.CoursesTimeID) && !examinationCourseTimeIDList.Contains(x.CoursesTimeID.Value)).Distinct().ToList();
- return result.OrderBy(x => x.StartTimes).ToList();
- }
- public List<CoursesTimeView> GetNotUseCoursesTimeViewList(Guid schoolyearID, int weekday, int toWeekday, Guid courseTimeID,
- int? weekNum, int? toWeekNum, Guid? fromTeacherID, Guid? replaceTeacherID, Guid educationMissionClassID)
- {
- var schedule = this.GetEducationScheduleView(new ConfiguretView(),
- (x => x.EM_EducationSchedulingClass.EducationMissionClassID == educationMissionClassID
- && x.Weekday == weekday && x.CoursesTimeID == courseTimeID
- && x.ES_EducationSchedulingWeekNum.Any(w => weekNum == w.WeekNum)), false).rows.FirstOrDefault();
- if (schedule == null)
- {
- return new List<CoursesTimeView>();
- }
- var scheduleWeekNum = this.EducationSchedulingDAL.EducationSchedulingWeekNumRepository
- .GetSingle(x => x.EducationSchedulingID == schedule.EducationSchedulingID && x.WeekNum == weekNum);
- var teacherList = schedule.TeacherTeachingViewList.Select(x => x.UserID).ToList();
- if (replaceTeacherID.HasValue)
- {
- teacherList.Remove(fromTeacherID ?? Guid.Empty);
- teacherList.Add(replaceTeacherID.Value);
- }
- var arrangementsNotWork = EducationSchedulingDAL.ArrangementsRepository.Entities.Where(x => !x.IsOnWork.Value && x.Weekday == toWeekday && x.EM_CoursesTime.RecordStatus == (int)SYS_STATUS.USABLE).ToList();
- var notWorkCoursesTimeIDList = arrangementsNotWork.Select(x => x.CoursesTimeID).ToList();
- var result = this.EducationSchedulingDAL.GetNotUseCoursesTime(schoolyearID, toWeekday, teacherList, toWeekNum,
- scheduleWeekNum.EducationSchedulingWeekNumID)
- .OrderBy(x => x.TimesSegment).ThenBy(x => x.StartTimes).ToList();
-
- var schoolyear = this.SchoolYearServices.Value.GetSchoolYearView(schoolyearID);
- result = result.Where(x => !this.SchoolYearServices.Value.IsTimePassed(schoolyear, toWeekNum, toWeekday, x.StartHour, x.StartMinutes) && !notWorkCoursesTimeIDList.Contains(x.CoursesTimeID))
- .ToList();
- var scheduleDate = this.SchoolYearServices.Value.GetDateByCoursesTime(schoolyear.SchoolYearID.Value, new List<FullCoursesTimeView> {
- new FullCoursesTimeView {
- WeekNum = toWeekNum,
- Weekday = toWeekday
- }
- }).FirstOrDefault();
- if (scheduleDate != null)
- {
- var examinationPlanList = ExaminationPlanDAL.GetExaminationPlanView(x => x.ExaminationDate == scheduleDate && x.SchoolyearID == schoolyear.SchoolYearID
- && x.RecordStatus == (int)EX_ExaminationPlanStatus.Submitted).ToList();
- var examinationPlanIDList = examinationPlanList.Select(x => x.ExaminationPlanID).ToList();
- var examinationRoomLayoutViewList = ExaminationPlanDAL.GetExaminationRoomLayoutView(x => examinationPlanIDList.Contains((Guid)x.ExaminationPlanID)).ToList();
- examinationPlanList.ForEach(x => x.ExaminationRoomLayoutView = new HashSet<ExaminationRoomLayoutView>(examinationRoomLayoutViewList.Where(y => y.ExaminationPlanID == x.ExaminationPlanID)));
-
- result = result.Where(x => !examinationPlanList.Any(w => w.StartTime < new TimeSpan(x.EndHour ?? 0, x.EndMinutes ?? 0, 0).Add(new TimeSpan(0, 1, 0))
- && w.EndTime >= new TimeSpan(x.StartHour ?? 0, x.StartMinutes ?? 0, 0)
- && w.ExaminationRoomLayoutView.SelectMany(v => v.Sys_User).Select(v => (Guid?)v.UserID).Contains(replaceTeacherID))
- ).ToList();
- }
- return result;
- }
- public IGridResultSet<ClassroomView> GetNotUseClassroomViewList(ConfiguretView configuretView, Guid schoolyearID, int weekday, int toWeekday,
- Guid coursesTimeID, Guid toCoursesTimeID, IList<int?> weekNumList, IList<int?> toWeekNumList, int classroomTypeID, Guid educationMissionClassID,
- int? pageIndex = null, int? pageSize = null)
- {
- var schedule = this.GetEducationScheduleView(new ConfiguretView(),
- (x => x.EM_EducationSchedulingClass.EducationMissionClassID == educationMissionClassID
- && x.Weekday == weekday && x.CoursesTimeID == coursesTimeID
- && x.ES_EducationSchedulingWeekNum.Any(w => weekNumList.Contains(w.WeekNum))), false).rows.FirstOrDefault();
- if (schedule == null)
- {
- return new GridResultSet<ClassroomView>() { rows = new List<ClassroomView>(), total = 0 };
- }
- var result = this.EducationSchedulingDAL.GetNotUseClassroomForAdjustment(schoolyearID, toWeekday, toCoursesTimeID, classroomTypeID,
- toWeekNumList, schedule.EducationSchedulingID);
- var schoolyear = this.SchoolYearServices.Value.GetSchoolYearView(schoolyearID);
- var coursesTime = CoursesTimeServices.Value.GetCoursesTimeView(coursesTimeID);
- var scheduleDateList = this.SchoolYearServices.Value.GetDateByCoursesTime(schoolyear.SchoolYearID.Value, toWeekNumList.Select(x => new FullCoursesTimeView {
- WeekNum = x,
- Weekday = toWeekday
- }).ToList()).Select(x => (DateTime?)x).ToList();
- if (scheduleDateList.Count > 0)
- {
- var examinationPlanList = ExaminationPlanDAL.GetExaminationPlanView(x => scheduleDateList.Contains(x.ExaminationDate) && x.SchoolyearID == schoolyear.SchoolYearID
- && x.RecordStatus == (int)EX_ExaminationPlanStatus.Submitted).ToList();
- examinationPlanList = examinationPlanList.Where(x => x.StartTime < new TimeSpan(coursesTime.EndHour ?? 0, coursesTime.EndMinutes ?? 0, 0).Add(new TimeSpan(0, 1, 0))
- && x.EndTime >= new TimeSpan(coursesTime.StartHour ?? 0, coursesTime.StartMinutes ?? 0, 0))
- .ToList();
- var examinationPlanIDList = examinationPlanList.Select(x => x.ExaminationPlanID).ToList();
- var examinationRoomLayoutViewList = ExaminationPlanDAL.GetExaminationRoomLayoutView(x => examinationPlanIDList.Contains((Guid)x.ExaminationPlanID)).ToList();
- examinationPlanList.ForEach(x => x.ExaminationRoomLayoutView = new HashSet<ExaminationRoomLayoutView>(examinationRoomLayoutViewList.Where(y => y.ExaminationPlanID == x.ExaminationPlanID)));
- var examinationClassRoomIDList = examinationPlanList.SelectMany(x => x.ExaminationRoomLayoutView).Select(x => x.ClassroomID).Distinct().ToList();
- result = result.Where(x => !examinationClassRoomIDList.Contains(x.ClassroomID));
- }
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- result = result
- .DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- }
- result = result.OrderBy(x => x.Code);
- return result.ToGridResultSet(pageIndex, pageSize);
- }
- public ScheduleAdjustmentEditView GetScheduleAdjustmentView(Guid educationSchedulingWeekNumID)
- {
- var stopApprovalStatus = this.EducationSchedulingStopServices.Value.GetCorrectEndStatus().Value;
- var scheduleAdjustmentView = this.EducationSchedulingDAL.GetScheduleAdjustmentViewQueryable(x => true,
- x => true, (x => true), (x => x.EducationSchedulingWeekNumID == educationSchedulingWeekNumID), stopApprovalStatus).FirstOrDefault();
-
- return scheduleAdjustmentView;
- }
- public EducationSchedulingStopView GetEducationSchedulingStopView(Guid educationSchedulingID)
- {
- var scheduleStopView = this.EducationSchedulingDAL.GetEducationSchedulingStopViewQueryable(x => true, x => x.EducationSchedulingID == educationSchedulingID).FirstOrDefault();
- var weekNumList = this.EducationSchedulingDAL.GetEducationMissionWeekNumQueryable(
- x => x.EducationSchedulingID == educationSchedulingID);
- scheduleStopView.ScheduleWeekNumList = weekNumList.Select(w => w.WeekNum)
- .ToList();
- return scheduleStopView;
- }
- public List<ClassroomScheduleView> GetClassroomScheduleViewList(Guid schoolyearID, Guid classroomID)
- {
- var scheduleQuery = (from es in this.EducationSchedulingDAL.EducationSchedulingRepository.GetList(x => x.SchoolyearID == schoolyearID
- && x.ClassroomID == classroomID)
- from esw in es.ES_EducationSchedulingWeekNum
- select new
- {
- es.CoursesTimeID,
- es.Weekday,
- WeekNum = esw.WeekNum
- }
- ).Concat(
- from ceu in this.ClassroomExcessiveUseDAL.ClassroomExcessiveUseRepository.GetList(x => x.SchoolyearID == schoolyearID
- && x.ClassroomID == classroomID, (x => x.ES_ClassroomExcessiveUseScheduling.Select(w => w.ES_ClassroomExcessiveUseSchedulingWeekNum)))
- from ceus in ceu.ES_ClassroomExcessiveUseScheduling
- from ceusw in ceus.ES_ClassroomExcessiveUseSchedulingWeekNum
- select new
- {
- ceus.CoursesTimeID,
- ceus.Weekday,
- WeekNum = ceusw.WeekNum
- }
- ).GroupBy(x => new { x.CoursesTimeID, x.Weekday })
- .Select(x => new { x.Key.CoursesTimeID, x.Key.Weekday, WeekNumList = x.Select(w => w.WeekNum).Distinct() }).ToList();
- var classroomScheduleList = (
- from ct in this.CoursesTimeServices.Value.GetCoursesTimeViewList(new ConfiguretView(), null).ToList()
- join es in scheduleQuery on ct.CoursesTimeID equals es.CoursesTimeID into des
- from ees in des.DefaultIfEmpty()
- select new
- {
- CoursesTime = ct,
- Weekday = (ees == null) ? null : ees.Weekday,
- WeekNumList = (ees == null) ? new List<int?>() : ees.WeekNumList
- }).ToList();
- var result = (from cs in classroomScheduleList
- group cs by cs.CoursesTime.CoursesTimeID into g
- select new ClassroomScheduleView
- {
- ClassroomID = classroomID,
- CoursesTimeID = g.FirstOrDefault().CoursesTime.CoursesTimeID ?? Guid.Empty,
- StartTimes = g.FirstOrDefault().CoursesTime.StartTimes,
- EndTimes = g.FirstOrDefault().CoursesTime.EndTimes,
- StartHour = g.FirstOrDefault().CoursesTime.StartHour,
- EndHour = g.FirstOrDefault().CoursesTime.EndHour,
- StartMinutes = g.FirstOrDefault().CoursesTime.StartMinutes,
- EndMinutes = g.FirstOrDefault().CoursesTime.EndMinutes,
- Monday = g.Where(x => x.Weekday != null && x.Weekday == (int)DayOfWeek.Monday)
- .SelectMany(x => x.WeekNumList).Distinct().ToList()
- .GetWeekNumString(),
- Tuesday = g.Where(x => x.Weekday != null && x.Weekday == (int)DayOfWeek.Tuesday)
- .SelectMany(x => x.WeekNumList).Distinct().ToList()
- .GetWeekNumString(),
- Wednesday = g.Where(x => x.Weekday != null && x.Weekday == (int)DayOfWeek.Wednesday)
- .SelectMany(x => x.WeekNumList).Distinct().ToList()
- .GetWeekNumString(),
- Thurday = g.Where(x => x.Weekday != null && x.Weekday == (int)DayOfWeek.Thursday)
- .SelectMany(x => x.WeekNumList).Distinct().ToList()
- .GetWeekNumString(),
- Friday = g.Where(x => x.Weekday != null && x.Weekday == (int)DayOfWeek.Friday)
- .SelectMany(x => x.WeekNumList).Distinct().ToList()
- .GetWeekNumString(),
- Saturday = g.Where(x => x.Weekday != null && x.Weekday == (int)DayOfWeek.Saturday)
- .SelectMany(x => x.WeekNumList).Distinct().ToList()
- .GetWeekNumString(),
- Sunday = g.Where(x => x.Weekday != null && x.Weekday == (int)DayOfWeek.Sunday)
- .SelectMany(x => x.WeekNumList).Distinct().ToList()
- .GetWeekNumString()
- }).OrderBy(x => x.StartTimes).ToList();
- return result;
- }
- private void ChangeCourseProcess(ES_EducationScheduling educationScheduling,
- IList<EducationSchedulingTeacherListView> lastTeacherViewList,
- IList<EducationSchedulingTeacherListView> newTeacherList)
- {
- var coursesTime = this.CoursesTimeServices.Value.GetCoursesTime(educationScheduling.CoursesTimeID);
- var weekList = educationScheduling.ES_EducationSchedulingWeekNum.Select(x => x.WeekNum).ToList();
- var userIDList = newTeacherList.Select(x => x.UserID).ToList();
- var lastTeacherList = lastTeacherViewList.Select(x => new { x.UserID, x.TeachingMethod }).ToList();
- var courseProcessList = this.EducationSchedulingClassDAL.EducationMissionClassDAL.Value.CourseProcessRepository
- .GetList(x => x.EducationMissionClassID == educationScheduling.EM_EducationSchedulingClass.EducationMissionClassID,
- (x => x.EM_CourseProcessTeacher))
- .ToList();
- var educationSchedulingList = this.EducationSchedulingDAL.EducationSchedulingRepository
- .GetList(x => x.EM_EducationSchedulingClass.EducationMissionClassID == educationScheduling.EM_EducationSchedulingClass.EducationMissionClassID,
- (x => x.ES_EducationSchedulingTeacher), (x => x.ES_EducationSchedulingWeekNum), (x => x.EM_CoursesTime))
- .ToList();
- var courseTimes = coursesTime.EndTimes - coursesTime.StartTimes + 1;
- //先找出涉及周内,之前的老师上课的课程进度记录,这批是要扣减课时的,但扣到多少为止,后面查一下课表再说
- var decreaseCourseProcessList = courseProcessList.Where(x => weekList.Contains(x.Week)
- && (lastTeacherList.Join(x.EM_CourseProcessTeacher.ToList(),
- (w => new { UserID = (Guid?)w.UserID, TeachType = w.TeachingMethod }),
- (w => new { w.UserID, w.TeachType }),
- ((w, y) => w)).Count() == lastTeacherList.Count
- && lastTeacherList.Count == x.EM_CourseProcessTeacher.Count))
- .ToList();
- var increaseCourseProcessList = courseProcessList.Where(x => weekList.Contains(x.Week)
- && (newTeacherList.Join(x.EM_CourseProcessTeacher.ToList(),
- (w => new { UserID = (Guid?)w.UserID, TeachType = w.TeachingMethod }),
- (w => new { w.UserID, w.TeachType }),
- ((w, y) => w)).Count() == newTeacherList.Count
- && newTeacherList.Count == x.EM_CourseProcessTeacher.Count))
- .ToList();
- var addCourseProcessWeekList = (from w in weekList
- join icp in increaseCourseProcessList on w equals icp.Week into dicp
- from icp in dicp.DefaultIfEmpty()
- where icp == null
- select w).ToList();
- //保存起要扣减的记录,添加时要找回对应的教室类型和教室
- var needAddCourseProcessList = decreaseCourseProcessList.Select(x => new {
- x.Week,
- x.ClassroomTypeID,
- x.ClassroomID }).ToList();
- decreaseCourseProcessList.ForEach(x =>
- {
- var minTimes = educationSchedulingList.Where(w => w.ES_EducationSchedulingWeekNum.Any(y => y.WeekNum == x.Week)
- && w.ES_EducationSchedulingTeacher.Join(x.EM_CourseProcessTeacher,
- (y => new { y.UserID, TeachType = y.TeachingMethod }),
- (y => new { y.UserID, y.TeachType }),
- ((y, z) => y)).Count() == w.ES_EducationSchedulingTeacher.Count
- && w.ES_EducationSchedulingTeacher.Count == x.EM_CourseProcessTeacher.Count)
- .Sum(w => w.EM_CoursesTime.EndTimes - w.EM_CoursesTime.StartTimes + 1);
- if (x.Times - courseTimes < minTimes)
- {
- x.Times = minTimes;
- }
- else
- {
- x.Times -= courseTimes;
- }
- if (x.Times <= 0)
- {
- UnitOfWork.Remove(x);
- }
- else
- {
- SetModifyStatus(x);
- }
- });
- increaseCourseProcessList.ForEach(x =>
- {
- x.Times += courseTimes;
- SetModifyStatus(x);
- });
- addCourseProcessWeekList.ForEach(week =>
- {
- var currentLastCourseProcess = needAddCourseProcessList.FirstOrDefault(x => x.Week == week);
- var newCourseProcess = new EM_CourseProcess
- {
- CourseProcessID = Guid.NewGuid(),
- EducationMissionClassID = educationScheduling.EM_EducationSchedulingClass.EducationMissionClassID,
- ClassroomTypeID = currentLastCourseProcess.ClassroomTypeID,
- ClassroomID = currentLastCourseProcess.ClassroomID,
- Times = courseTimes,
- Week = week
- };
- SetNewStatus(newCourseProcess);
- newTeacherList.ToList().ForEach(x =>
- {
- var newCourseProcessTeacher = new EM_CourseProcessTeacher
- {
- CourseProcessTeacherID = Guid.NewGuid(),
- CourseProcessID = newCourseProcess.CourseProcessID,
- UserID = x.UserID,
- TeachType = x.TeachingMethod
- };
- SetNewStatus(newCourseProcessTeacher);
- newCourseProcess.EM_CourseProcessTeacher.Add(newCourseProcessTeacher);
- });
- UnitOfWork.Add(newCourseProcess);
- });
- }
- public void ChangeClassroom(Guid educationSchedulingID, Guid classroomID)
- {
- var educationScheduling = this.EducationSchedulingDAL.EducationSchedulingRepository
- .GetSingle(x => x.EducationSchedulingID == educationSchedulingID,
- (x => x.ES_EducationSchedulingTeacher), (x => x.ES_EducationSchedulingWeekNum), (x => x.EM_EducationSchedulingClass), (x => x.CF_Classroom.CF_ClassroomType));
- educationScheduling.ClassroomID = classroomID;
- this.UnitOfWork.Commit();
- }
- public List<EducationSchedulingTeacherListView> GetEducationSchedulingTeacherViewList(Guid educationSchedulingID)
- {
- var teacherViewQueryable = this.EducationSchedulingDAL.GetTeacherViewQueryable(x => x.EducationSchedulingID == educationSchedulingID);
- return teacherViewQueryable.ToList();
- }
- private void CheckTeacherIsAvailable(ES_EducationScheduling educationScheduling, List<Guid> teacherIDList)
- {
- var notAvailableTeacherMessage = "";
- var teacherIsOnWorkList = this.EducationSchedulingDAL.CheckTeacherIsOnWork(x =>
- x.EducationSchedulingID == educationScheduling.EducationSchedulingID,
- (x => teacherIDList.Contains(x.UserID))).ToList();
- if (teacherIsOnWorkList.Count > 0)
- {
- teacherIsOnWorkList.ForEach(x => notAvailableTeacherMessage += string.Format("教师{0}在该节次不能排课。\n",
- x.Name,
- x.WeekdayDesc,
- x.Times));
- }
- var teacherIsBusyList = this.EducationSchedulingDAL.CheckTeacherIsBusy(x =>
- x.EducationSchedulingID == educationScheduling.EducationSchedulingID,
- (x => teacherIDList.Contains(x.UserID))).ToList();
- if (teacherIsBusyList.Count > 0)
- {
- teacherIsBusyList.ForEach(x => notAvailableTeacherMessage += string.Format("教师{0}在该节次在其他班级有课,不能排课。\n",
- x.Name,
- x.WeekdayDesc,
- x.Times));
- }
- if (!string.IsNullOrEmpty(notAvailableTeacherMessage))
- {
- throw new Exception(notAvailableTeacherMessage);
- }
- }
- private void RefreshEducationMissionClassTeachers(Guid educationMissionClassID)
- {
- var educationMissionClass = EducationSchedulingClassDAL.EducationMissionClassRepository
- .GetSingle(x => x.EducationMissionClassID == educationMissionClassID,
- (x => x.EM_MissionClassTeacher),
- (x => x.EM_CourseProcess.Select(w => w.EM_CourseProcessTeacher)));
- var teacherList = (from courseProcess in educationMissionClass.EM_CourseProcess
- from teacher in courseProcess.EM_CourseProcessTeacher
- group teacher by new { teacher.UserID, teacher.TeachType } into g
- select g.FirstOrDefault()).ToList();
- educationMissionClass.EM_MissionClassTeacher.ToList().ForEach(x => UnitOfWork.Remove(x));
- teacherList.ForEach(x => {
- var missionClassTeacher = new EM_MissionClassTeacher
- {
- MissionClassTeacherID = Guid.NewGuid(),
- MissionClassID = educationMissionClassID,
- UserID = x.UserID,
- TeachType = x.TeachType
- };
- this.SetNewStatus(missionClassTeacher);
- this.UnitOfWork.Add(missionClassTeacher);
- });
- }
- public void ChangeTeacher(Guid educationSchedulingID, IList<EducationSchedulingTeacherListView> teacherList)
- {
- var educationScheduling = this.EducationSchedulingDAL.EducationSchedulingRepository.GetSingle(x => x.EducationSchedulingID == educationSchedulingID,
- (x => x.ES_EducationSchedulingTeacher), (x => x.ES_EducationSchedulingWeekNum), (x => x.EM_EducationSchedulingClass), (x => x.CF_Classroom.CF_ClassroomType));
- this.CheckTeacherIsAvailable(educationScheduling, teacherList.Select(x => x.UserID).ToList());
- var lastTeacherList = this.EducationSchedulingDAL.GetTeacherViewQueryable(x => x.EducationSchedulingID == educationSchedulingID).ToList();
- this.UnitOfWork.Remove<ES_EducationSchedulingTeacher>(x => x.EducationSchedulingID == educationSchedulingID);
- teacherList.ToList().ForEach(x =>
- {
- var educationSchedulingTeacher = new ES_EducationSchedulingTeacher
- {
- EducationSchedulingTeacherID = Guid.NewGuid(),
- EducationSchedulingID = educationSchedulingID,
- UserID = x.UserID,
- TeachingMethod = x.TeachingMethod
- };
- this.SetNewStatus(educationSchedulingTeacher);
- this.UnitOfWork.Add(educationSchedulingTeacher);
- });
- this.ChangeCourseProcess(educationScheduling, lastTeacherList, teacherList);
- this.RefreshEducationMissionClassTeachers(educationScheduling.EM_EducationSchedulingClass.EducationMissionClassID.Value);
- this.UnitOfWork.Commit();
- }
- private void InitCommonByEducationSchedulingClassList(IList<EducationSchedulingClassScheduleView> educationSchedulingClassList)
- {
- SchedulingResult = new List<ES_EducationScheduling>(); //初始化排课结果
- SchedulingWeekNumResult = new List<ES_EducationSchedulingWeekNum>();
- SchedulingTeacherResult = new List<ES_EducationSchedulingTeacher>();
- NotScheduledList = new List<EducationSchedulingClassScheduleView>();
- SchoolYear = SchoolYearServices.Value.GetSchoolYearView(educationSchedulingClassList.First().SchoolYearID);
- CourseTimeList = CoursesTimeServices.Value.GetCoursesTimeViewList(new ConfiguretView(), null);
- CourseTimeList = CourseTimeList.OrderBy(x => x.StartTimes).ToList();
- ArrangementList = ArrangementDAL.GetArrangementView(x => x.IsOnWork == true).ToList();
- var staffIDList = educationSchedulingClassList.SelectMany(x => x.CourseProcessViewList)
- .SelectMany(x => x.CourseProcessTeacherViewList)
- .Select(x => x.UserID)
- .Union(
- educationSchedulingClassList.SelectMany(x => x.TeacherTeachingViewList)
- .Select(x => x.UserID)
- ).ToList();
- StaffList = StaffDAL.staffRepository.GetList(x => staffIDList.Contains(x.UserID)).ToList();
- CourseSchedulingSettingList = CourseScheduleDAL.CourseScheduleSettingRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- TeacherSchedulingSettingList = TeacherScheduleDAL.TeacherScheduleSettingRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- CourseTypePriorityList = this.CourseTypeScheduleDAL.CourseTypePriorityRepository.Entities.ToList();
- TeacherScheduleContinuousCount = this.ParameterServices.Value.GetParameterValue<int>(CF_ParameterType.TeacherScheduleContinuousCount);
- ClassScheduleContinuousCount = this.ParameterServices.Value.GetParameterValue<int>(CF_ParameterType.ClassScheduleContinuousCount);
- ClassCourseScheduleContinuousCount = this.ParameterServices.Value.GetParameterValue<int>(CF_ParameterType.ClassCourseScheduleContinuousCount);
- }
- private void InitScheduleClassInfoByEducationSchedulingClassList(IList<EducationSchedulingClassScheduleView> educationSchedulingClassList)
- {
- var collegeIDList = educationSchedulingClassList.Select(x => x.CourseCollegeID).ToList();
- CollegeList = CollegeScheduleDAL.CollegeDAL.Value.GetCollegeViewQueryable().Where(x => collegeIDList.Contains(x.CollegeID)).ToList();
- var submittedCollegeQuery = this.CollegeScheduleDAL.CollegeScheduleStatusRepository
- .GetList(x => collegeIDList.Contains(x.CollegeID) && x.RecordStatus == (int)ES_CollegeScheduleStatusCode.Submited
- && x.SchoolyearID == SchoolYear.SchoolYearID)
- .Include(x => x.CF_College);
- var submittedCollege = submittedCollegeQuery.ToList();
- if (submittedCollege.Count > 0)
- {
- throw new Exception(string.Join("、", submittedCollege.Select(x => x.CF_College.Name)) + "的相关课表已经提交,请先撤销提交后再进行排课。");
- }
- var today = DateTime.Today;
- var collegePriority = this.CollegePriorityDAL.GetCollegePriorityViewQueryable(x => collegeIDList.Contains(x.CollegeID)).ToList();
- var noPriorityCollege = (from c in CollegeList
- join cp in collegePriority on c.CollegeID equals cp.CollegeID into dcp
- from ecp in dcp.DefaultIfEmpty()
- where ecp == null
- select c).ToList();
- if (noPriorityCollege.Count > 0)
- {
- throw new Exception(string.Join("、", noPriorityCollege.Select(x => x.Name)) + "的未设置排课时间,无法排课,请通知相关管理人员调整排课优先级设置。");
- }
- var expireCollege = collegePriority.Where(x => x.StartDate > today || x.EndDate < today).ToList();
- if (expireCollege.Count > 0)
- {
- throw new Exception(string.Join("、", expireCollege.Select(x => x.CollegeName)) + "的已不在排课时间内,无法排课,请通知相关管理人员调整排课优先级设置。");
- }
- var educationSchedulingClassIDList = educationSchedulingClassList.Select(x => x.EducationSchedulingClassID).Distinct().ToList();
- EducationSchedulingClassViewList = educationSchedulingClassList.ToList();
- EducationSchedulingClassStudentViewList = EducationSchedulingClassDAL.GetEducationSchedulingClassStudentViewQueryable(x => educationSchedulingClassIDList.Contains(x.EducationSchedulingClassID))
- .ToList();
- ScheduledEducationViewList = this.GetEducationScheduleView(new ConfiguretView(), (x => x.SchoolyearID == SchoolYear.SchoolYearID), false).rows;
- var scheduledClassIDList = ScheduledEducationViewList.Select(x => x.EducationSchedulingClassID).Distinct().ToList();
- ScheduledEducationStudentViewList = EducationSchedulingClassDAL.GetEducationSchedulingClassStudentViewQueryable(x => scheduledClassIDList.Contains(x.EducationSchedulingClassID)).ToList();
- }
- public void GenerateSchedule(IList<Guid?> educationMissionClassIDList)
- {
- var educationSchedulingClassList = EducationSchedulingClassServices.Value.GetEducationSchedulingClassView(new ConfiguretView(),
- (x => educationMissionClassIDList.Contains(x.EducationMissionClassID))).rows;
- if (educationSchedulingClassList.Count == 0)
- {
- return;
- }
- if (educationSchedulingClassList.Select(x => x.SchoolYearID).Distinct().Count() > 1)
- {
- throw new Exception("所选记录包括不同学年学期的教学任务班,多个学期智能排课会使逻辑比较混乱,目前只支持同一个学年学期的智能排课。");
- }
- this.InitCommonByEducationSchedulingClassList(educationSchedulingClassList);
- this.InitScheduleClassInfoByEducationSchedulingClassList(educationSchedulingClassList);
- this.InitClassroomInfo();
- this.GenerateScheduleByInited();
- }
- public List<MobileUserEducationScheduleView> GetMobileStudentSchedule(Guid userID, DateTime date)
- {
- Expression<Func<ES_EducationScheduling, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var schoolyear = this.SchoolYearServices.Value.GetCurrentSchoolYear();
- var firstMonday = schoolyear.FirstWeek.Value.AddDays(1 - (int)schoolyear.FirstWeek.Value.DayOfWeek);
- var todayWeekNum = Math.Ceiling((Math.Floor(date.Subtract(schoolyear.FirstWeek.Value).TotalDays + 1)) / 7);
- var todayWeekday = date.DayOfWeek == DayOfWeek.Sunday ? 0 : (int)date.DayOfWeek;
- exp = exp.And(x => x.SchoolyearID == schoolyear.SchoolYearID && x.Weekday == todayWeekday);
- exp = exp.And(x => x.EM_EducationSchedulingClass.CF_Student.Any(w => w.UserID == userID));
- exp = exp.And(x => x.ES_EducationSchedulingWeekNum.Any(w => w.WeekNum == todayWeekNum));
- var scheduleViewList = this.GetEducationScheduleView(new ConfiguretView(), exp, false).rows;
- var resultGroup = scheduleViewList.GroupBy(x => new {
- SchoolyearID = x.SchoolyearID,
- SchoolyearCode = x.SchoolyearCode,
- CoursematerialID = x.CoursematerialID,
- CoursematerialName = x.CoursematerialName,
- TeachingModeID = x.TeachingModeID,
- Weekday = x.Weekday,
- TimeGroup = (x.CoursesTime.StartTimes - 1) / 2,
- ClassroomID = x.ClassroomID,
- ClassroomName = x.ClassroomName
- //TeacherTeachingViewList = x.TeacherTeachingViewList
- });
- var resultList = resultGroup
- .Select(x => new MobileUserEducationScheduleView
- {
- SchoolyearID = x.Key.SchoolyearID,
- SchoolyearCode = x.Key.SchoolyearCode,
- CoursematerialID = x.Key.CoursematerialID,
- CoursematerialName = x.Key.CoursematerialName,
- TeachingModeID = x.Key.TeachingModeID,
- Weekday = x.Key.Weekday,
- TimeGroup = x.Key.TimeGroup,
- CoursesTimeList = x.Select(w => w.CoursesTime).ToList(),
- ClassroomID = x.Key.ClassroomID,
- ClassroomName = x.Key.ClassroomName
- //TeacherTeachingViewList = x.Key.TeacherTeachingViewList
- });
- return resultList.OrderBy(x => x.TimeGroup)
- .ToList();
- }
- public EducationMissionClassView GetEducationMissionClassViewBySchedule(Guid? schoolyearID, DateTime date, Guid coursesTimeID, Guid teacherUserID)
- {
- var currentSchoolyear = this.SchoolYearServices.Value.GetCurrentSchoolYear();
- var firstWeek = currentSchoolyear.FirstWeek.Value.AddDays(1 - (int)currentSchoolyear.FirstWeek.Value.DayOfWeek);
- var nowWeekNum = (date.Subtract(firstWeek).Days + 7) / 7;
- var nowWeekday = (int)date.DayOfWeek == 0 ? 7 : (int)date.DayOfWeek;
- var scheduling = this.EducationSchedulingDAL.GetEducationSchedulingViewQueryable(x => x.ES_EducationSchedulingTeacher.Any(w => w.UserID == teacherUserID)
- && x.ES_EducationSchedulingWeekNum.Any(w => w.WeekNum == nowWeekNum) && x.Weekday == nowWeekday && x.CoursesTimeID == coursesTimeID && x.SchoolyearID == schoolyearID).FirstOrDefault();
- if (scheduling == null) return null;
- var educationMissionClass = this.EducationMissionClassDAL
- .GetEducationMissionClassViewQueryble(x => x.EducationMissionClassID == scheduling.EducationMissionClassID)
- .FirstOrDefault();
- return educationMissionClass;
- }
- public List<EducationSchedulingWeekNumView> GetEducationSchedulingWeekNumViewByDateTimeList(Guid schoolyearID, IList<StartEndTimeView> dateTimeList)
- {
- var fullCoursesTimeList = this.SchoolYearServices.Value.GetCoursesTimeByDateTime(schoolyearID, dateTimeList);
- var coursesTimeList = fullCoursesTimeList.Select(x => new { SchoolyearID = schoolyearID, x.WeekNum, x.Weekday, x.CoursesTimeID }).ToList();
- var educationSchedulingViewList = this.EducationSchedulingDAL.GetEducationSchedulingWeekNumViewQueryable(x => true)
- .SelectByKeys(coursesTimeList).ToList();
- var educationMissionClassIDList = educationSchedulingViewList.Select(x => x.EducationMissionClassID).Distinct().ToList();
- var teacherList = this.EducationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassIDList.Contains(x.EducationMissionClassID)).ToList();
- var studentList = this.EducationSchedulingClassDAL.EducationSchedulingClassRepository.GetList(x => educationMissionClassIDList.Contains(x.EducationMissionClassID),
- (x => x.CF_Student)).ToList();
- educationSchedulingViewList.ForEach(x =>
- {
- var fullCoursesTime = fullCoursesTimeList.FirstOrDefault(w => w.WeekNum == x.WeekNum && w.Weekday == x.Weekday && w.CoursesTimeID == x.CoursesTimeID);
- x.TeacherList = teacherList.Where(w => w.EducationMissionClassID == x.EducationMissionClassID).ToList();
- x.Date = fullCoursesTime.Date;
- x.StartTime = new TimeSpan(fullCoursesTime.StartHour ?? 0, fullCoursesTime.StartMinute ?? 0, 0);
- x.EndTime = new TimeSpan(fullCoursesTime.EndHour ?? 0, fullCoursesTime.EndMinute ?? 0, 0);
- x.StudentList = studentList.Where(w => w.EducationMissionClassID == x.EducationMissionClassID).SelectMany(w => w.CF_Student).ToList();
- });
- return educationSchedulingViewList;
- }
- /// <summary>
- /// 手动排考查询排考时间有课的老师
- /// </summary>
- /// <param name="schoolyearID"></param>
- /// <param name="dateTimeList"></param>
- /// <returns></returns>
- public List<EducationSchedulingWeekNumView> GetEducationSchedulingWeekNumViewForExaminationTeacher(Guid schoolyearID, IList<StartEndTimeView> dateTimeList)
- {
- var fullCoursesTimeList = this.SchoolYearServices.Value.GetCoursesTimeByDateTime(schoolyearID, dateTimeList);
- var coursesTimeList = fullCoursesTimeList.Select(x => new { SchoolyearID = schoolyearID, x.WeekNum, x.Weekday, x.CoursesTimeID }).ToList();
- var educationSchedulingViewList = this.EducationSchedulingDAL.GetEducationSchedulingWeekNumViewQueryable(x => true)
- .SelectByKeys(coursesTimeList).ToList();
- var educationMissionClassIDList = educationSchedulingViewList.Select(x => x.EducationMissionClassID).Distinct().ToList();
- var teacherListScheduling = this.EducationMissionClassDAL.GetEducationSchedulingTeacherQuery(x => educationMissionClassIDList.Contains(x.EducationMissionClassID)).ToList();
- var teacherList = this.EducationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassIDList.Contains(x.EducationMissionClassID)).ToList();
- var studentList = this.EducationSchedulingClassDAL.EducationSchedulingClassRepository.GetList(x => educationMissionClassIDList.Contains(x.EducationMissionClassID),
- (x => x.CF_Student)).ToList();
- educationSchedulingViewList.ForEach(x =>
- {
- var fullCoursesTime = fullCoursesTimeList.FirstOrDefault(w => w.WeekNum == x.WeekNum && w.Weekday == x.Weekday && w.CoursesTimeID == x.CoursesTimeID);
- //x.TeacherList = teacherList.Where(w => w.EducationMissionClassID == x.EducationMissionClassID).ToList();
- x.TeacherList = teacherListScheduling.Where(w => w.WeekNum == x.WeekNum && w.Weekday == x.Weekday && w.CoursesTimeID == x.CoursesTimeID).ToList();
- x.Date = fullCoursesTime.Date;
- x.StartTime = new TimeSpan(fullCoursesTime.StartHour ?? 0, fullCoursesTime.StartMinute ?? 0, 0);
- x.EndTime = new TimeSpan(fullCoursesTime.EndHour ?? 0, fullCoursesTime.EndMinute ?? 0, 0);
- x.StudentList = studentList.Where(w => w.EducationMissionClassID == x.EducationMissionClassID).SelectMany(w => w.CF_Student).ToList();
- });
- return educationSchedulingViewList;
- }
- }
- public class ClassroomConflictException : Exception
- {
- public ClassroomConflictException(string message)
- : base(message)
- {
- }
- public ClassroomConflictException(string message, Exception ex)
- : base(message, ex)
- {
- }
- }
- }
|