RetakePlanTaskDAL.cs 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel;
  7. using EMIS.ViewModel.RetakeManage;
  8. using EMIS.Entities;
  9. using System.Linq.Expressions;
  10. namespace EMIS.DataLogic.RetakeManage
  11. {
  12. public class RetakePlanTaskDAL
  13. {
  14. public RetakeConditionRepository RetakConditionRepository { get; set; }
  15. public RetakeConditionParameterRepository RetakeConditionParameterRepository { get; set; }
  16. public RetakePlanRepository RetakePlanRepository { get; set; }
  17. public RetakePlanStudentRepository RetakePlanStudentRepository { get; set; }
  18. public RetakeExamsCatagoryRepository RetakeExamsCatagoryRepository { get; set; }
  19. public RetakePlanSettingRepository RetakePlanSettingRepository { get; set; }
  20. public RetakePlanTeachingModeTypeRepository RetakePlanTeachingModeTypeRepository { get; set; }
  21. public RetakePlanTeachingPlaceRepository RetakePlanTeachingPlaceRepository { get; set; }
  22. public RetakePlanTeachingSettingRepository RetakePlanTeachingSettingRepository { get; set; }
  23. public FinallyScoreRepository FinallyScoreRepository { get; set; }
  24. public StudentRepository StudentRepository { get; set; }
  25. public UserRepository UserRepository { get; set; }
  26. public InSchoolSettingRepository InSchoolSettingRepository { get; set; }
  27. public ParameterRepository ParameterRepository { get; set; }
  28. public CoursematerialRepository CoursematerialRepository { get; set; }
  29. public ClassmajorRepository ClassmajorRepository { get; set; }
  30. public GrademajorRepository GrademajorRepository { get; set; }
  31. public FacultymajorRepository FacultymajorRepository { get; set; }
  32. public CollegeRepository CollegeRepository { get; set; }
  33. public DepartmentRepository DepartmentRepository { get; set; }
  34. public SchoolyearRepository SchoolyearRepository { get; set; }
  35. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  36. public RetakePlanSettingSchedulingRepository RetakePlanSettingSchedulingRepository { get; set; }
  37. public ClassroomRepository ClassroomRepository { get; set; }
  38. public CoursesTimeRepository coursesTimeRepository { get; set; }
  39. public EducationSchedulingRepository EducationSchedulingRepository { get; set; }
  40. public EducationSchedulingWeekNumRepository EducationSchedulingWeekNumRepository { get; set; }
  41. public EducationSchedulingTeacherRepository EducationSchedulingTeacherRepository { get; set; }
  42. public EducationMissionRepository EducationMissionRepository { get; set; }
  43. public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
  44. public EducationSchedulingClassRepository EducationSchedulingClassRepository { get; set; }
  45. public RetakePlanTeacherRepository RetakePlanTeacherRepository { get; set; }
  46. public StaffRepository StaffRepository { get; set; }
  47. /// <summary>
  48. /// 学生成绩预查信息View查询(不及格成绩,小于60分)
  49. /// </summary>
  50. /// <param name="expFinallyScore"></param>
  51. /// <param name="expStudent"></param>
  52. /// <returns></returns>
  53. public IQueryable<RetakeStudentListView> GetRetakePreStudentView(Expression<Func<ER_FinallyScore, bool>> expFinallyScore,
  54. Expression<Func<CF_Student, bool>> expStudent, Expression<Func<ER_RetakePlan, bool>> expRetakePlan)
  55. {
  56. //注:需要对重修设置中的重修学年学期、重修考试性质进行判断(不能为空)
  57. var query = from finSco in FinallyScoreRepository.GetList(expFinallyScore)
  58. join rec in RetakeExamsCatagoryRepository.Entities
  59. on finSco.ExamsCategoryID equals rec.ExamsCategoryID
  60. join stu in StudentRepository.GetList(expStudent)
  61. on finSco.UserID equals stu.UserID
  62. join sy in SchoolyearRepository.Entities
  63. on finSco.SchoolyearID equals sy.SchoolyearID
  64. join cou in CoursematerialRepository.Entities
  65. on finSco.CoursematerialID equals cou.CoursematerialID
  66. join dep in DepartmentRepository.Entities
  67. on finSco.DepartmentID equals dep.DepartmentID
  68. join cl in ClassmajorRepository.Entities
  69. on stu.ClassmajorID equals cl.ClassmajorID
  70. join gr in GrademajorRepository.Entities
  71. on cl.GrademajorID equals gr.GrademajorID
  72. join fa in FacultymajorRepository.Entities
  73. on gr.FacultymajorID equals fa.FacultymajorID
  74. join col in CollegeRepository.Entities
  75. on fa.CollegeID equals col.CollegeID
  76. join us in UserRepository.Entities
  77. on stu.UserID equals us.UserID
  78. join rePlan in
  79. (
  80. from rp in RetakePlanRepository.GetList(expRetakePlan)
  81. join rpStu in RetakePlanStudentRepository.Entities
  82. on rp.RetakePlanID equals rpStu.RetakePlanID
  83. select new
  84. {
  85. RetakePlanID = rp.RetakePlanID,
  86. SchoolyearID = rp.SchoolyearID,
  87. CoursematerialID = rp.CoursematerialID,
  88. CourseTypeID = rp.CourseTypeID,
  89. Credit = rp.Credit,
  90. RetakePlanStudentID = rpStu.RetakePlanStudentID,
  91. UserID = (Guid?)rpStu.UserID,
  92. SchoolyearNumID = rpStu.SchoolyearNumID,
  93. StarttermID = rpStu.StarttermID
  94. }
  95. )
  96. on
  97. new { finSco.CoursematerialID, finSco.CourseTypeID, finSco.Credit, finSco.UserID, finSco.SchoolyearNumID, finSco.StarttermID }
  98. equals
  99. new { rePlan.CoursematerialID, rePlan.CourseTypeID, rePlan.Credit, rePlan.UserID, rePlan.SchoolyearNumID, rePlan.StarttermID }
  100. into rePlanTemp
  101. from rePlanStu in rePlanTemp.DefaultIfEmpty()
  102. where finSco.TotalScore < 60 && rePlanStu.RetakePlanID == null
  103. select new RetakeStudentListView
  104. {
  105. FinallyScoreID = finSco.FinallyScoreID,
  106. SchoolyearID = finSco.SchoolyearID,
  107. SchoolyearCode = sy.Code,
  108. DepartmentID = finSco.DepartmentID, //开课教研室
  109. DepartmentCode = dep.No,
  110. DepartmentName = dep.Name,
  111. UserID = finSco.UserID,
  112. UserName = us.Name,
  113. LoginID = us.LoginID,
  114. SexID = stu.SexID,
  115. InSchoolStatusID = stu.InSchoolStatusID,
  116. StudentStatusID = stu.StudentStatus,
  117. ClassmajorID = stu.ClassmajorID,
  118. ClassmajorCode = cl.No,
  119. ClassmajorName = cl.Name,
  120. GrademajorID = cl.GrademajorID,
  121. GrademajorCode = gr.Code,
  122. GrademajorName = gr.Name,
  123. CollegeID = fa.CollegeID,
  124. CollegeNo = col.No,
  125. CollegeName = col.Name,
  126. Gradeyear = gr.GradeID,
  127. StandardID = fa.StandardID,
  128. EducationID = fa.EducationID,
  129. LearningformID = fa.LearningformID,
  130. LearnSystem = fa.LearnSystem,
  131. ExamsCategoryID = finSco.ExamsCategoryID,
  132. ExamsStateID = finSco.ExamsStateID,
  133. CoursematerialID = finSco.CoursematerialID,
  134. Abbreviation = cou.Abbreviation,
  135. CourseCode = cou.CourseCode,
  136. CourseName = cou.CourseName,
  137. CourseTypeID = finSco.CourseTypeID,
  138. CourseCredit = finSco.Credit ?? 0,
  139. Credit = finSco.ScoreCredit ?? 0,
  140. TotalScore = finSco.TotalScore,
  141. SchoolyearNumID = finSco.SchoolyearNumID,
  142. StarttermID = finSco.StarttermID
  143. };
  144. return query;
  145. }
  146. /// <summary>
  147. /// 查询重修计划信息View(统计对应的重修计划名单人数-计划人数)
  148. /// </summary>
  149. /// <param name="expRetakePlan"></param>
  150. /// <returns></returns>
  151. public IQueryable<RetakePlanTaskView> GetRetakePlanTaskView(Expression<Func<ER_RetakePlan, bool>> expRetakePlan)
  152. {
  153. var query = from rePlan in RetakePlanRepository.GetList(expRetakePlan)
  154. join cou in CoursematerialRepository.Entities
  155. on rePlan.CoursematerialID equals cou.CoursematerialID
  156. join sy in SchoolyearRepository.Entities
  157. on rePlan.SchoolyearID equals sy.SchoolyearID
  158. join reStu in
  159. (
  160. from stu in RetakePlanStudentRepository.Entities
  161. group stu by stu.RetakePlanID into g
  162. select new
  163. {
  164. RetakePlanID = g.Key,
  165. PlanNumber = g.Count()
  166. }
  167. )
  168. on rePlan.RetakePlanID equals reStu.RetakePlanID
  169. into reStuTemp
  170. from rePlanStu in reStuTemp.DefaultIfEmpty()
  171. join reSet in RetakePlanSettingRepository.Entities
  172. on rePlan.RetakePlanID equals reSet.RetakePlanID
  173. into reSetTemp
  174. from rePlanSet in reSetTemp.DefaultIfEmpty()
  175. join dep in DepartmentRepository.Entities
  176. on rePlanSet.DepartmentID equals dep.DepartmentID
  177. into reDepTemp
  178. from reDep in reDepTemp.DefaultIfEmpty()
  179. join reTeaching in RetakePlanTeachingSettingRepository.Entities
  180. on rePlan.RetakePlanID equals reTeaching.RetakePlanID
  181. into reTeachingTemp
  182. from rePlanTeaching in reTeachingTemp.DefaultIfEmpty()
  183. select new RetakePlanTaskView
  184. {
  185. RetakePlanID = rePlan.RetakePlanID,
  186. SchoolyearID = rePlan.SchoolyearID,
  187. SchoolyearCode = sy.Code,
  188. RetakeTypeID = rePlan.RetakeTypeID,
  189. ClassName = rePlan.ClassName,
  190. CoursematerialID = rePlan.CoursematerialID,
  191. CourseCode = cou.CourseCode,
  192. CourseName = cou.CourseName,
  193. DepartmentID = rePlanSet.DepartmentID,
  194. DepartmentCode = reDep.No,
  195. DepartmentName = reDep.Name,
  196. CourseCollegeID = reDep.CF_College.CollegeID,
  197. CourseCollegeNo = reDep.CF_College.No,
  198. CourseCollegeName = reDep.CF_College.Name,
  199. CourseTypeID = rePlan.CourseTypeID,
  200. Credit = rePlan.Credit ?? 0,
  201. PeopleNumlimit = rePlan.PeopleNumlimit ?? 0,
  202. PeopleNumlower = rePlan.PeopleNumlower ?? 0,
  203. TheoryCourse = rePlanTeaching.TheoryCourse ?? 0,
  204. Practicehours = rePlanTeaching.Practicehours ?? 0,
  205. Trialhours = rePlanTeaching.Trialhours ?? 0,
  206. StartWeeklyNum = rePlanTeaching.StartWeeklyNum,
  207. EndWeeklyNum = rePlanTeaching.EndWeeklyNum,
  208. PlanNumber = rePlanStu != null ? rePlanStu.PlanNumber : 0,
  209. RecordStatus = rePlan.RecordStatus
  210. };
  211. return query;
  212. }
  213. /// <summary>
  214. /// 查询重修计划相关信息View(含相关设置信息、排课教室等)
  215. /// 注:排课明细中目前只支持同一教室的情况
  216. /// </summary>
  217. /// <param name="expRetakePlan"></param>
  218. /// <returns></returns>
  219. public IQueryable<RetakePlanTaskSettingView> GetRetakePlanTaskSettingView(Expression<Func<ER_RetakePlan, bool>> expRetakePlan)
  220. {
  221. var query = from rePlan in RetakePlanRepository.GetList(expRetakePlan)
  222. join cou in CoursematerialRepository.Entities
  223. on rePlan.CoursematerialID equals cou.CoursematerialID
  224. join sy in SchoolyearRepository.Entities
  225. on rePlan.SchoolyearID equals sy.SchoolyearID
  226. join reSet in RetakePlanSettingRepository.Entities
  227. on rePlan.RetakePlanID equals reSet.RetakePlanID
  228. into reSetTemp
  229. from rePlanSet in reSetTemp.DefaultIfEmpty()
  230. join dep in DepartmentRepository.Entities
  231. on rePlanSet.DepartmentID equals dep.DepartmentID
  232. into reDepTemp
  233. from reDep in reDepTemp.DefaultIfEmpty()
  234. join reTeaching in RetakePlanTeachingSettingRepository.Entities
  235. on rePlan.RetakePlanID equals reTeaching.RetakePlanID
  236. into reTeachingTemp
  237. from rePlanTeaching in reTeachingTemp.DefaultIfEmpty()
  238. select new RetakePlanTaskSettingView
  239. {
  240. RetakePlanID = rePlan.RetakePlanID,
  241. SchoolyearID = rePlan.SchoolyearID,
  242. SchoolyearCode = sy.Code,
  243. RetakeTypeID = rePlan.RetakeTypeID,
  244. ClassName = rePlan.ClassName,
  245. CoursematerialID = rePlan.CoursematerialID,
  246. CourseCode = cou.CourseCode,
  247. CourseName = cou.CourseName,
  248. DepartmentID = rePlanSet.DepartmentID,
  249. DepartmentCode = reDep.No,
  250. DepartmentName = reDep.Name,
  251. CourseCollegeID = reDep.CF_College.CollegeID,
  252. CourseCollegeNo = reDep.CF_College.No,
  253. CourseCollegeName = reDep.CF_College.Name,
  254. Credit = rePlan.Credit ?? 0,
  255. CourseTypeID = rePlan.CourseTypeID,
  256. CourseStructureID = rePlanSet.CourseStructureID,
  257. CourseCategoryID = rePlanSet.CourseCategoryID,
  258. CourseQualityID = rePlanSet.CourseQualityID,
  259. ExaminationModeID = rePlanSet.ExaminationModeID,
  260. TeachinglanguageID = rePlanSet.TeachinglanguageID,
  261. IsNeedMaterial = rePlanSet.IsNeedMaterial ?? false,
  262. PracticeTypeID = rePlanSet.PracticeTypeID,
  263. CourseFineID = rePlanSet.CourseFineID,
  264. IsRequired = rePlanSet.IsRequired ?? false,
  265. IsSpecialtycore = rePlanSet.IsSpecialtycore ?? false,
  266. IsCooperation = rePlanSet.IsCooperation ?? false,
  267. IsElective = rePlanSet.IsElective ?? false,
  268. IsNetworkCourse = rePlanSet.IsNetworkCourse ?? false,
  269. IsMainCourse = rePlanSet.IsMainCourse ?? false,
  270. TheoryCourse = rePlanTeaching.TheoryCourse ?? 0,
  271. Practicehours = rePlanTeaching.Practicehours ?? 0,
  272. Trialhours = rePlanTeaching.Trialhours ?? 0,
  273. PeopleNumlimit = rePlan.PeopleNumlimit ?? 0,
  274. PeopleNumlower = rePlan.PeopleNumlower ?? 0,
  275. TheoryWeeklyNum = rePlanTeaching.TheoryWeeklyNum ?? 0,
  276. PracticeWeeklyNum = rePlanTeaching.PracticeWeeklyNum ?? 0,
  277. TrialWeeklyNum = rePlanTeaching.TrialWeeklyNum ?? 0,
  278. StartWeeklyNum = rePlanTeaching.StartWeeklyNum ?? 0,
  279. EndWeeklyNum = rePlanTeaching.EndWeeklyNum ?? 0,
  280. WeeklyHours = rePlanTeaching.WeeklyHours ?? 0,
  281. WeeklyNum = rePlanTeaching.WeeklyNum ?? 0,
  282. RecordStatus = rePlan.RecordStatus,
  283. Remarks = rePlanSet.Remarks,
  284. ClassroomID = rePlan.ER_RetakePlanSettingScheduling.FirstOrDefault() != null ? rePlan.ER_RetakePlanSettingScheduling.FirstOrDefault().ClassroomID : null
  285. };
  286. return query;
  287. }
  288. /// <summary>
  289. /// 查询重修计划名单信息View
  290. /// </summary>
  291. /// <param name="expRetakePlan"></param>
  292. /// <returns></returns>
  293. public IQueryable<RetakeStudentListView> GetRetakePlanTaskStudentView(Expression<Func<ER_RetakePlan, bool>> expRetakePlan)
  294. {
  295. var query = from rePlan in RetakePlanRepository.GetList(expRetakePlan)
  296. join sy in SchoolyearRepository.Entities
  297. on rePlan.SchoolyearID equals sy.SchoolyearID
  298. join cou in CoursematerialRepository.Entities
  299. on rePlan.CoursematerialID equals cou.CoursematerialID
  300. join rePlanStu in RetakePlanStudentRepository.Entities
  301. on rePlan.RetakePlanID equals rePlanStu.RetakePlanID
  302. join reSet in RetakePlanSettingRepository.Entities
  303. on rePlan.RetakePlanID equals reSet.RetakePlanID
  304. into reSetTemp
  305. from rePlanSet in reSetTemp.DefaultIfEmpty()
  306. join dep in DepartmentRepository.Entities
  307. on rePlanSet.DepartmentID equals dep.DepartmentID
  308. into reDepTemp
  309. from reDep in reDepTemp.DefaultIfEmpty()
  310. join stu in StudentRepository.Entities
  311. on rePlanStu.UserID equals stu.UserID
  312. join us in UserRepository.Entities
  313. on stu.UserID equals us.UserID
  314. join cl in ClassmajorRepository.Entities
  315. on stu.ClassmajorID equals cl.ClassmajorID
  316. join gr in GrademajorRepository.Entities
  317. on cl.GrademajorID equals gr.GrademajorID
  318. join fa in FacultymajorRepository.Entities
  319. on gr.FacultymajorID equals fa.FacultymajorID
  320. join col in CollegeRepository.Entities
  321. on fa.CollegeID equals col.CollegeID
  322. select new RetakeStudentListView
  323. {
  324. RetakePlanID = rePlan.RetakePlanID,
  325. RetakePlanStudentID = rePlanStu.RetakePlanStudentID,
  326. RetakeTypeID = rePlan.RetakeTypeID,
  327. SchoolyearID = rePlan.SchoolyearID,
  328. SchoolyearCode = sy.Code,
  329. ClassName = rePlan.ClassName,
  330. CoursematerialID = rePlan.CoursematerialID,
  331. CourseCode = cou.CourseCode,
  332. CourseName = cou.CourseName,
  333. DepartmentID = rePlanSet.DepartmentID,
  334. DepartmentCode = reDep.No,
  335. DepartmentName = reDep.Name,
  336. CourseTypeID = rePlan.CourseTypeID,
  337. CourseCredit = rePlan.Credit ?? 0,
  338. SchoolyearNumID = rePlanStu.SchoolyearNumID,
  339. StarttermID = rePlanStu.StarttermID,
  340. UserID = rePlanStu.UserID,
  341. LoginID = us.LoginID,
  342. UserName = us.Name,
  343. SexID = stu.SexID,
  344. InSchoolStatusID = stu.InSchoolStatusID,
  345. StudentStatusID = stu.StudentStatus,
  346. ClassmajorID = stu.ClassmajorID,
  347. ClassmajorCode = cl.No,
  348. ClassmajorName = cl.Name,
  349. GrademajorID = cl.GrademajorID,
  350. GrademajorCode = gr.Code,
  351. GrademajorName = gr.Name,
  352. CollegeID = fa.CollegeID,
  353. CollegeNo = col.No,
  354. CollegeName = col.Name,
  355. Gradeyear = gr.GradeID,
  356. StandardID = fa.StandardID,
  357. EducationID = fa.EducationID,
  358. LearningformID = fa.LearningformID,
  359. LearnSystem = fa.LearnSystem,
  360. RecordStatus = rePlan.RecordStatus,
  361. ApplyStatus = rePlan.CF_Student.Any(x => x.UserID == rePlanStu.UserID) ? true : false
  362. };
  363. return query;
  364. }
  365. /// <summary>
  366. /// 查询重修计划名单信息View
  367. /// </summary>
  368. /// <param name="expRetakePlan"></param>
  369. /// <param name="expRetakePlanStudent"></param>
  370. /// <param name="expStudent"></param>
  371. /// <returns></returns>
  372. public IQueryable<RetakeStudentListView> GetRetakePlanTaskStudentView(Expression<Func<ER_RetakePlan, bool>> expRetakePlan,
  373. Expression<Func<ER_RetakePlanStudent, bool>> expRetakePlanStudent, Expression<Func<CF_Student, bool>> expStudent)
  374. {
  375. var query = from rePlan in RetakePlanRepository.GetList(expRetakePlan)
  376. join sy in SchoolyearRepository.Entities
  377. on rePlan.SchoolyearID equals sy.SchoolyearID
  378. join cou in CoursematerialRepository.Entities
  379. on rePlan.CoursematerialID equals cou.CoursematerialID
  380. join rePlanStu in RetakePlanStudentRepository.GetList(expRetakePlanStudent)
  381. on rePlan.RetakePlanID equals rePlanStu.RetakePlanID
  382. join reSet in RetakePlanSettingRepository.Entities
  383. on rePlan.RetakePlanID equals reSet.RetakePlanID
  384. into reSetTemp
  385. from rePlanSet in reSetTemp.DefaultIfEmpty()
  386. join dep in DepartmentRepository.Entities
  387. on rePlanSet.DepartmentID equals dep.DepartmentID
  388. into reDepTemp
  389. from reDep in reDepTemp.DefaultIfEmpty()
  390. join stu in StudentRepository.GetList(expStudent)
  391. on rePlanStu.UserID equals stu.UserID
  392. join us in UserRepository.Entities
  393. on stu.UserID equals us.UserID
  394. join cl in ClassmajorRepository.Entities
  395. on stu.ClassmajorID equals cl.ClassmajorID
  396. join gr in GrademajorRepository.Entities
  397. on cl.GrademajorID equals gr.GrademajorID
  398. join fa in FacultymajorRepository.Entities
  399. on gr.FacultymajorID equals fa.FacultymajorID
  400. join col in CollegeRepository.Entities
  401. on fa.CollegeID equals col.CollegeID
  402. select new RetakeStudentListView
  403. {
  404. RetakePlanID = rePlan.RetakePlanID,
  405. RetakePlanStudentID = rePlanStu.RetakePlanStudentID,
  406. RetakeTypeID = rePlan.RetakeTypeID,
  407. SchoolyearID = rePlan.SchoolyearID,
  408. SchoolyearCode = sy.Code,
  409. ClassName = rePlan.ClassName,
  410. CoursematerialID = rePlan.CoursematerialID,
  411. CourseCode = cou.CourseCode,
  412. CourseName = cou.CourseName,
  413. DepartmentID = rePlanSet.DepartmentID,
  414. DepartmentCode = reDep.No,
  415. DepartmentName = reDep.Name,
  416. CourseTypeID = rePlan.CourseTypeID,
  417. CourseCredit = rePlan.Credit ?? 0,
  418. SchoolyearNumID = rePlanStu.SchoolyearNumID,
  419. StarttermID = rePlanStu.StarttermID,
  420. UserID = rePlanStu.UserID,
  421. LoginID = us.LoginID,
  422. UserName = us.Name,
  423. SexID = stu.SexID,
  424. InSchoolStatusID = stu.InSchoolStatusID,
  425. StudentStatusID = stu.StudentStatus,
  426. ClassmajorID = stu.ClassmajorID,
  427. ClassmajorCode = cl.No,
  428. ClassmajorName = cl.Name,
  429. GrademajorID = cl.GrademajorID,
  430. GrademajorCode = gr.Code,
  431. GrademajorName = gr.Name,
  432. CollegeID = fa.CollegeID,
  433. CollegeNo = col.No,
  434. CollegeName = col.Name,
  435. Gradeyear = gr.GradeID,
  436. StandardID = fa.StandardID,
  437. EducationID = fa.EducationID,
  438. LearningformID = fa.LearningformID,
  439. LearnSystem = fa.LearnSystem,
  440. RecordStatus = rePlan.RecordStatus,
  441. ApplyStatus = rePlan.CF_Student.Any(x => x.UserID == rePlanStu.UserID) ? true : false
  442. };
  443. return query;
  444. }
  445. /// <summary>
  446. /// 查询重修计划课程表信息
  447. /// </summary>
  448. /// <param name="exp"></param>
  449. /// <returns></returns>
  450. public IQueryable<RetakePlanSettingSchedulingView> GetSchedulingView(Expression<Func<ER_RetakePlanSettingScheduling, bool>> exp)
  451. {
  452. var query = from rePlanSch in RetakePlanSettingSchedulingRepository.GetList(exp)
  453. join rePlan in RetakePlanRepository.Entities
  454. on rePlanSch.RetakePlanID equals rePlan.RetakePlanID
  455. join rePlanSet in RetakePlanSettingRepository.Entities
  456. on rePlan.RetakePlanID equals rePlanSet.RetakePlanID
  457. join couTime in coursesTimeRepository.Entities
  458. on rePlanSch.CoursesTimeID equals couTime.CoursesTimeID
  459. join item in DictionaryItemRepository.Entities
  460. on
  461. new { couTime.TimesSegment, DictionaryCode = typeof(EMIS.ViewModel.CF_TimesSegment).Name }
  462. equals
  463. new { TimesSegment = item.Value.Value, item.DictionaryCode }
  464. into couTimeTemp
  465. from rePlanTime in couTimeTemp.DefaultIfEmpty()
  466. join room in ClassroomRepository.Entities
  467. on rePlanSch.ClassroomID equals room.ClassroomID
  468. into roomTemp
  469. from rePlanRoom in roomTemp.DefaultIfEmpty()
  470. join dep in DepartmentRepository.Entities
  471. on rePlanSet.DepartmentID equals dep.DepartmentID
  472. into reDepTemp
  473. from reDep in reDepTemp.DefaultIfEmpty()
  474. select new RetakePlanSettingSchedulingView
  475. {
  476. SchedulingID = rePlanSch.RetakePlanSettingSchedulingID,
  477. ID = rePlanSch.RetakePlanID,
  478. CoursesTimeID = rePlanSch.CoursesTimeID,
  479. Weekday = rePlanSch.Weekday,
  480. TimesSegment = couTime.TimesSegment,
  481. TimesSegmentName = rePlanTime.Name,
  482. StartTimes = couTime.StartTimes,
  483. EndTimes = couTime.EndTimes,
  484. ClassroomID = rePlanSch.ClassroomID,
  485. ClassroomName = rePlanRoom.Name,
  486. CourseDepartmentID = rePlanSet.DepartmentID,
  487. CourseCollegeID = reDep.CollegeID,
  488. RecordStatus = rePlanSch.RecordStatus,
  489. CreateTime = rePlanSch.CreateTime,
  490. CreateUserID = rePlanSch.CreateUserID,
  491. ModifyTime = rePlanSch.ModifyTime,
  492. ModifyUserID = rePlanSch.ModifyUserID
  493. };
  494. return query;
  495. }
  496. /// <summary>
  497. /// 查询重修计划任课老师信息
  498. /// </summary>
  499. /// <param name="exp"></param>
  500. /// <returns></returns>
  501. public IQueryable<RetakePlanTeacherListView> GetRetakePlanTeacherViewQueryable(Expression<Func<ER_RetakePlan, bool>> exp)
  502. {
  503. var query = from rePlan in RetakePlanRepository.GetList(exp)
  504. join reTea in RetakePlanTeacherRepository.Entities
  505. on rePlan.RetakePlanID equals reTea.RetakePlanID
  506. join staff in StaffRepository.Entities
  507. on reTea.UserID equals staff.UserID
  508. join us in UserRepository.Entities
  509. on staff.UserID equals us.UserID
  510. select new RetakePlanTeacherListView
  511. {
  512. RetakePlanTeacherID = reTea.RetakePlanTeacherID,
  513. RetakePlanID = rePlan.RetakePlanID,
  514. UserID = reTea.UserID.Value,
  515. LoginID = us.LoginID,
  516. Name = us.Name,
  517. Sex = staff.SexID,
  518. BirthDate = staff.BirthDate,
  519. TeacherType = staff.TeacherTypeID,
  520. IncumbencyState = staff.IncumbencyState,
  521. Title = staff.TitleID,
  522. TeachingMethod = reTea.TeachType,
  523. DepartmentID = staff.DepartmentID,
  524. DepartmentCode = staff.CF_Department.No,
  525. DepartmentName = staff.CF_Department.Name,
  526. CollegeID = staff.CollegeID,
  527. CollegeNo = staff.CF_College.No,
  528. CollegeName = staff.CF_College.Name
  529. };
  530. return query;
  531. }
  532. /// <summary>
  533. /// 查询重修计划授课方式信息
  534. /// </summary>
  535. /// <param name="exp"></param>
  536. /// <returns></returns>
  537. public IQueryable<Sys_DictionaryItem> GetTeachingModeType(Expression<Func<ER_RetakePlan, bool>> exp)
  538. {
  539. var query = from rePlan in RetakePlanRepository.GetList(exp)
  540. join reTeachingMode in RetakePlanTeachingModeTypeRepository.Entities
  541. on rePlan.RetakePlanID equals reTeachingMode.RetakePlanID
  542. join item in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
  543. on reTeachingMode.TeachingModeID equals item.Value
  544. into itemTemp
  545. from dicItem in itemTemp.DefaultIfEmpty()
  546. select dicItem;
  547. return query;
  548. }
  549. /// <summary>
  550. /// 查询重修计划授课地点信息
  551. /// </summary>
  552. /// <param name="exp"></param>
  553. /// <returns></returns>
  554. public IQueryable<Sys_DictionaryItem> GetTeachingPlace(Expression<Func<ER_RetakePlan, bool>> exp)
  555. {
  556. var query = from rePlan in RetakePlanRepository.GetList(exp)
  557. join reTeachingPlace in RetakePlanTeachingPlaceRepository.Entities
  558. on rePlan.RetakePlanID equals reTeachingPlace.RetakePlanID
  559. join item in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EMIS.ViewModel.EM_TeachingPlace).Name)
  560. on reTeachingPlace.TeachingPlace equals item.Value
  561. into itemTemp
  562. from dicItem in itemTemp.DefaultIfEmpty()
  563. select dicItem;
  564. return query;
  565. }
  566. /// <summary>
  567. /// 重修排课判断(教室时间)
  568. /// </summary>
  569. /// <param name="CoursesTimeID"></param>
  570. /// <param name="ClassroomID"></param>
  571. /// <param name="Weekday"></param>
  572. /// <param name="SchoolyearID"></param>
  573. /// <param name="StartWeeklyNum"></param>
  574. /// <param name="EndWeeklyNum"></param>
  575. /// <returns></returns>
  576. public IQueryable<RetakePlanSettingSchedulingView> GetRepeatRetakePlanSettingClassroom(Guid? CoursesTimeID, Guid? ClassroomID,
  577. int? Weekday, Guid? SchoolyearID, int? StartWeeklyNum, int? EndWeeklyNum)
  578. {
  579. var query = from a in RetakePlanSettingSchedulingRepository.GetList(x => x.CoursesTimeID == CoursesTimeID && x.ClassroomID == ClassroomID && x.Weekday == Weekday)
  580. join b in RetakePlanSettingRepository.GetList(x => x.ER_RetakePlan.SchoolyearID == SchoolyearID)
  581. on a.RetakePlanID equals b.RetakePlanID
  582. join c in coursesTimeRepository.Entities
  583. on a.CoursesTimeID equals c.CoursesTimeID
  584. join d in DictionaryItemRepository.Entities
  585. on
  586. new { c.TimesSegment, DictionaryCode = typeof(EMIS.ViewModel.CF_TimesSegment).Name }
  587. equals
  588. new { TimesSegment = d.Value.Value, d.DictionaryCode }
  589. into gbsta
  590. from gicbsta in gbsta.DefaultIfEmpty()
  591. join e in ClassroomRepository.GetList(x => x.IsConcurrentUse != true)
  592. on a.ClassroomID equals e.ClassroomID
  593. join f in DepartmentRepository.Entities
  594. on b.DepartmentID equals f.DepartmentID
  595. join s in RetakePlanTeachingSettingRepository.GetList(x =>
  596. (x.StartWeeklyNum >= StartWeeklyNum && StartWeeklyNum <= x.EndWeeklyNum) ||
  597. (x.StartWeeklyNum >= EndWeeklyNum && EndWeeklyNum <= x.EndWeeklyNum) ||
  598. (StartWeeklyNum <= x.StartWeeklyNum && x.StartWeeklyNum <= EndWeeklyNum) ||
  599. (StartWeeklyNum <= x.EndWeeklyNum && x.EndWeeklyNum <= EndWeeklyNum)
  600. )
  601. on b.RetakePlanID equals s.RetakePlanID
  602. select new RetakePlanSettingSchedulingView
  603. {
  604. DefaultClassName = b.ER_RetakePlan.ClassName,
  605. SchedulingID = a.RetakePlanSettingSchedulingID,
  606. ID = a.RetakePlanID,
  607. CourseCollegeID = f.CollegeID,
  608. ClassroomID = a.ClassroomID,
  609. ClassroomName = e.Name,
  610. CoursesTimeID = a.CoursesTimeID,
  611. TimesSegment = c.TimesSegment,
  612. TimesSegmentName = gicbsta.Name,
  613. StartTimes = c.StartTimes,
  614. EndTimes = c.EndTimes,
  615. Weekday = a.Weekday,
  616. RecordStatus = b.RecordStatus,
  617. CreateTime = b.CreateTime,
  618. CreateUserID = b.CreateUserID,
  619. ModifyTime = b.ModifyTime,
  620. ModifyUserID = b.ModifyUserID
  621. };
  622. return query;
  623. }
  624. /// <summary>
  625. /// 重修排课判断(教室时间、教师时间)
  626. /// </summary>
  627. /// <param name="UserIDList"></param>
  628. /// <param name="CoursesTimeID"></param>
  629. /// <param name="Weekday"></param>
  630. /// <param name="SchoolyearID"></param>
  631. /// <param name="StartWeeklyNum"></param>
  632. /// <param name="EndWeeklyNum"></param>
  633. /// <returns></returns>
  634. public IQueryable<RetakePlanSettingSchedulingView> GetRepeatRetakePlanTeacher(List<Guid> UserIDList, Guid? CoursesTimeID,
  635. int? Weekday, Guid? SchoolyearID, int? StartWeeklyNum, int? EndWeeklyNum)
  636. {
  637. var query = from a in RetakePlanSettingSchedulingRepository.GetList(x => x.CoursesTimeID == CoursesTimeID && x.Weekday == Weekday)
  638. join b in RetakePlanSettingRepository.GetList(x => x.ER_RetakePlan.SchoolyearID == SchoolyearID)
  639. on a.RetakePlanID equals b.RetakePlanID
  640. join c in coursesTimeRepository.Entities
  641. on a.CoursesTimeID equals c.CoursesTimeID
  642. join d in DictionaryItemRepository.Entities
  643. on
  644. new { c.TimesSegment, DictionaryCode = typeof(EMIS.ViewModel.CF_TimesSegment).Name }
  645. equals
  646. new { TimesSegment = d.Value.Value, d.DictionaryCode }
  647. into gbsta
  648. from gicbsta in gbsta.DefaultIfEmpty()
  649. join e in RetakePlanTeacherRepository.GetList(x => UserIDList.Contains(x.UserID.Value))
  650. on b.RetakePlanID equals e.RetakePlanID
  651. join f in ClassroomRepository.GetList(x => x.IsConcurrentUse != true)
  652. on a.ClassroomID equals f.ClassroomID
  653. join g in DepartmentRepository.Entities
  654. on b.DepartmentID equals g.DepartmentID
  655. join s in RetakePlanTeachingSettingRepository.GetList(x =>
  656. (x.StartWeeklyNum >= StartWeeklyNum && StartWeeklyNum <= x.EndWeeklyNum) ||
  657. (x.StartWeeklyNum >= EndWeeklyNum && EndWeeklyNum <= x.EndWeeklyNum) ||
  658. (StartWeeklyNum <= x.StartWeeklyNum && x.StartWeeklyNum <= EndWeeklyNum) ||
  659. (StartWeeklyNum <= x.EndWeeklyNum && x.EndWeeklyNum <= EndWeeklyNum)
  660. )
  661. on b.RetakePlanID equals s.RetakePlanID
  662. select new RetakePlanSettingSchedulingView
  663. {
  664. DefaultClassName = b.ER_RetakePlan.ClassName,
  665. SchedulingID = a.RetakePlanSettingSchedulingID,
  666. ID = a.RetakePlanID,
  667. CourseCollegeID = g.CollegeID,
  668. ClassroomID = a.ClassroomID,
  669. ClassroomName = f.Name,
  670. CoursesTimeID = a.CoursesTimeID,
  671. TimesSegment = c.TimesSegment,
  672. TimesSegmentName = gicbsta.Name,
  673. StartTimes = c.StartTimes,
  674. EndTimes = c.EndTimes,
  675. Weekday = a.Weekday,
  676. RecordStatus = b.RecordStatus,
  677. CreateTime = b.CreateTime,
  678. CreateUserID = b.CreateUserID,
  679. ModifyTime = b.ModifyTime,
  680. ModifyUserID = b.ModifyUserID
  681. };
  682. return query;
  683. }
  684. /// <summary>
  685. /// 教学任务排课判断(教室时间)
  686. /// </summary>
  687. /// <param name="CoursesTimeID"></param>
  688. /// <param name="ClassroomID"></param>
  689. /// <param name="Weekday"></param>
  690. /// <param name="SchoolyearID"></param>
  691. /// <param name="StartWeeklyNum"></param>
  692. /// <param name="EndWeeklyNum"></param>
  693. /// <returns></returns>
  694. public IQueryable<RetakePlanSettingSchedulingView> GetRepeatEducationMissionClassroom(Guid? CoursesTimeID, Guid? ClassroomID,
  695. int? Weekday, Guid? SchoolyearID, int? StartWeeklyNum, int? EndWeeklyNum)
  696. {
  697. var query = from a in EducationSchedulingRepository.GetList(x => x.CoursesTimeID == CoursesTimeID && x.ClassroomID == ClassroomID && x.Weekday == Weekday && x.CF_Classroom.IsConcurrentUse != true && x.SchoolyearID == SchoolyearID)
  698. join b in coursesTimeRepository.Entities on a.CoursesTimeID equals b.CoursesTimeID
  699. join s in EducationSchedulingWeekNumRepository.GetList(x =>
  700. (x.WeekNum >= StartWeeklyNum && x.WeekNum <= EndWeeklyNum)
  701. ) on a.EducationSchedulingID equals s.EducationSchedulingID
  702. join e in EducationSchedulingClassRepository.Entities on a.EducationSchedulingClassID equals e.EducationSchedulingClassID
  703. join f in EducationMissionClassRepository.Entities on e.EducationMissionClassID equals f.EducationMissionClassID
  704. select new RetakePlanSettingSchedulingView
  705. {
  706. DefaultClassName = f.Name,
  707. };
  708. return query;
  709. }
  710. /// <summary>
  711. /// 教学任务排课判断(教室时间、教师时间)
  712. /// </summary>
  713. /// <param name="UserIDList"></param>
  714. /// <param name="CoursesTimeID"></param>
  715. /// <param name="Weekday"></param>
  716. /// <param name="SchoolyearID"></param>
  717. /// <param name="StartWeeklyNum"></param>
  718. /// <param name="EndWeeklyNum"></param>
  719. /// <returns></returns>
  720. public IQueryable<RetakePlanSettingSchedulingView> GetRepeatEducationMissionTeacher(List<Guid> UserIDList, Guid? CoursesTimeID,
  721. int? Weekday, Guid? SchoolyearID, int? StartWeeklyNum, int? EndWeeklyNum)
  722. {
  723. var query = from a in EducationSchedulingRepository.GetList(x => x.CoursesTimeID == CoursesTimeID && x.Weekday == Weekday && x.SchoolyearID == SchoolyearID)
  724. join b in EducationSchedulingTeacherRepository.GetList(x => UserIDList.Contains(x.UserID.Value)) on a.EducationSchedulingID equals b.EducationSchedulingID
  725. join s in EducationSchedulingWeekNumRepository.GetList(x =>
  726. (x.WeekNum >= StartWeeklyNum && x.WeekNum <= EndWeeklyNum)
  727. ) on a.EducationSchedulingID equals s.EducationSchedulingID
  728. join e in EducationSchedulingClassRepository.Entities on a.EducationSchedulingClassID equals e.EducationSchedulingClassID
  729. join f in EducationMissionClassRepository.Entities on e.EducationMissionClassID equals f.EducationMissionClassID
  730. select new RetakePlanSettingSchedulingView
  731. {
  732. DefaultClassName = f.Name,
  733. };
  734. return query;
  735. }
  736. }
  737. }