123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.ScoreManage;
- using EMIS.Entities;
- using EMIS.ViewModel;
- namespace EMIS.DataLogic.ScoreManage
- {
- public class ExaminationSuspensionDAL
- {
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public FinalExaminationRepository FinalExaminationRepository { get; set; }
- public FinalExaminationStudentRepository FinalExaminationStudentRepository { get; set; }
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public ExaminationSuspensionRepository ExaminationSuspensionRepository { get; set; }
- public EducationMissionRepository EducationMissionRepository { get; set; }
- public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
- public IQueryable<ExaminationSuspensionView> GetExaminationSuspensionViewQueryable(Expression<Func<ER_ExaminationSuspension, bool>> exp)
- {
- var query = (from ms in ExaminationSuspensionRepository.GetList(exp)
- select new ExaminationSuspensionView
- {
- ExaminationSuspensionID = ms.ExaminationSuspensionID,
- UserID = ms.UserID,
- LoginID = ms.CF_Student.Sys_User.LoginID,
- Name = ms.CF_Student.Sys_User.Name,
- ClassmajorName = ms.CF_Student.CF_Classmajor.Name,
- CollegeID = ms.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID,
- Year = ms.CF_Student.CF_Classmajor.CF_Grademajor.GradeID,
- StandardID = ms.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID,
- SchoolyearID = ms.SchoolyearID,
- SchoolyearCode = ms.CF_Schoolyear.Code,
- CoursematerialID = ms.CoursematerialID,
- CourseCode = ms.EM_Coursematerial.CourseCode,
- CourseName = ms.EM_Coursematerial.CourseName,
- ExamsCategoryID = ms.ExamsCategoryID,
- Reason = ms.Reason,
- RecordStatus = ms.RecordStatus,
- CreateTime = ms.CreateTime
- });
- return query;
- }
- public IQueryable<ExaminationSuspensionCoursematerialView> GetExaminationSuspensionCoursematerialViewQueryable(
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> schoolyearExp, Expression<Func<CF_Student, bool>> studentExp)
- {
- List<int?> approvedFinalExaminationState = new List<int?> { (int)CF_ScoreState.Approved, (int)CF_ScoreState.Submitted };
- var query = (
- from emc in EducationMissionClassRepository.Entities
- join em in EducationMissionRepository.Entities on emc.EducationMissionID equals em.EducationMissionID
- join sy in SchoolyearRepository.GetList(schoolyearExp) on em.SchoolyearID equals sy.SchoolyearID
- join course in CoursematerialRepository.Entities on emc.CoursematerialID equals course.CoursematerialID
- from esc in emc.EM_EducationSchedulingClass
- from esccs in esc.CF_Student
- join s in StudentRepository.GetList(studentExp) on esccs.UserID equals s.UserID
- group emc by new ExaminationSuspensionCoursematerialView
- {
- CoursematerialID = course.CoursematerialID,
- CourseCode = course.CourseCode,
- CourseName = course.CourseName
- } into g
- select g.Key
- ).Union(
- from fe in FinalExaminationRepository.Entities
- join cm in CoursematerialRepository.Entities on fe.CoursematerialID equals cm.CoursematerialID
- join sy in SchoolyearRepository.GetList(schoolyearExp) on fe.SchoolyearID equals sy.SchoolyearID
- from fes in fe.ER_FinalExaminationStudent
- join s in StudentRepository.GetList(studentExp) on fes.UserID equals s.UserID
- group fe by new ExaminationSuspensionCoursematerialView {
- CoursematerialID = cm.CoursematerialID,
- CourseCode = cm.CourseCode,
- CourseName = cm.CourseName
- } into g
- select g.Key
- );
-
- return query.Distinct();
- }
- }
- }
|