123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel.EvaluationManage;
- using EMIS.DataLogic.SystemDAL;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EducationManage;
- using EMIS.ViewModel.EducationManagement;
- using Bowin.Common.Linq;
- using EMIS.DataLogic.UniversityManage.TeacherManage;
- namespace EMIS.DataLogic.Common.EvaluationManage
- {
- public class EvaluationSettingDAL
- {
- public EvaluationSettingRepository EvaluationSettingRepository { get; set; }
- public EducationMissionRepository EducationMissionRepository { get; set; }
- public EvaluationTeachingModeRepository EvaluationTeachingModeRepository { get; set; }
- public MissionClassTeacherRepository MissionClassTeacherRepository { get; set; }
- public EvaluationTableRepository EvaluationTableRepository { get; set; }
- public EducationSchedulingClassRepository EducationSchedulingClassRepository { get; set; }
- public DictionaryDAL DictionaryDAL { get; set; }
- public UserRepository UserRepository { get; set; }
- public StaffRepository StaffRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public Lazy<StaffDAL> staffDAL { get; set; }
- public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
- public SpecialtyPlanRepository SpecialtyPlanRepository { get; set; }
- public EvaluationTypeRepository evaluationTypeRepository { get; set; }
- public EvaluationTableDAL EvaluationTableDAL { get; set; }
- //public FreeSelectionCousePlanRepository freeSelectionCousePlanRepository { get; set; }
- public DepartmentRepository DepartmentRepository { get; set; }
- public EvaluationEnterRepository evaluationEnterRepository { get; set; }
- public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- public OptionalCoursePlanRepository optionalCoursePlanRepository { get; set; }
- public EducationMissionClassSettingsRepository educationMissionClassSettingsRepository { get; set; }
- public IQueryable<EvaluationSettingView> GetEvaluationSettingQuery(Expression<Func<EM_EvaluationSetting, bool>> filter)
- {
- List<int> intTypeList = new List<int>(); //生成评价表中已启用、并且存在的授课方式
- var evaluationTabList = EvaluationTableRepository.GetList(x => x.IsEnabled == true, (w => w.EM_EvaluationIntType))
- .Select(s => new
- {
- s.EM_EvaluationIntType.EvaluationIntTypeID
- });
- var IntTypeIDList = evaluationTabList.Select(w => w.EvaluationIntTypeID).ToList();
- EvaluationTeachingModeRepository.GetList(x => IntTypeIDList.Contains((Guid)x.EvaluationIntTypeID))
- .Select(w => w.TeachingModeID).ToList().ForEach(p => { intTypeList.Add(p.Value); });
- var query = from c in EvaluationSettingRepository.GetList(filter)
- join course in EducationMissionClassRepository.GetList(w => intTypeList.Contains(w.TeachingModeID ?? (int)CF_TeachingMode.Theory))
- on c.EducationMissionClassID equals course.EducationMissionClassID
- from stcontrol in EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true
- && x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID).Contains(course.TeachingModeID ?? (int)CF_TeachingMode.Theory)).DefaultIfEmpty()
- select new EvaluationSettingView
- {
- EvaluationSettingID = c.EvaluationSettingID,
- EvaluationSettingCode = c.EvaluationSettingCode,
- OpenStatus = (int)c.OpenStatus,
- OpenStatusName = (int)c.OpenStatus == (int)CF_YesOrNoStatus.Yes ? "是" : "否",
- EvaluationIntTypeID = stcontrol.EM_EvaluationIntType.EvaluationIntTypeID,
- EvaluationTableTypeName = stcontrol.EM_EvaluationIntType.Name,
- Remark = c.Remark,
- CoursematerialID = course.CoursematerialID,
- EvaluationTypeName = c.EM_EvaluationTable.EM_EvaluationType.Name,
- EducationMissionClassID = c.EducationMissionClassID,
- EducationMissionClassName = c.EM_EducationMissionClass.Name,
- SchoolyearID = course.EM_EducationMission.CF_Schoolyear.SchoolyearID,
- SchoolyearCode = course.EM_EducationMission.CF_Schoolyear.Code,
- CourseName = course.EM_Coursematerial.CourseName,
- CourseCode = course.EM_Coursematerial.CourseCode,
- //CourseTypeID =
- // Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User),
- DepartmentID = course.EM_EducationMission.CF_Department.DepartmentID,
- CollegeID = course.EM_EducationMission.CF_College.CollegeID,
- CollegeName = course.EM_EducationMission.CF_College.Name,
- CampusID = course.EM_EducationMission.CF_College.CampusID,
- EntityCreateTime = c.CreateTime,
- StaffCount = c.CF_Staff.Count,
- StudentCount = c.CF_Student.Count
- };
- return query.Distinct();
- }
- //2.0 查询同行
- public List<CF_Staff> GetEvaluationByStaff(Guid? educationMissionClassID, List<CF_Staff> StaffList)
- {
- var staffIDList = StaffList.Select(x => x.UserID).ToList();
- var q = (
- from staff in ((
- from missionClass in EducationMissionClassRepository.GetList(x => x.EducationMissionClassID == educationMissionClassID)
- join mission in EducationMissionRepository.Entities on missionClass.EducationMissionID equals mission.EducationMissionID
- join staff in StaffRepository.Entities on mission.DepartmentID equals staff.DepartmentID
- where !staffIDList.Contains(staff.UserID)
- select staff
- )
- .Concat(
- from missionClass in EducationMissionClassRepository.GetList(x => x.EducationMissionClassID == educationMissionClassID)
- join mission in EducationMissionRepository.Entities on missionClass.EducationMissionID equals mission.EducationMissionID
- join otherMission in EducationMissionRepository.Entities on mission.SchoolyearID equals otherMission.SchoolyearID
- join otherClass in EducationMissionClassRepository.Entities on
- new { EducationMissionID = (Guid?)otherMission.EducationMissionID, missionClass.CoursematerialID }
- equals new { otherClass.EducationMissionID, otherClass.CoursematerialID }
- join otherTeacher in MissionClassTeacherRepository.Entities on otherClass.EducationMissionClassID equals otherTeacher.MissionClassID
- join staff in StaffRepository.Entities on otherTeacher.UserID equals staff.UserID
- where !staffIDList.Contains(staff.UserID)
- select staff
- ))
- group staff by staff.UserID into g
- select g.FirstOrDefault()
- ).ToList();
- return q.ToList();
- }
- //3.0 查询学生
- public List<CF_Student> GetEvaluationByStudent(Guid? educationMissionClassID)
- {
- var query = from a in EducationSchedulingClassRepository.GetList(x => x.EducationMissionClassID == educationMissionClassID)
- from c in a.CF_Student
- join b in UserRepository.Entities
- on c.UserID equals b.UserID
- select new EducationMissionClassStudentView
- {
- UserID = b.UserID,
- LoginID = b.LoginID,
- Name = b.Name
- };
- var user = query.Select(x => x.UserID);
- var studentList = StudentRepository.GetList(x => user.Contains(x.UserID)).ToList();
- return studentList;
- }
- //4.0 学生明細信息
- public IQueryable<EvaluationSettingDetailView> GetEvaluationSettingStudentDetailQuery(Guid? evaluationSettingID)
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- bool isStudent = curUser.IsStudent;//获取当前用户是否是学生
- var evaluationSettingQuery = EvaluationSettingRepository.GetList(x => x.OpenStatus == (int)CF_YesOrNoStatus.Yes);
- Guid? typeID = evaluationTypeRepository.Entities.Where(w => w.IsStudent == true).FirstOrDefault().EvaluationTypeID;
- EM_EvaluationSetting evaluationSettingEntity = EvaluationSettingRepository.Entities.Where(x => x.EvaluationSettingID == evaluationSettingID).FirstOrDefault();
- //var tableEntity = EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true && x.TypeID == typeID && x.IntType == teachingModeID);
- var courseQuery = EducationMissionClassRepository.Entities.Where(x => x.EducationMissionClassID == evaluationSettingEntity.EducationMissionClassID)
- .Select(s => new
- {
- TeachingModeID = s.TeachingModeID == null ? (int)EM_EvaluationTableType.Theory : s.TeachingModeID,
- s.EducationMissionClassID,
- s.EM_EducationMission.CF_Schoolyear,
- s.EM_EducationMission.CF_Department,
- s.EM_Coursematerial
- });
- EM_EvaluationTable tableEntity = EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true && x.EvaluationTypeID == typeID).FirstOrDefault();
- //var TypeEntity = evaluationTypeRepository.Entities.Where(x => x.Name == "学生评" && x.IsStudent == true).FirstOrDefault();
- var query = from c in EvaluationSettingRepository.GetList(x => x.EvaluationSettingID == evaluationSettingID)
- join d in DictionaryDAL.GetDictionaryItemQuery(typeof(CF_YesOrNoStatus).Name) on c.OpenStatus equals d.Value
- join course in courseQuery on c.EducationMissionClassID equals course.EducationMissionClassID
- from user in c.CF_Student
- from f in EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true
- && x.EvaluationTypeID == typeID
- && x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID).Contains(course.TeachingModeID)).DefaultIfEmpty()
- select new EvaluationSettingDetailView
- {
- EvaluationTypeName = "学生评",
- EvaluationTableName = f.Name,
- EducationMissionClassName = user.CF_Classmajor.Name,
- SchoolyearCode = course.CF_Schoolyear.Code,
- CourseCode = course.EM_Coursematerial.CourseCode,
- CourseName = course.EM_Coursematerial.CourseName,
- UserName = user.Sys_User.Name,
- UserID = user.Sys_User.UserID,
- LoginID = user.Sys_User.LoginID,
- Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User)
- };
- return query;
- }
- //5.0 教职工明細信息
- public IQueryable<EvaluationSettingDetailView> GetEvaluationSettingStaffDetailQuery(Guid? evaluationSettingID)
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- bool isStudent = curUser.IsStudent;//获取当前用户是否是学生
- Guid? typeID = evaluationTypeRepository.Entities.Where(w => w.IsStudent == false && w.IsStudent == true).FirstOrDefault().EvaluationTypeID;
- var courseQuery = EducationMissionClassRepository.Entities
- .Select(s => new
- {
- TeachingModeID = s.TeachingModeID == null ? (int)CF_TeachingMode.Theory : s.TeachingModeID,
- s.EducationMissionClassID,
- s.EM_EducationMission.CF_Schoolyear,
- s.EM_EducationMission.CF_Department,
- s.EM_Coursematerial
- });
- // var TypeEntity = evaluationTypeRepository.Entities.Where(x => x.Name == "同行评").FirstOrDefault();
- var query = from c in EvaluationSettingRepository.GetList(x => x.EvaluationSettingID == evaluationSettingID)
- join d in DictionaryDAL.GetDictionaryItemQuery(typeof(CF_YesOrNoStatus).Name) on c.OpenStatus equals d.Value
- join course in courseQuery on c.EducationMissionClassID equals course.EducationMissionClassID
- from user in c.CF_Staff
- from f in EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true
- && x.EvaluationTypeID == typeID
- && x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID).Contains(course.TeachingModeID)).DefaultIfEmpty()
- select new EvaluationSettingDetailView
- {
- DepartmentName = user.CF_Department.Name,
- EvaluationTypeName = "同行评",
- EvaluationTableName = f.Name,
- UserID = user.Sys_User.UserID,
- EducationMissionClassName = c.EM_EducationMissionClass.Name,
- SchoolyearCode = course.CF_Schoolyear.Code,
- CourseCode = course.EM_Coursematerial.CourseCode,
- CourseName = course.EM_Coursematerial.CourseName,
- Name = user.Sys_User.Name,
- StaffCode = user.Sys_User.LoginID,
- Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User)
- };
- return query;
- }
- //6.0 查询 教学任务班对应的评价表
- public IList<EvaluationSettingView> GetEvaluationTableQuery(IList<EvaluationSettingView> educationMissionLsit, bool isStudt)
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- bool isStudent = curUser.IsStudent;//获取当前用户是否是学生
- Guid? typeID = isStudent == true ? evaluationTypeRepository.Entities.Where(w => w.IsStudent == true).FirstOrDefault().EvaluationTypeID : evaluationTypeRepository.Entities.Where(w => w.IsStudent == false && w.IsStudent == true).FirstOrDefault().EvaluationTypeID;
- var educationMissionIDs = educationMissionLsit.Select(x => x.EducationMissionClassID);
- //获取已提交的教学任务班
- var courseQuery = EducationMissionClassRepository.Entities.Where(x => educationMissionIDs.Contains(x.EducationMissionClassID) && x.RecordStatus == (int)CF_ApprovalStatus.Submitted)
- .Select(s => new
- {
- s.EducationMissionClassID,
- s.EM_Coursematerial,
- TeachingModeID = s.TeachingModeID == null ? (int)EM_EvaluationTableType.Theory : s.TeachingModeID
- });
- var querytable = EvaluationTableRepository.GetList(x => x.IsEnabled == true && x.EvaluationTypeID == typeID);
- var query = from c in courseQuery
- //join aa in EvaluationTableRepository.GetList(x => x.IsEnabled == true) on c.TeachingModeID equals aa.IntType
- join ent in EvaluationSettingRepository.Entities on c.EducationMissionClassID equals ent.EducationMissionClassID
- into tent
- from ctent in tent.DefaultIfEmpty()
- where ctent == null
- group new { c } by new { c.EducationMissionClassID, CourseCode = c.EM_Coursematerial.CourseCode } into g
- select new EvaluationSettingView
- {
- EducationMissionClassID = g.Key.EducationMissionClassID,
- //EvaluationTableTypeID = g.Key.IntType,//参评类型为空、默认理论
- EvaluationTableID = Guid.Empty,
- IsStudent = isStudent == true ? (int)CF_YesOrNoStatus.Yes : (int)CF_YesOrNoStatus.No //是否适用学生
- ,
- EvaluationTypeID = Guid.Empty,
- CourseCode = g.Key.CourseCode
- };
- return query.ToList();
- }
- //7.0 查询 该学年学期下对应的教学任务班
- public IQueryable<EducationMissionClassView> GetCreateInventoryQuery(Guid schoolyearID)
- {
- List<int> intTypeList = new List<int>(); //生成评价表中已启用、并且存在的授课方式
- var evaluationTabList = EvaluationTableRepository.GetList(x => x.IsEnabled == true, (w => w.EM_EvaluationIntType))
- .Select(s => new
- {
- s.EM_EvaluationIntType.EvaluationIntTypeID
- });
- var IntTypeIDList = evaluationTabList.Select(w => w.EvaluationIntTypeID).ToList();
- EvaluationTeachingModeRepository.GetList(x => IntTypeIDList.Contains((Guid)x.EvaluationIntTypeID))
- .Select(w => w.TeachingModeID).ToList().ForEach(p => { intTypeList.Add(p.Value); });
- Expression<Func<EM_EducationMissionClass, bool>> exp = x => x.EM_EducationMission.SchoolyearID == schoolyearID
- && x.RecordStatus != (int)EM_EducationMissionClassStatus.NotSubmitted
- && intTypeList.Contains(x.TeachingModeID ?? (int)CF_TeachingMode.Theory);
- //TODO:调整评价生成、提取教学任务班中排除未提交状态的数据。
- var query = from a in EducationMissionClassRepository.GetList(exp)
- from SchedulingClass in a.EM_EducationSchedulingClass.DefaultIfEmpty()
- join b in EvaluationSettingRepository.Entities on a.EducationMissionClassID equals b.EducationMissionClassID
- into tb
- from ctb in tb.DefaultIfEmpty()
- where ctb == null //如果不存在、那么生成
- select new EducationMissionClassView
- {
- EducationMissionID = a.EducationMissionID,
- EducationMissionClassID = a.EducationMissionClassID,
- MainScheduleClassID = a.MainScheduleClassID,
- TeachingModeID = a.TeachingModeID == null ? (int)CF_TeachingMode.Theory : (int)a.TeachingModeID,//如果授课方式为空、那么默认理论
- SchoolyearID = a.EM_EducationMission.SchoolyearID,
- SchoolyearCode = a.EM_EducationMission.CF_Schoolyear.Code,
- Name = a.Name,
- CoursematerialID = a.EM_Coursematerial.CoursematerialID,
- CourseCode = a.EM_Coursematerial.CourseCode,
- CourseName = a.EM_Coursematerial.CourseName,
- DepartmentID = a.EM_EducationMission.DepartmentID,
- ClassroomID = a.ClassroomID,
- ClassroomTypeID = a.ClassroomTypeID,
- ApprovalStatus = a.RecordStatus,
- CreateTime = a.CreateTime,
- CreateUserID = a.CreateUserID,
- Remark = a.Remark,
- CF_Student = SchedulingClass.CF_Student,
- CF_Staff = a.EM_MissionClassTeacher.Select(x => x.CF_Staff)
- };
- return query;
- }
- #region 8.0 教学任务班ID、加载评价表
- public IList<EvaluationTableView> GetTableByEducationMissionClassID(Guid? educationMissionClassID)
- {
- var courseQuery = EducationMissionClassRepository.Entities.Where(x => x.EducationMissionClassID == educationMissionClassID && x.RecordStatus == (int)CF_ApprovalStatus.Submitted)
- .Select(s => new
- {
- s.EducationMissionClassID,
- TeachingModeID = s.TeachingModeID == null ? (int)EM_EvaluationTableType.Theory : s.TeachingModeID
- });
- var query = from a in courseQuery
- join aa in EvaluationTableRepository.GetList(x => x.IsEnabled == true) on a.TeachingModeID equals aa.RecordStatus
- join bb in evaluationTypeRepository.Entities on aa.EvaluationTypeID equals bb.EvaluationTypeID
- select new EvaluationSettingView
- {
- EvaluationTableID = aa.EvaluationTableID
- };
- var tableList = EvaluationTableDAL.GetEvaluationTableQueryable(w => query.Select(x => x.EvaluationTableID).Contains(w.EvaluationTableID));//获取评价表
- return tableList.ToList();
- }
- #endregion
- #region 9.0加载选取教师|学生信息
- //5.0 教职工明細信息
- public IQueryable<EvaluationSettingDetailView> GetEvaluationSettingStaffDetailList(Guid? evaluationSettingID)
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- EM_EvaluationSetting evaluationSettingEntity = EvaluationSettingRepository.Entities.Where(x => x.EvaluationSettingID == evaluationSettingID).FirstOrDefault();
- var staffQuery = staffDAL.Value.GetStaffViewQueryable(x => x.CF_Department.DepartmentID == EducationMissionClassRepository.Entities.Where(w => w.EducationMissionClassID == evaluationSettingEntity.EducationMissionClassID).FirstOrDefault().EM_EducationMission.CF_Department.DepartmentID);//获取所有教师
- bool isStudent = curUser.IsStudent;//获取当前用户是否是学生
- Guid? typeID = evaluationTypeRepository.Entities.Where(w => w.IsStudent == false && w.IsStudent == true).FirstOrDefault().EvaluationTypeID;
- var courseQuery = from eds in EducationMissionClassRepository.Entities
- from tech in eds.EM_MissionClassTeacher
- join staff in staffQuery on eds.EM_EducationMission.CF_Department.DepartmentID equals staff.DepartmentID
- into user
- from staffuser in user.DefaultIfEmpty()
- where staffuser.UserID != tech.CF_Staff.Sys_User.UserID
- select new
- {
- TeachingModeID = eds.TeachingModeID == null ? (int)EM_EvaluationTableType.Theory : eds.TeachingModeID,
- eds.EducationMissionClassID,
- eds.EM_EducationMission.CF_Schoolyear,
- eds.EM_EducationMission.CF_Department,
- eds.EM_Coursematerial,
- eds.EM_MissionClassTeacher,
- Teacher = staffuser
- };
- // var TypeEntity = evaluationTypeRepository.Entities.Where(x => x.Name == "同行评").FirstOrDefault();
- var query = from c in EvaluationSettingRepository.GetList(x => x.EvaluationSettingID == evaluationSettingID)
- join d in DictionaryDAL.GetDictionaryItemQuery(typeof(CF_YesOrNoStatus).Name) on c.OpenStatus equals d.Value
- join course in courseQuery on (Guid)c.EducationMissionClassID equals (Guid)course.EducationMissionClassID
- from f in EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true
- && x.EvaluationTypeID == typeID
- && x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID).Contains(course.TeachingModeID)).DefaultIfEmpty()
- select new EvaluationSettingDetailView
- {
- DepartmentName = course.CF_Department.Name,
- EvaluationTypeName = "同行评",
- EvaluationTableName = f.Name,
- UserID = course.Teacher.UserID,
- EducationMissionClassName = c.EM_EducationMissionClass.Name,
- SchoolyearCode = course.CF_Schoolyear.Code,
- CourseCode = course.EM_Coursematerial.CourseCode,
- CourseName = course.EM_Coursematerial.CourseName,
- Name = course.Teacher.Name,
- StaffCode = course.Teacher.StaffCode,
- Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User)
- };
- return query;
- }
- //4.0 学生明細信息
- public IQueryable<EvaluationSettingDetailView> GetEvaluationSettingStudentDetailList(Guid? evaluationSettingID)
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- bool isStudent = curUser.IsStudent;//获取当前用户是否是学生
- var evaluationSettingQuery = EvaluationSettingRepository.GetList(x => x.OpenStatus == (int)CF_YesOrNoStatus.Yes);
- Guid? typeID = evaluationTypeRepository.Entities.Where(w => w.IsStudent == true).FirstOrDefault().EvaluationTypeID;
- EM_EvaluationSetting evaluationSettingEntity = EvaluationSettingRepository.Entities.Where(x => x.EvaluationSettingID == evaluationSettingID).FirstOrDefault();
- //var tableEntity = EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true && x.TypeID == typeID && x.IntType == teachingModeID);
- var courseQuery = EducationMissionClassRepository.Entities.Where(x => x.EducationMissionClassID == evaluationSettingEntity.EducationMissionClassID)
- .Select(s => new
- {
- TeachingModeID = s.TeachingModeID == null ? (int)EM_EvaluationTableType.Theory : s.TeachingModeID,
- s.EducationMissionClassID,
- s.EM_EducationMission.CF_Schoolyear,
- s.EM_EducationMission.CF_Department,
- s.EM_Coursematerial,
- s.EM_EducationSchedulingClass
- });
- EM_EvaluationTable tableEntity = EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true && x.EvaluationTypeID == typeID).FirstOrDefault();
- //var TypeEntity = evaluationTypeRepository.Entities.Where(x => x.Name == "学生评" && x.IsStudent == true).FirstOrDefault();
- var query = from c in EvaluationSettingRepository.GetList(x => x.EvaluationSettingID == evaluationSettingID)
- join d in DictionaryDAL.GetDictionaryItemQuery(typeof(CF_YesOrNoStatus).Name) on c.OpenStatus equals d.Value
- join course in courseQuery on c.EducationMissionClassID equals course.EducationMissionClassID
- from edshed in course.EM_EducationSchedulingClass
- from user in edshed.CF_Student
- from f in EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true
- && x.EvaluationTypeID == typeID
- && x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID).Contains(course.TeachingModeID)).DefaultIfEmpty()
- select new EvaluationSettingDetailView
- {
- EvaluationTypeName = "学生评",
- EvaluationTableName = f.Name,
- EducationMissionClassName = user.CF_Classmajor.Name,
- SchoolyearCode = course.CF_Schoolyear.Code,
- CourseCode = course.EM_Coursematerial.CourseCode,
- CourseName = course.EM_Coursematerial.CourseName,
- UserName = user.Sys_User.Name,
- UserID = user.Sys_User.UserID,
- LoginID = user.Sys_User.LoginID,
- Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User)
- };
- return query;
- }
- //这个部门对于的所有教师
- public List<EvaluationSettingMissionClassTeacherView> GetMissionClassTeacherViewQueryable(Expression<Func<EM_MissionClassTeacher, bool>> exp)
- {
- var query = from emc in MissionClassTeacherRepository.GetList(exp)
- select new EvaluationSettingMissionClassTeacherView
- {
- EducationMissionClassID = emc.MissionClassID,
- UserID = emc.CF_Staff.UserID,
- Name = emc.CF_Staff.Sys_User.Name,
- LoginID = emc.CF_Staff.Sys_User.LoginID
- };
- return query.ToList();
- }
- #endregion
- public IQueryable<EducationMissionClassView> GetEducationMissionClassQuery(Guid schoolyearID)
- {
- List<int> intTypeList = new List<int>(); //生成评价表中已启用、并且存在的授课方式
- var evaluationTabList = EvaluationTableRepository.GetList(x => x.IsEnabled == true, (w => w.EM_EvaluationIntType))
- .Select(s => new
- {
- s.EM_EvaluationIntType.EvaluationIntTypeID
- });
- var IntTypeIDList = evaluationTabList.Select(w => w.EvaluationIntTypeID).ToList();
- EvaluationTeachingModeRepository.GetList(x => IntTypeIDList.Contains((Guid)x.EvaluationIntTypeID))
- .Select(w => w.TeachingModeID).ToList().ForEach(p => { intTypeList.Add(p.Value); });
- Expression<Func<EM_EducationMissionClass, bool>> exp = x => x.EM_EducationMission.SchoolyearID == schoolyearID
- && intTypeList.Contains(x.TeachingModeID ?? (int)CF_TeachingMode.Theory);
- //TODO:调整评价生成、提取教学任务班中排除未提交状态的数据。
- var query = from a in EducationMissionClassRepository.GetList(exp)
- from SchedulingClass in a.EM_EducationSchedulingClass.DefaultIfEmpty()
- join b in EvaluationSettingRepository.Entities on a.EducationMissionClassID equals b.EducationMissionClassID
- into tb
- from ctb in tb.DefaultIfEmpty()
- where ctb == null //如果不存在、那么生成
- select new EducationMissionClassView
- {
- EducationMissionID = a.EducationMissionID,
- EducationMissionClassID = a.EducationMissionClassID,
- MainScheduleClassID = a.MainScheduleClassID,
- TeachingModeID = a.TeachingModeID == null ? (int)CF_TeachingMode.Theory : (int)a.TeachingModeID,//如果授课方式为空、那么默认理论
- SchoolyearID = a.EM_EducationMission.SchoolyearID,
- SchoolyearCode = a.EM_EducationMission.CF_Schoolyear.Code,
- Name = a.Name,
- CoursematerialID = a.EM_Coursematerial.CoursematerialID,
- CourseCode = a.EM_Coursematerial.CourseCode,
- CourseName = a.EM_Coursematerial.CourseName,
- DepartmentID = a.EM_EducationMission.DepartmentID,
- ClassroomID = a.ClassroomID,
- ClassroomTypeID = a.ClassroomTypeID,
- ApprovalStatus = a.RecordStatus,
- CreateTime = a.CreateTime,
- CreateUserID = a.CreateUserID,
- Remark = a.Remark,
- CF_Student = SchedulingClass.CF_Student,
- CF_Staff = a.EM_MissionClassTeacher.Select(x => x.CF_Staff)
- };
- return query;
- }
- }
- }
|