123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.EducationManage;
- using EMIS.Entities;
- using System.Linq.Expressions;
- using EMIS.ViewModel;
- using System.Data.Entity;
- namespace EMIS.DataLogic.EducationManage
- {
- public class ExecutableMinorPlanDAL
- {
- public ExecutableMinorPlanRepository ExecutableMinorPlanRepository { get; set; }
- public ExecutableMinorPlanTeachingSettingRepository ExecutableMinorPlanTeachingSettingRepository { get; set; }
- public ExecutableMinorPlanTeachingModeTypeRepository ExecutableMinorPlanTeachingModeTypeRepository { get; set; }
- public ExecutableMinorPlanTeachingPlaceRepository ExecutableMinorPlanTeachingPlaceRepository { get; set; }
- public MinorPlanRepository MinorPlanRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public GrademinorRepository GrademinorRepository { get; set; }
- public InSchoolSettingRepository inSchoolSettingRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- public EducationMissionClassRepository educationMissionClassRepository { get; set; }
- public ClassminorRepository ClassminorRepository { get; set; }
- public ClassminorStudentRepository ClassminorStudentRepository { get; set; }
- public IQueryable<ExecutableMinorPlanView> GetExecutableMinorPlanView(Expression<Func<EM_ExecutableMinorPlan, bool>> exp)
- {
- var inSchoolStatusIDList = inSchoolSettingRepository.GetList(x => x.IsSelected == true).Select(w => w.InSchoolStatusID).ToList();//获取选中的在校设定状态、
- var graduatingSemester = EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID;
- if (graduatingSemester == null)
- {
- throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查");
- }
- var SchoolcodeID = Convert.ToInt32(graduatingSemester);
- var query = (from emp in ExecutableMinorPlanRepository.GetList(exp)
- join mp in MinorPlanRepository.Entities on emp.MinorPlanID equals mp.MinorPlanID
- join gs in
- (
- from g in GrademinorRepository.Entities
- from c in g.CF_Classminor
- from s in c.CF_ClassminorStudent
- join student in StudentRepository.GetList(x => inSchoolStatusIDList.Contains(x.InSchoolStatusID)) on s.UserID equals student.UserID
- group s by g.GrademinorID into g
- select new
- {
- GrademinorID = g.Key,
- StudentCount = g.Count()
- }
- ) on mp.GrademinorID equals gs.GrademinorID into dgs
- from egs in dgs.DefaultIfEmpty()
- join dict in dictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseType).Name)
- on emp.CourseTypeID equals dict.Value into ddict
- from edict in ddict.DefaultIfEmpty()
- select new ExecutableMinorPlanView
- {
- ExecutableMinorPlanID = emp.ExecutableMinorPlanID,
- MinorPlanID = emp.MinorPlanID,
- CampusID = emp.CF_College.CampusID,
- CollegeID = emp.CF_College.CollegeID,
- CollegeCode = emp.CF_College.No,
- CollegeName = emp.CF_College.Name,
- YearID = mp.CF_Grademinor.YearID,
- StandardID = emp.StandardID,
- CoursematerialID = emp.CoursematerialID,
- CourseCode = emp.EM_Coursematerial.CourseCode,
- CourseName = emp.EM_Coursematerial.CourseName,
- IsNeedMaterial = emp.IsNeedMaterial ?? false,
- DepartmentID = emp.DepartmentID,
- DepartmentName = emp.CF_Department.Name,
- CourseStructureID = emp.CourseStructureID,
- CourseCategoryID = emp.CourseCategoryID,
- CourseTypeID = emp.CourseTypeID,
- CourseTypeName = edict.Name,
- CourseQualityID = emp.CourseQualityID,
- PracticeTypeID = emp.PracticeTypeID,
- ExaminationModeID = emp.ExaminationModeID,
- TeachinglanguageID = emp.TeachinglanguageID,
- CourseFineID = emp.CourseFineID,
- IsSpecialtycore = emp.IsSpecialtycore ?? false,
- IsCooperation = emp.IsCooperation ?? false,
- IsRequired = emp.IsRequired ?? false,
- IsElective = emp.IsElective ?? false,
- IsNetworkCourse = emp.IsNetworkCourse ?? false,
- IsMainCourse = emp.IsMainCourse ?? false,
- Credit = emp.EM_ExecutableMinorPlanTeachingSetting.Credit,
- Totalhours = (emp.EM_ExecutableMinorPlanTeachingSetting.TheoryCourse ?? 0) + (emp.EM_ExecutableMinorPlanTeachingSetting.Practicehours ?? 0),
- TheoryCourse = emp.EM_ExecutableMinorPlanTeachingSetting.TheoryCourse,
- Practicehours = emp.EM_ExecutableMinorPlanTeachingSetting.Practicehours,
- Trialhours = emp.EM_ExecutableMinorPlanTeachingSetting.Trialhours,
- SchoolweeksNum = (emp.EM_ExecutableMinorPlanTeachingSetting.TheoryWeeklyNum ?? 0) + (emp.EM_ExecutableMinorPlanTeachingSetting.PracticeWeeklyNum ?? 0),
- WeeklyNum = emp.EM_ExecutableMinorPlanTeachingSetting.WeeklyNum,
- TheoryWeeklyNum = emp.EM_ExecutableMinorPlanTeachingSetting.TheoryWeeklyNum,
- PracticeWeeklyNum = emp.EM_ExecutableMinorPlanTeachingSetting.PracticeWeeklyNum,
- TrialWeeklyNum = emp.EM_ExecutableMinorPlanTeachingSetting.TrialWeeklyNum,
- StartWeeklyNum = emp.EM_ExecutableMinorPlanTeachingSetting.StartWeeklyNum,
- EndWeeklyNum = emp.EM_ExecutableMinorPlanTeachingSetting.EndWeeklyNum,
- WeeklyHours = emp.EM_ExecutableMinorPlanTeachingSetting.WeeklyHours,
- SchoolcodeID = emp.CF_Schoolyear.SchoolcodeID,
- SchoolyearNumID = emp.CF_Schoolyear.Years - mp.CF_Grademinor.YearID + 1,
- SchoolyearID = emp.CF_Schoolyear.SchoolyearID,
- SchoolcodeStr = emp.CF_Schoolyear.Code,
- StarttermID = emp.CF_Schoolyear.Value - ((mp.CF_Grademinor.YearID * 2 - 1) + SchoolcodeID - 1) + 1,
- HandleModeID = emp.HandleModeID,
- PeopleNumber = egs.GrademinorID == null ? 0 : egs.StudentCount,
- ResultTypeID = emp.ResultTypeID,
- Remark = emp.Remarks,
- RecordStatus = emp.RecordStatus,
- CreateUserID = emp.CreateUserID,
- CreateTime = emp.CreateTime
- });
- return query;
- }
- public IQueryable<EM_EducationMissionClass> GetEducationMissionClassByExecutablePlanID(IList<Guid?> executablePlanIDList)
- {
- var inSchoolStatusIDList = inSchoolSettingRepository.GetList(x => x.IsSelected == true).Select(w => w.InSchoolStatusID).ToList();//获取选中的在校设定状态、
- var q = (from ep in ExecutableMinorPlanRepository.GetList(x => executablePlanIDList.Contains(x.ExecutableMinorPlanID))
- join mp in MinorPlanRepository.Entities on ep.MinorPlanID equals mp.MinorPlanID
- join c in ClassminorRepository.Entities on mp.GrademinorID equals c.GrademinorID
- join emc in educationMissionClassRepository.Entities on
- new
- {
- ep.SchoolyearID,
- ep.CoursematerialID,
- ep.HandleModeID
- } equals new
- {
- emc.EM_EducationMission.SchoolyearID,
- emc.CoursematerialID,
- emc.HandleModeID
- }
- from emcc in emc.CF_Classmajor
- where c.ClassminorID == emcc.ClassmajorID
- select emc)
- .Include(x => x.EM_EducationMission)
- .Include(x => x.CF_Classmajor)
- .Include(x => x.EM_EducationSchedulingClass.Select(w => w.CF_Student));
- return q;
- }
- /// <summary>
- /// 根据辅修专业课程获取授课方式
- /// </summary>
- /// <param name="specialtyCourseID"></param>
- /// <returns></returns>
- public List<string> GetTeachingModeTypeQueryble(Guid? ExecutableMinorPlanID)
- {
- var query = from a in ExecutableMinorPlanTeachingModeTypeRepository.Entities.Where(x => x.ExecutableMinorPlanID == ExecutableMinorPlanID)
- join b in dictionaryItemRepository.Entities on new { a.TeachingModeID, DictionaryCode = DictionaryItem.CF_TeachingMode.ToString() }
- equals new { TeachingModeID = b.Value, b.DictionaryCode }
- select b.Value.Value.ToString();
- return query.ToList();
- }
- /// <summary>
- /// 根据辅修专业课程获取授课地点
- /// </summary>
- /// <param name="specialtyCourseID"></param>
- /// <returns></returns>
- public List<string> GetTeachingPlaceQueryble(Guid? ExecutableMinorPlanID)
- {
- var query = from a in ExecutableMinorPlanTeachingPlaceRepository.Entities.Where(x => x.ExecutableMinorPlanID == ExecutableMinorPlanID)
- join b in dictionaryItemRepository.Entities on new { a.TeachingPlace, DictionaryCode = DictionaryItem.EM_TeachingPlace.ToString() }
- equals new { TeachingPlace = b.Value, b.DictionaryCode }
- select b.Value.Value.ToString();
- return query.ToList();
- }
- /// <summary>
- /// 根据辅修专业课程获取授课地点
- /// </summary>
- /// <param name="specialtyCourseID"></param>
- /// <returns></returns>
- public List<ExecutableMinorPlanView> GetEducationMissionClassQuerybles()
- {
- var query = (from a in ExecutableMinorPlanRepository.Entities
- from b in a.EM_EducationMissionClass
- select new ExecutableMinorPlanView
- {
- EducationMissionClassID=b.EducationMissionClassID,
- ExecutableMinorPlanID=a.ExecutableMinorPlanID
- });
- return query.ToList();
- }
- }
- }
|