123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- 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.EvaluationManage.EvaluationEnter;
- namespace EMIS.DataLogic.Common.EvaluationManage
- {
- public class EvaluationRecordDAL
- {
- #region --0.0定义--
- 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 EvaluationEnter_EM_EvaluationProjectRepository EvaluationEnter_EM_EvaluationProjectRepository { get; set; }
- public ClassmajorRepository ClassmajorRepository { get; set; }
- #endregion
- public IQueryable<EvaluationRecordView> GetEvaluationRecordQuery()
- {
- //var linqStr = EvaluationEnterRepository.Entities.ToList();
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- bool isStudent = curUser.IsStudent;//获取当前用户是否是学生
- //Guid? typeID = isStudent == true ? evaluationTypeRepository.Entities.Where(w => w.IsStudent == true).FirstOrDefault().TypeID : evaluationTypeRepository.Entities.Where(w => w.IsStudent == false && w.IsDefault == true).FirstOrDefault().TypeID;
- var query = from c in EvaluationSettingRepository.GetList(x => x.OpenStatus == (int)CF_YesOrNoStatus.Yes)
- join f in DictionaryDAL.GetDictionaryItemQuery(typeof(CF_TeachingMode).Name) on c.EM_EducationMissionClass.TeachingModeID equals f.Value
- join emc in EducationMissionClassRepository.Entities on c.EducationMissionClassID equals emc.EducationMissionClassID into temc
- from stemc in temc.DefaultIfEmpty()
- join cla in ClassmajorRepository.Entities on stemc.MainScheduleClassID equals cla.ClassmajorID into dcla
- from ecla in dcla.DefaultIfEmpty()
- from stcontrol in EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true
- && x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID).Contains(c.EM_EducationMissionClass.TeachingModeID)).DefaultIfEmpty()
- join even in EvaluationEnterRepository.Entities on new { c.EducationMissionClassID, TableID = (Guid)stcontrol.EvaluationTableID } equals new { even.EducationMissionClassID, TableID = (Guid)even.EvaluationTableID }
- into teven
- from cteven in teven.DefaultIfEmpty()
- join sfuser in UserRepository.Entities on cteven.StaffUserID equals sfuser.UserID
- into bsfuser
- from tbsfuser in bsfuser.DefaultIfEmpty()
- join sduser in UserRepository.Entities on cteven.StudentUserID equals sduser.UserID
- into bsduser
- from tbsduser in bsduser.DefaultIfEmpty()
- select new EvaluationRecordView
- {
- //staffID=c.EM_EducationMissionClass.EM_MissionClassTeacher.
- CampusID =stemc.EM_EducationMission.CF_College.CampusID,
- Grade = ecla.CF_Grademajor.GradeID,
- StandardID = ecla.CF_Grademajor.CF_Facultymajor.StandardID,
- CollegeID = ecla.CF_Grademajor.CF_Facultymajor.CollegeID,
- EvaluationTableID = stcontrol.EvaluationTableID,
- EvaluationTableNo = stcontrol.Code,
- EvaluationEnterID = cteven.EvaluationEnterID,
- EvaluationIntTypeID = stcontrol.EvaluationIntTypeID,
- EvaluationTableTypeName = stcontrol.EM_EvaluationIntType.Name, //评价类型
- EvaluationTypeName = stcontrol.EM_EvaluationType.Name,
- EvaluationTypeID = stcontrol.EvaluationTypeID,
- EducationMissionClassName = c.EM_EducationMissionClass.Name,
- EducationMissionClassID = c.EM_EducationMissionClass.EducationMissionClassID,
- EvaluationSettingCode = c.EvaluationSettingCode,
- EvaluationCount = cteven.EvaluationEnterID == null ? 0 : cteven.EM_EvaluationEnter_EM_EvaluationProject.GroupBy(x => x.ModifyTime).Select(y => y).Count(),
- LimitMore = (int)stcontrol.EM_EvaluationType.Number,
- SchoolyearID = stemc.EM_EducationMission.CF_Schoolyear.SchoolyearID,
- year=stemc.EM_EducationMission.CF_Schoolyear.Years,
- SchoolyearCode = stemc.EM_EducationMission.CF_Schoolyear.Code,
- Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User),
- EvaluationCode = tbsfuser.LoginID == null ? tbsduser.LoginID : tbsfuser.LoginID,
- EvaluationName = tbsfuser.Name == null ? tbsduser.Name : tbsfuser.Name,
- EvaluationTableName = stcontrol.Name,
- //EvaluationTableTypeID = stcontrol.EM_EvaluationType.TypeID,
- EvaluationTableTypeID = stcontrol.EvaluationIntTypeID,
- CourseName = stemc.EM_Coursematerial.CourseName,
- CourseCode = stemc.EM_Coursematerial.CourseCode,
- LearningformID = ecla.CF_Grademajor.CF_Facultymajor.LearningformID,
- LearnSystem = ecla.CF_Grademajor.CF_Facultymajor.LearnSystem,
- EducationID = ecla.CF_Grademajor.CF_Facultymajor.EducationID,
- };
- return query.Where(x => x.EvaluationCode != null);
- }
- /// <summary>
- /// 读取参评类型信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<EvaluationTypeView> GetEvaluationTypeQueryable(Expression<Func<EM_EvaluationTable, bool>> exp)
- {
- var query = from c in EvaluationTableRepository.GetList(exp)
- join
- a in evaluationTypeRepository.Entities on c.EvaluationTypeID equals a.EvaluationTypeID
- select new EvaluationTypeView
- {
- TypeID = a.EvaluationTypeID,
- //Code = a.Code,
- Name = a.Name,
- IsStudent = a.IsStudent.Value,
- Student = (a.IsStudent.HasValue && a.IsStudent == true) ? "是" : "否",
- IsDefault = a.IsStudent.Value,
- Default = (a.IsStudent.HasValue && a.IsStudent == true) ? "是" : "否",
- StartTime = a.StartTime,
- EndTime = a.EndTime,
- Number = a.Number,
- Remark = a.Remark,
- CreateUserID = a.CreateUserID,
- CreateTime = a.CreateTime
- };
- return query;
- }
- public IQueryable<EvaluationRecordView> GetEvaluationRecordQuery(Expression<Func<EM_EvaluationSetting, bool>> filter)
- {
- //var linqStr = EvaluationEnterRepository.Entities.ToList();
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- bool isStudent = curUser.IsStudent;//获取当前用户是否是学生
- //Guid? typeID = isStudent == true ? evaluationTypeRepository.Entities.Where(w => w.IsStudent == true).FirstOrDefault().TypeID : evaluationTypeRepository.Entities.Where(w => w.IsStudent == false && w.IsDefault == true).FirstOrDefault().TypeID;
- var query =
- from c in EvaluationSettingRepository.GetList(filter)
- join f in DictionaryDAL.GetDictionaryItemQuery(typeof(CF_TeachingMode).Name) on c.EM_EducationMissionClass.TeachingModeID equals f.Value
- join emc in EducationMissionClassRepository.Entities on c.EducationMissionClassID equals emc.EducationMissionClassID into temc
- from stemc in temc.DefaultIfEmpty()
- join classmajor in ClassmajorRepository.Entities on stemc.MainScheduleClassID equals classmajor.ClassmajorID into dclassmajor
- from classmajor in dclassmajor.DefaultIfEmpty()
- from stcontrol in EvaluationTableRepository.Entities.Where(x => x.IsEnabled == true
- && x.EM_EvaluationIntType.EM_EvaluationTeachingMode.Select(w => w.TeachingModeID).Contains(c.EM_EducationMissionClass.TeachingModeID)).DefaultIfEmpty()
- join even in EvaluationEnterRepository.Entities on new { c.EducationMissionClassID, TableID = (Guid)stcontrol.EvaluationTableID } equals new { even.EducationMissionClassID, TableID = (Guid)even.EvaluationTableID }
- into teven
- from cteven in teven.DefaultIfEmpty()
- join sfuser in UserRepository.Entities on cteven.StaffUserID equals sfuser.UserID
- into bsfuser
- from tbsfuser in bsfuser.DefaultIfEmpty()
- join sduser in UserRepository.Entities on cteven.StudentUserID equals sduser.UserID
- into bsduser
- from tbsduser in bsduser.DefaultIfEmpty()
- select new EvaluationRecordView
- {
- //ClassID=stemc.EM_ExecutablePlan.CF_Grademajor.CF_Classmajor
- CampusID = classmajor.CF_Grademajor.CF_Facultymajor.CF_College.CampusID,
- StandardID = classmajor.CF_Grademajor.CF_Facultymajor.StandardID,
- CollegeID = classmajor.CF_Grademajor.CF_Facultymajor.CollegeID,
- EvaluationTableID = stcontrol.EvaluationTableID,
- EvaluationEnterID = cteven.EvaluationEnterID,
- EvaluationTableTypeName = stcontrol.EM_EvaluationIntType.Name, //评价类型
- EvaluationTypeName = stcontrol.EM_EvaluationType.Name,
- EvaluationTypeID = stcontrol.EvaluationTypeID,
- EducationMissionClassName = c.EM_EducationMissionClass.Name,
- EducationMissionClassID = c.EM_EducationMissionClass.EducationMissionClassID,
- EvaluationSettingCode = c.EvaluationSettingCode,
- EvaluationCount = cteven.EvaluationEnterID == null ? 0 : cteven.EM_EvaluationEnter_EM_EvaluationProject.GroupBy(x => x.ModifyTime).Select(y => y).Count(),
- LimitMore = (int)stcontrol.EM_EvaluationType.Number,
- SchoolyearID = stemc.EM_EducationMission.CF_Schoolyear.SchoolyearID,
- SchoolyearCode = stemc.EM_EducationMission.CF_Schoolyear.Code,
- Sys_User = c.EM_EducationMissionClass.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User),
- EvaluationCode = tbsfuser.LoginID == null ? tbsduser.LoginID : tbsfuser.LoginID,
- EvaluationName = tbsfuser.Name == null ? tbsduser.Name : tbsfuser.Name,
- EvaluationTableName = stcontrol.Name,
- EvaluationTableTypeID = stcontrol.EM_EvaluationType.EvaluationTypeID,
- CourseName = stemc.EM_Coursematerial.CourseName,
- CourseCode = stemc.EM_Coursematerial.CourseCode,
- };
- return query.Where(x => x.EvaluationCode != null);
- }
- }
- }
|