GraduationStandardDAL.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel.EnrollManage.SpecialtyManage;
  8. using EMIS.ViewModel.Students;
  9. using EMIS.DataLogic.Common.Students;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
  12. using EMIS.ViewModel.EducationManagement;
  13. using EMIS.ViewModel.CultureplanManage.PlanManagement;
  14. using EMIS.DataLogic.Repositories;
  15. using EMIS.ViewModel.GraduationManage.GraduationSetting;
  16. namespace EMIS.DataLogic.GraduationManage.GraduationSetting
  17. {
  18. public class GraduationStandardDAL
  19. {
  20. public GraduationStandardRepository GraduationStandardRepository { get; set; }
  21. public GrademajorRepository GrademajorRepository { get; set; }
  22. public FacultymajorRepository FacultymajorRepository { get; set; }
  23. public DepartmentRepository DepartmentRepository { get; set; }
  24. public CollegeRepository CollegeRepository { get; set; }
  25. public CampusRepository CampusRepository { get; set; }
  26. public SchoolyearRepository SchoolyearRepository { get; set; }
  27. public ClassmajorRepository ClassmajorRepository { get; set; }
  28. public StudentRepository StudentRepository { get; set; }
  29. public SpecialtyPlanRepository SpecialtyPlanRepository { get; set; }
  30. public SpecialtyPlanTeachingSettingRepository SpecialtyPlanTeachingSettingRepository { get; set; }
  31. public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
  32. public ExecutablePlanTeachingSettingRepository ExecutablePlanTeachingSettingRepository { get; set; }
  33. public CoursematerialRepository CoursematerialRepository { get; set; }
  34. public CourseTypeSelectCourseTypeRepository CourseTypeSelectCourseTypeRepository { get; set; }
  35. public UserRepository UserRepository { get; set; }
  36. /// <summary>
  37. /// 查询对应的毕业标准信息View
  38. /// </summary>
  39. /// <param name="exp"></param>
  40. /// <returns></returns>
  41. public IQueryable<GraduationStandardView> GetGraduationStandardViewQueryable(Expression<Func<ER_GraduationStandard, bool>> exp)
  42. {
  43. var query = from gs in GraduationStandardRepository.GetList(exp)
  44. join gr in GrademajorRepository.Entities
  45. on gs.GrademajorID equals gr.GrademajorID
  46. join fa in FacultymajorRepository.Entities
  47. on gr.FacultymajorID equals fa.FacultymajorID
  48. join col in CollegeRepository.Entities
  49. on fa.CollegeID equals col.CollegeID
  50. join cam in CampusRepository.Entities
  51. on col.CampusID equals cam.CampusID
  52. join sye in SchoolyearRepository.Entities
  53. on
  54. new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
  55. equals
  56. new { SchoolyearID = sye.Years, SchoolcodeID = sye.SchoolcodeID }
  57. into tempsyenter
  58. from syenter in tempsyenter.DefaultIfEmpty()
  59. select new GraduationStandardView
  60. {
  61. GraduationStandardID = gs.GraduationStandardID,
  62. GrademajorID = gs.GrademajorID,
  63. GrademajorCode = gr.Code,
  64. GrademajorName = gr.Name,
  65. FacultymajorID = fa.FacultymajorID,
  66. FacultymajorNo = fa.Code,
  67. FacultymajorName = fa.Name,
  68. CollegeID = fa.CollegeID,
  69. CollegeNo = col.No,
  70. CollegeName = col.Name,
  71. CampusID = col.CampusID,
  72. CampusNo = cam.No,
  73. CampusName = cam.Name,
  74. SchoolyearID = gr.GradeID,
  75. SchoolcodeID = gr.SemesterID,
  76. EnteringSchoolYearID = syenter.SchoolyearID,
  77. EnteringSchoolYearCode = syenter.Code,
  78. GraduatingSemesterID = gr.CF_Schoolyear.SchoolyearID,
  79. GraduatingSemesterCode = gr.CF_Schoolyear.Code,
  80. StandardID = fa.StandardID,
  81. EducationID = fa.EducationID,
  82. LearningformID = fa.LearningformID,
  83. LearnSystem = fa.LearnSystem,
  84. RequireCourseCount = gs.RequireCourseCount,
  85. GraduationCredit = gs.GraduationCredit,
  86. RecordStatus = gs.RecordStatus,
  87. CreateUserID = gs.CreateUserID,
  88. CreateTime = gs.CreateTime,
  89. ModifyUserID = gs.ModifyUserID,
  90. ModifyTime = gs.ModifyTime
  91. };
  92. return query;
  93. }
  94. /// <summary>
  95. /// 查询对应的毕业标准信息View(门数、各类型学分统计:专业计划、执行计划)
  96. /// 注:由于学分制实行的程度不同,目前只对专业计划进行统计
  97. /// 默认为普教版本
  98. /// </summary>
  99. /// <param name="expGraduationStandard"></param>
  100. /// <param name="expExecutablePlan"></param>
  101. /// <param name="expStudent"></param>
  102. /// <returns></returns>
  103. public virtual IQueryable<GraduationStandardView> GetGraduationStandardViewQueryable(Expression<Func<ER_GraduationStandard, bool>> expGraduationStandard,
  104. Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan, Expression<Func<CF_Student, bool>> expStudent)
  105. {
  106. var query = from gs in GraduationStandardRepository.GetList(expGraduationStandard)
  107. join gr in GrademajorRepository.Entities
  108. on gs.GrademajorID equals gr.GrademajorID
  109. join fa in FacultymajorRepository.Entities
  110. on gr.FacultymajorID equals fa.FacultymajorID
  111. join col in CollegeRepository.Entities
  112. on fa.CollegeID equals col.CollegeID
  113. join cam in CampusRepository.Entities
  114. on col.CampusID equals cam.CampusID
  115. join sye in SchoolyearRepository.Entities
  116. on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
  117. equals new { SchoolyearID = sye.Years, SchoolcodeID = sye.SchoolcodeID } into tempsyenter
  118. from syenter in tempsyenter.DefaultIfEmpty()
  119. join stugr in
  120. (
  121. //年级专业对应的学生人数(区分在校、非在校)
  122. from stu in StudentRepository.GetList(expStudent)
  123. join cl in ClassmajorRepository.Entities
  124. on stu.ClassmajorID equals cl.ClassmajorID
  125. group cl by cl.GrademajorID into g
  126. select new
  127. {
  128. GrademajorID = g.Key,
  129. StudentCount = g.Count()
  130. }
  131. )
  132. on gr.GrademajorID equals stugr.GrademajorID into tempstugr
  133. from gsstugr in tempstugr.DefaultIfEmpty()
  134. join spgr in
  135. (
  136. //专业计划(计划门数、计划学分、必修、限选、任选学分统计)
  137. from spct in
  138. (
  139. from sp in SpecialtyPlanRepository.Entities
  140. join ct in CourseTypeSelectCourseTypeRepository.Entities
  141. on sp.CourseTypeID equals ct.CourseTypeID into tempct
  142. from spct in tempct.DefaultIfEmpty()
  143. select new
  144. {
  145. GrademajorID = sp.GrademajorID,
  146. CourseTypeID = sp.CourseTypeID,
  147. Credit = sp.EM_SpecialtyPlanTeachingSetting.Credit ?? 0,
  148. IsRequired = spct.IsRequired ?? true,
  149. IsOptionalCourse = spct.IsOptionalCourse ?? false,
  150. IsFreeSelectionCourse = spct.IsFreeSelectionCourse ?? false,
  151. }
  152. )
  153. group spct by spct.GrademajorID into g
  154. select new
  155. {
  156. GrademajorID = g.Key,
  157. PlanCourseCount = g.Count(),
  158. SpecialtyRequireCreditTotal = g.Sum(x => x.IsRequired ? x.Credit : 0),
  159. OptionalCreditTotal = g.Sum(x => x.IsOptionalCourse ? x.Credit : 0),
  160. FreeSelectionCreditTotal = g.Sum(x => x.IsFreeSelectionCourse ? x.Credit : 0),
  161. SpecialtyCreditTotal = g.Sum(x => x.Credit)
  162. }
  163. )
  164. on gr.GrademajorID equals spgr.GrademajorID into tempspgr
  165. from gsspgr in tempspgr.DefaultIfEmpty()
  166. join epgr in
  167. (
  168. //执行计划(执行门数、执行学分)
  169. from ep in ExecutablePlanRepository.GetList(expExecutablePlan)
  170. join ct in CourseTypeSelectCourseTypeRepository.Entities
  171. on ep.CourseTypeID equals ct.CourseTypeID into tempct
  172. from epct in tempct.DefaultIfEmpty()
  173. group ep by ep.GrademajorID into g
  174. select new
  175. {
  176. GrademajorID = g.Key,
  177. ExecCourseCount = g.Count(),
  178. ExecutableCreditTotal = g.Sum(x => x.EM_ExecutablePlanTeachingSetting.Credit ?? 0)
  179. }
  180. )
  181. on gr.GrademajorID equals epgr.GrademajorID into tempepgr
  182. from gsepgr in tempepgr.DefaultIfEmpty()
  183. select new GraduationStandardView
  184. {
  185. GraduationStandardID = gs.GraduationStandardID,
  186. GrademajorID = gs.GrademajorID,
  187. GrademajorCode = gr.Code,
  188. GrademajorName = gr.Name,
  189. FacultymajorID = fa.FacultymajorID,
  190. FacultymajorNo = fa.Code,
  191. FacultymajorName = fa.Name,
  192. CollegeID = fa.CollegeID,
  193. CollegeNo = col.No,
  194. CollegeName = col.Name,
  195. CampusID = col.CampusID,
  196. CampusNo = cam.No,
  197. CampusName = cam.Name,
  198. SchoolyearID = gr.GradeID,
  199. SchoolcodeID = gr.SemesterID,
  200. EnteringSchoolYearID = syenter.SchoolyearID,
  201. EnteringSchoolYearCode = syenter.Code,
  202. GraduatingSemesterID = gr.CF_Schoolyear.SchoolyearID,
  203. GraduatingSemesterCode = gr.CF_Schoolyear.Code,
  204. StandardID = fa.StandardID,
  205. EducationID = fa.EducationID,
  206. LearningformID = fa.LearningformID,
  207. LearnSystem = fa.LearnSystem,
  208. StudentCount = gsstugr.StudentCount == null ? 0 : gsstugr.StudentCount,
  209. PlanCourseCount = gsspgr.PlanCourseCount == null ? 0 : gsspgr.PlanCourseCount,
  210. SpecialtyRequireCreditTotal = gsspgr.SpecialtyRequireCreditTotal == null ? 0 : gsspgr.SpecialtyRequireCreditTotal,
  211. OptionalCreditTotal = gsspgr.OptionalCreditTotal == null ? 0 : gsspgr.OptionalCreditTotal,
  212. FreeSelectionCreditTotal = gsspgr.FreeSelectionCreditTotal == null ? 0 : gsspgr.FreeSelectionCreditTotal,
  213. SpecialtyCreditTotal = gsspgr.SpecialtyCreditTotal == null ? 0 : gsspgr.SpecialtyCreditTotal,
  214. ExecCourseCount = gsepgr.ExecCourseCount == null ? 0 : gsepgr.ExecCourseCount,
  215. ExecutableCreditTotal = gsepgr.ExecutableCreditTotal == null ? 0 : gsepgr.ExecutableCreditTotal,
  216. RequireCourseCount = gs.RequireCourseCount,
  217. GraduationCredit = gs.GraduationCredit,
  218. RecordStatus = gs.RecordStatus,
  219. CreateUserID = gs.CreateUserID,
  220. CreateTime = gs.CreateTime,
  221. ModifyUserID = gs.ModifyUserID,
  222. ModifyTime = gs.ModifyTime
  223. };
  224. return query;
  225. }
  226. /// <summary>
  227. /// 查询对应的年级专业信息View
  228. /// </summary>
  229. /// <param name="expGrademajor"></param>
  230. /// <param name="expStudent"></param>
  231. /// <returns></returns>
  232. public IQueryable<GrademajorView> GetGrademajorViewQueryable(Expression<Func<CF_Grademajor, bool>> expGrademajor, Expression<Func<CF_Student, bool>> expStudent)
  233. {
  234. var query = from gr in GrademajorRepository.GetList(expGrademajor)
  235. join fa in FacultymajorRepository.Entities
  236. on gr.FacultymajorID equals fa.FacultymajorID
  237. join col in CollegeRepository.Entities
  238. on fa.CollegeID equals col.CollegeID
  239. join cam in CampusRepository.Entities
  240. on col.CampusID equals cam.CampusID
  241. join grsy in SchoolyearRepository.Entities
  242. on gr.GraduateSchoolyearID equals grsy.SchoolyearID
  243. join stugr in
  244. (
  245. //年级专业对应的学生人数
  246. from stu in StudentRepository.GetList(expStudent)
  247. join cl in ClassmajorRepository.Entities
  248. on stu.ClassmajorID equals cl.ClassmajorID
  249. group cl by cl.GrademajorID into g
  250. select new
  251. {
  252. GrademajorID = g.Key,
  253. StudentCount = g.Count()
  254. }
  255. )
  256. on gr.GrademajorID equals stugr.GrademajorID into tempstugr
  257. from gsstugr in tempstugr.DefaultIfEmpty()
  258. select new GrademajorView
  259. {
  260. GrademajorID = gr.GrademajorID,
  261. Code = gr.Code,
  262. Name = gr.Name,
  263. Abbreviation = gr.Abbreviation,
  264. GradeID = gr.GradeID,
  265. SemesterID = gr.SemesterID,
  266. GraduateSchoolyearID = gr.GraduateSchoolyearID,
  267. GraduateSchoolyearCode = grsy.Code,
  268. GraduateValue = grsy.Value,
  269. FacultymajorID = gr.FacultymajorID,
  270. FacultymajorCode = fa.Code,
  271. FacultymajorName = fa.Name,
  272. EducationID = fa.EducationID,
  273. LearningformID = fa.LearningformID,
  274. LearnSystem = fa.LearnSystem,
  275. StudentCount = gsstugr.StudentCount == null ? 0 : gsstugr.StudentCount,
  276. StandardID = fa.StandardID,
  277. CollegeID = fa.CollegeID,
  278. CollegeCode = col.No,
  279. CollegeName = col.Name,
  280. CampusID = col.CampusID,
  281. CampusNo = cam.No,
  282. CampusName = cam.Name
  283. };
  284. return query;
  285. }
  286. /// <summary>
  287. /// 查询未新增的毕业标准对应的年级专业信息View
  288. /// </summary>
  289. /// <param name="expGrademajor"></param>
  290. /// <param name="expStudent"></param>
  291. /// <returns></returns>
  292. public IQueryable<GrademajorView> GetGraduationStandardViewNoAddQueryable(Expression<Func<CF_Grademajor, bool>> expGrademajor, Expression<Func<CF_Student, bool>> expStudent)
  293. {
  294. var query = from gr in this.GetGrademajorViewQueryable(expGrademajor, expStudent)
  295. join gs in GraduationStandardRepository.Entities
  296. on gr.GrademajorID equals gs.GrademajorID into tempgs
  297. from grgs in tempgs.DefaultIfEmpty()
  298. where grgs.GraduationStandardID == null
  299. select gr;
  300. return query;
  301. }
  302. /// <summary>
  303. /// 查询毕业标准对应的专业计划信息
  304. /// 注:默认为普教版本
  305. /// </summary>
  306. /// <param name="exp"></param>
  307. /// <returns></returns>
  308. public virtual IQueryable<SpecialtyPlanView> GetSpecialtyPlanViewQueryable(Expression<Func<ER_GraduationStandard, bool>> exp)
  309. {
  310. var query = from gs in GraduationStandardRepository.GetList(exp)
  311. join gr in GrademajorRepository.Entities
  312. on gs.GrademajorID equals gr.GrademajorID
  313. join fa in FacultymajorRepository.Entities
  314. on gr.FacultymajorID equals fa.FacultymajorID
  315. join col in CollegeRepository.Entities
  316. on fa.CollegeID equals col.CollegeID
  317. join sp in SpecialtyPlanRepository.Entities
  318. on gr.GrademajorID equals sp.GrademajorID
  319. join sy in SchoolyearRepository.Entities
  320. on sp.SchoolyearID equals sy.SchoolyearID
  321. join cou in CoursematerialRepository.Entities
  322. on sp.CoursematerialID equals cou.CoursematerialID
  323. join depcou in DepartmentRepository.Entities
  324. on sp.DepartmentID equals depcou.DepartmentID into tempdepcou
  325. from spdepcou in tempdepcou.DefaultIfEmpty()
  326. select new SpecialtyPlanView
  327. {
  328. SpecialtyPlanID = sp.SpecialtyPlanID,
  329. SchoolyearID = sp.SchoolyearID,
  330. SchoolyearCode = sy.Code,
  331. GrademajorID = sp.GrademajorID,
  332. GrademajorCode = gr.Code,
  333. GrademajorName = gr.Name,
  334. CollegeID = fa.CollegeID,
  335. CollegeCode = col.No,
  336. CollegeName = col.Name,
  337. CoursematerialID = sp.CoursematerialID,
  338. CourseCode = cou.CourseCode,
  339. CourseName = cou.CourseName,
  340. CourseStructureID = sp.CourseStructureID,
  341. CourseCategoryID = sp.CourseCategoryID,
  342. CourseTypeID = sp.CourseTypeID,
  343. CourseQualityID = sp.CourseQualityID,
  344. ResultTypeID = sp.ResultTypeID,
  345. PracticeTypeID = sp.PracticeTypeID,
  346. ExaminationModeID = sp.ExaminationModeID,
  347. TeachinglanguageID = sp.TeachinglanguageID,
  348. CourseFineID = sp.CourseFineID,
  349. IsSpecialtycore = sp.IsSpecialtycore ?? false,
  350. IsCooperation = sp.IsCooperation ?? false,
  351. IsRequired = sp.IsRequired ?? false,
  352. IsElective = sp.IsElective ?? false,
  353. IsNetworkCourse = sp.IsNetworkCourse ?? false,
  354. IsMainCourse = sp.IsMainCourse ?? false,
  355. Credit = sp.EM_SpecialtyPlanTeachingSetting.Credit ?? 0,
  356. TheoryCourse = sp.EM_SpecialtyPlanTeachingSetting.TheoryCourse ?? 0,
  357. Practicehours = sp.EM_SpecialtyPlanTeachingSetting.Practicehours ?? 0,
  358. Trialhours = sp.EM_SpecialtyPlanTeachingSetting.Trialhours ?? 0,
  359. Totalhours = (sp.EM_SpecialtyPlanTeachingSetting.TheoryCourse ?? 0) + (sp.EM_SpecialtyPlanTeachingSetting.Practicehours ?? 0),
  360. SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
  361. SchoolcodeID = sy.SchoolcodeID,
  362. StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
  363. DepartmentID = sp.DepartmentID,
  364. DepartmentCode = spdepcou.No,
  365. DepartmentName = spdepcou.Name,
  366. HandleModeID = sp.HandleModeID,
  367. Remark = sp.Remark,
  368. RecordStatus = sp.RecordStatus,
  369. CreateUserID = sp.CreateUserID,
  370. CreateTime = sp.CreateTime,
  371. ModifyUserID = sp.ModifyUserID,
  372. ModifyTime = sp.ModifyTime
  373. };
  374. return query;
  375. }
  376. /// <summary>
  377. /// 查询毕业标准对应的执行计划信息
  378. /// </summary>
  379. /// <param name="exp"></param>
  380. /// <returns></returns>
  381. public IQueryable<ExecutablePlanView> GetExecutablePlanViewQueryable(Expression<Func<ER_GraduationStandard, bool>> exp)
  382. {
  383. var query = from gs in GraduationStandardRepository.GetList(exp)
  384. join gr in GrademajorRepository.Entities
  385. on gs.GrademajorID equals gr.GrademajorID
  386. join fa in FacultymajorRepository.Entities
  387. on gr.FacultymajorID equals fa.FacultymajorID
  388. join col in CollegeRepository.Entities
  389. on fa.CollegeID equals col.CollegeID
  390. join ep in ExecutablePlanRepository.Entities
  391. on gr.GrademajorID equals ep.GrademajorID
  392. join sy in SchoolyearRepository.Entities
  393. on ep.SchoolyearID equals sy.SchoolyearID
  394. join cou in CoursematerialRepository.Entities
  395. on ep.CoursematerialID equals cou.CoursematerialID
  396. join depcou in DepartmentRepository.Entities
  397. on ep.DepartmentID equals depcou.DepartmentID into tempdepcou
  398. from epdepcou in tempdepcou.DefaultIfEmpty()
  399. select new ExecutablePlanView
  400. {
  401. ExecutablePlanID = ep.ExecutablePlanID,
  402. SpecialtyPlanID = ep.SpecialtyPlanID,
  403. SchoolyearID = ep.SchoolyearID,
  404. SchoolyearCode = sy.Code,
  405. GrademajorID = ep.GrademajorID,
  406. GrademajorCode = gr.Code,
  407. GrademajorName = gr.Name,
  408. CollegeID = fa.CollegeID,
  409. CollegeCode = col.No,
  410. CollegeName = col.Name,
  411. CoursematerialID = ep.CoursematerialID,
  412. CourseCode = cou.CourseCode,
  413. CourseName = cou.CourseName,
  414. CourseStructureID = ep.CourseStructureID,
  415. CourseCategoryID = ep.CourseCategoryID,
  416. CourseTypeID = ep.CourseTypeID,
  417. CourseQualityID = ep.CourseQualityID,
  418. ResultTypeID = ep.ResultTypeID,
  419. PracticeTypeID = ep.EM_ExecutablePlanProfile.PracticeTypeID,
  420. ExaminationModeID = ep.EM_ExecutablePlanProfile.ExaminationModeID,
  421. TeachinglanguageID = ep.EM_ExecutablePlanProfile.TeachinglanguageID,
  422. CourseFineID = ep.EM_ExecutablePlanProfile.CourseFineID,
  423. IsSpecialtycore = ep.EM_ExecutablePlanProfile.IsSpecialtycore ?? false,
  424. IsCooperation = ep.EM_ExecutablePlanProfile.IsCooperation ?? false,
  425. IsRequired = ep.EM_ExecutablePlanProfile.IsRequired ?? false,
  426. IsElective = ep.EM_ExecutablePlanProfile.IsElective ?? false,
  427. IsNetworkCourse = ep.EM_ExecutablePlanProfile.IsNetworkCourse ?? false,
  428. IsMainCourse = ep.EM_ExecutablePlanProfile.IsMainCourse ?? false,
  429. Credit = ep.EM_ExecutablePlanTeachingSetting.Credit ?? 0,
  430. TheoryCourse = ep.EM_ExecutablePlanTeachingSetting.TheoryCourse ?? 0,
  431. Practicehours = ep.EM_ExecutablePlanTeachingSetting.Practicehours ?? 0,
  432. Trialhours = ep.EM_ExecutablePlanTeachingSetting.Trialhours ?? 0,
  433. Totalhours = (ep.EM_ExecutablePlanTeachingSetting.TheoryCourse ?? 0) + (ep.EM_ExecutablePlanTeachingSetting.Practicehours ?? 0),
  434. SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
  435. SchoolcodeID = sy.SchoolcodeID,
  436. StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
  437. DepartmentID = ep.DepartmentID,
  438. DepartmentCode = epdepcou.No,
  439. DepartmentName = epdepcou.Name,
  440. HandleModeID = ep.HandleModeID,
  441. ExecuteStatus = ep.RecordStatus,
  442. Remark = ep.Remark,
  443. RecordStatus = ep.RecordStatus,
  444. CreateUserID = ep.CreateUserID,
  445. CreateTime = ep.CreateTime,
  446. ModifyUserID = ep.ModifyUserID,
  447. ModifyTime = ep.ModifyTime
  448. };
  449. return query;
  450. }
  451. /// <summary>
  452. /// 查询年级专业对应的各在校状态学生信息
  453. /// </summary>
  454. /// <param name="expGrademajor"></param>
  455. /// <param name="expStudent"></param>
  456. /// <returns></returns>
  457. public IQueryable<BaseStudentView> GetGradeMajorStudentViewQueryAble(Expression<Func<CF_Grademajor, bool>> expGrademajor, Expression<Func<CF_Student, bool>> expStudent)
  458. {
  459. var query = from gr in GrademajorRepository.GetList(expGrademajor)
  460. join cl in ClassmajorRepository.Entities
  461. on gr.GrademajorID equals cl.GrademajorID
  462. join stu in StudentRepository.GetList(expStudent)
  463. on cl.ClassmajorID equals stu.ClassmajorID
  464. join us in UserRepository.Entities
  465. on stu.UserID equals us.UserID
  466. select new BaseStudentView
  467. {
  468. UserID = stu.UserID,
  469. LoginID = us.LoginID,
  470. UserName = us.Name,
  471. SexID = stu.SexID,
  472. IDNumber = stu.IDNumber,
  473. InSchoolStatusID = stu.InSchoolStatusID,
  474. StudentStatus = stu.StudentStatus,
  475. SchoolyearID = gr.GradeID,
  476. GrademajorID = cl.GrademajorID,
  477. GrademajorCode = gr.Code,
  478. GrademajorName = gr.Name,
  479. ClassmajorID = stu.ClassmajorID,
  480. ClassmajorCode = cl.No,
  481. ClassmajorName = cl.Name
  482. };
  483. return query;
  484. }
  485. }
  486. }