123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- 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;
- using EMIS.Utility;
- using EMIS.DataLogic.Common.Students;
- using Bowin.Common.Linq;
- namespace EMIS.DataLogic.Common.EvaluationManage
- {
- public class TeacherEvaluationCountDAL
- {
- public StudentRepository StudentRepository { get; set; }
- public StaffRepository StaffRepository { get; set; }
- public EvaluationSettingRepository EvaluationSettingRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- //public StudentEvaluationRepository StudentEvaluationRepository { get; set; }
- public EducationMissionRepository EducationMissionRepository { get; set; }
- public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
- public EM_EvaluationSetting EvaluationSetting { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public EvaluationEnterRepository EvaluationEnterRepository { get; set; }
- public IQueryable<TeacherEvaluationCountView> GetTeacherView(Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> exp,
- Expression<Func<EM_EvaluationSetting, bool>> expset
- )
- // Expression<Func<EM_EducationMissionClass, bool>> exp =null
- {
- var query3 = from s in StaffRepository.Entities
- //from set in s.EM_EvaluationSetting
- join nses in
- (from sr in StaffRepository.Entities
- from es in sr.EM_EvaluationSetting.Where(x => x.OpenStatus == 1)
- //join set in EvaluationSettingRepository.GetList(expset) on es.EvaluationSettingID equals set.EvaluationSettingID
- join em in EducationMissionClassRepository.Entities on es.EducationMissionClassID equals em.EducationMissionClassID
- join emc in EducationMissionRepository.Entities on em.EducationMissionID equals emc.EducationMissionID
- join sy in SchoolyearRepository.GetList(exp) on emc.SchoolyearID equals sy.SchoolyearID
- group sr by new { sr.UserID, sy.SchoolyearID, sy.Code } into ns
- select new
- {
- //TypeID = ns.Key.EvaluationIntTypeID,
- SchoolCode = ns.Key.Code,
- SchoolyearID = ns.Key.SchoolyearID,
- UserID = ns.Key.UserID,
- NeedEvaluationCount = ns.Count()
- }) on s.UserID equals nses.UserID
- join set in
- (from sr in StaffRepository.Entities
- from est in sr.EM_EvaluationSetting.Where(x => x.OpenStatus == 1)
- //join set in EvaluationSettingRepository.GetList(expset) on est.EvaluationSettingID equals set.EvaluationSettingID
- join em in EducationMissionClassRepository.Entities on est.EducationMissionClassID equals em.EducationMissionClassID
- join emc in EducationMissionRepository.Entities on em.EducationMissionID equals emc.EducationMissionID
- join sy in SchoolyearRepository.GetList(exp) on emc.SchoolyearID equals sy.SchoolyearID
- where (from et in EvaluationEnterRepository.Entities.Where(x => x.StaffUserID == sr.UserID) select et.EducationMissionClassID).Contains(est.EducationMissionClassID)
- group sr by new { sr.UserID, sy.SchoolyearID, sy.Code, } into nst
- select new
- {
- //TypeID = nst.Key.EvaluationIntTypeID,
- SchoolCode = nst.Key.Code,
- SchoolyearID = nst.Key.SchoolyearID,
- UserID = nst.Key.UserID,
- CompleteCount = nst.Count(),
- }) on s.UserID equals set.UserID
- into g
- from n_set in g.DefaultIfEmpty()
- select new TeacherEvaluationCountView
- {
- CollegeID = s.CF_College.CollegeID,
- TeacherNo = s.StaffCode,
- TeacherName = s.Sys_User.Name,
- //EvaluationTypeID = n_set.TypeID,
- //EvaluationTypeName = set.EM_EvaluationTable.Name,
- DepartmentID = s.CF_Department.DepartmentID,
- //s.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID,
- //SchoolyearNumID
- ////s.CF_Classmajor.CF_Grademajor.SchoolyearID,
- //StandardID = s.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID,
- //StudentNo = s.Sys_User.LoginID,
- //Name = s.Sys_User.Name,
- //ClassmajorID = s.ClassmajorID,
- //ClassmajorName = s.CF_Classmajor.Name,
- SchoolyearID = n_set.SchoolyearID,//s.CF_Classmajor.CF_Grademajor.CF_Schoolyear.SchoolyearID,
- SchoolyearCode = nses.SchoolCode,//s.CF_Classmajor.CF_Grademajor.CF_Schoolyear.Code,
- CompleteCount = n_set.CompleteCount == null ? 0 : n_set.CompleteCount,
- NeedEvaluationCount = nses.NeedEvaluationCount,
- UncompletedCount = nses.NeedEvaluationCount - (n_set.CompleteCount == null ? 0 : n_set.CompleteCount),
- };
- return query3;
- }
- }
- }
|