123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- 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 Bowin.Common.Linq;
- using EMIS.ViewModel.EvaluationManage.EvaluationEnter;
- using EMIS.Utility;
- using EMIS.DataLogic.StudentManage.StudentStatistics;
- namespace EMIS.DataLogic.Common.EvaluationManage
- {
- public class EvaluationEnterDAL
- {
- public DataRangeDAL DataRangeDAL { get; set; }
- public InSchoolSettingDAL InSchoolSettingDAL { get; set; }
- public EvaluationSettingRepository EvaluationSettingRepository { get; set; }
- public EducationMissionRepository EducationMissionRepository { 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 EducationMissionClassRepository EducationMissionClassRepository { get; set; }
- public SpecialtyPlanRepository SpecialtyPlanRepository { get; set; }
- public EvaluationTypeRepository evaluationTypeRepository { get; set; }
- public EvaluationControlRepository EvaluationControlRepository { get; set; }
- public EvaluationEnterRepository EvaluationEnterRepository { get; set; }
- public EvaluationProjectRepository EvaluationProjectRepository { get; set; }
- public EvaluationTargetRepository EvaluationTargetRepository { get; set; }
- public EvaluationNormRepository EvaluationNormRepository { get; set; }
- public EvaluationNormDetailRepository EvaluationNormDetailRepository { get; set; }
- //public EvaluationNeedDAL evaluationNeedDAL { get; set; }
- public EvaluationGradeControlRepository EvaluationGradeControlRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public EvaluationEnter_EM_EvaluationProjectRepository EvaluationEnter_EM_EvaluationProjectRepository { get; set; }
- // 加载进入评价信息
- public IQueryable<EvaluationEnterView> GetEvaluationEnterQuery(Expression<Func<EM_EvaluationSetting, bool>> expEvaluationSetting = null,
- Expression<Func<EM_EvaluationEnter, bool>> expEvaluationEnter = null, Expression<Func<EM_EvaluationTable, bool>> expEvaluationTable = null)
- {
- if (expEvaluationSetting == null)
- {
- expEvaluationSetting = (x => true);
- }
- if (expEvaluationEnter == null)
- {
- expEvaluationEnter = (x => true);
- }
- if (expEvaluationTable == null)
- {
- expEvaluationTable = (x => true);
- }
- var query = from c in EvaluationSettingRepository.GetList(expEvaluationSetting)
- from stcontrol in EvaluationTableRepository.Entities.Where(expEvaluationTable)
- .Where(x => x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID)
- .Contains(c.EM_EducationMissionClass.TeachingModeID ?? (int)CF_TeachingMode.Theory)).DefaultIfEmpty()
- //into tcontrol//评价表评价类型变动、转变成一对多关系、一种评价类型对应多个授课类型
- //from stcontrol in tcontrol.DefaultIfEmpty()
- join even in EvaluationEnterRepository.GetList(expEvaluationEnter) on new { c.EducationMissionClassID, TableID = (Guid)stcontrol.EvaluationTableID }
- equals new { even.EducationMissionClassID, TableID = (Guid)even.EvaluationTableID }
- into teven
- from cteven in teven.DefaultIfEmpty()
- join evcontrol in EvaluationControlRepository.Entities on c.EM_EducationMissionClass.EM_EducationMission.SchoolyearID equals evcontrol.SchoolyearID
- into Temevcontrol
- from evcontroltab in Temevcontrol.DefaultIfEmpty()
- select new EvaluationEnterView
- {
- EntityCreateTime = cteven.ModifyTime,
- CollegeID = c.EM_EducationMissionClass.EM_EducationMission.CollegeID,
- DepartmentName = c.EM_EducationMissionClass.EM_EducationMission.CF_Department.Name,
- EvaluationTableID = stcontrol.EvaluationTableID,
- EvaluationTableName = stcontrol.Name,
- EvaluationEnterID = cteven.EvaluationEnterID,
- EvaluationSettingID = c.EvaluationSettingID,//评价设置ID
- EvaluationIntTypeID = stcontrol.EM_EvaluationIntType.EvaluationIntTypeID,
- EvaluationTableTypeName = stcontrol.EM_EvaluationIntType.Name,
- EvaluationTypeID = stcontrol.EM_EvaluationType.EvaluationTypeID,//参评类型
- EvaluationTypeName = stcontrol.EM_EvaluationType.Name,
- EducationMissionClassName = c.EM_EducationMissionClass.Name,
- EducationMissionClassID = c.EM_EducationMissionClass.EducationMissionClassID,
- EvaluationSettingCode = c.EvaluationSettingCode,
- DepartmentID = c.EM_EducationMissionClass.EM_EducationMission.DepartmentID,
- SchoolyearID = c.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.SchoolyearID,
- SchoolyearCode = c.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.Code,
- CourseName = c.EM_EducationMissionClass.EM_Coursematerial.CourseName,
- CourseCode = c.EM_EducationMissionClass.EM_Coursematerial.CourseCode,
- LimitMore = stcontrol.EM_EvaluationType.Number,
- PhotoUrl = c.EM_EducationMissionClass.EM_MissionClassTeacher.Where(x => x.TeachType == (int)EM_TeachingMethod.Lecturer).FirstOrDefault().CF_Staff.PhotoUrl,
- Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User),
- StaffDepartmentID = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.DepartmentID),
- IsEvaluation = DateTime.Now > stcontrol.EM_EvaluationType.StartTime && DateTime.Now < stcontrol.EM_EvaluationType.EndTime ? true : false,
- EvaluationCount = cteven.EvaluationEnterID == null ? 0 : cteven.EM_EvaluationEnter_EM_EvaluationProject.GroupBy(x => x.ModifyTime).Select(y => y).Count(),
- Remark = cteven.Remark,
- };
- return query;
- }
-
- //学生加载进入评价信息
- public IQueryable<EvaluationEnterView> GetStudentEvaluationEnterQuery(Expression<Func<EM_EvaluationSetting, bool>> expEvaluationSetting = null,
- Expression<Func<EM_EvaluationEnter, bool>> expEvaluationEnter = null, Expression<Func<EM_EvaluationTable, bool>> expEvaluationTable = null,
- Expression<Func<EM_EvaluationGradeControl, bool>> expEvaluationGradeControl = null,
- Expression<Func<CF_Student, bool>> expStudent = null)
- {
- if (expEvaluationSetting == null)
- {
- expEvaluationSetting = (x => true);
- }
- if (expEvaluationEnter == null)
- {
- expEvaluationEnter = (x => true);
- }
- if (expEvaluationTable == null)
- {
- expEvaluationTable = (x => true);
- }
- if (expEvaluationGradeControl == null)
- {
- expEvaluationGradeControl = (x => true);
- }
- if (expStudent == null)
- {
- expStudent = (x => true);
- }
- var query = from c in EvaluationSettingRepository.GetList(expEvaluationSetting)
- from stcontrol in EvaluationTableRepository.Entities.Where(expEvaluationTable)
- .Where(x => x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID)
- .Contains(c.EM_EducationMissionClass.TeachingModeID ?? (int)CF_TeachingMode.Theory)).DefaultIfEmpty()
- //into tcontrol//评价表评价类型变动、转变成一对多关系、一种评价类型对应多个授课类型
- //from stcontrol in tcontrol.DefaultIfEmpty()
- join even in EvaluationEnterRepository.GetList(expEvaluationEnter)
- on new { c.EducationMissionClassID, TableID = (Guid)stcontrol.EvaluationTableID }
- equals new { even.EducationMissionClassID, TableID = (Guid)even.EvaluationTableID }
- into teven
- from cteven in teven.DefaultIfEmpty()
- join evcontrol in EvaluationControlRepository.Entities
- on c.EM_EducationMissionClass.EM_EducationMission.SchoolyearID equals evcontrol.SchoolyearID into Temevcontrol
- from evcontroltab in Temevcontrol.DefaultIfEmpty()
- from student in StudentRepository.Entities.Where(expStudent).DefaultIfEmpty()
- join grade in GrademajorRepository.Entities on student.CF_Classmajor.CF_Grademajor.GrademajorID equals grade.GrademajorID
- join egcontrol in EvaluationGradeControlRepository.Entities
- on new { c.EM_EducationMissionClass.EM_EducationMission.SchoolyearID, GrademajorID = grade.GrademajorID }
- equals new { egcontrol.SchoolyearID, GrademajorID = (Guid)egcontrol.GrademajorID }
- into eg
- from e in eg.DefaultIfEmpty()
- select new EvaluationEnterView
- {
- EntityCreateTime = cteven.ModifyTime,
- CollegeID = c.EM_EducationMissionClass.EM_EducationMission.CollegeID,
- DepartmentName = c.EM_EducationMissionClass.EM_EducationMission.CF_Department.Name,
- EvaluationTableID = stcontrol.EvaluationTableID,
- EvaluationTableName = stcontrol.Name,
- EvaluationEnterID = cteven.EvaluationEnterID,
- EvaluationSettingID = c.EvaluationSettingID,//评价设置ID
- EvaluationIntTypeID = stcontrol.EM_EvaluationIntType.EvaluationIntTypeID,
- EvaluationTableTypeName = stcontrol.EM_EvaluationIntType.Name,
- EvaluationTypeID = stcontrol.EM_EvaluationType.EvaluationTypeID,//参评类型
- EvaluationTypeName = stcontrol.EM_EvaluationType.Name,
- EducationMissionClassName = c.EM_EducationMissionClass.Name,
- EducationMissionClassID = c.EM_EducationMissionClass.EducationMissionClassID,
- EvaluationSettingCode = c.EvaluationSettingCode,
- DepartmentID = c.EM_EducationMissionClass.EM_EducationMission.DepartmentID,
- SchoolyearID = c.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.SchoolyearID,
- SchoolyearCode = c.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.Code,
- CourseName = c.EM_EducationMissionClass.EM_Coursematerial.CourseName,
- CourseCode = c.EM_EducationMissionClass.EM_Coursematerial.CourseCode,
- LimitMore = (e.EvaluationGradeControlID == null ? stcontrol.EM_EvaluationType.Number : e.Number),
- PhotoUrl = c.EM_EducationMissionClass.EM_MissionClassTeacher.Where(x => x.TeachType == (int)EM_TeachingMethod.Lecturer).FirstOrDefault().CF_Staff.PhotoUrl,
- Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User),
- StaffDepartmentID = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.DepartmentID),
- IsEvaluation = DateTime.Now > stcontrol.EM_EvaluationType.StartTime && DateTime.Now < stcontrol.EM_EvaluationType.EndTime ? true : false,
- IsStudentEvaluation = (e.EvaluationGradeControlID == null ?
- (DateTime.Now > stcontrol.EM_EvaluationType.StartTime && DateTime.Now < stcontrol.EM_EvaluationType.EndTime ? true : false)
- : (DateTime.Now > e.StartTime && DateTime.Now < e.EndTime ? true : false)),
- EvaluationCount = cteven.EvaluationEnterID == null ? 0 : cteven.EM_EvaluationEnter_EM_EvaluationProject.GroupBy(x => x.ModifyTime).Select(y => y).Count(),
- Remark = cteven.Remark,
- };
- return query;
- }
- // 加载进入评价表头相关信息
- public EvaluationEnterView GetEvaluationEnterTitleView(Guid? educationMissionClassID, Guid? evaluationTableID)
- {
- var Query = from c in EvaluationSettingRepository.GetList(x => x.OpenStatus == (int)CF_YesOrNoStatus.Yes && x.EvaluationTableID == evaluationTableID)
- //join f in DictionaryDAL.GetDictionaryItemQuery(typeof(CF_TeachingMode).Name) on c.EM_EvaluationTable.IntType equals f.Value
- join emc in EducationMissionClassRepository.GetList(x => x.EducationMissionClassID == educationMissionClassID)
- on c.EducationMissionClassID equals emc.EducationMissionClassID into temc
- from stemc in temc.DefaultIfEmpty()
- join control in EvaluationControlRepository.Entities on stemc.EM_EducationMission.CF_Schoolyear.SchoolyearID equals control.SchoolyearID
- into tcontrol
- from stcontrol in tcontrol.DefaultIfEmpty()
- // join entype in evaluationTypeRepository.Entities on c.EM_EvaluationType.TypeID equals entype.TypeID
- // join user in UserRepository.Entities on stcourse.UserID equals user.UserID
- select new EvaluationEnterView
- {
- EvaluationTableID = c.EvaluationTableID,
- //EvaluationTableTypeName = f.Name,
- EvaluationTypeName = c.EM_EvaluationType.Name,
- EducationMissionClassName = c.EM_EducationMissionClass.Name,
- EducationMissionClassID = c.EM_EducationMissionClass.EducationMissionClassID,
- EvaluationSettingCode = c.EvaluationSettingCode,
- CourseName = stemc.EM_Coursematerial.CourseName,
- CourseCode = stemc.EM_Coursematerial.CourseCode,
- Remark = stemc.EM_EducationMission.CF_Department.Name,
- LimitMore = c.EM_EvaluationType.Number,//entype.Number,
- Sys_User = stemc.EM_MissionClassTeacher.Select(x => x.CF_Staff.Sys_User)
- };
- return Query.FirstOrDefault();
- }
- // 加载进入评价评价项目相关信息
- public IQueryable<EvaluationEnterView> GetEvaluationEnterView(Guid? evaluationEnterID, Guid? evaluationTableID)
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- //取最大操作时间
- var maxModifyTime = (from a in EvaluationEnter_EM_EvaluationProjectRepository.Entities.Where(x => x.EvaluationEnterID == evaluationEnterID)
- group new { a } by new { a.ModifyTime } into g
- select new { ModifyTime = g.Max(x => x.a.ModifyTime) }).OrderByDescending(x => x.ModifyTime).FirstOrDefault();
- var Query = from c in EvaluationEnterRepository.Entities.Where(x => x.EvaluationTableID == evaluationTableID && x.EvaluationEnterID == evaluationEnterID)
- join b in EvaluationEnter_EM_EvaluationProjectRepository.Entities.Where(x => x.CreateUserID == curUser.UserID && x.ModifyTime == maxModifyTime.ModifyTime)
- on c.EvaluationEnterID equals b.EvaluationEnterID
- into tProject
- from ctProject in tProject.DefaultIfEmpty()
- group new { ctProject } by new { ctProject.ModifyTime, ctProject.EvaluationScore, ctProject.ProjectID } into g
- select new EvaluationEnterView
- {
- EvaluationScore = (decimal)g.Key.EvaluationScore,
- ProjectID = g.Key.ProjectID,
- ModifyTime = g.Max(x => x.ctProject.ModifyTime)
- };
- return Query;
- }
- //这个部门对于的所有教师
- public IQueryable<DepartmentStaffView> GetDepartmentStaffViewQueryable(Expression<Func<EM_EducationMissionClass, bool>> exp)
- {
- var query = from emc in EducationMissionClassRepository.GetList(exp)
- from emcTecher in emc.EM_MissionClassTeacher.DefaultIfEmpty()
- join staff in StaffRepository.Entities.Where(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE)
- on emcTecher.CF_Staff.DepartmentID equals staff.DepartmentID
- select new DepartmentStaffView
- {
- EducationMissionClassID = emc.EducationMissionClassID,
- UserID = staff.UserID,
- Name = staff.Sys_User.Name,
- DepartmentID = staff.DepartmentID,
- StaffCode = staff.Sys_User.LoginID
- };
- return query;
- }
- }
- }
|