123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.EducationManagement;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.DataLogic.CultureplanManage.PlanManagement;
- using System.Data.Entity;
- using EMIS.ViewModel.EducationManage;
- using EMIS.ViewModel;
- using EMIS.DataLogic.UniversityManage.AdministrativeOrgan;
- namespace EMIS.DataLogic.EducationManage
- {
- public class AdultEducationMissionClassDAL
- {
- //public FreeSelectionCousePlanRepository freeSelectionCousePlanRepository { get; set; }
- public EducationMissionClassRepository educationMissionClassRepository { get; set; }
- public EducationMissionClassTeachingSettingRepository EducationMissionClassTeachingSettingRepository { get; set; }
- public EducationMissionRepository EducationMissionRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- public EducationMissionClassSettingsRepository educationMissionClassSettingsRepository { get; set; }
- public MissionClassTeacherRepository missionClassTeacherRepository { get; set; }
- public EducationSchedulingClassRepository educationSchedulingClassRepository { get; set; }
- public StudentRepository studentRepository { get; set; }
- public UserRepository userRepository { get; set; }
- public ClassmajorRepository ClassmajorRepository { get; set; }
- public CourseProcessRepository CourseProcessRepository { get; set; }
- public EducationMissionRepository educationMissionRepository { get; set; }
- public EducationSchedulingRepository educationSchedulingRepository { get; set; }
- public ClassroomRepository ClassroomRepository { get; set; }
- public InSchoolSettingRepository inSchoolSettingRepository { get; set; }
- public CollegeScheduleStatusRepository CollegeScheduleStatusRepository { get; set; }
- public CoursesTimeRepository coursesTimeRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public FacultymajorRepository FacultymajorRepository { get; set; }
- public CollegeRepository CollegeRepository { get; set; }
- public DepartmentRepository DepartmentRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public Lazy<CollegeDAL> CollegeDAL { get; set; }
- public EducationMissionExamTimeRepository EducationMissionExamTimeRepository { get; set; }
- /// <summary>
- /// 查询教学任务班数据
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<EducationMissionImportClassView> GetEducationMissionClassViewQueryble(Expression<Func<EM_EducationMissionClass, bool>> missionClassExp, Expression<Func<CF_Classmajor, bool>> classmajorFilter)
- {
- TimeSpan s = new TimeSpan();
- DateTime d = new DateTime();
- //媚姐说:教学任务的查询不要过滤教学任务中没有在校学生
- //var inSchoolStatusIDList = inSchoolSettingRepository.GetList(x => x.IsSelected == true).Select(w => w.InSchoolStatusID).ToList();//获取选中的在校设定状态、
- //var inSchoolStatusIDList = inSchoolSettingRepository.GetList(x =>true).Select(w => w.InSchoolStatusID).ToList();//获取选中的在校设定状态、
- var query = from missionClass in educationMissionClassRepository.GetList(missionClassExp)
- join mission in EducationMissionRepository.Entities on missionClass.EducationMissionID equals mission.EducationMissionID
- join teachSetting in EducationMissionClassTeachingSettingRepository.Entities on missionClass.EducationMissionClassID equals teachSetting.EducationMissionClassID
- join classmajor in ClassmajorRepository.GetList(classmajorFilter) on missionClass.MainScheduleClassID equals classmajor.ClassmajorID
- //into dclassmajor
- //from classmajor in dclassmajor.DefaultIfEmpty()
- join grade in GrademajorRepository.Entities on classmajor.GrademajorID equals grade.GrademajorID into dgrade
- from grade in dgrade.DefaultIfEmpty()
- join faculty in FacultymajorRepository.Entities on grade.FacultymajorID equals faculty.FacultymajorID into dfaculty
- from faculty in dfaculty.DefaultIfEmpty()
- join department in DepartmentRepository.Entities on mission.DepartmentID equals department.DepartmentID
- join college in CollegeRepository.Entities on department.CollegeID equals college.CollegeID
- join schoolyear in SchoolyearRepository.Entities on mission.SchoolyearID equals schoolyear.SchoolyearID
- join course in CoursematerialRepository.Entities on missionClass.CoursematerialID equals course.CoursematerialID
- join schedulingClass in
- (
- from sc in educationSchedulingClassRepository.Entities
- group sc by sc.EducationMissionClassID into g
- select new
- {
- EducationMissionClassID = g.Key,
- ClassNum = g.Sum(x => x.CF_Student.Count())
- }
- ) on missionClass.EducationMissionClassID equals schedulingClass.EducationMissionClassID into dschedulingClass
- from schedulingClass in dschedulingClass.DefaultIfEmpty()
- join courseProcess in
- (from cp in CourseProcessRepository.Entities
- group cp by cp.EducationMissionClassID into g
- select new
- {
- EducationMissionClassID = g.Key,
- CourseProcessTimes = g.Sum(x => x.Times)
- }) on missionClass.EducationMissionClassID equals courseProcess.EducationMissionClassID into dcourseProcess
- from courseProcess in dcourseProcess.DefaultIfEmpty()
- join status in CollegeScheduleStatusRepository.Entities
- on new { missionClass.EM_EducationMission.CollegeID, missionClass.EM_EducationMission.SchoolyearID }
- equals new { status.CollegeID, status.SchoolyearID }
- into dstatus
- from status in dstatus.DefaultIfEmpty()
- from courseTime in missionClass.EM_CoursesTime.DefaultIfEmpty()
- join examtime in EducationMissionExamTimeRepository.Entities on missionClass.EducationMissionID equals examtime.EducationMissionID into dexamtime
- from examtime in dexamtime.DefaultIfEmpty()
- select new EducationMissionImportClassView
- {
- EndTime = examtime.EndTime ?? s,
- StarTime = examtime.StartTime ?? s,
- ExamDate = examtime.ExamDate ?? d,
- TimeID = courseTime.TimesSegment,
- StartHour = courseTime.StartHour,
- StartMinutes = courseTime.StartMinutes,
- EndHour = courseTime.EndHour,
- EndMinutes = courseTime.EndMinutes,
- CourseTimeID = courseTime.CoursesTimeID,
- EducationMissionID = missionClass.EducationMissionID,
- EducationMissionClassID = missionClass.EducationMissionClassID,
- TeachingModeID = missionClass.TeachingModeID ?? 1,
- SchoolyearID = missionClass.EM_EducationMission.SchoolyearID,
- SchoolyearCode = missionClass.EM_EducationMission.CF_Schoolyear.Code,
- Name = missionClass.Name,
- CoursematerialID = missionClass.CoursematerialID,
- CourseCode = course.CourseCode,
- CourseName = course.CourseName,
- CampusID = college.CampusID,
- ClassmajorCollegeID = mission.CollegeID,
- //兵良哥说院系所对应的是教学任务的院系所字段
- CollegeID = mission.CollegeID,
- CollegeNo = mission.CF_College.No,
- CollegeName =mission.CF_College.Name,
- //CollegeID = department.CollegeID,
- //CollegeNo = college.No,
- //CollegeName = college.Name,
- DepartmentID = mission.DepartmentID,
- DepartmentName = department.Name,
- GrademajorID = grade.GrademajorID,
- StandardID = faculty.StandardID,
- GradeYearID = grade.GradeID,
- ClassroomID = missionClass.ClassroomID,
- ClassroomName = missionClass.CF_Classroom.Name,
- ClassroomTypeID = missionClass.ClassroomTypeID,
- CourseStructureID = missionClass.CourseStructureID,
- CourseCategoryID = missionClass.CourseCategoryID,
- CourseTypeID = missionClass.CourseTypeID,
- CourseQualityID = missionClass.CourseQualityID,
- ExaminationModeID = missionClass.ExaminationModeID,
- TeachinglanguageID = missionClass.TeachinglanguageID,
- HandleModeID = missionClass.HandleModeID,
- IsNeedMaterial = missionClass.IsNeedMaterial ?? false,
- OrderNo = missionClass.OrderNo ?? 0,
- SchedulingClassNum = missionClass.EM_EducationSchedulingClass.Count,
- ClassNum = (schedulingClass.EducationMissionClassID == null ? 0 : schedulingClass.ClassNum),
- MainScheduleClassID = missionClass.MainScheduleClassID,
- MainScheduleClassGrademajorID = classmajor.GrademajorID,
- MainScheduleClassCollegeID = faculty.CollegeID,
- SchedulingClass = mission.ClassName,
- StartWeeklyNum = teachSetting.StartWeeklyNum,
- EndWeeklyNum = teachSetting.EndWeeklyNum,
- StartWeeklyNumReserved = missionClass.EM_EducationMissionClassSettings.Min(w => w.WeeklyNum).Value,
- EndWeeklyNumReserved = missionClass.EM_EducationMissionClassSettings.Max(w => w.WeeklyNum).Value,
- Credit = teachSetting.Credit,
- TheoryCourse = teachSetting.TheoryCourse,
- Practicehours = teachSetting.Practicehours,
- Trialhours = teachSetting.Trialhours,
- TheoryWeeklyNum = teachSetting.TheoryWeeklyNum,
- PracticeWeeklyNum = teachSetting.PracticeWeeklyNum,
- TrialWeeklyNum = teachSetting.TrialWeeklyNum,
- WeeklyNum = teachSetting.WeeklyNum,
- WeeklyHours = teachSetting.WeeklyHours,
- ApprovalStatus = missionClass.RecordStatus,
- CourseProcessTimes = courseProcess.CourseProcessTimes,
- CreateTime = missionClass.CreateTime,
- CreateUserID = missionClass.CreateUserID,
- ResultTypeID=missionClass.ResultTypeID,
- Remark = missionClass.Remark,
- IsCollegeScheduleSubmitted = (status.RecordStatus == (int)ES_CollegeScheduleStatusCode.Submited)
- };
- return query;
- }
- public List<MissionClassTeacherView> GetMissionClassTeacherQuery(Expression<Func<EM_EducationMissionClass, bool>> exp)
- {
- var query = (from emc in educationMissionClassRepository.GetList(exp)
- from tec in emc.EM_MissionClassTeacher
- select new MissionClassTeacherView
- {
- UserID = tec.CF_Staff.UserID,
- EducationMissionClassID = emc.EducationMissionClassID,
- Name = tec.CF_Staff.Sys_User.Name
- });
- return query.Distinct().ToList();
- }
- public IQueryable<EM_CourseProcess> GetRelatedCourseProcess(Expression<Func<EM_EducationMissionClass, bool>> exp)
- {
- var query = (from emc in educationMissionClassRepository.GetList(exp)
- // from remc in emc.EM_EducationMission.EM_EducationMissionClass
- from cp in emc.EM_CourseProcess
- select cp).Include(x => x.EM_EducationMissionClass);
- return query;
- }
- }
- }
|