12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data.Entity;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EducationManagement;
- using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
- using EMIS.ViewModel.Students;
- using EMIS.ViewModel.CultureplanManage.PlanManagement;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.Cultureplan;
- using EMIS.DataLogic.Common.Cultureplan;
- using EMIS.ViewModel.EducationManage;
- namespace EMIS.DataLogic.EducationManage
- {
- public class ExecutablePlanDAL
- {
- public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
- public ExecutablePlanProfileRepository ExecutablePlanProfileRepository { get; set; }
- public ExecutablePlanTeachingSettingRepository ExecutablePlanTeachingSettingRepository { get; set; }
- public ExecutablePlanTeachingModeTypeRepository ExecutablePlanTeachingModeTypeRepository { get; set; }
- public ExecutablePlanTeachingPlaceRepository ExecutablePlanTeachingPlaceRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public ClassGroupingRepository ClassGroupingRepository { get; set; }
- public ClassGroupingSettingsRepository ClassGroupingSettingsRepository { get; set; }
- public DepartmentRepository DepartmentRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public ClassmajorRepository ClassmajorRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public FacultymajorRepository FacultymajorRepository { get; set; }
- public CollegeRepository CollegeRepository { get; set; }
- public CampusRepository CampusRepository { get; set; }
- public SpecialtyRepository SpecialtyRepository { get; set; }
- public SpecialtyPlanRepository SpecialtyPlanRepository { get; set; }
- public SpecialtyPlanTeachingSettingRepository SpecialtyPlanTeachingSettingRepository { get; set; }
- public EducationMissionRepository EducationMissionRepository { get; set; }
- public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
- public EducationMissionClassTeachingSettingRepository EducationMissionClassTeachingSettingRepository { get; set; }
- public EducationSchedulingClassRepository EducationSchedulingClassRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public RetakePlanStudentRepository RetakePlanStudentRepository { get; set; }
- public Lazy<CoursematerialDAL> CoursematerialDAL { get; set; }
- /// <summary>
- /// 查询执行计划信息ExecutablePlanView
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<ExecutablePlanView> GetExecutablePlanViewQueryable(Expression<Func<EM_ExecutablePlan, bool>> exp)
- {
- var query = from ep in ExecutablePlanRepository.GetList(exp)
- join eppr in ExecutablePlanProfileRepository.Entities
- on ep.ExecutablePlanID equals eppr.ExecutablePlanID into tempeppr
- from epeppr in tempeppr.DefaultIfEmpty()
- join epst in ExecutablePlanTeachingSettingRepository.Entities
- on ep.ExecutablePlanID equals epst.ExecutablePlanID into tempepst
- from epepst in tempepst.DefaultIfEmpty()
- join sy in SchoolyearRepository.Entities
- on ep.SchoolyearID equals sy.SchoolyearID
- join cou in CoursematerialRepository.Entities
- on ep.CoursematerialID equals cou.CoursematerialID
- join cg in ClassGroupingRepository.Entities
- on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg
- from coucg in tempcg.DefaultIfEmpty()
- join dep in DepartmentRepository.Entities
- on ep.DepartmentID equals dep.DepartmentID into tempdep
- from epdep in tempdep.DefaultIfEmpty()
- join gr in GrademajorRepository.Entities
- on ep.GrademajorID equals gr.GrademajorID
- join stsy in SchoolyearRepository.Entities
- on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
- equals new { SchoolyearID = stsy.Years, SchoolcodeID = stsy.SchoolcodeID } into tempstsy
- from startsy in tempstsy.DefaultIfEmpty()
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join spe in SpecialtyRepository.Entities
- on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
- equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
- join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
- on fa.StandardID equals dicst.Value into tempst
- from fast in tempst.DefaultIfEmpty()
- join col in CollegeRepository.Entities
- on fa.CollegeID equals col.CollegeID
- join cam in CampusRepository.Entities
- on col.CampusID equals cam.CampusID
- select new ExecutablePlanView
- {
- ExecutablePlanID = ep.ExecutablePlanID,
- SourceTypeID = ep.SourceTypeID,
- DefaultClassName = ep.DefaultClassName,
- SpecialtyPlanID = ep.SpecialtyPlanID,
- SchoolyearID = ep.SchoolyearID,
- SchoolyearCode = sy.Code,
- YearID = sy.Years,
- Value = sy.Value,
- SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
- SchoolcodeID = sy.SchoolcodeID,
- StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
- GrademajorID = ep.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- GradeID = gr.GradeID,
- FacultymajorID = gr.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- CollegeID = fa.CollegeID,
- CollegeCode = col.No,
- CollegeName = col.Name,
- CampusID = col.CampusID,
- CampusNo = cam.No,
- CampusName = cam.Name,
- StartSchoolyearID = startsy.SchoolyearID,
- StartSchoolyearCode = startsy.Code,
- StartValue = startsy.Value,
- StartSchoolcodeID = gr.SemesterID,
- GraduatingSemesterID = gr.GraduateSchoolyearID,
- SpecialtyID = spe.SpecialtyID,
- StandardID = fa.StandardID,
- StandardName = fast.Name,
- EducationID = fa.EducationID,
- LearningformID = fa.LearningformID,
- LearnSystem = fa.LearnSystem,
- CoursematerialID = ep.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- ClassGroupingID = cou.ClassGroupingID,
- ClassGroupingName = coucg.ClassName,
- CourseStructureID = ep.CourseStructureID,
- CourseCategoryID = ep.CourseCategoryID,
- CourseTypeID = ep.CourseTypeID,
- CourseQualityID = ep.CourseQualityID,
- Credit = epepst.Credit ?? 0,
- TheoryCourse = epepst.TheoryCourse ?? 0,
- Practicehours = epepst.Practicehours ?? 0,
- Trialhours = epepst.Trialhours ?? 0,
- Totalhours = (epepst.TheoryCourse ?? 0) + (epepst.Practicehours ?? 0),
- TheoryWeeklyNum = epepst.TheoryWeeklyNum ?? 0,
- PracticeWeeklyNum = epepst.PracticeWeeklyNum ?? 0,
- TrialWeeklyNum = epepst.TrialWeeklyNum ?? 0,
- SchoolweeksNum = (epepst.TheoryWeeklyNum ?? 0) + (epepst.PracticeWeeklyNum ?? 0),
- WeeklyHours = epepst.WeeklyHours ?? 0,
- WeeklyNum = epepst.WeeklyNum ?? 0,
- StartWeeklyNum = epepst.StartWeeklyNum ?? 0,
- EndWeeklyNum = epepst.EndWeeklyNum ?? 0,
- StartEndWeeklyNum = (epepst.StartWeeklyNum ?? 0) + "-" + (epepst.EndWeeklyNum ?? 0),
- DepartmentID = ep.DepartmentID,
- DepartmentCode = epdep.No,
- DepartmentName = epdep.Name,
- CourseCollegeID = epdep.CollegeID,
- CourseCollegeCode = epdep.CF_College.No,
- CourseCollegeName = epdep.CF_College.Name,
- IsSpecialtycore = epeppr.IsSpecialtycore ?? false,
- IsCooperation = epeppr.IsCooperation ?? false,
- IsRequired = epeppr.IsRequired ?? false,
- IsElective = epeppr.IsElective ?? false,
- IsNetworkCourse = epeppr.IsNetworkCourse ?? false,
- IsMainCourse = epeppr.IsMainCourse ?? false,
- IsNeedMaterial = ep.IsNeedMaterial ?? false,
- CourseFineID = epeppr.CourseFineID,
- PracticeTypeID = epeppr.PracticeTypeID,
- TeachinglanguageID = epeppr.TeachinglanguageID,
- ExaminationModeID = epeppr.ExaminationModeID,
- ResultTypeID = ep.ResultTypeID,
- HandleModeID = ep.HandleModeID,
- TeachingModeIDList = ep.EM_ExecutablePlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
- TeachingPlaceIDList = ep.EM_ExecutablePlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
- PlanTypeID = ep.SpecialtyPlanID == null ? (int)EM_PlanType.Outside : (int)EM_PlanType.Inside,
- ExecuteStatus = ep.RecordStatus,
- Remark = ep.Remark,
- RecordStatus = ep.RecordStatus,
- CreateUserID = ep.CreateUserID,
- CreateTime = ep.CreateTime,
- ModifyUserID = ep.ModifyUserID,
- ModifyTime = ep.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询执行计划信息ExecutablePlanView(统计对应的计划范围、学生人数)
- /// </summary>
- /// <param name="expExecutablePlan"></param>
- /// <param name="expStudent"></param>
- /// <returns></returns>
- public IQueryable<ExecutablePlanView> GetExecutablePlanViewQueryable(Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan,
- Expression<Func<CF_Student, bool>> expStudent)
- {
- var query = from ep in ExecutablePlanRepository.GetList(expExecutablePlan)
- join eppr in ExecutablePlanProfileRepository.Entities
- on ep.ExecutablePlanID equals eppr.ExecutablePlanID into tempeppr
- from epeppr in tempeppr.DefaultIfEmpty()
- join epst in ExecutablePlanTeachingSettingRepository.Entities
- on ep.ExecutablePlanID equals epst.ExecutablePlanID into tempepst
- from epepst in tempepst.DefaultIfEmpty()
- join sy in SchoolyearRepository.Entities
- on ep.SchoolyearID equals sy.SchoolyearID
- join cou in CoursematerialRepository.Entities
- on ep.CoursematerialID equals cou.CoursematerialID
- join cg in ClassGroupingRepository.Entities
- on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg
- from coucg in tempcg.DefaultIfEmpty()
- join dep in DepartmentRepository.Entities
- on ep.DepartmentID equals dep.DepartmentID into tempdep
- from epdep in tempdep.DefaultIfEmpty()
- join gr in GrademajorRepository.Entities
- on ep.GrademajorID equals gr.GrademajorID
- join stsy in SchoolyearRepository.Entities
- on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
- equals new { SchoolyearID = stsy.Years, SchoolcodeID = stsy.SchoolcodeID } into tempstsy
- from startsy in tempstsy.DefaultIfEmpty()
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join spe in SpecialtyRepository.Entities
- on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
- equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
- join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
- on fa.StandardID equals dicst.Value into tempst
- from fast in tempst.DefaultIfEmpty()
- join col in CollegeRepository.Entities
- on fa.CollegeID equals col.CollegeID
- join cam in CampusRepository.Entities
- on col.CampusID equals cam.CampusID
- join pr in
- (
- from cl in ClassmajorRepository.Entities
- group cl by cl.GrademajorID into gpr
- select new
- {
- GrademajorID = gpr.Key,
- PlanRange = gpr.Count()
- }
- )
- on gr.GrademajorID equals pr.GrademajorID into temppr
- from grpr in temppr.DefaultIfEmpty()
- join stu in
- (
- from stu in StudentRepository.GetList(expStudent)
- group stu by stu.CF_Classmajor.CF_Grademajor.GrademajorID into gstu
- select new
- {
- GrademajorID = gstu.Key,
- StudentCount = gstu.Count()
- }
- )
- on gr.GrademajorID equals stu.GrademajorID into tempstu
- from grstu in tempstu.DefaultIfEmpty()
- select new ExecutablePlanView
- {
- ExecutablePlanID = ep.ExecutablePlanID,
- SourceTypeID = ep.SourceTypeID,
- DefaultClassName = ep.DefaultClassName,
- SpecialtyPlanID = ep.SpecialtyPlanID,
- SchoolyearID = ep.SchoolyearID,
- SchoolyearCode = sy.Code,
- YearID = sy.Years,
- Value = sy.Value,
- SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
- SchoolcodeID = sy.SchoolcodeID,
- StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
- GrademajorID = ep.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- GradeID = gr.GradeID,
- FacultymajorID = gr.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- CollegeID = fa.CollegeID,
- CollegeCode = col.No,
- CollegeName = col.Name,
- CampusID = col.CampusID,
- CampusNo = cam.No,
- CampusName = cam.Name,
- StartSchoolyearID = startsy.SchoolyearID,
- StartSchoolyearCode = startsy.Code,
- StartValue = startsy.Value,
- StartSchoolcodeID = gr.SemesterID,
- GraduatingSemesterID = gr.GraduateSchoolyearID,
- SpecialtyID = spe.SpecialtyID,
- StandardID = fa.StandardID,
- StandardName = fast.Name,
- EducationID = fa.EducationID,
- LearningformID = fa.LearningformID,
- LearnSystem = fa.LearnSystem,
- CoursematerialID = ep.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- ClassGroupingID = cou.ClassGroupingID,
- ClassGroupingName = coucg.ClassName,
- CourseStructureID = ep.CourseStructureID,
- CourseCategoryID = ep.CourseCategoryID,
- CourseTypeID = ep.CourseTypeID,
- CourseQualityID = ep.CourseQualityID,
- Credit = epepst.Credit ?? 0,
- TheoryCourse = epepst.TheoryCourse ?? 0,
- Practicehours = epepst.Practicehours ?? 0,
- Trialhours = epepst.Trialhours ?? 0,
- Totalhours = (epepst.TheoryCourse ?? 0) + (epepst.Practicehours ?? 0),
- TheoryWeeklyNum = epepst.TheoryWeeklyNum ?? 0,
- PracticeWeeklyNum = epepst.PracticeWeeklyNum ?? 0,
- TrialWeeklyNum = epepst.TrialWeeklyNum ?? 0,
- SchoolweeksNum = (epepst.TheoryWeeklyNum ?? 0) + (epepst.PracticeWeeklyNum ?? 0),
- WeeklyHours = epepst.WeeklyHours ?? 0,
- WeeklyNum = epepst.WeeklyNum ?? 0,
- StartWeeklyNum = epepst.StartWeeklyNum ?? 0,
- EndWeeklyNum = epepst.EndWeeklyNum ?? 0,
- StartEndWeeklyNum = (epepst.StartWeeklyNum ?? 0) + "-" + (epepst.EndWeeklyNum ?? 0),
- DepartmentID = ep.DepartmentID,
- DepartmentCode = epdep.No,
- DepartmentName = epdep.Name,
- CourseCollegeID = epdep.CollegeID,
- CourseCollegeCode = epdep.CF_College.No,
- CourseCollegeName = epdep.CF_College.Name,
- IsSpecialtycore = epeppr.IsSpecialtycore ?? false,
- IsCooperation = epeppr.IsCooperation ?? false,
- IsRequired = epeppr.IsRequired ?? false,
- IsElective = epeppr.IsElective ?? false,
- IsNetworkCourse = epeppr.IsNetworkCourse ?? false,
- IsMainCourse = epeppr.IsMainCourse ?? false,
- IsNeedMaterial = ep.IsNeedMaterial ?? false,
- CourseFineID = epeppr.CourseFineID,
- PracticeTypeID = epeppr.PracticeTypeID,
- TeachinglanguageID = epeppr.TeachinglanguageID,
- ExaminationModeID = epeppr.ExaminationModeID,
- ResultTypeID = ep.ResultTypeID,
- HandleModeID = ep.HandleModeID,
- TeachingModeIDList = ep.EM_ExecutablePlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
- TeachingPlaceIDList = ep.EM_ExecutablePlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
- PlanRange = grpr.PlanRange == null ? 0 : grpr.PlanRange,
- StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
- PlanTypeID = ep.SpecialtyPlanID == null ? (int)EM_PlanType.Outside : (int)EM_PlanType.Inside,
- ExecuteStatus = ep.RecordStatus,
- Remark = ep.Remark,
- RecordStatus = ep.RecordStatus,
- CreateUserID = ep.CreateUserID,
- CreateTime = ep.CreateTime,
- ModifyUserID = ep.ModifyUserID,
- ModifyTime = ep.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的未新增专业计划信息(统计对应的学生人数)
- /// 注:普教版本(年级专业)
- /// </summary>
- /// <param name="expSpecialtyPlan"></param>
- /// <param name="expGrademajor"></param>
- /// <param name="expStudent"></param>
- /// <param name="expExecutablePlan"></param>
- /// <returns></returns>
- public IQueryable<SpecialtyPlanView> GetSpecialtyPlanViewNoAddQueryable(Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan,
- Expression<Func<CF_Grademajor, bool>> expGrademajor, Expression<Func<CF_Student, bool>> expStudent,
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan)
- {
- var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
- join spst in SpecialtyPlanTeachingSettingRepository.Entities
- on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
- from spspst in tempspst.DefaultIfEmpty()
- join sy in SchoolyearRepository.Entities
- on sp.SchoolyearID equals sy.SchoolyearID
- join cou in CoursematerialRepository.Entities
- on sp.CoursematerialID equals cou.CoursematerialID
- join dep in DepartmentRepository.Entities
- on sp.DepartmentID equals dep.DepartmentID into tempdep
- from spdep in tempdep.DefaultIfEmpty()
- join gr in GrademajorRepository.GetList(expGrademajor)
- on sp.GrademajorID equals gr.GrademajorID
- join stsy in SchoolyearRepository.Entities
- on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
- equals new { SchoolyearID = stsy.Years, SchoolcodeID = stsy.SchoolcodeID } into tempstsy
- from startsy in tempstsy.DefaultIfEmpty()
- join grsy in SchoolyearRepository.Entities
- on gr.GraduateSchoolyearID equals grsy.SchoolyearID into tempgrsy
- from gradsy in tempgrsy.DefaultIfEmpty()
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join spe in SpecialtyRepository.Entities
- on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
- equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
- join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
- on fa.StandardID equals dicst.Value into tempst
- from fast in tempst.DefaultIfEmpty()
- join col in CollegeRepository.Entities
- on fa.CollegeID equals col.CollegeID
- join cam in CampusRepository.Entities
- on col.CampusID equals cam.CampusID
- join stu in
- (
- from stu in StudentRepository.GetList(expStudent)
- join cl in ClassmajorRepository.Entities
- on stu.ClassmajorID equals cl.ClassmajorID
- join gr in GrademajorRepository.GetList(expGrademajor)
- on cl.GrademajorID equals gr.GrademajorID
- group new { stu, gr } by gr.GrademajorID into gstu
- select new
- {
- GrademajorID = gstu.Key,
- StudentCount = gstu.Count()
- }
- )
- on gr.GrademajorID equals stu.GrademajorID into tempstu
- from grstu in tempstu.DefaultIfEmpty()
- join ep in
- (
- from ep in ExecutablePlanRepository.GetList(expExecutablePlan)
- join eppr in ExecutablePlanProfileRepository.Entities
- on ep.ExecutablePlanID equals eppr.ExecutablePlanID into tempeppr
- from epeppr in tempeppr.DefaultIfEmpty()
- join epst in ExecutablePlanTeachingSettingRepository.Entities
- on ep.ExecutablePlanID equals epst.ExecutablePlanID into tempepst
- from epepst in tempepst.DefaultIfEmpty()
- select new
- {
- ExecutablePlanID = ep.ExecutablePlanID,
- SpecialtyPlanID = ep.SpecialtyPlanID,
- SchoolyearID = ep.SchoolyearID,
- GrademajorID = ep.GrademajorID,
- CoursematerialID = ep.CoursematerialID,
- CourseTypeID = ep.CourseTypeID,
- Credit = epepst.Credit,
- DepartmentID = ep.DepartmentID,
- HandleModeID = ep.HandleModeID
- }
- )
- on new { SchoolyearID = sp.SchoolyearID, GrademajorID = sp.GrademajorID, CoursematerialID = sp.CoursematerialID }
- equals new { SchoolyearID = ep.SchoolyearID, GrademajorID = ep.GrademajorID, CoursematerialID = ep.CoursematerialID } into tempep
- from spep in tempep.DefaultIfEmpty()
- where spep.ExecutablePlanID == null
- select new SpecialtyPlanView
- {
- SpecialtyPlanID = sp.SpecialtyPlanID,
- PlanApplicationID = sp.PlanApplicationID,
- SchoolyearID = sp.SchoolyearID,
- SchoolyearCode = sy.Code,
- YearID = sy.Years,
- Value = sy.Value,
- SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
- SchoolcodeID = sy.SchoolcodeID,
- StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
- GrademajorID = sp.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- GradeID = gr.GradeID,
- FacultymajorID = gr.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- CollegeID = fa.CollegeID,
- CollegeCode = col.No,
- CollegeName = col.Name,
- CampusID = col.CampusID,
- CampusNo = cam.No,
- CampusName = cam.Name,
- StartSchoolyearID = startsy.SchoolyearID,
- StartSchoolyearCode = startsy.Code,
- StartValue = startsy.Value,
- StartSchoolcodeID = gr.SemesterID,
- GraduatingSemesterID = gr.GraduateSchoolyearID,
- GraduatingSemesterCode = gradsy.Code,
- GraduatingSemesterValue = gradsy.Value,
- SpecialtyID = spe.SpecialtyID,
- StandardID = fa.StandardID,
- StandardName = fast.Name,
- EducationID = fa.EducationID,
- LearningformID = fa.LearningformID,
- LearnSystem = fa.LearnSystem,
- CoursematerialID = sp.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- CourseStructureID = sp.CourseStructureID,
- CourseCategoryID = sp.CourseCategoryID,
- CourseTypeID = sp.CourseTypeID,
- CourseQualityID = sp.CourseQualityID,
- Credit = spspst.Credit ?? 0,
- TheoryCourse = spspst.TheoryCourse ?? 0,
- Practicehours = spspst.Practicehours ?? 0,
- Trialhours = spspst.Trialhours ?? 0,
- Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
- TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
- PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
- TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
- SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
- WeeklyHours = spspst.WeeklyHours ?? 0,
- WeeklyNum = spspst.WeeklyNum ?? 0,
- StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
- EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
- StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
- DepartmentID = sp.DepartmentID,
- DepartmentCode = spdep.No,
- DepartmentName = spdep.Name,
- CourseCollegeID = spdep.CollegeID,
- CourseCollegeCode = spdep.CF_College.No,
- CourseCollegeName = spdep.CF_College.Name,
- IsSpecialtycore = sp.IsSpecialtycore ?? false,
- IsCooperation = sp.IsCooperation ?? false,
- IsRequired = sp.IsRequired ?? false,
- IsElective = sp.IsElective ?? false,
- IsNetworkCourse = sp.IsNetworkCourse ?? false,
- IsMainCourse = sp.IsMainCourse ?? false,
- IsNeedMaterial = sp.IsNeedMaterial ?? false,
- CourseFineID = sp.CourseFineID,
- PracticeTypeID = sp.PracticeTypeID,
- TeachinglanguageID = sp.TeachinglanguageID,
- ExaminationModeID = sp.ExaminationModeID,
- ResultTypeID = sp.ResultTypeID,
- HandleModeID = sp.HandleModeID,
- TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
- TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
- StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
- Remark = sp.Remark,
- RecordStatus = sp.RecordStatus,
- CreateUserID = sp.CreateUserID,
- CreateTime = sp.CreateTime,
- ModifyUserID = sp.ModifyUserID,
- ModifyTime = sp.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的未新增专业计划信息(统计对应的学生人数)
- /// 注:成教版本(入学学年学期、专业信息)
- /// </summary>
- /// <param name="expGrademajor"></param>
- /// <param name="expSpecialtyPlan"></param>
- /// <param name="expStudent"></param>
- /// <param name="expExecutablePlan"></param>
- /// <returns></returns>
- public IQueryable<SpecialtyPlanView> GetAdultSpecialtyPlanViewNoAddQueryable(Expression<Func<CF_Grademajor, bool>> expGrademajor,
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan, Expression<Func<CF_Student, bool>> expStudent,
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan)
- {
- var query = from gr in GrademajorRepository.GetList(expGrademajor)
- join startsy in SchoolyearRepository.Entities
- on new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value }
- equals new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID }
- join grsy in SchoolyearRepository.Entities
- on gr.GraduateSchoolyearID equals grsy.SchoolyearID into tempgrsy
- from gradsy in tempgrsy.DefaultIfEmpty()
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join spe in SpecialtyRepository.Entities
- on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
- equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
- join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
- on fa.StandardID equals dicst.Value into tempst
- from fast in tempst.DefaultIfEmpty()
- join col in CollegeRepository.Entities
- on fa.CollegeID equals col.CollegeID
- join cam in CampusRepository.Entities
- on col.CampusID equals cam.CampusID
- join sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
- on new { StartSchoolyearID = startsy.SchoolyearID, SpecialtyID = spe.SpecialtyID }
- equals new { StartSchoolyearID = sp.StartSchoolyearID.Value, SpecialtyID = sp.SpecialtyID.Value }
- join spst in SpecialtyPlanTeachingSettingRepository.Entities
- on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
- from spspst in tempspst.DefaultIfEmpty()
- join sy in SchoolyearRepository.Entities
- on sp.SchoolyearID equals sy.SchoolyearID
- join cou in CoursematerialRepository.Entities
- on sp.CoursematerialID equals cou.CoursematerialID
- join dep in DepartmentRepository.Entities
- on sp.DepartmentID equals dep.DepartmentID into tempdep
- from spdep in tempdep.DefaultIfEmpty()
- join stu in
- (
- from stu in StudentRepository.GetList(expStudent)
- join cl in ClassmajorRepository.Entities
- on stu.ClassmajorID equals cl.ClassmajorID
- join gr in GrademajorRepository.GetList(expGrademajor)
- on cl.GrademajorID equals gr.GrademajorID
- group new { stu, gr } by gr.GrademajorID into gstu
- select new
- {
- GrademajorID = gstu.Key,
- StudentCount = gstu.Count()
- }
- )
- on gr.GrademajorID equals stu.GrademajorID into tempstu
- from grstu in tempstu.DefaultIfEmpty()
- join ep in
- (
- from ep in ExecutablePlanRepository.GetList(expExecutablePlan)
- join eppr in ExecutablePlanProfileRepository.Entities
- on ep.ExecutablePlanID equals eppr.ExecutablePlanID into tempeppr
- from epeppr in tempeppr.DefaultIfEmpty()
- join epst in ExecutablePlanTeachingSettingRepository.Entities
- on ep.ExecutablePlanID equals epst.ExecutablePlanID into tempepst
- from epepst in tempepst.DefaultIfEmpty()
- select new
- {
- ExecutablePlanID = ep.ExecutablePlanID,
- SpecialtyPlanID = ep.SpecialtyPlanID,
- SchoolyearID = ep.SchoolyearID,
- GrademajorID = ep.GrademajorID,
- CoursematerialID = ep.CoursematerialID,
- CourseTypeID = ep.CourseTypeID,
- Credit = epepst.Credit,
- DepartmentID = ep.DepartmentID,
- HandleModeID = ep.HandleModeID
- }
- )
- on new { SchoolyearID = sp.SchoolyearID, GrademajorID = gr.GrademajorID, CoursematerialID = sp.CoursematerialID }
- equals new { SchoolyearID = ep.SchoolyearID, GrademajorID = ep.GrademajorID.Value, CoursematerialID = ep.CoursematerialID } into tempep
- from spep in tempep.DefaultIfEmpty()
- where spep.ExecutablePlanID == null
- select new SpecialtyPlanView
- {
- SpecialtyPlanID = sp.SpecialtyPlanID,
- PlanApplicationID = sp.PlanApplicationID,
- SchoolyearID = sp.SchoolyearID,
- SchoolyearCode = sy.Code,
- YearID = sy.Years,
- Value = sy.Value,
- SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
- SchoolcodeID = sy.SchoolcodeID,
- StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
- GrademajorID = gr.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- GradeID = gr.GradeID,
- FacultymajorID = gr.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- CollegeID = fa.CollegeID,
- CollegeCode = col.No,
- CollegeName = col.Name,
- CampusID = col.CampusID,
- CampusNo = cam.No,
- CampusName = cam.Name,
- StartSchoolyearID = sp.StartSchoolyearID,
- StartSchoolyearCode = startsy.Code,
- StartValue = startsy.Value,
- StartSchoolcodeID = gr.SemesterID,
- GraduatingSemesterID = gr.GraduateSchoolyearID,
- GraduatingSemesterCode = gradsy.Code,
- GraduatingSemesterValue = gradsy.Value,
- SpecialtyID = sp.SpecialtyID,
- StandardID = fa.StandardID,
- StandardName = fast.Name,
- EducationID = fa.EducationID,
- LearningformID = fa.LearningformID,
- LearnSystem = fa.LearnSystem,
- CoursematerialID = sp.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- CourseStructureID = sp.CourseStructureID,
- CourseCategoryID = sp.CourseCategoryID,
- CourseTypeID = sp.CourseTypeID,
- CourseQualityID = sp.CourseQualityID,
- Credit = spspst.Credit ?? 0,
- TheoryCourse = spspst.TheoryCourse ?? 0,
- Practicehours = spspst.Practicehours ?? 0,
- Trialhours = spspst.Trialhours ?? 0,
- Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
- TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
- PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
- TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
- SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
- WeeklyHours = spspst.WeeklyHours ?? 0,
- WeeklyNum = spspst.WeeklyNum ?? 0,
- StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
- EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
- StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
- DepartmentID = sp.DepartmentID,
- DepartmentCode = spdep.No,
- DepartmentName = spdep.Name,
- CourseCollegeID = spdep.CollegeID,
- CourseCollegeCode = spdep.CF_College.No,
- CourseCollegeName = spdep.CF_College.Name,
- IsSpecialtycore = sp.IsSpecialtycore ?? false,
- IsCooperation = sp.IsCooperation ?? false,
- IsRequired = sp.IsRequired ?? false,
- IsElective = sp.IsElective ?? false,
- IsNetworkCourse = sp.IsNetworkCourse ?? false,
- IsMainCourse = sp.IsMainCourse ?? false,
- IsNeedMaterial = sp.IsNeedMaterial ?? false,
- CourseFineID = sp.CourseFineID,
- PracticeTypeID = sp.PracticeTypeID,
- TeachinglanguageID = sp.TeachinglanguageID,
- ExaminationModeID = sp.ExaminationModeID,
- ResultTypeID = sp.ResultTypeID,
- HandleModeID = sp.HandleModeID,
- TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
- TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
- StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
- Remark = sp.Remark,
- RecordStatus = sp.RecordStatus,
- CreateUserID = sp.CreateUserID,
- CreateTime = sp.CreateTime,
- ModifyUserID = sp.ModifyUserID,
- ModifyTime = sp.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的计划范围信息(根据执行计划信息,统计各班级信息对应的学生人数)
- /// </summary>
- /// <param name="expExecutablePlan"></param>
- /// <param name="expStudent"></param>
- /// <returns></returns>
- public IQueryable<ClassmajorView> GetPlanRangeViewQueryable(Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan,
- Expression<Func<CF_Student, bool>> expStudent)
- {
- var query = from ep in ExecutablePlanRepository.GetList(expExecutablePlan)
- join gr in GrademajorRepository.Entities
- on ep.GrademajorID equals gr.GrademajorID
- join cl in ClassmajorRepository.Entities
- on gr.GrademajorID equals cl.GrademajorID
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join col in CollegeRepository.Entities
- on fa.CollegeID equals col.CollegeID
- join sc in
- (
- from stu in StudentRepository.GetList(expStudent)
- group stu by stu.CF_Classmajor.ClassmajorID into gstu
- select new
- {
- ClassmajorID = gstu.Key,
- StudentCount = gstu.Count()
- })
- on cl.ClassmajorID equals sc.ClassmajorID into tempsc
- from clsc in tempsc.DefaultIfEmpty()
- join us in UserRepository.Entities
- on cl.UserID equals us.UserID into tempus
- from clus in tempus.DefaultIfEmpty()
- join au in UserRepository.Entities
- on cl.AssistantUserID equals au.UserID into tempau
- from clau in tempau.DefaultIfEmpty()
- select new ClassmajorView
- {
- ClassmajorID = cl.ClassmajorID,
- No = cl.No,
- Name = cl.Name,
- Abbreviation = cl.Abbreviation,
- EnglishName = cl.EnglishName,
- ClassNum = cl.ClassNum ?? 1,
- FacultymajorID = gr.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- GrademajorID = gr.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- CampusID = col.CampusID,
- CampusNo = col.CF_Campus.No,
- CampusName = col.CF_Campus.Name,
- CollegeID = fa.CollegeID,
- CollegeCode = col.No,
- CollegeName = col.Name,
- GradeID = gr.GradeID,
- SemesterID = gr.SemesterID,
- StandardID = fa.StandardID,
- EducationID = fa.EducationID,
- LearningformID = fa.LearningformID,
- LearnSystem = fa.LearnSystem,
- GraduateSchoolyearID = gr.GraduateSchoolyearID,
- GraduateValue = gr.CF_Schoolyear.Value,
- GraduateSchoolyearCode = gr.CF_Schoolyear.Code,
- UserID = cl.UserID,
- UserName = clus.Name,
- AssistantUserID = cl.AssistantUserID,
- AssistantUserName = clau.Name,
- Fixedclassroom = cl.Fixedclassroom,
- StudentCount = clsc.StudentCount == null ? 0 : clsc.StudentCount,
- Remark = cl.Remark,
- RecordStatus = cl.RecordStatus,
- CreateUserID = cl.CreateUserID,
- CreateTime = cl.CreateTime,
- ModifyUserID = cl.ModifyUserID,
- ModifyTime = cl.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询执行计划对应的学生信息BaseStudentView(根据执行计划信息、学生信息)
- /// </summary>
- /// <param name="expExecutablePlan"></param>
- /// <param name="expStudent"></param>
- /// <returns></returns>
- public IQueryable<BaseStudentView> GetBaseStudentViewQueryable(Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan,
- Expression<Func<CF_Student, bool>> expStudent)
- {
- var query = from ep in ExecutablePlanRepository.GetList(expExecutablePlan)
- join gr in GrademajorRepository.Entities
- on ep.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 cl in ClassmajorRepository.Entities
- on gr.GrademajorID equals cl.GrademajorID
- join stu in StudentRepository.GetList(expStudent)
- on cl.ClassmajorID equals stu.ClassmajorID
- join us in UserRepository.Entities
- on stu.UserID equals us.UserID
- select new BaseStudentView
- {
- UserID = stu.UserID,
- LoginID = us.LoginID,
- UserName = us.Name,
- SexID = stu.SexID,
- IDNumber = stu.IDNumber,
- StudentStatus = stu.StudentStatus,
- InSchoolStatusID = stu.InSchoolStatusID,
- ClassmajorID = stu.ClassmajorID,
- ClassmajorCode = cl.No,
- ClassmajorName = cl.Name,
- ClassNum = cl.ClassNum == null ? 1 : cl.ClassNum,
- SchoolyearID = gr.GradeID,
- GrademajorID = cl.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- FacultymajorID = gr.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- CollegeID = fa.CollegeID,
- CollegeNo = col.No,
- CollegeName = col.Name
- };
- return query;
- }
- /// <summary>
- /// 查询执行计划信息对应的授课方式
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<int?> GetTeachingModeTypeQueryble(Expression<Func<EM_ExecutablePlan, bool>> exp)
- {
- var query = from ep in ExecutablePlanRepository.GetList(exp)
- join eptm in ExecutablePlanTeachingModeTypeRepository.Entities
- on ep.ExecutablePlanID equals eptm.ExecutablePlanID
- join dictm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
- on eptm.TeachingModeID equals dictm.Value
- select dictm.Value;
- return query;
- }
- /// <summary>
- /// 查询执行计划信息对应的授课方式
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<int?> GetTeachingPlaceQueryble(Expression<Func<EM_ExecutablePlan, bool>> exp)
- {
- var query = from ep in ExecutablePlanRepository.GetList(exp)
- join eptp in ExecutablePlanTeachingPlaceRepository.Entities
- on ep.ExecutablePlanID equals eptp.ExecutablePlanID
- join dictp in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EMIS.ViewModel.EM_TeachingPlace).Name)
- on eptp.TeachingPlace equals dictp.Value
- select dictp.Value;
- return query;
- }
- /// <summary>
- /// 查询对应的专业信息CF_Specialty(根据年级专业信息)
- /// </summary>
- /// <param name="expGrademajor"></param>
- /// <returns></returns>
- public IQueryable<CF_Specialty> GetSpecialtyQueryable(Expression<Func<CF_Grademajor, bool>> expGrademajor)
- {
- var query = from gr in GrademajorRepository.GetList(expGrademajor)
- join fa in FacultymajorRepository.Entities
- on gr.FacultymajorID equals fa.FacultymajorID
- join spe in SpecialtyRepository.Entities
- on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
- equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
- select spe;
- return query;
- }
- /// <summary>
- /// 查询年级专业对应的班级范围信息(根据年级专业信息)
- /// </summary>
- /// <param name="expGrademajor"></param>
- /// <returns></returns>
- public IQueryable<CF_Classmajor> GetClassmajorRangeQueryable(Expression<Func<CF_Grademajor, bool>> expGrademajor)
- {
- var query = from gr in GrademajorRepository.GetList(expGrademajor)
- join cl in ClassmajorRepository.Entities
- on gr.GrademajorID equals cl.GrademajorID
- select cl;
- return query;
- }
- /// <summary>
- /// 查询年级专业对应的学生范围信息(根据年级专业信息,不区分在校、非在校)
- /// </summary>
- /// <param name="expGrademajor"></param>
- /// <param name="expStudent"></param>
- /// <returns></returns>
- public IQueryable<CF_Student> GetStudentRangeQueryable(Expression<Func<CF_Grademajor, bool>> expGrademajor)
- {
- var query = from gr in GrademajorRepository.GetList(expGrademajor)
- join cl in ClassmajorRepository.Entities
- on gr.GrademajorID equals cl.GrademajorID
- join stu in StudentRepository.Entities
- on cl.ClassmajorID equals stu.ClassmajorID
- select stu;
- return query;
- }
- /// <summary>
- /// 查询年级专业对应的学生范围信息(根据年级专业信息、学生信息)
- /// </summary>
- /// <param name="expGrademajor"></param>
- /// <param name="expStudent"></param>
- /// <returns></returns>
- public IQueryable<CF_Student> GetStudentRangeQueryable(Expression<Func<CF_Grademajor, bool>> expGrademajor,
- Expression<Func<CF_Student, bool>> expStudent)
- {
- var query = from gr in GrademajorRepository.GetList(expGrademajor)
- join cl in ClassmajorRepository.Entities
- on gr.GrademajorID equals cl.GrademajorID
- join stu in StudentRepository.GetList(expStudent)
- on cl.ClassmajorID equals stu.ClassmajorID
- select stu;
- return query;
- }
- /// <summary>
- /// 查询对应的教学任务班信息EM_EducationMissionClass(根据执行计划信息)
- /// </summary>
- /// <param name="expExecutablePlan"></param>
- /// <returns></returns>
- public IQueryable<EM_EducationMissionClass> GetEducationMissionClassQueryable(Expression<Func<EM_ExecutablePlan, bool>> exp)
- {
- var query = (
- from ep in ExecutablePlanRepository.GetList(exp)
- join gr in GrademajorRepository.Entities
- on ep.GrademajorID equals gr.GrademajorID
- join cl in ClassmajorRepository.Entities
- on gr.GrademajorID equals cl.GrademajorID
- join educl in EducationMissionClassRepository.Entities
- on new { SchoolyearID = ep.SchoolyearID, CoursematerialID = ep.CoursematerialID }
- equals new { SchoolyearID = educl.EM_EducationMission.SchoolyearID, CoursematerialID = educl.CoursematerialID }
- from edu_cl in educl.CF_Classmajor
- where cl.ClassmajorID == edu_cl.ClassmajorID
- select educl
- )
- .Include(x => x.EM_EducationMission)
- .Include(x => x.EM_EducationMissionClassTeachingSetting)
- .Include(x => x.CF_Classmajor)
- .Include(x => x.EM_EducationSchedulingClass)
- .Include(x => x.EM_EducationSchedulingClass.Select(s => s.CF_Student))
- .Include(x => x.EM_EducationMissionClassSettings)
- .Include(x => x.EM_MissionClassTeacher)
- .Include(x => x.EM_CourseProcess);
- return query;
- }
- /// <summary>
- /// 查询课程信息中授课方式分班信息(根据课程信息)
- /// </summary>
- /// <param name="expCoursematerial"></param>
- /// <returns></returns>
- public IQueryable<int?> GetSeparateModeTypeQueryble(Expression<Func<EM_Coursematerial, bool>> expCoursematerial)
- {
- var query = from cou in CoursematerialRepository.GetList(expCoursematerial)
- join cg in ClassGroupingRepository.Entities
- on cou.ClassGroupingID equals cg.ClassGroupingID
- join cgst in ClassGroupingSettingsRepository.Entities
- on cg.ClassGroupingID equals cgst.ClassGroupingID
- join dictm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
- on cgst.TeachingModeID equals dictm.Value
- select dictm.Value;
- return query;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="studentExp"></param>
- /// <returns></returns>
- public IQueryable<CoursematerialView> GetLastCoursematerialViewQueryable(Expression<Func<CF_Student, bool>> studentExp)
- {
- var courseQuery = CoursematerialDAL.Value.GetCoursematerialViewQueryable(x => true);
- var query = (from plan in ExecutablePlanRepository.Entities
- from schoolyear in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == plan.SchoolyearID)
- from classmajor in ClassmajorRepository.Entities.Where(x => x.GrademajorID == plan.GrademajorID)
- from student in StudentRepository.Entities.Where(x => x.ClassmajorID == classmajor.ClassmajorID)
- .Where(studentExp)
- from course in courseQuery.Where(x => x.CoursematerialID == plan.CoursematerialID)
- group new { course, schoolyear } by plan.CoursematerialID into g
- select g.OrderByDescending(x => x.schoolyear.Value)
- .Select(x => x.course)
- .FirstOrDefault()
- );
- return query;
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public IQueryable<LastCourseStarttermView> GetLastCourseStarttermViewQueryable()
- {
- var query = (from plan in ExecutablePlanRepository.Entities
- from profile in ExecutablePlanProfileRepository.Entities.Where(x => x.ExecutablePlanID == plan.ExecutablePlanID)
- from setting in ExecutablePlanTeachingSettingRepository.Entities.Where(x => x.ExecutablePlanID == plan.ExecutablePlanID)
- from schoolyear in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == plan.SchoolyearID)
- from classmajor in ClassmajorRepository.Entities.Where(x => x.GrademajorID == plan.GrademajorID)
- from student in classmajor.CF_Student
- from grade in GrademajorRepository.Entities.Where(x => x.GrademajorID == classmajor.GrademajorID)
- from gradeSchoolyear in SchoolyearRepository.Entities.Where(x => x.Years == grade.GradeID && x.SchoolcodeID == grade.SemesterID)
- from temp in
- (
- from plan1 in ExecutablePlanRepository.Entities
- from schoolyear1 in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == plan1.SchoolyearID)
- from classmajor1 in ClassmajorRepository.Entities.Where(x => x.GrademajorID == plan1.GrademajorID)
- from student1 in classmajor1.CF_Student
- group new { student1.UserID, plan1.CoursematerialID, SchoolyearValue = schoolyear1.Value }
- by new { student1.UserID, plan1.CoursematerialID } into g
- select new { UserID = g.Key.UserID, CoursematerialID = g.Key.CoursematerialID, MaxSchoolyearValue = g.Max(x => x.SchoolyearValue) })
- .Where(x => x.CoursematerialID == plan.CoursematerialID && x.MaxSchoolyearValue == schoolyear.Value
- && x.UserID == student.UserID)
- select new
- {
- SchoolyearID = plan.SchoolyearID,
- SchoolyearNumID = ((schoolyear.Value - gradeSchoolyear.Value) / 2) + 1,
- CoursematerialID = plan.CoursematerialID,
- DepartmentID = plan.DepartmentID,
- ClassName = plan.DefaultClassName,
- CourseTypeID = plan.CourseTypeID,
- ExaminationModeID = profile.ExaminationModeID,
- HandleModeID = plan.HandleModeID,
- Credit = setting.Credit,
- TotalHours = (setting.TheoryCourse ?? 0) + (setting.Practicehours ?? 0),
- ResultTypeID = plan.ResultTypeID,
- StarttermID = (schoolyear.Value - gradeSchoolyear.Value + 1),
- UserID = student.UserID
- } into s
- select new LastCourseStarttermView
- {
- SchoolyearID = s.SchoolyearID,
- SchoolyearNumID = s.SchoolyearNumID,
- CoursematerialID = s.CoursematerialID,
- DepartmentID = s.DepartmentID,
- ClassName = s.ClassName,
- CourseTypeID = s.CourseTypeID,
- ExaminationModeID = s.ExaminationModeID,
- HandleModeID = s.HandleModeID,
- Credit = s.Credit,
- TotalHours = s.TotalHours,
- ResultTypeID = s.ResultTypeID,
- StarttermID = s.StarttermID,
- UserID = s.UserID
- }
- );
- return query;
- }
- }
- }
|