1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.Utility;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EducationManagement;
- using EMIS.ViewModel.EducationManage;
- using EMIS.ViewModel.CacheManage;
- using EMIS.ViewModel.UniversityManage.ClassroomManage;
- using EMIS.ViewModel.UniversityManage.TeacherManage;
- using EMIS.DataLogic.Common.Students;
- using EMIS.DataLogic.UniversityManage.TeacherManage;
- using EMIS.DataLogic.RetakeManage;
- using EMIS.DataLogic.SchedulingManage.SchedulingSettings;
- using EMIS.DataLogic.SelectCourse;
- using EMIS.DataLogic.EducationManage;
- using EMIS.DataLogic.Common.CalendarManage;
- using EMIS.DataLogic.EducationSchedule;
- using EMIS.CommonLogic.Students;
- using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
- namespace EMIS.CommonLogic.EducationManagement
- {
- public partial class EducationMissionClassServices : BaseServices, IEducationMissionClassServices
- {
- public ExecutableMinorPlanDAL ExecutableMinorPlanDAL { get; set; }
- public RetakePlanDAL RetakePlanDAL { get; set; }
- public EducationMissionClassDAL educationMissionClassDAL { get; set; }
- public ClassroomScheduleDAL ClassroomScheduleDAL { get; set; }
- public SchoolYearDAL schoolYearDAL { get; set; }
- public IStudentsServices studentServices { get; set; }
- public Lazy<StudentsDAL> StudentsDAL { get; set; }
- public Lazy<StaffDAL> staffDAL { get; set; }
- public CourseTimeHoursDAL CourseTimeHoursDAL { get; set; }
- public CoursesTimeDAL coursesTimeDAL { get; set; }
- public OptionalCourseSettingDAL OptionalCourseSettingDAL { get; set; }
- public ExecutableFreeSelectionCouseDAL ExecutableFreeSelectionCouseDAL { get; set; }
- public EducationMissionOpenControlDAL EducationMissionOpenControlDAL { get; set; }
- /// <summary>
- /// 根据任务班ID查询对应班级
- /// </summary>
- /// <param name="eductionMissionClassID"></param>
- /// <returns></returns>
- public ClassmajorView GetClassmajorByEducationClassID(Guid? eductionMissionClassID)
- {
- Expression<Func<EM_EducationMissionClass, bool>> exp = x => true;
- if (eductionMissionClassID.HasValue)
- {
- exp = exp.And(x => x.EducationMissionClassID == eductionMissionClassID);
- }
- return educationMissionClassDAL.GetClassmajorByEducationMissionClassID(exp);
- }
- //添加学生
- public void AddStudentbyEducationMissionClassID(Guid? educationMissionClassID, List<Guid> userIDs)
- {
- try
- {
- List<CF_Student> stuList = new List<CF_Student>();
- var queryUserIDList = userIDs.Select(x => (Guid?)x).ToList();
- //EM_EducationSchedulingClass educationSchedulingClass = ClassroomScheduleDAL.EducationSchedulingRepository.GetList(x => x.EM_EducationSchedulingClass.EducationMissionClassID == educationMissionClassID);
- EducationMissionClassView educationMissionClassView = GetEducationMissionClassView(educationMissionClassID);
- List<EducationMissionClassStudentView> studentList = GetEducationMissionClassSchedulingStudentViewList(educationMissionClassID);
- var studentcount = studentList.Where(x => queryUserIDList.Contains(x.UserID)).Count();
- if (studentcount > 0)
- {
- throw new Exception("抱歉,您添加的学生的数据中已存在学生,请检查!");
- }
- List<EM_EducationSchedulingClass> educationSchedulingClassList = GetEducationSchedulingClassList(educationMissionClassID);
- EM_EducationSchedulingClass educationSchedulingClass = educationSchedulingClassList.FirstOrDefault();
- foreach (var userID in userIDs)
- {
- Expression<Func<CF_Student, bool>> expression = x => x.UserID == userID;
- educationSchedulingClass.CF_Student.Add(StudentsDAL.Value.StudentRepository.GetSingle(expression));
- }
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 查询教师列表
- /// </summary>
- /// <param name="configuretView">查询条件实体</param>
- /// <param name="campusID">校区ID</param>
- /// <param name="collegeID">学院ID</param>
- /// <param name="DepartmentID">教研室ID</param>
- /// <param name="isPhoto">是否显示照片</param>
- /// <param name="pageIndex">页码</param>
- /// <param name="pageSize">显示码</param>
- /// <returns></returns>
- public IGridResultSet<StaffView> GetStaffViewGrid(ViewModel.ConfiguretView configuretView, Guid? campusID, Guid? collegeID, Guid? departmentID, int? isPhoto, Guid? userID, int pageIndex, int pageSize)
- {
- var query = staffDAL.Value.GetStaffViewQueryable(x => true);
- if (campusID.HasValue)
- query = query.Where(x => x.CampusID == campusID);
- if (collegeID.HasValue)
- query = query.Where(x => x.CollegeID == collegeID);
- if (userID.HasValue)
- query = query.Where(x => x.UserID == userID);
- if (departmentID.HasValue)
- query = query.Where(x => x.DepartmentID == departmentID);
- if (isPhoto > 0)
- query = query.Where(x => x.PhotoUrl != null && x.PhotoUrl != "");
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- return query
- .OrderBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenBy(x => x.StaffCode.Length).ThenBy(x => x.StaffCode)
- .ToGridResultSet<StaffView>(pageIndex, pageSize);
- }
-
- public void DeleteStudentbyEducationMissionClassID(Guid? educationMissionClassID, List<Guid> userIDs)
- {
- try
- {
- List<CF_Student> stuList = new List<CF_Student>();
- var queryUserIDList = userIDs.Select(x => (Guid?)x).ToList();
- //EM_EducationSchedulingClass educationSchedulingClass = ClassroomScheduleDAL.EducationSchedulingRepository.GetList(x => x.EM_EducationSchedulingClass.EducationMissionClassID == educationMissionClassID);
- //EducationMissionClassView educationMissionClassView = GetEducationMissionClassView(educationMissionClassID);
- //List<EducationMissionClassStudentView> studentList = GetEducationMissionClassSchedulingStudentViewList(educationMissionClassID);
- //var studentcount = studentList.Where(x => queryUserIDList.Contains(x.UserID)).Count();
- //if (studentcount > 0)
- //{
- // throw new Exception("抱歉,您添加的学生的数据中已存在学生,请检查!");
- //}
- List<EM_EducationSchedulingClass> educationSchedulingClassList = GetEducationSchedulingClassList(educationMissionClassID);
- EM_EducationSchedulingClass educationSchedulingClass = educationSchedulingClassList.FirstOrDefault();
- foreach (var userID in userIDs)
- {
- Expression<Func<CF_Student, bool>> expression = x => x.UserID == userID;
- educationSchedulingClass.CF_Student.Remove(StudentsDAL.Value.StudentRepository.GetSingle(expression));
- }
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 查询教学任务班
- /// </summary>
- /// <param name="configuretView">查询条件</param>
- /// <param name="schoolyearID">学年学期ID</param>
- /// <param name="courseCode">课程代码</param>
- /// <param name="courseName">课程名称</param>
- /// <param name="name">排课班级</param>
- /// <param name="pageIndex">页数</param>
- /// <param name="pageSize">显示数</param>
- /// <returns></returns>
- public Bowin.Common.Linq.Entity.IGridResultSet<EducationMissionClassView> GetEducationMissionClassViewGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, Guid? schoolyearID, Guid? departmentID, Guid? coursematerialID,
- int? approvalStatus, int? teachingModeID, Guid? classmajorID, int? gradeYearID, int pageIndex, int pageSize)
- {
- bool hasClassmajorFilter = false;
- Expression<Func<EM_EducationMissionClass, bool>> exp = (x => true);
- Expression<Func<CF_Classmajor, bool>> classmajorFilter = x => true;
- if (campusID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_College.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_Department.CollegeID == collegeID);
- }
- if (departmentID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.DepartmentID == departmentID);
- }
- if (gradeYearID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorFilter = classmajorFilter.And(x => x.CF_Grademajor.GradeID == gradeYearID);
- }
- if (classmajorID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorFilter = classmajorFilter.And(x => x.ClassmajorID == classmajorID);
- }
- if (hasClassmajorFilter)
- {
- exp = exp.And(w => w.CF_Classmajor.AsQueryable().Any(classmajorFilter));
- }
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (approvalStatus.HasValue)
- {
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (teachingModeID.HasValue)
- {
- exp = exp.And(x => x.TeachingModeID == teachingModeID);
- }
- var query = educationMissionClassDAL.GetEducationMissionClassViewQueryble(exp);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var result = this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID)
- .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name)
- .ToGridResultSet<EducationMissionClassView>(pageIndex, pageSize);
- var educationMissionClassID = result.rows.Select(x => x.EducationMissionClassID).ToList();
- var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- result.rows.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
- //result.rows.ForEach(x => x.CourseTimeID = new HashSet<EM_CoursesTime>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
- return result;
- }
- /// <summary>
- /// 查询教学任务班
- /// </summary>
- /// <param name="configuretView">查询条件</param>
- /// <param name="schoolyearID">学年学期ID</param>
- /// <param name="courseCode">课程代码</param>
- /// <param name="courseName">课程名称</param>
- /// <param name="name">排课班级</param>
- /// <returns></returns>
- public List<EducationMissionClassView> GetEducationMissionClassViewList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, Guid? schoolyearID, Guid? departmentID, Guid? coursematerialID,
- int? approvalStatus, int? teachingModeID, Guid? classmajorID, int? gradeYearID)
- {
- bool hasClassmajorFilter = false;
- Expression<Func<EM_EducationMissionClass, bool>> exp = (x => true);
- Expression<Func<CF_Classmajor, bool>> classmajorFilter = x => true;
- if (campusID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_College.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_Department.CollegeID == collegeID);
- }
- if (departmentID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.DepartmentID == departmentID);
- }
- if (gradeYearID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorFilter = classmajorFilter.And(x => x.CF_Grademajor.GradeID == gradeYearID);
- }
- if (classmajorID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorFilter = classmajorFilter.And(x => x.ClassmajorID == classmajorID);
- }
- if (hasClassmajorFilter)
- {
- exp = exp.And(w => w.CF_Classmajor.AsQueryable().Any(classmajorFilter));
- }
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (approvalStatus.HasValue)
- {
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (teachingModeID.HasValue)
- {
- exp = exp.And(x => x.TeachingModeID == teachingModeID);
- }
- var query = educationMissionClassDAL.GetEducationMissionClassViewQueryble(exp);
- var educationMissionClassID = query.Select(x => x.EducationMissionClassID).ToList();
- var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var result = this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID)
- .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name)
- .ToList();
- result.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
- return result;
- }
- /// <summary>
- /// 查询教学任务班
- /// </summary>
- /// <param name="configuretView">查询条件</param>
- /// <param name="schoolyearID">学年学期ID</param>
- /// <param name="courseCode">课程代码</param>
- /// <param name="courseName">课程名称</param>
- /// <param name="name">排课班级</param>
- /// <param name="pageIndex">页数</param>
- /// <param name="pageSize">显示数</param>
- /// <returns></returns>
- public Bowin.Common.Linq.Entity.IGridResultSet<EducationMissionClassView> GetEducationMissionClassViewGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, Guid? schoolyearID, int? standardID, Guid? coursematerialID,
- int? approvalStatus, int? teachingModeID, Guid? classmajorID, int? gradeYearID, Guid? CoursesTimeID, int pageIndex, int pageSize)
- {
- bool hasClassmajorFilter = false;
- Expression<Func<EM_EducationMissionClass, bool>> exp = (x => true);
- Expression<Func<CF_Classmajor, bool>> classmajorExp = (x => true);
- if (campusID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_College.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_Department.CollegeID == collegeID);
- }
- if (CoursesTimeID.HasValue)
- {
- exp = exp.And(x => x.EM_CoursesTime.Any(c => c.CoursesTimeID == CoursesTimeID));
- }
- if (standardID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorExp = classmajorExp.And(x => x.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (gradeYearID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorExp = classmajorExp.And(x => x.CF_Grademajor.GradeID == gradeYearID);
- }
- if (classmajorID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorExp = classmajorExp.And(x => x.ClassmajorID == classmajorID);
- }
- if (hasClassmajorFilter)
- {
- exp = exp.And(w => w.CF_Classmajor.AsQueryable().Any(classmajorExp));
- }
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (approvalStatus.HasValue)
- {
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (teachingModeID.HasValue)
- {
- exp = exp.And(x => x.TeachingModeID == teachingModeID);
- }
- var query = educationMissionClassDAL.GetEducationMissionClassViewQueryble(exp);
- if (configuretView.Attribute == "TeacherName" && !string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- var educationMissionClassID = query.Select(x => x.EducationMissionClassID).ToList();
- //获取查询结果教学任务所有教师
- var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- //按教师姓名条件查询对应教学任务
- missionClassTeacherList = missionClassTeacherList.Where(x => x.Name == configuretView.ConditionValue).ToList();
- var missionClassIDList = missionClassTeacherList.Select(x => x.EducationMissionClassID).ToList();
- //由于教学任务可能有多个教师授课,所以还要再拿筛选后的教学任务在匹配一次教师
- missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => missionClassIDList.Contains(x.EducationMissionClassID)).ToList();
- query = query.Where(x => missionClassIDList.Contains(x.EducationMissionClassID));
- var resultQuery = this.GetQueryByDataRangeByDepartment(query).OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID)
- .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name);
- var result = resultQuery.ToGridResultSet<EducationMissionClassView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
- return result;
- }
- else
- {
- if (!string.IsNullOrEmpty(configuretView.ConditionValue) && configuretView.Attribute != "TeacherName")
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var resultQuery = this.GetQueryByDataRangeByDepartment(query).OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID)
- .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name);
- var result = resultQuery.ToGridResultSet<EducationMissionClassView>(pageIndex, pageSize);
- var educationMissionClassID = result.rows.Select(x => x.EducationMissionClassID).ToList();
- var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- result.rows.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
- return result;
- }
- }
- public List<EducationMissionClassView> GetEducationMissionClassViewList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, Guid? schoolyearID, int? standardID, Guid? coursematerialID, int? approvalStatus, int? teachingModeID, Guid? classmajorID, int? gradeYearID, int? learningformID, int? education, string LearnSystem, List<Guid?> EducationMissionClassIDList)
- {
- bool hasClassmajorFilter = false;
- Expression<Func<EM_EducationMissionClass, bool>> exp = (x => true);
- Expression<Func<CF_Classmajor, bool>> classmajorExp = (x => true);
- if (EducationMissionClassIDList!=null)
- {
- exp = exp.And(x => EducationMissionClassIDList.Contains(x.EducationMissionClassID));
- }
- if (campusID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_College.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_Department.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorExp = classmajorExp.And(x => x.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (gradeYearID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorExp = classmajorExp.And(x => x.CF_Grademajor.GradeID == gradeYearID);
- }
- if (classmajorID.HasValue)
- {
- hasClassmajorFilter = true;
- classmajorExp = classmajorExp.And(x => x.ClassmajorID == classmajorID);
- }
- if (hasClassmajorFilter)
- {
- exp = exp.And(w => w.CF_Classmajor.AsQueryable().Any(classmajorExp));
- }
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (approvalStatus.HasValue)
- {
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (teachingModeID.HasValue)
- {
- exp = exp.And(x => x.TeachingModeID == teachingModeID);
- }
- if (learningformID.HasValue)
- exp = exp.And(x => x.CF_Classmajor.Any(w => w.CF_Grademajor.CF_Facultymajor.LearningformID == learningformID));
- if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(LearnSystem);
- exp = exp.And(x => x.CF_Classmajor.Any(w => w.CF_Grademajor.CF_Facultymajor.LearnSystem == LearnSystems));
- }
- if (education.HasValue)
- {
- exp = exp.And(x => x.CF_Classmajor.Any(w => w.CF_Grademajor.CF_Facultymajor.EducationID == education.Value));
- }
- var query = educationMissionClassDAL.GetEducationMissionClassViewQueryble(exp);
- if (configuretView.Attribute == "TeacherName" && !string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- var educationMissionClassID = query.Select(x => x.EducationMissionClassID).ToList();
- //获取查询结果教学任务所有教师
- var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- //按教师姓名条件查询对应教学任务
- missionClassTeacherList = missionClassTeacherList.Where(x => x.Name == configuretView.ConditionValue).ToList();
- var missionClassIDList = missionClassTeacherList.Select(x => x.EducationMissionClassID).ToList();
- //由于教学任务可能有多个教师授课,所以还要再拿筛选后的教学任务在匹配一次教师
- missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => missionClassIDList.Contains(x.EducationMissionClassID)).ToList();
- query = query.Where(x => missionClassIDList.Contains(x.EducationMissionClassID));
- var resultQuery = this.GetQueryByDataRangeByDepartment(query).OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID)
- .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name);
- var result = resultQuery.ToList();
- result.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
- return result;
- }
- else
- {
- if (!string.IsNullOrEmpty(configuretView.ConditionValue) && configuretView.Attribute != "TeacherName")
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var resultQuery = this.GetQueryByDataRangeByDepartment(query).OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID)
- .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name);
- var result = resultQuery.ToList();
- var educationMissionClassID = result.Select(x => x.EducationMissionClassID).ToList();
- var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- result.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
- return result;
- }
- }
- /// <summary>
- /// 查询教学任务班
- /// </summary>
- /// <param name="configuretView">查询条件</param>
- /// <param name="schoolyearID">学年学期ID</param>
- /// <param name="courseCode">课程代码</param>
- /// <param name="courseName">课程名称</param>
- /// <param name="name">排课班级</param>
- /// <returns></returns>
- public List<EducationMissionClassView> GetEducationMissionClassViewList(IList<Guid> educationMissionClassIDList)
- {
- Expression<Func<EM_EducationMissionClass, bool>> exp = (x => educationMissionClassIDList.Contains(x.EducationMissionClassID));
- var query = educationMissionClassDAL.GetEducationMissionClassViewQueryble(exp);
- var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassIDList.Contains(x.EducationMissionClassID)).ToList();
- var result = this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID)
- .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name)
- .ToList();
- var missionClassClassmajorList = educationMissionClassDAL.GetClassmajorQuery(x => educationMissionClassIDList.Contains(x.EducationMissionClassID)).ToList();
- result.ForEach(x => x.ClassmajorViewList = new HashSet<ClassView>
- (missionClassClassmajorList.Where(y => y.CoursematerialID == x.CoursematerialID
- && y.TeachingModeID == x.TeachingModeID
- && y.SchoolyearID == x.SchoolyearID)));
- result.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
- return result;
- }
- /// <summary>
- /// 获取任务班信息
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- public EducationMissionClassView GetEducationMissionClassView(Guid? educationMissionClassID)
- {
- return educationMissionClassDAL.GetEducationMissionClassViewQueryble(x => x.EducationMissionClassID == educationMissionClassID).FirstOrDefault();
- }
- /// <summary>
- /// 获取任务班信息
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- public Entities.EM_EducationMissionClass GetEducationMissionClass(Guid? educationMissionClassID)
- {
- return educationMissionClassDAL.EducationMissionClassRepository.GetSingle(x => x.EducationMissionClassID == educationMissionClassID,
- (x => x.EM_EducationMission),
- (x => x.CF_Classmajor),
- (x => x.EM_CoursesTime),
- (x => x.EM_MissionClassTeacher),
- (x => x.EM_EducationMissionClassSettings),
- (x => x.EM_CourseProcess),
- (x => x.EM_CourseProcess.Select(y => y.EM_CourseProcessTeacher)),
- (x => x.EM_EducationSchedulingClass),
- (x => x.EM_EducationMissionClassTeachingSetting),
- (x => x.CF_Classroom));
- }
- /// <summary>
- /// 保存更新排课序号
- /// </summary>
- /// <param name="educationMissionClasss"></param>
- /// <param name="orderNos"></param>
- public void UpdateEducationMissionClassOrderNo(List<Guid?> educationMissionClassIDs, List<int?> orderNos)
- {
- try
- {
- int i = 0;
- foreach (var educationMissionClassID in educationMissionClassIDs)
- {
- EM_EducationMissionClass educationMissionClass = GetEducationMissionClass(educationMissionClassID);
- educationMissionClass.OrderNo = orderNos[i];
- i++;
- }
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 更新教学任务班信息
- /// </summary>
- /// <param name="educationMissionClassView"></param>
- public void UpdateEducationMissionClass(EducationMissionClassView educationMissionClassView)
- {
- throw new NotImplementedException();
- }
- /// <summary>
- /// 获取设置周数
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- public List<string> GetEducationMissionClassSettings(Guid? educationMissionClassID)
- {
- List<string> listeducation = new List<string>();
- var list = educationMissionClassDAL.GetEducationMissionClassSettingsQueryble(educationMissionClassID);
- if (list.Count > 0)
- return list;
- var educationMissionClass = GetEducationMissionClassView(educationMissionClassID);
- if (educationMissionClass != null)
- {
- for (int i = (int)educationMissionClass.StartWeeklyNum; i <= (int)educationMissionClass.EndWeeklyNum; i++)
- {
- listeducation.Add(i.ToString());
- }
- }
- return listeducation;
- }
- /// <summary>
- /// 获取教学任务授课老师
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- public List<EducationMissionClassTeacherListView> GetEducationMissionClassTeacherListViewList(Guid? educationMissionClassID)
- {
- return educationMissionClassDAL.GetEducationMissionClassTeacherListViewQueryble().Where(x => x.EducationMissionClassID == educationMissionClassID).OrderBy(x => x.TeachingMethod).ToList();
- }
- /// <summary>
- /// 教学安排
- /// </summary>
- /// <param name="educationMissionClassView">实体</param>
- /// <param name="weekNumList">选中周次</param>
- /// <param name="teacherList">教师</param>
- public void EducationMissionClassUpdate(EducationMissionClassView educationMissionClassView, List<int?> weekNumList, List<EducationMissionClassTeacherListView> teacherList)
- {
- try
- {
- if (educationMissionClassView.EducationMissionClassID != null && educationMissionClassView.EducationMissionClassID != Guid.Empty)
- {
- EM_EducationMissionClass educationMissionClass = GetEducationMissionClass(educationMissionClassView.EducationMissionClassID);
- if (educationMissionClass.RecordStatus == (int)EM_EducationMissionClassStatus.Scheduled)
- {
- throw new Exception("当前任务班已经排课,无法进行教学安排。");
- }
- if (educationMissionClass.RecordStatus == (int)EM_EducationMissionClassStatus.Submitted)
- {
- throw new Exception("当前任务班已经提交,无法进行教学安排。");
- }
- if (educationMissionClassView.ClassroomID != null)
- {
- CF_Classroom classroomEntity = educationMissionClassDAL.ClassroomRepository.GetSingle(x => x.ClassroomID == educationMissionClassView.ClassroomID);
- EM_EducationSchedulingClass educationSchedulingEntity = educationMissionClassDAL.EducationSchedulingClassRepository.GetSingle(x => x.EducationMissionClassID == educationMissionClass.EducationMissionClassID, x => x.CF_Student);
- int classNum = educationSchedulingEntity.CF_Student.Count();
- if (classroomEntity != null && classroomEntity.Totalseating != null
- && classroomEntity.Totalseating > 0
- && classNum > classroomEntity.Totalseating)//教学安排班级人数不能大于选定的教室总座位数
- {
- throw new Exception("该教室总座位数不能小于班级人数。");
- }
- }
- if (educationMissionClass != null)
- {
- educationMissionClass.ClassroomID = educationMissionClassView.ClassroomID;
- educationMissionClass.ClassroomTypeID = educationMissionClassView.ClassroomTypeID;
- educationMissionClass.Name = educationMissionClassView.Name;//已提交状态可编辑教学任务名称
- SetModifyStatus(educationMissionClass);
- //添加周次设置表
- if (weekNumList.Count > 0)
- {
- //删除设置
- UnitOfWork.Delete<EM_EducationMissionClassSettings>(x => x.EducationMissionClassID == educationMissionClass.EducationMissionClassID);
- UnitOfWork.Delete<EM_CourseProcess>(x => x.EducationMissionClassID == educationMissionClass.EducationMissionClassID);
- foreach (var weekNum in weekNumList)
- {
- EM_EducationMissionClassSettings educationMissionClassSettings = new EM_EducationMissionClassSettings();
- educationMissionClassSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- educationMissionClassSettings.EducationMissionClassID = educationMissionClass.EducationMissionClassID;
- educationMissionClassSettings.WeeklyNum = weekNum;
- SetNewStatus(educationMissionClassSettings);
- UnitOfWork.Add(educationMissionClassSettings);
- EM_CourseProcess courseProcess = new EM_CourseProcess();
- courseProcess.CourseProcessID = Guid.NewGuid();
- courseProcess.EducationMissionClassID = educationMissionClass.EducationMissionClassID;
- courseProcess.Week = weekNum;
- //周学时改为用户手动修改,不在根据任、限选计划自动修改。
- courseProcess.Times = educationMissionClassView.WeeklyHours;
- courseProcess.ClassroomTypeID = educationMissionClass.ClassroomTypeID;
- courseProcess.ClassroomID = educationMissionClass.ClassroomID;
- teacherList.ForEach(x => {
- var courseProcessTeacher = new EM_CourseProcessTeacher
- {
- CourseProcessTeacherID = Guid.NewGuid(),
- CourseProcessID = courseProcess.CourseProcessID,
- UserID = x.UserID,
- TeachType = x.TeachingMethod
- };
- SetNewStatus(courseProcessTeacher);
- courseProcess.EM_CourseProcessTeacher.Add(courseProcessTeacher);
- });
- SetNewStatus(courseProcess);
- UnitOfWork.Add(courseProcess);
- }
- }
- if (teacherList.Count == 0)
- {
- //删除教师
- UnitOfWork.Delete<EM_MissionClassTeacher>(x => x.MissionClassID == educationMissionClass.EducationMissionClassID);
- }
- //添加教师
- if (teacherList.Count > 0)
- {
- //删除教师
- UnitOfWork.Delete<EM_MissionClassTeacher>(x => x.MissionClassID == educationMissionClass.EducationMissionClassID);
- foreach (var teacher in teacherList)
- {
- EM_MissionClassTeacher missionClassTeacher = new EM_MissionClassTeacher();
- missionClassTeacher.MissionClassTeacherID = Guid.NewGuid();
- missionClassTeacher.MissionClassID = educationMissionClass.EducationMissionClassID;
- missionClassTeacher.UserID = teacher.UserID;
- missionClassTeacher.TeachType = teacher.TeachingMethod;
- SetNewStatus(missionClassTeacher);
- UnitOfWork.Add(missionClassTeacher);
- }
- }
- //添加教学任务时间段
- if (educationMissionClassView.CourseTimeID != null)
- {
- var year = educationMissionClassDAL.GetEducationMissionClassViewQueryble(x => x.EducationMissionClassID == educationMissionClassView.EducationMissionClassID).FirstOrDefault();
- var isok = CourseTimeHoursDAL.GetCoursesTimeQueryable(x => x.RecordStatus > (int?)SYS_STATUS.UNUSABLE, w => w.RecordStatus > (int?)SYS_STATUS.UNUSABLE && w.Years == year.GradeYearID).ToList();
- if (isok.Count() > 0)
- {
- List<EM_CoursesTime> coursesTime = coursesTimeDAL.coursesTimeRepository.Entities.Where(x => x.CoursesTimeID == educationMissionClassView.CourseTimeID).ToList();
- educationMissionClass.EM_CoursesTime = new HashSet<EM_CoursesTime>();
- foreach (var time in coursesTime)
- {
- EM_CoursesTime c = time;
- educationMissionClass.EM_CoursesTime.Add(c);
- }
- }
- }
- UnitOfWork.Commit();
- }
- }
- }
- catch (Exception)
- {
- throw;
- }
- }
- public void EducationMissionConjunctionClassAdd(List<Guid?> educationMissionClassIDs)
- {
- throw new NotImplementedException();
- }
- /// <summary>
- /// 排课分班
- /// </summary>
- /// <param name="educationMissionClassIDs"></param>
- public void DivideIntoClassesAdd(DivideIntoClassesView divideIntoClassesView)
- {
- try
- {
- if (divideIntoClassesView.EducationMissionClassID != null && divideIntoClassesView.EducationMissionClassID != Guid.Empty)
- {
- EM_EducationMissionClass educationMissionClass = GetEducationMissionClass(divideIntoClassesView.EducationMissionClassID);
- if (educationMissionClass.RecordStatus == (int)EM_EducationMissionClassStatus.Scheduled)
- {
- throw new Exception("当前任务班已经排课,无法分班。");
- }
- if (educationMissionClass.RecordStatus == (int)EM_EducationMissionClassStatus.Submitted)
- {
- throw new Exception("当前任务班已经提交,无法分班。");
- }
- if (educationMissionClass != null)
- {
- //获取学生
- var listStudent = GetEducationMissionClassStudentViewList(educationMissionClass.EducationMissionClassID);
- int createMissionClassCount;
- #region 为了兼容以前的旧数据,分班时需要把原任务班的排课班数据重置成新格式
- UnitOfWork.RemoveRange(educationMissionClass.EM_EducationSchedulingClass);
- EM_EducationSchedulingClass newMainEducationSchedulingClass = new EM_EducationSchedulingClass();
- newMainEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newMainEducationSchedulingClass.EducationMissionClassID = educationMissionClass.EducationMissionClassID;
- newMainEducationSchedulingClass.TaskGroupName = "1组";
- SetNewStatus(newMainEducationSchedulingClass);
- UnitOfWork.Add(newMainEducationSchedulingClass);
- #endregion
- var studentGroup = listStudent.GroupBy(x => x.ClassmajorID).ToList();
- if (divideIntoClassesView.OrderType ==true)
- {
- educationMissionClass.CF_Classmajor.RemoveWhere(x => x.ClassmajorID != studentGroup[0].Key);
- educationMissionClass.MainScheduleClassID = studentGroup[0].Key;
- newMainEducationSchedulingClass.CF_Student = new HashSet<CF_Student>(studentGroup[0].Select(x => x));
- createMissionClassCount = studentGroup.Count - 1;
- }
- else
- {
- createMissionClassCount = (divideIntoClassesView.GroupNum ?? 0) - 1;
- if (divideIntoClassesView.OrderType == false)
- {
- listStudent = listStudent.OrderBy(x => x.Sys_User.LoginID).ToList();
- }
- newMainEducationSchedulingClass.CF_Student = new HashSet<CF_Student>(listStudent.Take(divideIntoClassesView.StudentNum ?? 0).ToList());
- //跳过第一个班的学生
- listStudent = listStudent.Skip(divideIntoClassesView.StudentNum ?? 0).ToList();
- }
- for (int i = 0; i < createMissionClassCount; i++)
- {
- string groupNum = (i + 2).ToString();
- string groupName = "(" + groupNum + ")";
- EM_EducationMission newEducationMission = new EM_EducationMission();
- if (divideIntoClassesView.IsNotBuildEducationMission)
- {
- newEducationMission = educationMissionClass.EM_EducationMission;
- }
- else
- {
- newEducationMission.EducationMissionID = Guid.NewGuid();
- newEducationMission.CollegeID = educationMissionClass.EM_EducationMission.CollegeID;
- newEducationMission.DepartmentID = educationMissionClass.EM_EducationMission.DepartmentID;
- newEducationMission.SchoolyearID = educationMissionClass.EM_EducationMission.SchoolyearID;
- newEducationMission.ClassName = educationMissionClass.EM_EducationMission.ClassName + groupName;
- SetNewStatus(newEducationMission);
- UnitOfWork.Add(newEducationMission);
- }
- EM_EducationMissionClass newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = newEducationMission.EducationMissionID;
- if (divideIntoClassesView.OrderType == true)
- {
- newEducationMissionClass.MainScheduleClassID = studentGroup[i + 1].FirstOrDefault().CF_Classmajor.ClassmajorID;
- }
- else
- {
- newEducationMissionClass.MainScheduleClassID = educationMissionClass.MainScheduleClassID;
- }
- newEducationMissionClass.OrderNo = educationMissionClass.OrderNo;
- newEducationMissionClass.Name = educationMissionClass.Name + groupName;
- newEducationMissionClass.TeachingModeID = educationMissionClass.TeachingModeID;
- newEducationMissionClass.OptionalCourseTypeID = educationMissionClass.OptionalCourseTypeID;
- newEducationMissionClass.ClassroomTypeID = educationMissionClass.ClassroomTypeID;
- newEducationMissionClass.ClassroomID = educationMissionClass.ClassroomID;
- newEducationMissionClass.CoursematerialID = educationMissionClass.CoursematerialID;
- newEducationMissionClass.CourseStructureID = educationMissionClass.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = educationMissionClass.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = educationMissionClass.CourseTypeID;
- newEducationMissionClass.CourseQualityID = educationMissionClass.CourseQualityID;
- newEducationMissionClass.ExaminationModeID = educationMissionClass.ExaminationModeID;
- newEducationMissionClass.TeachinglanguageID = educationMissionClass.TeachinglanguageID;
- newEducationMissionClass.HandleModeID = educationMissionClass.HandleModeID;
- newEducationMissionClass.IsNeedMaterial = educationMissionClass.IsNeedMaterial;
- newEducationMissionClass.Remark = educationMissionClass.Remark;
- newEducationMissionClass.ResultTypeID = educationMissionClass.ResultTypeID;
- newEducationMissionClass.EM_CoursesTime = educationMissionClass.EM_CoursesTime;
- SetNewStatus(newEducationMissionClass);
- newEducationMissionClass.RecordStatus = educationMissionClass.RecordStatus;
- if (divideIntoClassesView.OrderType == true)
- {
- newEducationMissionClass.CF_Classmajor.Add(studentGroup[i + 1].FirstOrDefault().CF_Classmajor);
- }
- else
- {
- newEducationMissionClass.CF_Classmajor = educationMissionClass.CF_Classmajor;
- }
- UnitOfWork.Add(newEducationMissionClass);
- EM_EducationMissionClassTeachingSetting newEducationMissionClassTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEducationMissionClassTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationMissionClassTeachingSetting.Credit = educationMissionClass.EM_EducationMissionClassTeachingSetting.Credit;
- newEducationMissionClassTeachingSetting.TheoryCourse = educationMissionClass.EM_EducationMissionClassTeachingSetting.TheoryCourse;
- newEducationMissionClassTeachingSetting.Practicehours = educationMissionClass.EM_EducationMissionClassTeachingSetting.Practicehours;
- newEducationMissionClassTeachingSetting.Trialhours = educationMissionClass.EM_EducationMissionClassTeachingSetting.Trialhours;
- newEducationMissionClassTeachingSetting.WeeklyNum = educationMissionClass.EM_EducationMissionClassTeachingSetting.WeeklyNum;
- newEducationMissionClassTeachingSetting.TheoryWeeklyNum = educationMissionClass.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum;
- newEducationMissionClassTeachingSetting.PracticeWeeklyNum = educationMissionClass.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum;
- newEducationMissionClassTeachingSetting.TrialWeeklyNum = educationMissionClass.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum;
- newEducationMissionClassTeachingSetting.StartWeeklyNum = educationMissionClass.EM_EducationMissionClassTeachingSetting.StartWeeklyNum;
- newEducationMissionClassTeachingSetting.EndWeeklyNum = educationMissionClass.EM_EducationMissionClassTeachingSetting.EndWeeklyNum;
- newEducationMissionClassTeachingSetting.WeeklyHours = educationMissionClass.EM_EducationMissionClassTeachingSetting.WeeklyHours;
- UnitOfWork.Add(newEducationMissionClassTeachingSetting);
- //生成任务班设置表
- foreach (var educationMissionClassSettings in educationMissionClass.EM_EducationMissionClassSettings.ToList())
- {
- EM_EducationMissionClassSettings newEducationMissionClassSettings = new EM_EducationMissionClassSettings();
- newEducationMissionClassSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- newEducationMissionClassSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationMissionClassSettings.WeeklyNum = educationMissionClassSettings.WeeklyNum;
- SetNewStatus(newEducationMissionClassSettings);
- UnitOfWork.Add(newEducationMissionClassSettings);
- }
- //生成任课老师
- foreach (var educationMissionClassTeacher in educationMissionClass.EM_MissionClassTeacher.ToList())
- {
- EM_MissionClassTeacher newMissionClassTeacher = new EM_MissionClassTeacher();
- newMissionClassTeacher.MissionClassTeacherID = Guid.NewGuid();
- newMissionClassTeacher.MissionClassID = newEducationMissionClass.EducationMissionClassID;
- newMissionClassTeacher.UserID = educationMissionClassTeacher.UserID;
- newMissionClassTeacher.TeachType = educationMissionClassTeacher.TeachType;
- SetNewStatus(newMissionClassTeacher);
- UnitOfWork.Add(newMissionClassTeacher);
- }
- //生成课程进度
- foreach (var courseProcess in educationMissionClass.EM_CourseProcess.ToList())
- {
- EM_CourseProcess newCourseProcess = new EM_CourseProcess();
- newCourseProcess.CourseProcessID = Guid.NewGuid();
- newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newCourseProcess.Week = courseProcess.Week;
- newCourseProcess.Times = courseProcess.Times;
- newCourseProcess.ClassroomTypeID = courseProcess.ClassroomTypeID;
- newCourseProcess.ClassroomID = courseProcess.ClassroomID;
- newCourseProcess.EM_CourseProcessTeacher = new HashSet<EM_CourseProcessTeacher>();
- courseProcess.EM_CourseProcessTeacher.ToList().ForEach(x => {
- var newCourseProcessTeacher = new EM_CourseProcessTeacher
- {
- CourseProcessTeacherID = Guid.NewGuid(),
- CourseProcessID = newCourseProcess.CourseProcessID,
- UserID = x.UserID,
- TeachType = x.TeachType
- };
- this.SetNewStatus(newCourseProcessTeacher);
- newCourseProcess.EM_CourseProcessTeacher.Add(newCourseProcessTeacher);
- });
- SetNewStatus(newCourseProcess);
- UnitOfWork.Add(newCourseProcess);
- }
- //生成排课班
- EM_EducationSchedulingClass newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = groupNum + "组";
- SetNewStatus(newEducationSchedulingClass);
- if (divideIntoClassesView.OrderType == true)
- {
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>(studentGroup[i + 1]);
- }
- else
- {
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>(listStudent.Take(divideIntoClassesView.StudentNum ?? 0).ToList());
- listStudent = listStudent.Skip(divideIntoClassesView.StudentNum ?? 0).ToList();
- }
- //当运行到最后一次循环,需要把剩余的学生都加入到这个排课班中
- if (i == createMissionClassCount - 1 && divideIntoClassesView.OrderType != true)
- {
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>(newEducationSchedulingClass.CF_Student.Concat(listStudent));
- }
- var retakePlanStudentList = newEducationSchedulingClass.CF_Student.SelectMany(x => x.ER_RetakePlanStudent)
- .Where(x => x.EducationMissionID == educationMissionClass.EducationMissionID).ToList();
- retakePlanStudentList.ForEach(x => x.EducationMissionID = newEducationMission.EducationMissionID);
- UnitOfWork.Add(newEducationSchedulingClass);
- }
- educationMissionClass.EM_EducationMission.ClassName += "(1)";
- educationMissionClass.Name += "(1)";
- UnitOfWork.Commit();
- }
- }
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- /// <summary>
- /// 分班信息
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- public DivideIntoClassesView GetDivideIntoClassesView(Guid? educationMissionClassID)
- {
- string ClassName = string.Empty;
- int StudentTotalNum = 0; //学生总数
- DivideIntoClassesView divideIntoClassesView = new DivideIntoClassesView();
- var listDivideIntoClassesView = educationMissionClassDAL.GetDivideIntoClassesViewQueryable().Where(x => x.EducationMissionClassID == educationMissionClassID).ToList();
- foreach (var item in listDivideIntoClassesView)
- {
- ClassName = item.ClassName;
- StudentTotalNum += (int)item.StudentTotalNum;
- }
- divideIntoClassesView.ClassName = ClassName;
- divideIntoClassesView.StudentTotalNum = StudentTotalNum;
- return divideIntoClassesView;
- }
- /// <summary>
- /// 排课班表
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- public EM_EducationSchedulingClass GetEducationSchedulingClass(Guid? educationSchedulingClassID)
- {
- System.Linq.Expressions.Expression<Func<EM_EducationSchedulingClass, bool>> expression = (x => x.EducationSchedulingClassID == educationSchedulingClassID);
- return educationMissionClassDAL.EducationSchedulingClassRepository.GetSingle(expression, (x => x.CF_Student));
- }
- /// <summary>
- /// 获取排课班学生信息
- /// </summary>
- /// <param name="educationMissionClassID">任务班ID</param>
- /// <param name="IsStudentLogin">按学号顺序进行分组</param>
- /// <returns></returns>
- private List<CF_Student> GetEducationMissionClassStudentViewList(Guid? educationMissionClassID)
- {
- List<CF_Student> listStudent = new List<CF_Student>();
- List<EM_EducationSchedulingClass> listEducationSchedulingClass = GetEducationSchedulingClassList(educationMissionClassID);
- return listEducationSchedulingClass.SelectMany(x => x.CF_Student).ToList();
- }
- /// <summary>
- /// 获取排课班信息
- /// </summary>
- /// <returns></returns>
- public IGridResultSet<EducationSchedulingClassView> GetEducationSchedulingClassViewGrid(Guid? educationMissionClassID, int pageIndex, int pageSize)
- {
- var query = educationMissionClassDAL.GetEducationSchedulingClassViewQueryable().Where(x => x.EducationMissionClassID == educationMissionClassID);
- return query.OrderBy(x => x.TaskGroupName).ToGridResultSet<EducationSchedulingClassView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 获取排课班学生信息
- /// </summary>
- /// <param name="educationSchedulingClassID">排课班ID</param>
- /// <returns></returns>
- public IGridResultSet<EducationMissionClassStudentView> GetEducationMissionClassStudentViewGrid(Guid? educationSchedulingClassID, int pageIndex, int pageSize)
- {
- return educationMissionClassDAL.GetEducationMissionClassStudentViewQueryable(educationSchedulingClassID).OrderBy(x => x.LoginID).ToGridResultSet<EducationMissionClassStudentView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 获取排课班列表
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- private List<EM_EducationSchedulingClass> GetEducationSchedulingClassList(Guid? educationMissionClassID)
- {
- return educationMissionClassDAL.EducationSchedulingClassRepository
- .GetList(x => x.EducationMissionClassID == educationMissionClassID,
- (x => x.CF_Student),
- (x => x.CF_Student.Select(w => w.Sys_User)),
- (x => x.CF_Student.Select(w => w.CF_Classmajor)),
- (x => x.CF_Student.Select(w => w.ER_RetakePlanStudent))
- ).ToList();
- }
- /// <summary>
- /// 获取任务班对应的所以排课班学生信息
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<EducationMissionClassStudentView> GetEducationMissionClassSchedulingStudentViewGrid(Guid? educationMissionClassID, int pageIndex, int pageSize)
- {
- return educationMissionClassDAL.GetEducationMissionClassSchedulingStudentViewQueryble(educationMissionClassID).OrderBy(x => x.LoginID).ToGridResultSet<EducationMissionClassStudentView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 获取任务班对应的所以排课班学生信息
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public List<EducationMissionClassStudentView> GetEducationMissionClassSchedulingStudentViewList(Guid? educationMissionClassID)
- {
- return educationMissionClassDAL.GetEducationMissionClassSchedulingStudentViewQueryble(educationMissionClassID).OrderBy(x => x.LoginID).ToList();
- }
- /// <summary>
- /// 合班
- /// </summary>
- /// <param name="educationMissionClassView"></param>
- /// <param name="educationMissionClassIDs"></param>
- public void EducationMissionClassConjunctionAdd(EducationMissionClassView educationMissionClassView, List<Guid?> educationMissionClassIDs)
- {
- try
- {
- var educationMissionClassList = educationMissionClassDAL.EducationMissionClassRepository
- .GetList(x => educationMissionClassIDs.Contains(x.EducationMissionClassID),
- (x => x.CF_Classmajor),
- (x => x.EM_EducationMission),
- (x => x.EM_EducationMission.ER_FinalExamination.Select(w => w.EM_EducationMission)),
- (x => x.EM_EducationMission.ER_RetakePlanStudent.Select(w => w.EM_EducationMission)),
- (x => x.EM_EducationMission.EX_ExaminationPlan.Select(w => w.EM_EducationMission)),
- (x => x.EM_EducationMissionClassSettings),
- (x => x.EM_EducationMissionClassTeachingSetting),
- (x => x.EM_EducationSchedulingClass),
- (x => x.EM_EducationSchedulingClass.Select(w => w.CF_Student)),
- (x => x.EM_EducationSchedulingClass.Select(w => w.CF_Student.Select(v => v.ER_RetakePlanStudent))),
- (x => x.EM_EvaluationSetting),
- (x => x.EM_EvaluationEnter),
- (x => x.EM_MissionClassTeacher),
- (x => x.EM_CourseProcess),
- (x => x.EM_CoursesTime),
- (x => x.EM_CourseProcess.Select(y => y.EM_CourseProcessTeacher))).ToList();
- EM_EducationMission mainEducationMission = null;
- EM_EducationMissionClass mainEducationMissionClass = null;
- int? type = null; //
- if (educationMissionClassList.Count > 0)
- {
- type = educationMissionClassList[0].OptionalCourseTypeID;
- }
- foreach (var educationMissionClass in educationMissionClassList)
- {
- if (type != null)
- {
- if (type == educationMissionClass.OptionalCourseTypeID)
- {
- type = educationMissionClass.OptionalCourseTypeID;
- }
- else
- {
- throw new Exception("不是相同选修类型的任务,不能合班。如限选只能与限选合班");
- }
- }
- if (educationMissionClass.EducationMissionClassID == educationMissionClassView.EducationMissionClassID)
- {
- mainEducationMission = educationMissionClass.EM_EducationMission;
- mainEducationMissionClass = educationMissionClass;
- }
- }
- if (mainEducationMission == null)
- {
- throw new Exception("主要排课任务班数据异常,没有匹配的教学任务。");
- }
- #region 根据主要班级生成新的任务班
- string teachingModeName = IdNameExt.GetDictionaryItem(DictionaryItem.CF_TeachingMode.ToString())
- .Where(x => x.Value == mainEducationMissionClass.TeachingModeID).Select(x => x.Name).FirstOrDefault();
- EM_EducationMission newEducationMission = new EM_EducationMission();
- newEducationMission.EducationMissionID = Guid.NewGuid();
- newEducationMission.CollegeID = mainEducationMission.CollegeID;
- newEducationMission.DepartmentID = mainEducationMission.DepartmentID;
- newEducationMission.SchoolyearID = mainEducationMission.SchoolyearID;
- string teachingModeString = "(" + teachingModeName + ")";
- newEducationMission.ClassName = educationMissionClassView.Name.Replace("-" + teachingModeString, "");
- newEducationMission.ClassName = newEducationMission.ClassName.Replace(teachingModeString, "");
- SetNewStatus(newEducationMission);
- UnitOfWork.Add(newEducationMission);
- #region 将教学任务对应的期末设定指向新的合班后的教学任务,防止学分之类的信息丢失
- var finalExaminationList = educationMissionClassList.SelectMany(x => x.EM_EducationMission.ER_FinalExamination).ToList();
- finalExaminationList.ForEach(x => x.EducationMissionID = newEducationMission.EducationMissionID);
- #endregion
- #region 将教学任务对应的重修名单指向新的合班后的教学任务
- var retakePlanStudentList = educationMissionClassList.SelectMany(x => x.EM_EducationMission.ER_RetakePlanStudent).ToList();
- retakePlanStudentList.ForEach(x => x.EducationMissionID = newEducationMission.EducationMissionID);
- #endregion
- #region 将教学任务对应的考试计划指向新的合班后的教学任务
- var examinationPlanList = educationMissionClassList.SelectMany(x => x.EM_EducationMission.EX_ExaminationPlan).ToList();
- examinationPlanList.ForEach(x => x.EducationMissionID = newEducationMission.EducationMissionID);
- #endregion
- EM_EducationMissionClass newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = newEducationMission.EducationMissionID;
- newEducationMissionClass.MainScheduleClassID = mainEducationMissionClass.MainScheduleClassID;
- newEducationMissionClass.OrderNo = mainEducationMissionClass.OrderNo;
- newEducationMissionClass.Name = educationMissionClassView.Name;
- newEducationMissionClass.TeachingModeID = mainEducationMissionClass.TeachingModeID;
- newEducationMissionClass.OptionalCourseTypeID = mainEducationMissionClass.OptionalCourseTypeID;
- newEducationMissionClass.ClassroomTypeID = mainEducationMissionClass.ClassroomTypeID;
- newEducationMissionClass.ClassroomID = mainEducationMissionClass.ClassroomID;
- newEducationMissionClass.CoursematerialID = mainEducationMissionClass.CoursematerialID;
- newEducationMissionClass.CourseStructureID = mainEducationMissionClass.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = mainEducationMissionClass.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = mainEducationMissionClass.CourseTypeID;
- newEducationMissionClass.CourseQualityID = mainEducationMissionClass.CourseQualityID;
- newEducationMissionClass.ExaminationModeID = mainEducationMissionClass.ExaminationModeID;
- newEducationMissionClass.TeachinglanguageID = mainEducationMissionClass.TeachinglanguageID;
- newEducationMissionClass.HandleModeID = mainEducationMissionClass.HandleModeID;
- newEducationMissionClass.IsNeedMaterial = mainEducationMissionClass.IsNeedMaterial;
- newEducationMissionClass.ResultTypeID = mainEducationMissionClass.ResultTypeID;
- newEducationMissionClass.Remark = mainEducationMissionClass.Remark;
- SetNewStatus(newEducationMissionClass);
- newEducationMissionClass.RecordStatus = (int)EMIS.ViewModel.EM_EducationMissionClassStatus.NotSubmitted;
- newEducationMissionClass.EM_CoursesTime = mainEducationMissionClass.EM_CoursesTime;
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>(educationMissionClassList
- .SelectMany(x => x.CF_Classmajor)
- .GroupBy(x => x.ClassmajorID, (x, y) => y.FirstOrDefault())
- .ToList());
- UnitOfWork.Add(newEducationMissionClass);
- #region 将教学任务班对应的教学评价指向新的合班后的教学任务班
- var evaluationSettingList = educationMissionClassList.SelectMany(x => x.EM_EvaluationSetting).ToList();
- evaluationSettingList.ForEach(x => x.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID);
- var evaluationEnterList = educationMissionClassList.SelectMany(x => x.EM_EvaluationEnter).ToList();
- evaluationEnterList.ForEach(x => x.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID);
- #endregion
- EM_EducationMissionClassTeachingSetting newEducationMissionClassTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEducationMissionClassTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationMissionClassTeachingSetting.Credit = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.Credit;
- newEducationMissionClassTeachingSetting.TheoryCourse = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.TheoryCourse;
- newEducationMissionClassTeachingSetting.Practicehours = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.Practicehours;
- newEducationMissionClassTeachingSetting.Trialhours = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.Trialhours;
- newEducationMissionClassTeachingSetting.WeeklyNum = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.WeeklyNum;
- newEducationMissionClassTeachingSetting.TheoryWeeklyNum = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum;
- newEducationMissionClassTeachingSetting.PracticeWeeklyNum = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum;
- newEducationMissionClassTeachingSetting.TrialWeeklyNum = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum;
- newEducationMissionClassTeachingSetting.StartWeeklyNum = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.StartWeeklyNum;
- newEducationMissionClassTeachingSetting.EndWeeklyNum = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.EndWeeklyNum;
- newEducationMissionClassTeachingSetting.WeeklyHours = mainEducationMissionClass.EM_EducationMissionClassTeachingSetting.WeeklyHours;
- UnitOfWork.Add(newEducationMissionClassTeachingSetting);
- //生成任务班设置表
- foreach (var mainEducationMissionClassSettings in mainEducationMissionClass.EM_EducationMissionClassSettings.ToList())
- {
- EM_EducationMissionClassSettings newEducationMissionClassSettings = new EM_EducationMissionClassSettings();
- newEducationMissionClassSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- newEducationMissionClassSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationMissionClassSettings.WeeklyNum = mainEducationMissionClassSettings.WeeklyNum;
- SetNewStatus(newEducationMissionClassSettings);
- UnitOfWork.Add(newEducationMissionClassSettings);
- }
- //生成任课老师
- foreach (var mainMissionClassTeacher in mainEducationMissionClass.EM_MissionClassTeacher.ToList())
- {
- EM_MissionClassTeacher newMissionClassTeacher = new EM_MissionClassTeacher();
- newMissionClassTeacher.MissionClassTeacherID = Guid.NewGuid();
- newMissionClassTeacher.MissionClassID = newEducationMissionClass.EducationMissionClassID;
- newMissionClassTeacher.UserID = mainMissionClassTeacher.UserID;
- newMissionClassTeacher.TeachType = mainMissionClassTeacher.TeachType;
- SetNewStatus(newMissionClassTeacher);
- UnitOfWork.Add(newMissionClassTeacher);
- }
- //生成课程进度
- foreach (var mainCourseProcess in mainEducationMissionClass.EM_CourseProcess.ToList())
- {
- EM_CourseProcess newCourseProcess = new EM_CourseProcess();
- newCourseProcess.CourseProcessID = Guid.NewGuid();
- newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newCourseProcess.Week = mainCourseProcess.Week;
- newCourseProcess.Times = mainCourseProcess.Times;
- newCourseProcess.ClassroomTypeID = mainCourseProcess.ClassroomTypeID;
- newCourseProcess.ClassroomID = mainCourseProcess.ClassroomID;
- mainCourseProcess.EM_CourseProcessTeacher.ToList().ForEach(x =>
- {
- var newCourseProcessTeacher = new EM_CourseProcessTeacher
- {
- CourseProcessTeacherID = Guid.NewGuid(),
- CourseProcessID = newCourseProcess.CourseProcessID,
- UserID = x.UserID,
- TeachType = x.TeachType
- };
- this.SetNewStatus(newCourseProcessTeacher);
- newCourseProcess.EM_CourseProcessTeacher.Add(newCourseProcessTeacher);
- });
- SetNewStatus(newCourseProcess);
- UnitOfWork.Add(newCourseProcess);
- }
- //生成排课班
- EM_EducationSchedulingClass newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- SetNewStatus(newEducationSchedulingClass);
- //获取主排课班学生
- List<CF_Student> studentList = educationMissionClassList
- .SelectMany(x => x.EM_EducationSchedulingClass)
- .SelectMany(x => x.CF_Student)
- .GroupBy(x => x.UserID, (x, y) => y.FirstOrDefault())
- .ToList();
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>(studentList);
- UnitOfWork.Add(newEducationSchedulingClass);
- var allEducationMissionIDList = educationMissionClassList.Select(x => x.EducationMissionID).Distinct().ToList();
- //var retakePlanStudentList = newEducationSchedulingClass.CF_Student.SelectMany(x => x.ER_RetakePlanStudent)
- // .Where(x => allEducationMissionIDList.Contains(x.EducationMissionID)).ToList();
- //retakePlanStudentList.ForEach(x => x.EducationMissionID = newEducationMission.EducationMissionID);
- #endregion
- #region 将参与合班的教学任务其他的任务班拉到这个合并后的教学任务中
- var allEducationMissionClassList = educationMissionClassDAL.EducationMissionClassRepository
- .GetList(x => allEducationMissionIDList.Contains(x.EducationMissionID) && !educationMissionClassIDs.Contains(x.EducationMissionClassID))
- .ToList();
- foreach (var otherEducationMissionClass in allEducationMissionClassList)
- {
- otherEducationMissionClass.EducationMissionID = newEducationMission.EducationMissionID;
- }
- #endregion
- //删除课程类型
- foreach (var id in educationMissionClassIDs)
- {
- if (id != mainEducationMissionClass.EducationMissionClassID)
- {
- EM_EducationMissionClass EducationMissionClass = GetEducationMissionClass(id);
- EducationMissionClass.EM_CoursesTime = new HashSet<EM_CoursesTime>();
- }
- }
- mainEducationMissionClass.EM_CoursesTime = new HashSet<EM_CoursesTime>();
- UnitOfWork.Remove<EM_EducationMissionClassTeachingSetting>(x => educationMissionClassIDs.Contains(x.EducationMissionClassID));
- UnitOfWork.Remove<EM_EducationMissionClass>(x => educationMissionClassIDs.Contains(x.EducationMissionClassID));
- UnitOfWork.Remove<EM_EducationMission>(x => allEducationMissionIDList.Contains(x.EducationMissionID)); //删除教学任务
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 获取主表对象
- /// </summary>
- /// <param name="educationMissionID"></param>
- /// <returns></returns>
- public EM_EducationMission GetEducationMission(Guid? educationMissionID)
- {
- return educationMissionClassDAL.EducationMissionRepository.GetSingle(x => x.EducationMissionID == educationMissionID);
- }
- /// <summary>
- /// 获取学籍班的所有任务班
- /// </summary>
- /// <param name="educationMissionID">学籍班ID</param>
- /// <returns></returns>
- public List<EM_EducationMissionClass> GetEducationMissionClassList(Guid? educationMissionID)
- {
- return educationMissionClassDAL.EducationMissionClassRepository.GetList(x => x.EducationMissionID == educationMissionID, (x => x.EM_EducationSchedulingClass)).ToList();
- }
- /// <summary>
- /// 获取学籍班的所有任务班
- /// </summary>
- /// <returns></returns>
- public List<EM_EducationMissionClass> GetEducationMissionClassList()
- {
- return educationMissionClassDAL.EducationMissionClassRepository.GetList(x => true, (x => x.EM_MissionClassTeacher), (x => x.EM_EducationMissionClassSettings)).ToList();
- }
- /// <summary>
- /// 更新教学任务班表 处理状态
- /// </summary>
- /// <param name="educationMissionClassIDs"></param>
- public void EducationMissionClassUpdate(List<Guid?> educationMissionClassIDs)
- {
- try
- {
- string massge = string.Empty;
- var educationMissionClassList = educationMissionClassDAL
- .GetEducationMissionClass(x => educationMissionClassIDs.Contains(x.EducationMissionClassID)).Distinct().ToList();
- var educationMissionIDList = educationMissionClassList.Select(x => x.EducationMissionID).Distinct();
- //var courseProcessList = educationMissionClassDAL.GetRelatedCourseProcess(x => educationMissionClassIDs.Contains(x.EducationMissionClassID))
- // .ToList();
- foreach (var educationMissionClass in educationMissionClassList)
- {
- if (educationMissionClass.RecordStatus != (int)EMIS.ViewModel.EM_EducationMissionClassStatus.NotSubmitted)
- massge += educationMissionClass.Name + "任务班,已提交,不能重复提交。";
- if (educationMissionClass.EM_MissionClassTeacher.Count == 0 && !Const.LOCAL_SETTING_MISSIONCLASS_CAN_SUBMIT_NOTEACHER)
- massge += educationMissionClass.Name + "任务班,未设置授课老师。";
- if (educationMissionClass.EM_EducationMissionClassSettings.Count == 0)
- massge += educationMissionClass.Name + "任务班,未设置授课周次。";
- if (educationMissionClass.ClassroomTypeID == null)
- massge += educationMissionClass.Name + "任务班,未设置教室类型。";
- var courseProcessList = educationMissionClassDAL.GetRelatedCourseProcess(x => x.EducationMissionClassID == educationMissionClass.EducationMissionClassID)
- .ToList();
- var hours = courseProcessList.Select(x => x.Times).Sum();
- //总学时
- int? totalHours = (educationMissionClass.EM_EducationMissionClassTeachingSetting.TheoryCourse ?? 0)
- + (educationMissionClass.EM_EducationMissionClassTeachingSetting.Practicehours ?? 0);
- //TODO:兵良说:排课学时要小于等于总学时 2016年10月17日18:48:49
- if (hours > totalHours)
- {
- massge += educationMissionClass.Name + "任务班,课程进度设置错误,请检查并重新设置后提交。";
- }
- if (!string.IsNullOrEmpty(massge))
- massge += ",";
- }
- //20161110 MM姐提的要求, 先提交数据检测是否问题,有问题把所有问题反馈回页面让客户进行修改,再重新提交
- if (!string.IsNullOrEmpty(massge))
- throw new Exception(massge.TrimEnd(','));
- foreach (var educationMissionClass in educationMissionClassList)
- {
- educationMissionClass.RecordStatus = (int)EMIS.ViewModel.EM_EducationMissionClassStatus.Submitted;
- }
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
- throw;
- }
- }
- public void UnSubmit(List<Guid?> educationMissionClassIDs)
- {
- try
- {
- string massge = string.Empty;
- var educationMissionClassList = educationMissionClassDAL
- .GetEducationMissionClass(x => educationMissionClassIDs.Contains(x.EducationMissionClassID)).Distinct().ToList();
- foreach (var educationMissionClass in educationMissionClassList)
- {
- if (educationMissionClass.RecordStatus == (int)EMIS.ViewModel.EM_EducationMissionClassStatus.NotSubmitted)
- massge += educationMissionClass.Name + "任务班未提交,不能撤销。";
- if (educationMissionClass.RecordStatus == (int)EMIS.ViewModel.EM_EducationMissionClassStatus.Scheduled)
- massge += educationMissionClass.Name + "任务班已排课,不能撤销。";
- }
- if (!string.IsNullOrEmpty(massge))
- throw new Exception(massge.TrimEnd(','));
- foreach (var educationMissionClass in educationMissionClassList)
- {
- educationMissionClass.RecordStatus = (int)EMIS.ViewModel.EM_EducationMissionClassStatus.NotSubmitted;
- }
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
- throw;
- }
- }
- public void Delete(List<Guid?> educationMissionClassIDs)
- {
- try
- {
- var educationMissionClassList = this.educationMissionClassDAL.EducationMissionClassRepository
- .GetList(x => educationMissionClassIDs.Contains(x.EducationMissionClassID),
- (x => x.CF_Classmajor),
- (x => x.EM_EducationMission),
- (x => x.EM_EducationMission.EM_EducationMissionClass),
- (x => x.EM_EducationSchedulingClass.Select(w => w.ES_EducationScheduling)),
- (x => x.EM_EducationMissionClassSettings),
- (x => x.EM_EducationMissionClassTeachingSetting),
- (x => x.EM_MissionClassTeacher),
- (x => x.EM_CoursesTime)).ToList();
- //先找出教学任务主表ID,若是重修生成的教学任务,更新重修任务时用到
- var educationMissionIDList = educationMissionClassList.Select(x => x.EducationMissionID).Distinct().ToList();
- var errorList = new List<string>();
- foreach (var educationMissionClass in educationMissionClassList)
- {
- //任选课生成时就已经排了课,所以即使已排课状态也可以删除
- if (educationMissionClass.RecordStatus == (int)EM_EducationMissionClassStatus.Scheduled
- && !(educationMissionClass.HandleModeID == (int)CF_HandleMode.SelectionCourse && educationMissionClass.OptionalCourseTypeID == (int)CF_CourseSelectType.FreeSelectionCourse))
- {
- errorList.Add("任务班" + educationMissionClass.Name + "包含已排课状态,不能删除");
- }
- }
- if (errorList.Count > 0)
- {
- throw new Exception(string.Join("\n", errorList));
- }
- //由于要兼容合班,因此不能直接以任务班自身的ID去搜索执行计划,必须用学年学期、年级专业、课程这三个条件去找匹配的执行计划来更新状态
- var executablePlanList = educationMissionClassDAL.GetRelatedExecutablePlan(x => educationMissionClassIDs.Contains(x.EducationMissionClassID)).ToList();
- //先预先找出需要删除的教学任务,逻辑是找出自身教学任务中,没有和自己不同的其他任务班的教学任务
- var needDeleteEducationMissionList = (from emc in educationMissionClassList
- where !emc.EM_EducationMission.EM_EducationMissionClass
- .Any(x => !educationMissionClassIDs.Contains(x.EducationMissionClassID))
- group emc.EM_EducationMission by emc.EM_EducationMission.EducationMissionID into g
- select g.FirstOrDefault()).ToList();
- List<Guid> educationMissionClassIDList = new List<Guid>();
- var ExecutableMinorPlanList = ExecutableMinorPlanDAL.ExecutableMinorPlanRepository.GetList(x => true,(x=>x.EM_EducationMissionClass)).ToList();
- var ExecutableMinorPlanEducationMissionList = ExecutableMinorPlanDAL.GetEducationMissionClassQuerybles().ToList();
-
- foreach (var educationMissionClass in educationMissionClassList)
- {
- var ExecutableMinorPlanIDList = ExecutableMinorPlanEducationMissionList.Where(x => x.EducationMissionClassID == educationMissionClass.EducationMissionClassID).Select(x => x.ExecutableMinorPlanID).ToList();
- if (ExecutableMinorPlanIDList.Count>0)
- {
- var ExecutableMinorPlan = ExecutableMinorPlanList.Where(x => ExecutableMinorPlanIDList.Contains(x.ExecutableMinorPlanID));
- foreach (var ExecutableMinor in ExecutableMinorPlan)
- {
- ExecutableMinor.EM_EducationMissionClass=new HashSet<EM_EducationMissionClass>();
- ExecutableMinor.RecordStatus = (int)EM_ExecuteStatus.NotSubmited;
- }
- }
- educationMissionClassIDList.Add(educationMissionClass.EducationMissionClassID);
- educationMissionClass.EM_CoursesTime = new HashSet<EM_CoursesTime>();
- var educationSchedulingIDList = educationMissionClass.EM_EducationSchedulingClass
- .SelectMany(x => x.ES_EducationScheduling).Select(x => x.EducationSchedulingID).ToList();
- //由于前面已经有拦截必修和限选的排课状态数据,所以这里应该只会包含任选课的排课表,可以放心地删掉
- UnitOfWork.Remove<ES_EducationSchedulingWeekNum>(x => educationSchedulingIDList.Contains(x.EducationSchedulingID.Value));
- UnitOfWork.Remove<ES_EducationSchedulingTeacher>(x => educationSchedulingIDList.Contains(x.EducationSchedulingID.Value));
- UnitOfWork.Remove<ES_EducationScheduling>(x => educationSchedulingIDList.Contains(x.EducationSchedulingID));
- UnitOfWork.RemoveRange(educationMissionClass.EM_CourseProcess);
- UnitOfWork.RemoveRange(educationMissionClass.EM_EducationSchedulingClass);
- if (educationMissionClass.HandleModeID == (int)CF_HandleMode.SelectionCourse && educationMissionClass.OptionalCourseTypeID == (int)CF_CourseSelectType.OptionalCourse)
- UnitOfWork.RemoveRange(educationMissionClass.EM_EducationSchedulingClass);
- UnitOfWork.RemoveRange(educationMissionClass.EM_EducationMissionClassSettings);
- UnitOfWork.RemoveRange(educationMissionClass.EM_MissionClassTeacher);
- UnitOfWork.Remove(educationMissionClass.EM_EducationMissionClassTeachingSetting);
- UnitOfWork.Remove(educationMissionClass);
- }
- //UnitOfWork.Commit();
- foreach (var executablePlan in executablePlanList)
- {
- executablePlan.RecordStatus = (int)EM_ExecuteStatus.NotSubmited;
- }
- //由于任务班会分班合班,无法直接关联,所以现在改为直接找报名学生都不在任务班中的限选设定进行重置
- var value = schoolYearDAL.schoolyearRepository.Entities.Where(x => x.IsCurrent == true).FirstOrDefault().Value;
- var executableOptionalCourseList = OptionalCourseSettingDAL.GetNoMissionClassExecutableOptionalCourse(value, educationMissionClassIDList).ToList();
- foreach (var executableOptionalCourse in executableOptionalCourseList)
- {
- //要删除的教学任务对应的限选设定,变成取消开班状态
- executableOptionalCourse.RecordStatus = (int)EM_SelectCourseResultStatus.CancleCreate;
- }
- //任选设定同上,分别是任选设定还要强制删除课程进度及排课
- var executableFreeSelectionCourseList = ExecutableFreeSelectionCouseDAL.GetNoMissionClassExecutableFreeSelectionCourse(value, educationMissionClassIDList).ToList();
- foreach (var executableFreeSelectionCourse in executableFreeSelectionCourseList)
- {
- executableFreeSelectionCourse.RecordStatus = (int)EM_SelectCourseResultStatus.CancleCreate;
- }
- //考虑到重修开班时根据授课方式生成多个教学任务班时,只有当教学任务班都删除完时才修改重修计划
- var educationMissionIDList1 = educationMissionClassDAL.EducationMissionClassRepository.GetList(x => educationMissionIDList.Contains(x.EducationMissionID)).Select(x => x.EducationMissionID).ToList();
- var educationIDList = educationMissionIDList1.Except(educationMissionIDList);
- //更新重修计划状态和删除重修名单的教学任务主表ID,用教学任务主表ID查询重修名单表,
- var retakePlan = RetakePlanDAL.RetakePlanRepository.GetList(x => x.ER_RetakePlanStudent.Any(w => educationMissionIDList1.Contains(w.EducationMissionID.Value) && !educationIDList.Contains(w.EducationMissionID.Value)), x => x.ER_RetakePlanStudent).ToList();
- if (retakePlan.Count > 0)
- {
- //重修计划状态改为已开放
- retakePlan.ForEach(x =>
- {
- x.RecordStatus = (int)EMIS.ViewModel.ER_RetakePlanStatus.Opened;
- x.ER_RetakePlanStudent.ToList().ForEach(w => w.EducationMissionID = null);
- });
- }
- foreach (var needDeleteEducationMission in needDeleteEducationMissionList)
- {
- UnitOfWork.Remove(needDeleteEducationMission);
- }
-
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
-
- throw;
- }
- }
- public List<CourseProcessView> GetCourseProcessView(Guid educationMissionClassID)
- {
- //2016年12月1日15:28:47
- //TODO :调整教学任务课程进度统计规则[将原按教学任务获取该教学任务下所对应的教学任务班课程进度信息调整为按对应教学任务班进行统计]
- //var courseViewList = this.educationMissionClassDAL.GetCourseProcessView(x => x.EducationMissionID == educationMissionID)
- // .OrderBy(x => x.Week).ToList();
- var courseViewList = this.educationMissionClassDAL.GetCourseProcessView(x => x.EducationMissionClassID == educationMissionClassID)
- .OrderBy(x => x.Week).ToList();
- var courseViewTeacherList = this.educationMissionClassDAL.GetCourseProcessTeacherView(x => x.EducationMissionClassID == educationMissionClassID).ToList();
- courseViewList.ForEach(x =>
- {
- x.CourseProcessTeacherViewList = courseViewTeacherList.Where(w => w.CourseProcessID == x.CourseProcessID).ToList();
- //x.StaffIDAndTeachTypes = string.Join(",", x.CourseProcessTeacherViewList.Select(w => w.UserID.ToString() + "|" + w.TeacherType.ToString()));
- //x.StaffNames = string.Join(",", x.CourseProcessTeacherViewList.Select(w => w.Name));
- });
- return courseViewList;
- }
- public List<CourseProcessTeacherView> GetCourseProcessTeacherView(Guid courseProcessID)
- {
- var courseProcessTeacherQueryable = this.educationMissionClassDAL.GetCourseProcessTeacherViewByCourseProcess(x => x.CourseProcessID == courseProcessID);
- return courseProcessTeacherQueryable.ToList();
- }
- public void SaveCourseProcessView(EducationMissionClassView educationMissionClassView, IList<CourseProcessView> courseProcessViewList)
- {
- var educationMissionClass = educationMissionClassDAL.EducationMissionClassRepository
- .GetSingle(x => x.EducationMissionClassID == educationMissionClassView.EducationMissionClassID,
- (x => x.EM_MissionClassTeacher));
- if (courseProcessViewList.Count > 0)
- {
- if (courseProcessViewList.Select(x => x.Times).Sum() > educationMissionClassView.Totalhours)
- {
- throw new Exception("课程进度学时不能超出总学时,请检查调整!");
- }
- }
- if (educationMissionClass.RecordStatus == (int)EM_EducationMissionClassStatus.Scheduled)
- {
- //TODO:已提交的数据不能做编辑操作~
- throw new Exception("已排课的任务班不能修改。");
- }
- var groupedCoursesProcessViewList = courseProcessViewList
- .GroupBy(x => new
- {
- x.EducationMissionClassID,
- x.Week,
- x.ClassroomID,
- x.ClassroomTypeID,
- TeacherKey = string.Join(",", x.CourseProcessTeacherViewList.OrderBy(w => w.UserID).ThenBy(w => w.TeachingMethod)
- .Select(w => w.UserID.ToString() + "|" + w.TeachingMethod.ToString()))
- }).Select(x => new {
- x.Key.EducationMissionClassID,
- x.Key.Week,
- x.Key.ClassroomID,
- x.Key.ClassroomTypeID,
- x.FirstOrDefault().CourseProcessTeacherViewList,
- Times = x.Sum(w => w.Times)
- }).ToList();
- this.UnitOfWork.Delete<EM_CourseProcess>(x => x.EducationMissionClassID == educationMissionClassView.EducationMissionClassID);
- foreach (var courseProcessView in groupedCoursesProcessViewList)
- {
- EM_CourseProcess courseProcess = new EM_CourseProcess();
- courseProcess.CourseProcessID = Guid.NewGuid();
- courseProcess.EducationMissionClassID = courseProcessView.EducationMissionClassID;
- courseProcess.Week = courseProcessView.Week;
- courseProcess.Times = courseProcessView.Times;
- courseProcess.ClassroomTypeID = courseProcessView.ClassroomTypeID;
- courseProcess.ClassroomID = courseProcessView.ClassroomID;
- courseProcess.EM_CourseProcessTeacher = new HashSet<EM_CourseProcessTeacher>();
- SetNewStatus(courseProcess);
- UnitOfWork.Add(courseProcess);
- courseProcessView.CourseProcessTeacherViewList.ToList().ForEach(x =>
- {
- UnitOfWork.Add(new EM_CourseProcessTeacher
- {
- CourseProcessTeacherID = Guid.NewGuid(),
- CourseProcessID = courseProcess.CourseProcessID,
- UserID = x.UserID,
- TeachType = x.TeachingMethod,
- RecordStatus = (int)SYS_STATUS.USABLE,
- CreateTime = courseProcess.CreateTime,
- CreateUserID = courseProcess.CreateUserID,
- ModifyTime = courseProcess.ModifyTime,
- ModifyUserID = courseProcess.ModifyUserID
- });
- });
- }
- var missionClassTeacherList = (from courseProcess in courseProcessViewList
- from teacher in courseProcess.CourseProcessTeacherViewList
- group teacher by new { teacher.UserID, teacher.TeachingMethod } into g
- select g.FirstOrDefault()).ToList();
- educationMissionClass.EM_MissionClassTeacher.ToList().ForEach(x => UnitOfWork.Remove(x));
- missionClassTeacherList.ForEach(x =>
- {
- var missionClassTeacher = new EM_MissionClassTeacher
- {
- MissionClassTeacherID = Guid.NewGuid(),
- MissionClassID = educationMissionClass.EducationMissionClassID,
- UserID = x.UserID,
- TeachType = x.TeachingMethod
- };
- this.SetNewStatus(missionClassTeacher);
- this.UnitOfWork.Add(missionClassTeacher);
- });
- this.UnitOfWork.Commit();
- }
- public int GetStudentCount(Guid educationMissionClassID)
- {
- var educationSchedulingClass = educationMissionClassDAL
- .EducationSchedulingClassRepository
- .GetSingle(x => x.EducationMissionClassID == educationMissionClassID, (x => x.CF_Student));
- return educationSchedulingClass.CF_Student.Count;
- }
- public IGridResultSet<ClassroomView> GetAvailableClassroom(ConfiguretView configuretView, Guid collegeID, Guid? buildingID,
- int? classroomType, int? minSeatCount, int? pageIndex, int? pageSize)
- {
- Expression<Func<CF_Classroom, bool>> exp = (x => true);
- if (buildingID.HasValue)
- {
- exp = exp.And(x => x.BuildingsInfoID == buildingID);
- }
- var classroomView = ClassroomScheduleDAL.GetAvailableClassroom(collegeID, minSeatCount, exp, classroomType);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- classroomView = classroomView.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- return classroomView.OrderBy(x => x.BuildingsInfoName)
- .ThenBy(x => x.Name)
- .ThenBy(x => x.Totalseating).ToGridResultSet(pageIndex, pageSize);
- }
- public List<string> GetEducationMissionClassStatus()
- {
- var list = DictionaryHelper.GetDictionaryValue("EM_EducationMissionClassStatus").Select(x => x.Value.ToString()).ToList();
- return list;
- }
- [Obsolete]
- public bool Verification(List<Guid?> collegeIDList, List<Guid?> schoolyearIDList)
- {
- Expression<Func<EM_EducationMissionOpenControl, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var isOK = true;
- var query = EducationMissionOpenControlDAL.GetEducationMissionOpenControlViewQueryable(exp).ToList();
- int VerificationNum = collegeIDList.Count();
- for (int i = 0; i < VerificationNum; i++)
- {
- var OpenControl = query.Where(x => x.CollegeID == collegeIDList[i] && x.SchoolyearID == schoolyearIDList[i]).FirstOrDefault();
- if (OpenControl!=null)
- {
- if (OpenControl.StartDate > System.DateTime.Now || System.DateTime.Now > OpenControl.EndDate.Value.AddDays(1))
- {
- isOK = false;
- return isOK;
- }
- }
- }
- return isOK;
- }
- public bool CheckEducationMissionClassOpenControl(IList<Guid> educationMissionClassIDList)
- {
- var nowTime = DateTime.Today;
- var collegeSchoolyearKeyList = this.educationMissionClassDAL.EducationMissionClassRepository.GetList(x => educationMissionClassIDList.Contains(x.EducationMissionClassID))
- .GroupBy(x => new { x.EM_EducationMission.SchoolyearID, x.EM_EducationMission.CF_Department.CollegeID })
- .Select(x => new { x.Key.SchoolyearID, x.Key.CollegeID }).ToList();
- var openControlList = EducationMissionOpenControlDAL.EducationMissionOpenControlRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && (x.StartDate > nowTime || x.EndDate < nowTime))
- .SelectByKeys(collegeSchoolyearKeyList);
- if (openControlList.Count > 0)
- {
- throw new Exception("受教学安排的时间控制,所选教学任务不在可操作时间范围,暂时无法操作。");
- }
- return true;
- }
- [Obsolete]
- public IGridResultSet<EducationMissionClassView> GetLastCourseEducationMissionClassViewGrid(ConfiguretView configuretView, Guid userID,
- int? pageIndex, int? pageSize)
- {
- Expression<Func<CF_Student, bool>> studentExp = (x => x.UserID == userID);
- var query = this.educationMissionClassDAL.GetLastCourseEducationMissionClassViewQueryable(studentExp);
- query = query.OrderBy(x => x.CourseCode).ThenBy(x => x.CourseName);
- return query.ToGridResultSet(pageIndex, pageSize);
- }
- }
- }
|