123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.DataLogic.Common.CalendarManage;
- using EMIS.ViewModel.Students.HighBaseTable;
- using System.Linq.Expressions;
- using EMIS.Entities;
- namespace EMIS.DataLogic.Common.Students.HighBaseTable
- {
- public class InschoolOtherStatusDAL
- {
- public InschoolOtherStatusRepository InschoolOtherStatusRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public StudentProfileRepository StudentProfileRepository { get; set; }
- public ClassmajorRepository ClassmajorRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public FacultymajorRepository FacultymajorRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public RecruitstudentsRepository RecruitstudentsRepository { get; set; }
- public InSchoolSettingRepository InSchoolSettingRepository { get; set; }
- public EducationTypeSettingRepository EducationTypeSettingRepository { get; set; }
- public SchoolYearDAL SchoolYearDAL { get; set; }
- public StudentReportRepository StudentReportRepository { get; set; }
- /// <summary>
- /// 少数民族统计
- /// </summary>
- /// <returns></returns>
- public IQueryable<InschoolOtherStatusView> GetInschoolOtherStatusMinorityCount(int? schoolYear)
- {
- //var schYear = SchoolYearDAL.GetSchoolYearQueryable(x => x.IsCurrent).FirstOrDefault().Years;
- var query = from student in StudentRepository.GetList(x => x.NationID != (int)EMIS.ViewModel.CF_Nation.Han)
- join inschool in InSchoolSettingRepository.Entities.Where(x => x.IsSelected == true)
- on student.InSchoolStatusID equals inschool.InSchoolStatusID
- join profile in StudentProfileRepository.Entities
- on student.UserID equals profile.UserID
- join clmajor in ClassmajorRepository.Entities on student.ClassmajorID equals clmajor.ClassmajorID
- join grmajor in GrademajorRepository.Entities on clmajor.GrademajorID equals grmajor.GrademajorID
- join famajor in FacultymajorRepository.Entities on grmajor.FacultymajorID equals famajor.FacultymajorID
- join edutype in EducationTypeSettingRepository.Entities on famajor.EducationID equals edutype.EducationID
- //join report in
- // (
- // from report in StudentReportRepository.GetList(x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE
- // && x.ReportStatusID == (int)EMIS.ViewModel.CF_ReportStatus.Havetoreportforduty)
- // join schoolyear in SchoolyearRepository.Entities on report.SchoolyearID equals schoolyear.SchoolyearID
- // where schoolyear.Years == schoolYear
- // select report.UserID
- // ).Distinct() on student.UserID equals report
- group student by new
- {
- student.NationID,
- edutype.EducationTypeID,
- } into g
- select new InschoolOtherStatusView
- {
- EducationTypeID = g.Key.EducationTypeID,
- Nation = g.Key.NationID,
- Minority = g.Count()
- };
- return query;
- }
- //政治面貌分组统计
- public IQueryable<InschoolOtherStatusView> GetInschoolOtherStatusPoliticsCount(Expression<Func<CF_Student, bool>> exp, int? schoolYear)
- {
- var schYear = SchoolYearDAL.GetSchoolYearQueryable(x => x.IsCurrent).FirstOrDefault().Years;
- var query = from student in StudentRepository.GetList(exp)
- join inschool in InSchoolSettingRepository.Entities.Where(x => x.IsSelected == true)
- on student.InSchoolStatusID equals inschool.InSchoolStatusID
- join profile in StudentProfileRepository.Entities on student.UserID equals profile.UserID
- join clmajor in ClassmajorRepository.Entities on student.ClassmajorID equals clmajor.ClassmajorID
- join grmajor in GrademajorRepository.Entities on clmajor.GrademajorID equals grmajor.GrademajorID
- join famajor in FacultymajorRepository.Entities on grmajor.FacultymajorID equals famajor.FacultymajorID
- join edutype in EducationTypeSettingRepository.Entities on famajor.EducationID equals edutype.EducationID
- //join report in
- // (
- // from report in StudentReportRepository.GetList(x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE
- // && x.ReportStatusID == (int)EMIS.ViewModel.CF_ReportStatus.Havetoreportforduty)
- // join schoolyear in SchoolyearRepository.Entities on report.SchoolyearID equals schoolyear.SchoolyearID
- // where schoolyear.Years == schoolYear
- // select report.UserID
- // ).Distinct() on student.UserID equals report
- group student by new
- {
- student.PoliticsID,
- edutype.EducationTypeID,
- } into g
- select new InschoolOtherStatusView
- {
- EducationTypeID = g.Key.EducationTypeID,
- Politics = g.Key.PoliticsID,
- PoliticsCount = g.Count()
- };
- return query;
- }
- }
- }
|