GraduateCardApplyDAL.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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.DataLogic.Repositories;
  8. using EMIS.ViewModel;
  9. using EMIS.ViewModel.GraduationManage.GraduateCardManage;
  10. using EMIS.ViewModel.ScoreManage;
  11. namespace EMIS.DataLogic.GraduationManage.GraduateCardManage
  12. {
  13. public class GraduateCardApplyDAL
  14. {
  15. public GraduateCardApplyRepository GraduateCardApplyRepository { get; set; }
  16. public GraduateCardApplyAttachmentRepository GraduateCardApplyAttachmentRepository { get; set; }
  17. public SchoolyearRepository SchoolyearRepository { get; set; }
  18. public StudentRepository StudentRepository { get; set; }
  19. public ClassmajorRepository ClassmajorRepository { get; set; }
  20. public GrademajorRepository GrademajorRepository { get; set; }
  21. public FacultymajorRepository FacultymajorRepository { get; set; }
  22. public EducationTypeSettingRepository EducationTypeSettingRepository { get; set; }
  23. public DepartmentRepository DepartmentRepository { get; set; }
  24. public CollegeRepository CollegeRepository { get; set; }
  25. public CampusRepository CampusRepository { get; set; }
  26. public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
  27. public ExecutablePlanProfileRepository ExecutablePlanProfileRepository { get; set; }
  28. public ExecutablePlanTeachingSettingRepository ExecutablePlanTeachingSettingRepository { get; set; }
  29. public CoursematerialRepository CoursematerialRepository { get; set; }
  30. public CourseTypeSelectCourseTypeRepository CourseTypeSelectCourseTypeRepository { get; set; }
  31. public FinallyScoreRepository FinallyScoreRepository { get; set; }
  32. public UserRepository UserRepository { get; set; }
  33. /// <summary>
  34. /// 查询对应的去向申请信息View(根据对应的去向申请信息)
  35. /// </summary>
  36. /// <param name="exp"></param>
  37. /// <returns></returns>
  38. public IQueryable<GraduateCardApplyView> GetGraduateCardApplyViewQueryable(Expression<Func<ER_GraduateCardApply, bool>> exp)
  39. {
  40. var query = from gc in GraduateCardApplyRepository.GetList(exp)
  41. join gcsy in SchoolyearRepository.Entities
  42. on gc.GraduatingSemesterID equals gcsy.SchoolyearID
  43. join stu in StudentRepository.Entities
  44. on gc.UserID equals stu.UserID
  45. join cl in ClassmajorRepository.Entities
  46. on stu.ClassmajorID equals cl.ClassmajorID
  47. join gr in GrademajorRepository.Entities
  48. on cl.GrademajorID equals gr.GrademajorID
  49. join fa in FacultymajorRepository.Entities
  50. on gr.FacultymajorID equals fa.FacultymajorID
  51. join ets in EducationTypeSettingRepository.Entities
  52. on fa.EducationID equals ets.EducationID
  53. join col in CollegeRepository.Entities
  54. on fa.CollegeID equals col.CollegeID
  55. join cam in CampusRepository.Entities
  56. on col.CampusID equals cam.CampusID
  57. join us in UserRepository.Entities
  58. on stu.UserID equals us.UserID
  59. join assistant in UserRepository.Entities
  60. on cl.UserID equals assistant.UserID into tempassistant
  61. from usassistant in tempassistant.DefaultIfEmpty()
  62. join sye in SchoolyearRepository.Entities
  63. on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
  64. equals new { SchoolyearID = sye.Years, SchoolcodeID = sye.SchoolcodeID } into tempsyenter
  65. from syenter in tempsyenter.DefaultIfEmpty()
  66. select new GraduateCardApplyView
  67. {
  68. GraduateCardApplyID = gc.GraduateCardApplyID,
  69. UserID = gc.UserID,
  70. StudentNo = us.LoginID,
  71. UserName = us.Name,
  72. ExamineeNum = stu.CF_Recruitstudents.ExamineeNum,
  73. IDNumber = stu.IDNumber,
  74. SexID = stu.SexID,
  75. BirthDate = stu.BirthDate,
  76. NationID = stu.NationID,
  77. PoliticsID = stu.PoliticsID,
  78. EntranceDate = stu.CF_Recruitstudents.EntranceDate,
  79. ZIPCode = stu.CF_StudentContact.ZIPCode,
  80. Telephone = stu.CF_StudentContact.Telephone,
  81. Mobile = stu.CF_StudentContact.Mobile,
  82. Address = stu.CF_StudentContact.Address,
  83. InSchoolStatusID = stu.InSchoolStatusID,
  84. StudentStatusID = stu.StudentStatus,
  85. ClassID = stu.ClassmajorID,
  86. ClassNo = cl.No,
  87. ClassName = cl.Name,
  88. GrademajorID = cl.GrademajorID,
  89. GrademajorCode = gr.Code,
  90. GrademajorName = gr.Name,
  91. FacultymajorID = fa.FacultymajorID,
  92. FacultymajorNo = fa.Code,
  93. FacultymajorName = fa.Name,
  94. CollegeID = fa.CollegeID,
  95. CollegeNo = col.No,
  96. CollegeName = col.Name,
  97. CampusID = col.CampusID,
  98. CampusNo = cam.No,
  99. CampusName = cam.Name,
  100. SchoolyearID = gr.GradeID,
  101. EnteringSchoolYearID = syenter.SchoolyearID,
  102. EnteringSchoolYearCode = syenter.Code,
  103. StandardID = fa.StandardID,
  104. EducationID = fa.EducationID,
  105. EducationTypeID = ets.EducationTypeID,
  106. LearningformID = fa.LearningformID,
  107. LearnSystem = fa.LearnSystem,
  108. GraduationTypeID = gc.GraduationTypeID,
  109. GraduatingSemesterID = gc.GraduatingSemesterID,
  110. GraduatingSemesterCode = gcsy.Code,
  111. GraduatingSemesterValue = gcsy.Value,
  112. GraduationYear = gcsy.Years,
  113. NeedCardResult = gc.NeedCardResult,
  114. ApprovalStatus = gc.ApprovalStatus,
  115. RecordStatus = gc.RecordStatus,
  116. Remark = gc.Remark,
  117. CreateUserID = gc.CreateUserID,
  118. CreateTime = gc.CreateTime,
  119. ModifyUserID = gc.ModifyUserID,
  120. ModifyTime = gc.ModifyTime
  121. };
  122. return query;
  123. }
  124. /// <summary>
  125. /// 查询对应的去向申请信息View(根据对应的去向申请信息、学生信息,统计对应的最终成绩)
  126. /// </summary>
  127. /// <param name="expGraduateCardApply"></param>
  128. /// <param name="expStudent"></param>
  129. /// <returns></returns>
  130. public IQueryable<GraduateCardApplyView> GetGraduateCardApplyViewQueryable(Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply,
  131. Expression<Func<CF_Student, bool>> expStudent)
  132. {
  133. var query = from gc in GraduateCardApplyRepository.GetList(expGraduateCardApply)
  134. join gcsy in SchoolyearRepository.Entities
  135. on gc.GraduatingSemesterID equals gcsy.SchoolyearID
  136. join stu in StudentRepository.GetList(expStudent)
  137. on gc.UserID equals stu.UserID
  138. join cl in ClassmajorRepository.Entities
  139. on stu.ClassmajorID equals cl.ClassmajorID
  140. join gr in GrademajorRepository.Entities
  141. on cl.GrademajorID equals gr.GrademajorID
  142. join fa in FacultymajorRepository.Entities
  143. on gr.FacultymajorID equals fa.FacultymajorID
  144. join ets in EducationTypeSettingRepository.Entities
  145. on fa.EducationID equals ets.EducationID
  146. join col in CollegeRepository.Entities
  147. on fa.CollegeID equals col.CollegeID
  148. join cam in CampusRepository.Entities
  149. on col.CampusID equals cam.CampusID
  150. join us in UserRepository.Entities
  151. on stu.UserID equals us.UserID
  152. join assistant in UserRepository.Entities
  153. on cl.UserID equals assistant.UserID into tempassistant
  154. from usassistant in tempassistant.DefaultIfEmpty()
  155. join sye in SchoolyearRepository.Entities
  156. on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
  157. equals new { SchoolyearID = sye.Years, SchoolcodeID = sye.SchoolcodeID } into tempsyenter
  158. from syenter in tempsyenter.DefaultIfEmpty()
  159. join fsgr in
  160. (
  161. //学生最终成绩(已修门数)
  162. from fs in FinallyScoreRepository.Entities
  163. group fs by fs.UserID into g
  164. select new
  165. {
  166. UserID = g.Key,
  167. FinallyScoreCount = g.Count()
  168. }
  169. )
  170. on stu.UserID equals fsgr.UserID into tempfsgr
  171. from gcfsgr in tempfsgr.DefaultIfEmpty()
  172. select new GraduateCardApplyView
  173. {
  174. GraduateCardApplyID = gc.GraduateCardApplyID,
  175. UserID = gc.UserID,
  176. StudentNo = us.LoginID,
  177. UserName = us.Name,
  178. ExamineeNum = stu.CF_Recruitstudents.ExamineeNum,
  179. IDNumber = stu.IDNumber,
  180. SexID = stu.SexID,
  181. BirthDate = stu.BirthDate,
  182. NationID = stu.NationID,
  183. PoliticsID = stu.PoliticsID,
  184. EntranceDate = stu.CF_Recruitstudents.EntranceDate,
  185. ZIPCode = stu.CF_StudentContact.ZIPCode,
  186. Telephone = stu.CF_StudentContact.Telephone,
  187. Mobile = stu.CF_StudentContact.Mobile,
  188. Address = stu.CF_StudentContact.Address,
  189. InSchoolStatusID = stu.InSchoolStatusID,
  190. StudentStatusID = stu.StudentStatus,
  191. ClassID = stu.ClassmajorID,
  192. ClassNo = cl.No,
  193. ClassName = cl.Name,
  194. GrademajorID = cl.GrademajorID,
  195. GrademajorCode = gr.Code,
  196. GrademajorName = gr.Name,
  197. FacultymajorID = fa.FacultymajorID,
  198. FacultymajorNo = fa.Code,
  199. FacultymajorName = fa.Name,
  200. CollegeID = fa.CollegeID,
  201. CollegeNo = col.No,
  202. CollegeName = col.Name,
  203. CampusID = col.CampusID,
  204. CampusNo = cam.No,
  205. CampusName = cam.Name,
  206. SchoolyearID = gr.GradeID,
  207. EnteringSchoolYearID = syenter.SchoolyearID,
  208. EnteringSchoolYearCode = syenter.Code,
  209. StandardID = fa.StandardID,
  210. EducationID = fa.EducationID,
  211. EducationTypeID = ets.EducationTypeID,
  212. LearningformID = fa.LearningformID,
  213. LearnSystem = fa.LearnSystem,
  214. GraduationTypeID = gc.GraduationTypeID,
  215. GraduatingSemesterID = gc.GraduatingSemesterID,
  216. GraduatingSemesterCode = gcsy.Code,
  217. GraduatingSemesterValue = gcsy.Value,
  218. GraduationYear = gcsy.Years,
  219. FinallyScoreCount = gcfsgr.FinallyScoreCount == null ? 0 : gcfsgr.FinallyScoreCount,
  220. NeedCardResult = gc.NeedCardResult,
  221. ApprovalStatus = gc.ApprovalStatus,
  222. RecordStatus = gc.RecordStatus,
  223. Remark = gc.Remark,
  224. CreateUserID = gc.CreateUserID,
  225. CreateTime = gc.CreateTime,
  226. ModifyUserID = gc.ModifyUserID,
  227. ModifyTime = gc.ModifyTime
  228. };
  229. return query;
  230. }
  231. /// <summary>
  232. /// 查询对应的毕业学生信息View(根据相应的学生信息、学年学期信息、去向申请信息、毕业学期ID)
  233. /// 注:需排除相应的去向申请信息(待审核、已通过)
  234. /// 注:计算对应的毕业年限(通过当前设置的毕业学期Value与学生年级专业对应的毕业学期Value进行计算)
  235. /// </summary>
  236. /// <param name="expStudent"></param>
  237. /// <param name="expSchoolyear"></param>
  238. /// <param name="expGraduateCardApply"></param>
  239. /// <param name="graduatingSemesterID"></param>
  240. /// <returns></returns>
  241. public IQueryable<GraduateCardApplyView> GetGraduationStudentViewQueryable(Expression<Func<CF_Student, bool>> expStudent,
  242. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear, Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply,
  243. Guid? graduatingSemesterID)
  244. {
  245. var query = from stu in StudentRepository.GetList(expStudent)
  246. join us in UserRepository.Entities
  247. on stu.UserID equals us.UserID
  248. join cl in ClassmajorRepository.Entities
  249. on stu.ClassmajorID equals cl.ClassmajorID
  250. join gr in GrademajorRepository.Entities
  251. on cl.GrademajorID equals gr.GrademajorID
  252. join grsy in SchoolyearRepository.GetList(expSchoolyear)
  253. on gr.GraduateSchoolyearID equals grsy.SchoolyearID
  254. join fa in FacultymajorRepository.Entities
  255. on gr.FacultymajorID equals fa.FacultymajorID
  256. join ets in EducationTypeSettingRepository.Entities
  257. on fa.EducationID equals ets.EducationID
  258. join col in CollegeRepository.Entities
  259. on fa.CollegeID equals col.CollegeID
  260. join cam in CampusRepository.Entities
  261. on col.CampusID equals cam.CampusID
  262. join assistant in UserRepository.Entities
  263. on cl.UserID equals assistant.UserID into tempassistant
  264. from usassistant in tempassistant.DefaultIfEmpty()
  265. join stsy in SchoolyearRepository.Entities
  266. on graduatingSemesterID equals stsy.SchoolyearID into tempstsy
  267. from grstsy in tempstsy.DefaultIfEmpty()
  268. join gc in GraduateCardApplyRepository.GetList(expGraduateCardApply)
  269. on stu.UserID equals gc.UserID into tempga
  270. from stugc in tempga.DefaultIfEmpty()
  271. where stugc.GraduateCardApplyID == null
  272. select new GraduateCardApplyView
  273. {
  274. UserID = stu.UserID,
  275. StudentNo = us.LoginID,
  276. UserName = us.Name,
  277. SexID = stu.SexID,
  278. InSchoolStatusID = stu.InSchoolStatusID,
  279. StudentStatusID = stu.StudentStatus,
  280. ClassID = stu.ClassmajorID,
  281. ClassNo = cl.No,
  282. ClassName = cl.Name,
  283. GrademajorID = cl.GrademajorID,
  284. GrademajorCode = gr.Code,
  285. GrademajorName = gr.Name,
  286. FacultymajorID = gr.FacultymajorID,
  287. FacultymajorNo = fa.Code,
  288. FacultymajorName = fa.Name,
  289. CollegeID = fa.CollegeID,
  290. CollegeNo = col.No,
  291. CollegeName = col.Name,
  292. CampusID = col.CampusID,
  293. CampusNo = cam.No,
  294. CampusName = cam.Name,
  295. SchoolyearID = gr.GradeID,
  296. StandardID = fa.StandardID,
  297. EducationID = fa.EducationID,
  298. EducationTypeID = ets.EducationTypeID,
  299. LearningformID = fa.LearningformID,
  300. LearnSystem = fa.LearnSystem,
  301. GraduatingSemesterID = gr.GraduateSchoolyearID,
  302. GraduatingSemesterCode = grsy.Code,
  303. GraduatingSemesterValue = grsy.Value,
  304. GraduationYear = grsy.Years,
  305. GraduationAgeLimitValue = grstsy.Value == null ? 0 : Math.Round(((decimal)(grstsy.Value - grsy.Value) / 2), 1)
  306. };
  307. return query;
  308. }
  309. /// <summary>
  310. /// 查询对应的未新增毕业学生信息View(根据相应的学生信息、学年学期信息、去向申请信息、毕业学期ID)
  311. /// 注:需排除相应的去向申请信息(待审核、已通过)
  312. /// 注:需排除相应的去向申请信息(业务主键)
  313. /// 注:计算对应的毕业年限(通过当前设置的毕业学期Value与学生年级专业对应的毕业学期Value进行计算)
  314. /// </summary>
  315. /// <param name="expStudent"></param>
  316. /// <param name="expSchoolyear"></param>
  317. /// <param name="expGraduateCardApply"></param>
  318. /// <param name="graduatingSemesterID"></param>
  319. /// <returns></returns>
  320. public IQueryable<GraduateCardApplyView> GetGraduationStudentNoAddViewQueryable(Expression<Func<CF_Student, bool>> expStudent,
  321. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear, Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply,
  322. Guid? graduatingSemesterID)
  323. {
  324. var query = from stu in this.GetGraduationStudentViewQueryable(expStudent, expSchoolyear, expGraduateCardApply, graduatingSemesterID)
  325. join gc in GraduateCardApplyRepository.Entities
  326. on new { UserID = stu.UserID, GraduatingSemesterID = graduatingSemesterID }
  327. equals new { UserID = gc.UserID, GraduatingSemesterID = gc.GraduatingSemesterID } into tempgc
  328. from stugc in tempgc.DefaultIfEmpty()
  329. where stugc.GraduateCardApplyID == null
  330. select stu;
  331. return query;
  332. }
  333. /// <summary>
  334. /// 查询去向申请对应的最终成绩信息(根据动向申请信息并且匹配执行计划)
  335. /// 注:以学生最终成绩为准匹配对应的执行计划(左连)
  336. /// 注:由于存在在不同的学年学期参加补考的情况,匹配学生最终成绩时,采用开学学期ID匹配
  337. /// 注:匹配暂时不考虑总学时TotalHours
  338. /// </summary>
  339. /// <param name="exp"></param>
  340. /// <returns></returns>
  341. public IQueryable<FinallyScoreView> GetFinallyScoreViewQueryable(Expression<Func<ER_GraduateCardApply, bool>> exp)
  342. {
  343. var query = from gc in GraduateCardApplyRepository.GetList(exp)
  344. join stu in StudentRepository.Entities
  345. on gc.UserID equals stu.UserID
  346. join cl in ClassmajorRepository.Entities
  347. on stu.ClassmajorID equals cl.ClassmajorID
  348. join gr in GrademajorRepository.Entities
  349. on cl.GrademajorID equals gr.GrademajorID
  350. join fa in FacultymajorRepository.Entities
  351. on gr.FacultymajorID equals fa.FacultymajorID
  352. join col in CollegeRepository.Entities
  353. on fa.CollegeID equals col.CollegeID
  354. join fs in FinallyScoreRepository.Entities
  355. on stu.UserID equals fs.UserID
  356. join sy in SchoolyearRepository.Entities
  357. on fs.SchoolyearID equals sy.SchoolyearID
  358. join cou in CoursematerialRepository.Entities
  359. on fs.CoursematerialID equals cou.CoursematerialID
  360. join us in UserRepository.Entities
  361. on stu.UserID equals us.UserID
  362. join cd in DepartmentRepository.Entities
  363. on fs.DepartmentID equals cd.DepartmentID into tempcd
  364. from coudep in tempcd.DefaultIfEmpty()
  365. join ue in UserRepository.Entities
  366. on fs.CreatorUserID equals ue.UserID into tempue
  367. from usentry in tempue.DefaultIfEmpty()
  368. join ct in CourseTypeSelectCourseTypeRepository.Entities
  369. on fs.CourseTypeID equals ct.CourseTypeID into tempct
  370. from fsct in tempct.DefaultIfEmpty()
  371. join ep in
  372. (
  373. from gc in GraduateCardApplyRepository.GetList(exp)
  374. join stu in StudentRepository.Entities
  375. on gc.UserID equals stu.UserID
  376. join cl in ClassmajorRepository.Entities
  377. on stu.ClassmajorID equals cl.ClassmajorID
  378. join gr in GrademajorRepository.Entities
  379. on cl.GrademajorID equals gr.GrademajorID
  380. join ep in ExecutablePlanRepository.Entities
  381. on gr.GrademajorID equals ep.GrademajorID
  382. join epsy in SchoolyearRepository.Entities
  383. on ep.SchoolyearID equals epsy.SchoolyearID
  384. join pf in ExecutablePlanProfileRepository.Entities
  385. on ep.ExecutablePlanID equals pf.ExecutablePlanID into temppf
  386. from eppro in temppf.DefaultIfEmpty()
  387. join st in ExecutablePlanTeachingSettingRepository.Entities
  388. on ep.ExecutablePlanID equals st.ExecutablePlanID into tempst
  389. from epst in tempst.DefaultIfEmpty()
  390. select new
  391. {
  392. ExecutablePlanID = ep.ExecutablePlanID,
  393. SpecialtyPlanID = ep.SpecialtyPlanID,
  394. GrademajorID = ep.GrademajorID,
  395. UserID = gc.UserID,
  396. DepartmentID = ep.DepartmentID,
  397. CoursematerialID = ep.CoursematerialID,
  398. CourseTypeID = ep.CourseTypeID,
  399. Credit = epst.Credit,
  400. TheoryCourse = epst.TheoryCourse,
  401. Practicehours = epst.Practicehours,
  402. Trialhours = epst.Trialhours,
  403. Totalhours = (epst.TheoryCourse ?? 0) + (epst.Practicehours ?? 0),
  404. SchoolyearID = ep.SchoolyearID,
  405. SchoolyearCode = epsy.Code,
  406. SchoolyearNumID = (epsy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
  407. SchoolcodeID = epsy.SchoolcodeID,
  408. StarttermID = (epsy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1),
  409. IsSpecialtycore = eppro.IsSpecialtycore == null ? false : eppro.IsSpecialtycore.Value,
  410. IsCooperation = eppro.IsCooperation == null ? false : eppro.IsCooperation.Value,
  411. IsRequired = eppro.IsRequired == null ? false : eppro.IsRequired.Value,
  412. IsElective = eppro.IsElective == null ? false : eppro.IsElective.Value,
  413. IsNetworkCourse = eppro.IsNetworkCourse == null ? false : eppro.IsNetworkCourse.Value,
  414. IsMainCourse = eppro.IsMainCourse == null ? false : eppro.IsMainCourse.Value,
  415. ResultTypeID = ep.ResultTypeID,
  416. RecordStatus = ep.RecordStatus
  417. }
  418. )
  419. on
  420. new { UserID = gc.UserID, StarttermID = fs.StarttermID, CoursematerialID = fs.CoursematerialID, CourseTypeID = fs.CourseTypeID, Credit = fs.Credit }
  421. equals
  422. new { UserID = ep.UserID, StarttermID = ep.StarttermID, CoursematerialID = ep.CoursematerialID, CourseTypeID = ep.CourseTypeID, Credit = ep.Credit }
  423. into tempep
  424. from fsep in tempep.DefaultIfEmpty()
  425. select new FinallyScoreView
  426. {
  427. FinallyScoreID = fs.FinallyScoreID,
  428. SchoolyearID = fs.SchoolyearID,
  429. SchoolyearCode = sy.Code,
  430. UserID = fs.UserID,
  431. LoginID = us.LoginID,
  432. UserName = us.Name,
  433. ClassmajorID = stu.ClassmajorID,
  434. ClassmajorNo = cl.No,
  435. ClassmajorName = cl.Name,
  436. CollegeID = fa.CollegeID,
  437. CollegeNo = col.No,
  438. CollegeName = col.Name,
  439. SchoolyearNumID = fs.SchoolyearNumID,
  440. StarttermID = fs.StarttermID,
  441. ClassName = fs.ClassName,
  442. CoursematerialID = fs.CoursematerialID,
  443. CourseCode = cou.CourseCode,
  444. CourseName = cou.CourseName,
  445. DepartmentID = fs.DepartmentID,
  446. DepartmentNo = coudep.No,
  447. DepartmentName = coudep.Name,
  448. CourseTypeID = fs.CourseTypeID,
  449. IsMainCourse = fsep.IsMainCourse == null ? false : fsep.IsMainCourse,
  450. CourseSelectTypeID = (fsct.IsFreeSelectionCourse ?? false) ? (int)EMIS.ViewModel.CF_CourseSelectType.FreeSelectionCourse
  451. : ((fsct.IsOptionalCourse ?? false) ? (int)EMIS.ViewModel.CF_CourseSelectType.OptionalCourse
  452. : (int)EMIS.ViewModel.CF_CourseSelectType.Required),
  453. CourseTypeColour = fsct.CourseTypeColour == null ? "white" : fsct.CourseTypeColour,
  454. Credit = fs.Credit ?? 0,
  455. TotalHours = fs.TotalHours ?? 0,
  456. IsExecutablePlan = fsep.ExecutablePlanID == null ? false : true,
  457. ExecutablePlanStatus = fsep.RecordStatus,
  458. ExaminationType = fs.ExaminationType,
  459. ExaminationModeID = fs.ExaminationModeID,
  460. HandleModeID = fs.HandleModeID,
  461. ExamsDatetime = fs.ExamsDatetime,
  462. CreatorUserID = fs.CreatorUserID,
  463. CreatorUserNo = usentry.LoginID,
  464. CreatorUserName = usentry.Name,
  465. EntryDeadlineTime = fs.EntryDeadlineTime,
  466. ResultTypeID = fs.ResultTypeID,
  467. ExamsCategoryID = fs.ExamsCategoryID,
  468. ExamsStateID = fs.ExamsStateID,
  469. TotalScore = fs.TotalScore,
  470. ScoreCredit = fs.ScoreCredit ?? 0,
  471. GradePoint = fs.GradePoint ?? 0,
  472. Remarks = fs.Remark,
  473. RecordStatus = fs.RecordStatus,
  474. CreateUserID = fs.CreateUserID,
  475. CreateTime = fs.CreateTime,
  476. ModifyUserID = fs.ModifyUserID,
  477. ModifyTime = fs.ModifyTime
  478. };
  479. return query;
  480. }
  481. /// <summary>
  482. /// 查询对应的附件文件明细信息FileUploadView(根据去向申请信息)
  483. /// </summary>
  484. /// <param name="exp"></param>
  485. /// <returns></returns>
  486. public IQueryable<FileUploadView> GetGraduateCardApplyAttachmentQueryable(Expression<Func<ER_GraduateCardApply, bool>> exp)
  487. {
  488. var tableName = typeof(ER_GraduateCardApplyAttachment).Name;
  489. var query = from gc in GraduateCardApplyRepository.GetList(exp)
  490. from gcat in GraduateCardApplyAttachmentRepository.Entities
  491. .Where(x => x.GraduateCardApplyID == gc.GraduateCardApplyID)
  492. select new FileUploadView
  493. {
  494. FileID = gcat.GraduateCardApplyAttachmentID,
  495. FormID = gc.GraduateCardApplyID,
  496. FileName = gcat.Name,
  497. FileUrl = gcat.Url,
  498. TableName = tableName,
  499. RecordStatus = gcat.RecordStatus,
  500. CreateUserID = gcat.CreateUserID,
  501. CreateTime = gcat.CreateTime,
  502. ModifyUserID = gcat.ModifyUserID,
  503. ModifyTime = gcat.ModifyTime
  504. };
  505. return query;
  506. }
  507. }
  508. }