123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel;
- using EMIS.ViewModel.RetakeManage;
- using EMIS.Entities;
- using System.Linq.Expressions;
- namespace EMIS.DataLogic.RetakeManage
- {
- public class RetakePlanResultDAL
- {
- public RetakeConditionRepository RetakConditionRepository { get; set; }
- public RetakeConditionParameterRepository RetakeConditionParameterRepository { get; set; }
- public RetakePlanRepository RetakePlanRepository { get; set; }
- public RetakePlanStudentRepository RetakePlanStudentRepository { get; set; }
- public RetakeExamsCatagoryRepository RetakeExamsCatagoryRepository { get; set; }
- public RetakePlanSettingRepository RetakePlanSettingRepository { get; set; }
- public RetakePlanTeachingModeTypeRepository RetakePlanTeachingModeTypeRepository { get; set; }
- public RetakePlanTeachingPlaceRepository RetakePlanTeachingPlaceRepository { get; set; }
- public RetakePlanTeachingSettingRepository RetakePlanTeachingSettingRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public InSchoolSettingRepository InSchoolSettingRepository { get; set; }
- public ParameterRepository ParameterRepository { get; set; }
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public FinallyScoreRepository FinallyScoreRepository { get; set; }
- public ClassmajorRepository ClassmajorRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public FacultymajorRepository FacultymajorRepository { get; set; }
- public CollegeRepository CollegeRepository { get; set; }
- public DepartmentRepository DepartmentRepository { get; set; }
- public ClassroomRepository ClassroomRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public CoursesTimeRepository coursesTimeRepository { get; set; }
- public RetakePlanSettingSchedulingRepository RetakePlanSettingSchedulingRepository { get; set; }
- public RetakePlanTeacherRepository RetakePlanTeacherRepository { get; set; }
- /// <summary>
- /// 查询重修班级信息View(统计已报人数,根据重修计划相关信息)
- /// </summary>
- /// <param name="expRetakePlan"></param>
- /// <returns></returns>
- public IQueryable<RetakePlanTaskView> GetRetakePlanResultTaskView(Expression<Func<ER_RetakePlan, bool>> expRetakePlan)
- {
- var query = from rePlan in RetakePlanRepository.GetList(expRetakePlan)
- join cou in CoursematerialRepository.Entities
- on rePlan.CoursematerialID equals cou.CoursematerialID
- join sy in SchoolyearRepository.Entities
- on rePlan.SchoolyearID equals sy.SchoolyearID
- join reStu in
- (
- from stu in RetakePlanStudentRepository.Entities
- group stu by stu.RetakePlanID into g
- select new
- {
- RetakePlanID = g.Key,
- PlanNumber = g.Count()
- }
- )
- on rePlan.RetakePlanID equals reStu.RetakePlanID
- into reStuTemp
- from rePlanStu in reStuTemp.DefaultIfEmpty()
- join reSet in RetakePlanSettingRepository.Entities
- on rePlan.RetakePlanID equals reSet.RetakePlanID
- into reSetTemp
- from rePlanSet in reSetTemp.DefaultIfEmpty()
- join dep in DepartmentRepository.Entities
- on rePlanSet.DepartmentID equals dep.DepartmentID
- into reDepTemp
- from reDep in reDepTemp.DefaultIfEmpty()
- join reTeaching in RetakePlanTeachingSettingRepository.Entities
- on rePlan.RetakePlanID equals reTeaching.RetakePlanID
- into reTeachingTemp
- from rePlanTeaching in reTeachingTemp.DefaultIfEmpty()
- select new RetakePlanTaskView
- {
- RetakePlanID = rePlan.RetakePlanID,
- SchoolyearID = rePlan.SchoolyearID,
- SchoolyearCode = sy.Code,
- RetakeTypeID = rePlan.RetakeTypeID,
- ClassName = rePlan.ClassName,
- CoursematerialID = rePlan.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- DepartmentID = rePlanSet.DepartmentID,
- DepartmentCode = reDep.No,
- DepartmentName = reDep.Name,
- CourseCollegeID = reDep.CF_College.CollegeID,
- CourseCollegeNo = reDep.CF_College.No,
- CourseCollegeName = reDep.CF_College.Name,
- CourseTypeID = rePlan.CourseTypeID,
- Credit = rePlan.Credit ?? 0,
- PeopleNumlimit = rePlan.PeopleNumlimit ?? 0,
- PeopleNumlower = rePlan.PeopleNumlower ?? 0,
- TheoryCourse = rePlanTeaching.TheoryCourse ?? 0,
- Practicehours = rePlanTeaching.Practicehours ?? 0,
- Trialhours = rePlanTeaching.Trialhours ?? 0,
- StartWeeklyNum = rePlanTeaching.StartWeeklyNum,
- EndWeeklyNum = rePlanTeaching.EndWeeklyNum,
- PlanNumber = rePlanStu != null ? rePlanStu.PlanNumber : 0,
- ApplyNumber = rePlan.CF_Student.Count,
- RecordStatus = rePlan.RecordStatus
- };
- return query;
- }
- /// <summary>
- /// 查询重修班级对应的报名名单信息View(已报名,根据重修计划相关信息)
- /// </summary>
- /// <param name="expRetakePlan"></param>
- /// <returns></returns>
- public IQueryable<RetakeStudentListView> GetRetakePlanResultView(Expression<Func<ER_RetakePlan, bool>> expRetakePlan)
- {
- var query = from rePlan in RetakePlanRepository.GetList(expRetakePlan)
- from applyStu in rePlan.CF_Student
- join rePlanStu in RetakePlanStudentRepository.Entities
- on
- new { applyStu.UserID, rePlan.RetakePlanID }
- equals
- new { rePlanStu.UserID, rePlanStu.RetakePlanID }
- join stu in StudentRepository.Entities
- on rePlanStu.UserID equals stu.UserID
- join us in UserRepository.Entities
- on stu.UserID equals us.UserID
- join cl in ClassmajorRepository.Entities
- on stu.ClassmajorID equals cl.ClassmajorID
- join gr in GrademajorRepository.Entities
- on cl.GrademajorID equals gr.GrademajorID
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join col in CollegeRepository.Entities
- on fa.CollegeID equals col.CollegeID
- join sy in SchoolyearRepository.Entities
- on rePlan.SchoolyearID equals sy.SchoolyearID
- join cou in CoursematerialRepository.Entities
- on rePlan.CoursematerialID equals cou.CoursematerialID
- join reSet in RetakePlanSettingRepository.Entities
- on rePlan.RetakePlanID equals reSet.RetakePlanID
- into reSetTemp
- from rePlanSet in reSetTemp.DefaultIfEmpty()
- join dep in DepartmentRepository.Entities
- on rePlanSet.DepartmentID equals dep.DepartmentID
- into reDepTemp
- from reDep in reDepTemp.DefaultIfEmpty()
- select new RetakeStudentListView
- {
- RetakePlanID = rePlan.RetakePlanID,
- RetakePlanStudentID = rePlanStu.RetakePlanStudentID,
- RetakeTypeID = rePlan.RetakeTypeID,
- SchoolyearID = rePlan.SchoolyearID,
- SchoolyearCode = sy.Code,
- ClassName = rePlan.ClassName,
- CoursematerialID = rePlan.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- DepartmentID = rePlanSet.DepartmentID,
- DepartmentCode = reDep.No,
- DepartmentName = reDep.Name,
- CourseTypeID = rePlan.CourseTypeID,
- CourseCredit = rePlan.Credit ?? 0,
- SchoolyearNumID = rePlanStu.SchoolyearNumID,
- StarttermID = rePlanStu.StarttermID,
- UserID = rePlanStu.UserID,
- LoginID = us.LoginID,
- UserName = us.Name,
- SexID = stu.SexID,
- InSchoolStatusID = stu.InSchoolStatusID,
- StudentStatusID = stu.StudentStatus,
- ClassmajorID = stu.ClassmajorID,
- ClassmajorCode = cl.No,
- ClassmajorName = cl.Name,
- GrademajorID = cl.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- CollegeID = fa.CollegeID,
- CollegeNo = col.No,
- CollegeName = col.Name,
- Gradeyear = gr.GradeID,
- StandardID = fa.StandardID,
- EducationID = fa.EducationID,
- LearningformID = fa.LearningformID,
- LearnSystem = fa.LearnSystem,
- RecordStatus = rePlan.RecordStatus,
- ApplyStatus = rePlan.CF_Student.Any(x => x.UserID == rePlanStu.UserID) ? true : false
- };
- return query;
- }
- /// <summary>
- /// 查询重修班级对应的报名名单信息View(已报名,根据重修计划相关信息、学生信息)
- /// </summary>
- /// <param name="expRetakePlan"></param>
- /// <param name="expStudent"></param>
- /// <returns></returns>
- public IQueryable<RetakeStudentListView> GetRetakePlanResultStudentView(Expression<Func<ER_RetakePlan, bool>> expRetakePlan,
- Expression<Func<CF_Student, bool>> expStudent)
- {
- var query = from rePlan in RetakePlanRepository.GetList(expRetakePlan)
- from applyStu in rePlan.CF_Student
- join rePlanStu in RetakePlanStudentRepository.Entities
- on
- new { applyStu.UserID, rePlan.RetakePlanID }
- equals
- new { rePlanStu.UserID, rePlanStu.RetakePlanID }
- join stu in StudentRepository.GetList(expStudent)
- on rePlanStu.UserID equals stu.UserID
- join us in UserRepository.Entities
- on stu.UserID equals us.UserID
- join cl in ClassmajorRepository.Entities
- on stu.ClassmajorID equals cl.ClassmajorID
- join gr in GrademajorRepository.Entities
- on cl.GrademajorID equals gr.GrademajorID
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join col in CollegeRepository.Entities
- on fa.CollegeID equals col.CollegeID
- join sy in SchoolyearRepository.Entities
- on rePlan.SchoolyearID equals sy.SchoolyearID
- join cou in CoursematerialRepository.Entities
- on rePlan.CoursematerialID equals cou.CoursematerialID
- join reSet in RetakePlanSettingRepository.Entities
- on rePlan.RetakePlanID equals reSet.RetakePlanID
- into reSetTemp
- from rePlanSet in reSetTemp.DefaultIfEmpty()
- join dep in DepartmentRepository.Entities
- on rePlanSet.DepartmentID equals dep.DepartmentID
- into reDepTemp
- from reDep in reDepTemp.DefaultIfEmpty()
- select new RetakeStudentListView
- {
- RetakePlanID = rePlan.RetakePlanID,
- RetakePlanStudentID = rePlanStu.RetakePlanStudentID,
- RetakeTypeID = rePlan.RetakeTypeID,
- SchoolyearID = rePlan.SchoolyearID,
- SchoolyearCode = sy.Code,
- ClassName = rePlan.ClassName,
- CoursematerialID = rePlan.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- DepartmentID = rePlanSet.DepartmentID,
- DepartmentCode = reDep.No,
- DepartmentName = reDep.Name,
- CourseTypeID = rePlan.CourseTypeID,
- CourseCredit = rePlan.Credit ?? 0,
- SchoolyearNumID = rePlanStu.SchoolyearNumID,
- StarttermID = rePlanStu.StarttermID,
- UserID = rePlanStu.UserID,
- LoginID = us.LoginID,
- UserName = us.Name,
- SexID = stu.SexID,
- InSchoolStatusID = stu.InSchoolStatusID,
- StudentStatusID = stu.StudentStatus,
- ClassmajorID = stu.ClassmajorID,
- ClassmajorCode = cl.No,
- ClassmajorName = cl.Name,
- GrademajorID = cl.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- CollegeID = fa.CollegeID,
- CollegeNo = col.No,
- CollegeName = col.Name,
- Gradeyear = gr.GradeID,
- StandardID = fa.StandardID,
- EducationID = fa.EducationID,
- LearningformID = fa.LearningformID,
- LearnSystem = fa.LearnSystem,
- RecordStatus = rePlan.RecordStatus,
- ApplyStatus = rePlan.CF_Student.Any(x => x.UserID == rePlanStu.UserID) ? true : false
- };
- return query;
- }
- /// <summary>
- /// 查询重修班级对应的未报名名单信息View(未报名,根据重修计划相关信息)
- /// </summary>
- /// <param name="expRetakePlan"></param>
- /// <returns></returns>
- public IQueryable<RetakeStudentListView> GetRetakePlanResultTaskStudentView(Expression<Func<ER_RetakePlan, bool>> expRetakePlan)
- {
- var query = from rePlan in RetakePlanRepository.GetList(expRetakePlan)
- join rePlanStu in RetakePlanStudentRepository.Entities
- on rePlan.RetakePlanID equals rePlanStu.RetakePlanID
- join stu in StudentRepository.Entities
- on rePlanStu.UserID equals stu.UserID
- join us in UserRepository.Entities
- on stu.UserID equals us.UserID
- join cl in ClassmajorRepository.Entities
- on stu.ClassmajorID equals cl.ClassmajorID
- join gr in GrademajorRepository.Entities
- on cl.GrademajorID equals gr.GrademajorID
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join col in CollegeRepository.Entities
- on fa.CollegeID equals col.CollegeID
- join sy in SchoolyearRepository.Entities
- on rePlan.SchoolyearID equals sy.SchoolyearID
- join cou in CoursematerialRepository.Entities
- on rePlan.CoursematerialID equals cou.CoursematerialID
- join reSet in RetakePlanSettingRepository.Entities
- on rePlan.RetakePlanID equals reSet.RetakePlanID
- into reSetTemp
- from rePlanSet in reSetTemp.DefaultIfEmpty()
- join dep in DepartmentRepository.Entities
- on rePlanSet.DepartmentID equals dep.DepartmentID
- into reDepTemp
- from reDep in reDepTemp.DefaultIfEmpty()
- where !rePlan.CF_Student.Contains(stu)
- select new RetakeStudentListView
- {
- RetakePlanID = rePlan.RetakePlanID,
- RetakePlanStudentID = rePlanStu.RetakePlanStudentID,
- RetakeTypeID = rePlan.RetakeTypeID,
- SchoolyearID = rePlan.SchoolyearID,
- SchoolyearCode = sy.Code,
- ClassName = rePlan.ClassName,
- CoursematerialID = rePlan.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- DepartmentID = rePlanSet.DepartmentID,
- DepartmentCode = reDep.No,
- DepartmentName = reDep.Name,
- CourseTypeID = rePlan.CourseTypeID,
- CourseCredit = rePlan.Credit ?? 0,
- SchoolyearNumID = rePlanStu.SchoolyearNumID,
- StarttermID = rePlanStu.StarttermID,
- UserID = rePlanStu.UserID,
- LoginID = us.LoginID,
- UserName = us.Name,
- SexID = stu.SexID,
- InSchoolStatusID = stu.InSchoolStatusID,
- StudentStatusID = stu.StudentStatus,
- ClassmajorID = stu.ClassmajorID,
- ClassmajorCode = cl.No,
- ClassmajorName = cl.Name,
- GrademajorID = cl.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- CollegeID = fa.CollegeID,
- CollegeNo = col.No,
- CollegeName = col.Name,
- Gradeyear = gr.GradeID,
- StandardID = fa.StandardID,
- EducationID = fa.EducationID,
- LearningformID = fa.LearningformID,
- LearnSystem = fa.LearnSystem,
- RecordStatus = rePlan.RecordStatus,
- ApplyStatus = rePlan.CF_Student.Any(x => x.UserID == rePlanStu.UserID) ? true : false
- };
- return query;
- }
- /// <summary>
- /// 查询重修计划对应的任课教师信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<RetakePlanTaskView> GetRetakePlanTeacherView(Expression<Func<ER_RetakePlan, bool>> exp)
- {
- var query = from plan in RetakePlanRepository.GetList(exp)
- join teacher in RetakePlanTeacherRepository.Entities
- on plan.RetakePlanID equals teacher.RetakePlanID into tmp
- from teacher in tmp.DefaultIfEmpty()
- select new RetakePlanTaskView
- {
- RetakePlanID = plan.RetakePlanID,
- TeacherName = teacher.CF_Staff.Sys_User.Name,
- TeacherUserID = teacher.UserID,
- TeacherUserCode = teacher.CF_Staff.StaffCode,
- };
- return query;
- }
- }
- }
|