SpecialtyPlanDAL.cs 85 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366
  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;
  8. using EMIS.ViewModel.CultureplanManage;
  9. using EMIS.ViewModel.CultureplanManage.PlanManagement;
  10. using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
  11. using EMIS.ViewModel.Students;
  12. using EMIS.DataLogic.Repositories;
  13. using EMIS.DataLogic.UniversityManage.SpecialtyClassManage;
  14. namespace EMIS.DataLogic.CultureplanManage.PlanManagement
  15. {
  16. public class SpecialtyPlanDAL
  17. {
  18. public SpecialtyPlanRepository SpecialtyPlanRepository { get; set; }
  19. public SpecialtyPlanTeachingSettingRepository SpecialtyPlanTeachingSettingRepository { get; set; }
  20. public SpecialtyPlanTeachingModeTypeRepository SpecialtyPlanTeachingModeTypeRepository { get; set; }
  21. public SpecialtyPlanTeachingPlaceRepository SpecialtyPlanTeachingPlaceRepository { get; set; }
  22. public SchoolyearRepository SchoolyearRepository { get; set; }
  23. public CoursematerialRepository CoursematerialRepository { get; set; }
  24. public DepartmentRepository DepartmentRepository { get; set; }
  25. public GrademajorRepository GrademajorRepository { get; set; }
  26. public ClassmajorRepository ClassmajorRepository { get; set; }
  27. public StudentRepository StudentRepository { get; set; }
  28. public UserRepository UserRepository { get; set; }
  29. public FacultymajorRepository FacultymajorRepository { get; set; }
  30. public CollegeRepository CollegeRepository { get; set; }
  31. public CampusRepository CampusRepository { get; set; }
  32. public SpecialtyRepository SpecialtyRepository { get; set; }
  33. public SpecialtyCourseRepository SpecialtyCourseRepository { get; set; }
  34. public SpecialtyCourseTeachingSettingRepository SpecialtyCourseTeachingSettingRepository { get; set; }
  35. public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
  36. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  37. /// <summary>
  38. /// 查询专业计划信息SpecialtyPlanView
  39. /// 注:普教版本(年级专业)
  40. /// </summary>
  41. /// <param name="exp"></param>
  42. /// <returns></returns>
  43. public IQueryable<SpecialtyPlanView> GetSpecialtyPlanViewQueryable(Expression<Func<EM_SpecialtyPlan, bool>> exp)
  44. {
  45. var query = from sp in SpecialtyPlanRepository.GetList(exp)
  46. join spst in SpecialtyPlanTeachingSettingRepository.Entities
  47. on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
  48. from spspst in tempspst.DefaultIfEmpty()
  49. join sy in SchoolyearRepository.Entities
  50. on sp.SchoolyearID equals sy.SchoolyearID
  51. join cou in CoursematerialRepository.Entities
  52. on sp.CoursematerialID equals cou.CoursematerialID
  53. join dep in DepartmentRepository.Entities
  54. on sp.DepartmentID equals dep.DepartmentID into tempdep
  55. from spdep in tempdep.DefaultIfEmpty()
  56. join gr in GrademajorRepository.Entities
  57. on sp.GrademajorID equals gr.GrademajorID
  58. join stsy in SchoolyearRepository.Entities
  59. on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
  60. equals new { SchoolyearID = stsy.Years, SchoolcodeID = stsy.SchoolcodeID } into tempstsy
  61. from startsy in tempstsy.DefaultIfEmpty()
  62. join grsy in SchoolyearRepository.Entities
  63. on gr.GraduateSchoolyearID equals grsy.SchoolyearID into tempgrsy
  64. from gradsy in tempgrsy.DefaultIfEmpty()
  65. join fa in FacultymajorRepository.Entities
  66. on gr.FacultymajorID equals fa.FacultymajorID
  67. join spe in SpecialtyRepository.Entities
  68. on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  69. equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  70. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  71. on fa.StandardID equals dicst.Value into tempst
  72. from fast in tempst.DefaultIfEmpty()
  73. join col in CollegeRepository.Entities
  74. on fa.CollegeID equals col.CollegeID
  75. join cam in CampusRepository.Entities
  76. on col.CampusID equals cam.CampusID
  77. select new SpecialtyPlanView
  78. {
  79. SpecialtyPlanID = sp.SpecialtyPlanID,
  80. PlanApplicationID = sp.PlanApplicationID,
  81. SchoolyearID = sp.SchoolyearID,
  82. SchoolyearCode = sy.Code,
  83. YearID = sy.Years,
  84. Value = sy.Value,
  85. SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
  86. SchoolcodeID = sy.SchoolcodeID,
  87. StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
  88. GrademajorID = sp.GrademajorID,
  89. GrademajorCode = gr.Code,
  90. GrademajorName = gr.Name,
  91. GradeID = gr.GradeID,
  92. FacultymajorID = gr.FacultymajorID,
  93. FacultymajorCode = fa.Code,
  94. FacultymajorName = fa.Name,
  95. CollegeID = fa.CollegeID,
  96. CollegeCode = col.No,
  97. CollegeName = col.Name,
  98. CampusID = col.CampusID,
  99. CampusNo = cam.No,
  100. CampusName = cam.Name,
  101. StartSchoolyearID = startsy.SchoolyearID,
  102. StartSchoolyearCode = startsy.Code,
  103. StartValue = startsy.Value,
  104. StartSchoolcodeID = gr.SemesterID,
  105. GraduatingSemesterID = gr.GraduateSchoolyearID,
  106. GraduatingSemesterCode = gradsy.Code,
  107. GraduatingSemesterValue = gradsy.Value,
  108. SpecialtyID = spe.SpecialtyID,
  109. StandardID = fa.StandardID,
  110. StandardName = fast.Name,
  111. EducationID = fa.EducationID,
  112. LearningformID = fa.LearningformID,
  113. LearnSystem = fa.LearnSystem,
  114. CoursematerialID = sp.CoursematerialID,
  115. CourseCode = cou.CourseCode,
  116. CourseName = cou.CourseName,
  117. CourseStructureID = sp.CourseStructureID,
  118. CourseCategoryID = sp.CourseCategoryID,
  119. CourseTypeID = sp.CourseTypeID,
  120. CourseQualityID = sp.CourseQualityID,
  121. Credit = spspst.Credit ?? 0,
  122. TheoryCourse = spspst.TheoryCourse ?? 0,
  123. Practicehours = spspst.Practicehours ?? 0,
  124. Trialhours = spspst.Trialhours ?? 0,
  125. Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
  126. TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
  127. PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
  128. TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
  129. SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
  130. WeeklyHours = spspst.WeeklyHours ?? 0,
  131. WeeklyNum = spspst.WeeklyNum ?? 0,
  132. StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
  133. EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
  134. StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
  135. DepartmentID = sp.DepartmentID,
  136. DepartmentCode = spdep.No,
  137. DepartmentName = spdep.Name,
  138. CourseCollegeID = spdep.CollegeID,
  139. CourseCollegeCode = spdep.CF_College.No,
  140. CourseCollegeName = spdep.CF_College.Name,
  141. IsSpecialtycore = sp.IsSpecialtycore ?? false,
  142. IsCooperation = sp.IsCooperation ?? false,
  143. IsRequired = sp.IsRequired ?? false,
  144. IsElective = sp.IsElective ?? false,
  145. IsNetworkCourse = sp.IsNetworkCourse ?? false,
  146. IsMainCourse = sp.IsMainCourse ?? false,
  147. IsNeedMaterial = sp.IsNeedMaterial ?? false,
  148. CourseFineID = sp.CourseFineID,
  149. PracticeTypeID = sp.PracticeTypeID,
  150. TeachinglanguageID = sp.TeachinglanguageID,
  151. ExaminationModeID = sp.ExaminationModeID,
  152. ResultTypeID = sp.ResultTypeID,
  153. HandleModeID = sp.HandleModeID,
  154. TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
  155. TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
  156. PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
  157. Remark = sp.Remark,
  158. RecordStatus = sp.RecordStatus,
  159. CreateUserID = sp.CreateUserID,
  160. CreateTime = sp.CreateTime,
  161. ModifyUserID = sp.ModifyUserID,
  162. ModifyTime = sp.ModifyTime
  163. };
  164. return query;
  165. }
  166. /// <summary>
  167. /// 查询专业计划信息SpecialtyPlanView(统计对应的计划范围、学生人数)
  168. /// 注:普教版本(年级专业)
  169. /// </summary>
  170. /// <param name="expSpecialtyPlan"></param>
  171. /// <param name="expStudent"></param>
  172. /// <returns></returns>
  173. public IQueryable<SpecialtyPlanView> GetSpecialtyPlanViewQueryable(Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan,
  174. Expression<Func<CF_Student, bool>> expStudent)
  175. {
  176. var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  177. join spst in SpecialtyPlanTeachingSettingRepository.Entities
  178. on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
  179. from spspst in tempspst.DefaultIfEmpty()
  180. join sy in SchoolyearRepository.Entities
  181. on sp.SchoolyearID equals sy.SchoolyearID
  182. join cou in CoursematerialRepository.Entities
  183. on sp.CoursematerialID equals cou.CoursematerialID
  184. join dep in DepartmentRepository.Entities
  185. on sp.DepartmentID equals dep.DepartmentID into tempdep
  186. from spdep in tempdep.DefaultIfEmpty()
  187. join gr in GrademajorRepository.Entities
  188. on sp.GrademajorID equals gr.GrademajorID
  189. join stsy in SchoolyearRepository.Entities
  190. on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
  191. equals new { SchoolyearID = stsy.Years, SchoolcodeID = stsy.SchoolcodeID } into tempstsy
  192. from startsy in tempstsy.DefaultIfEmpty()
  193. join grsy in SchoolyearRepository.Entities
  194. on gr.GraduateSchoolyearID equals grsy.SchoolyearID into tempgrsy
  195. from gradsy in tempgrsy.DefaultIfEmpty()
  196. join fa in FacultymajorRepository.Entities
  197. on gr.FacultymajorID equals fa.FacultymajorID
  198. join spe in SpecialtyRepository.Entities
  199. on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  200. equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  201. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  202. on fa.StandardID equals dicst.Value into tempst
  203. from fast in tempst.DefaultIfEmpty()
  204. join col in CollegeRepository.Entities
  205. on fa.CollegeID equals col.CollegeID
  206. join cam in CampusRepository.Entities
  207. on col.CampusID equals cam.CampusID
  208. join pr in
  209. (
  210. from cl in ClassmajorRepository.Entities
  211. group cl by cl.GrademajorID into gpr
  212. select new
  213. {
  214. GrademajorID = gpr.Key,
  215. PlanRange = gpr.Count()
  216. }
  217. )
  218. on gr.GrademajorID equals pr.GrademajorID into temppr
  219. from grpr in temppr.DefaultIfEmpty()
  220. join stu in
  221. (
  222. from stu in StudentRepository.GetList(expStudent)
  223. group stu by stu.CF_Classmajor.CF_Grademajor.GrademajorID into gstu
  224. select new
  225. {
  226. GrademajorID = gstu.Key,
  227. StudentCount = gstu.Count()
  228. }
  229. )
  230. on gr.GrademajorID equals stu.GrademajorID into tempstu
  231. from grstu in tempstu.DefaultIfEmpty()
  232. select new SpecialtyPlanView
  233. {
  234. SpecialtyPlanID = sp.SpecialtyPlanID,
  235. PlanApplicationID = sp.PlanApplicationID,
  236. SchoolyearID = sp.SchoolyearID,
  237. SchoolyearCode = sy.Code,
  238. YearID = sy.Years,
  239. Value = sy.Value,
  240. SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
  241. SchoolcodeID = sy.SchoolcodeID,
  242. StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
  243. GrademajorID = sp.GrademajorID,
  244. GrademajorCode = gr.Code,
  245. GrademajorName = gr.Name,
  246. GradeID = gr.GradeID,
  247. FacultymajorID = gr.FacultymajorID,
  248. FacultymajorCode = fa.Code,
  249. FacultymajorName = fa.Name,
  250. CollegeID = fa.CollegeID,
  251. CollegeCode = col.No,
  252. CollegeName = col.Name,
  253. CampusID = col.CampusID,
  254. CampusNo = cam.No,
  255. CampusName = cam.Name,
  256. StartSchoolyearID = startsy.SchoolyearID,
  257. StartSchoolyearCode = startsy.Code,
  258. StartValue = startsy.Value,
  259. StartSchoolcodeID = gr.SemesterID,
  260. GraduatingSemesterID = gr.GraduateSchoolyearID,
  261. GraduatingSemesterCode = gradsy.Code,
  262. GraduatingSemesterValue = gradsy.Value,
  263. SpecialtyID = spe.SpecialtyID,
  264. StandardID = fa.StandardID,
  265. StandardName = fast.Name,
  266. EducationID = fa.EducationID,
  267. LearningformID = fa.LearningformID,
  268. LearnSystem = fa.LearnSystem,
  269. CoursematerialID = sp.CoursematerialID,
  270. CourseCode = cou.CourseCode,
  271. CourseName = cou.CourseName,
  272. CourseStructureID = sp.CourseStructureID,
  273. CourseCategoryID = sp.CourseCategoryID,
  274. CourseTypeID = sp.CourseTypeID,
  275. CourseQualityID = sp.CourseQualityID,
  276. Credit = spspst.Credit ?? 0,
  277. TheoryCourse = spspst.TheoryCourse ?? 0,
  278. Practicehours = spspst.Practicehours ?? 0,
  279. Trialhours = spspst.Trialhours ?? 0,
  280. Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
  281. TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
  282. PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
  283. TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
  284. SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
  285. WeeklyHours = spspst.WeeklyHours ?? 0,
  286. WeeklyNum = spspst.WeeklyNum ?? 0,
  287. StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
  288. EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
  289. StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
  290. DepartmentID = sp.DepartmentID,
  291. DepartmentCode = spdep.No,
  292. DepartmentName = spdep.Name,
  293. CourseCollegeID = spdep.CollegeID,
  294. CourseCollegeCode = spdep.CF_College.No,
  295. CourseCollegeName = spdep.CF_College.Name,
  296. IsSpecialtycore = sp.IsSpecialtycore ?? false,
  297. IsCooperation = sp.IsCooperation ?? false,
  298. IsRequired = sp.IsRequired ?? false,
  299. IsElective = sp.IsElective ?? false,
  300. IsNetworkCourse = sp.IsNetworkCourse ?? false,
  301. IsMainCourse = sp.IsMainCourse ?? false,
  302. IsNeedMaterial = sp.IsNeedMaterial ?? false,
  303. CourseFineID = sp.CourseFineID,
  304. PracticeTypeID = sp.PracticeTypeID,
  305. TeachinglanguageID = sp.TeachinglanguageID,
  306. ExaminationModeID = sp.ExaminationModeID,
  307. ResultTypeID = sp.ResultTypeID,
  308. HandleModeID = sp.HandleModeID,
  309. TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
  310. TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
  311. PlanRange = grpr.PlanRange == null ? 0 : grpr.PlanRange,
  312. StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
  313. PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
  314. Remark = sp.Remark,
  315. RecordStatus = sp.RecordStatus,
  316. CreateUserID = sp.CreateUserID,
  317. CreateTime = sp.CreateTime,
  318. ModifyUserID = sp.ModifyUserID,
  319. ModifyTime = sp.ModifyTime
  320. };
  321. return query;
  322. }
  323. /// <summary>
  324. /// 查询对应的计划范围信息(根据专业计划信息,统计各班级信息对应的学生人数)
  325. /// 注:普教版本(年级专业)
  326. /// </summary>
  327. /// <param name="expSpecialtyPlan"></param>
  328. /// <param name="expStudent"></param>
  329. /// <returns></returns>
  330. public IQueryable<ClassmajorView> GetPlanRangeViewQueryable(Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan,
  331. Expression<Func<CF_Student, bool>> expStudent)
  332. {
  333. var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  334. join gr in GrademajorRepository.Entities
  335. on sp.GrademajorID equals gr.GrademajorID
  336. join cl in ClassmajorRepository.Entities
  337. on gr.GrademajorID equals cl.GrademajorID
  338. join fa in FacultymajorRepository.Entities
  339. on gr.FacultymajorID equals fa.FacultymajorID
  340. join col in CollegeRepository.Entities
  341. on fa.CollegeID equals col.CollegeID
  342. join sc in
  343. (
  344. from stu in StudentRepository.GetList(expStudent)
  345. group stu by stu.CF_Classmajor.ClassmajorID into gstu
  346. select new
  347. {
  348. ClassmajorID = gstu.Key,
  349. StudentCount = gstu.Count()
  350. })
  351. on cl.ClassmajorID equals sc.ClassmajorID into tempsc
  352. from clsc in tempsc.DefaultIfEmpty()
  353. join us in UserRepository.Entities
  354. on cl.UserID equals us.UserID into tempus
  355. from clus in tempus.DefaultIfEmpty()
  356. join au in UserRepository.Entities
  357. on cl.AssistantUserID equals au.UserID into tempau
  358. from clau in tempau.DefaultIfEmpty()
  359. select new ClassmajorView
  360. {
  361. ClassmajorID = cl.ClassmajorID,
  362. No = cl.No,
  363. Name = cl.Name,
  364. Abbreviation = cl.Abbreviation,
  365. EnglishName = cl.EnglishName,
  366. ClassNum = cl.ClassNum,
  367. FacultymajorID = gr.FacultymajorID,
  368. FacultymajorCode = fa.Code,
  369. FacultymajorName = fa.Name,
  370. GrademajorID = gr.GrademajorID,
  371. GrademajorCode = gr.Code,
  372. GrademajorName = gr.Name,
  373. CampusID = col.CampusID,
  374. CampusNo = col.CF_Campus.No,
  375. CampusName = col.CF_Campus.Name,
  376. CollegeID = fa.CollegeID,
  377. CollegeCode = col.No,
  378. CollegeName = col.Name,
  379. GradeID = gr.GradeID,
  380. SemesterID = gr.SemesterID,
  381. StandardID = fa.StandardID,
  382. EducationID = fa.EducationID,
  383. LearningformID = fa.LearningformID,
  384. LearnSystem = fa.LearnSystem,
  385. GraduateSchoolyearID = gr.GraduateSchoolyearID,
  386. GraduateValue = gr.CF_Schoolyear.Value,
  387. GraduateSchoolyearCode = gr.CF_Schoolyear.Code,
  388. UserID = cl.UserID,
  389. UserName = clus.Name,
  390. AssistantUserID = cl.AssistantUserID,
  391. AssistantUserName = clau.Name,
  392. Fixedclassroom = cl.Fixedclassroom,
  393. StudentCount = clsc.StudentCount == null ? 0 : clsc.StudentCount,
  394. Remark = cl.Remark,
  395. RecordStatus = cl.RecordStatus,
  396. CreateUserID = cl.CreateUserID,
  397. CreateTime = cl.CreateTime,
  398. ModifyUserID = cl.ModifyUserID,
  399. ModifyTime = cl.ModifyTime
  400. };
  401. return query;
  402. }
  403. /// <summary>
  404. /// 查询专业计划对应的学生信息BaseStudentView
  405. /// 注:普教版本(年级专业)
  406. /// </summary>
  407. /// <param name="expSpecialtyPlan"></param>
  408. /// <param name="expStudent"></param>
  409. /// <returns></returns>
  410. public IQueryable<BaseStudentView> GetBaseStudentViewQueryable(Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan,
  411. Expression<Func<CF_Student, bool>> expStudent)
  412. {
  413. var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  414. join gr in GrademajorRepository.Entities
  415. on sp.GrademajorID equals gr.GrademajorID
  416. join fa in FacultymajorRepository.Entities
  417. on gr.FacultymajorID equals fa.FacultymajorID
  418. join col in CollegeRepository.Entities
  419. on fa.CollegeID equals col.CollegeID
  420. join cl in ClassmajorRepository.Entities
  421. on gr.GrademajorID equals cl.GrademajorID
  422. join stu in StudentRepository.GetList(expStudent)
  423. on cl.ClassmajorID equals stu.ClassmajorID
  424. join us in UserRepository.Entities
  425. on stu.UserID equals us.UserID
  426. select new BaseStudentView
  427. {
  428. UserID = stu.UserID,
  429. LoginID = us.LoginID,
  430. UserName = us.Name,
  431. SexID = stu.SexID,
  432. IDNumber = stu.IDNumber,
  433. StudentStatus = stu.StudentStatus,
  434. InSchoolStatusID = stu.InSchoolStatusID,
  435. ClassmajorID = stu.ClassmajorID,
  436. ClassmajorCode = cl.No,
  437. ClassmajorName = cl.Name,
  438. ClassNum = cl.ClassNum == null ? 1 : cl.ClassNum,
  439. SchoolyearID = gr.GradeID,
  440. GrademajorID = cl.GrademajorID,
  441. GrademajorCode = gr.Code,
  442. GrademajorName = gr.Name,
  443. FacultymajorID = gr.FacultymajorID,
  444. FacultymajorCode = fa.Code,
  445. FacultymajorName = fa.Name,
  446. CollegeID = fa.CollegeID,
  447. CollegeNo = col.No,
  448. CollegeName = col.Name
  449. };
  450. return query;
  451. }
  452. /// <summary>
  453. /// 查询对应的未新增专业课程信息
  454. /// 注:普教版本(年级专业)
  455. /// </summary>
  456. /// <param name="expSpecialtyCourse"></param>
  457. /// <param name="expGrademajor"></param>
  458. /// <param name="expSpecialtyPlan"></param>
  459. /// <returns></returns>
  460. public IQueryable<SpecialtyCourseView> GetSpecialtyCourseViewNoAddQueryable(Expression<Func<EM_SpecialtyCourse, bool>> expSpecialtyCourse,
  461. Expression<Func<CF_Grademajor, bool>> expGrademajor, Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan)
  462. {
  463. var query = from sc in SpecialtyCourseRepository.GetList(expSpecialtyCourse)
  464. join spe in SpecialtyRepository.Entities
  465. on sc.SpecialtyID equals spe.SpecialtyID
  466. join fa in FacultymajorRepository.Entities
  467. on new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  468. equals new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  469. join gr in GrademajorRepository.GetList(expGrademajor)
  470. on fa.FacultymajorID equals gr.FacultymajorID
  471. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  472. on spe.StandardID equals dicst.Value into tempst
  473. from spest in tempst.DefaultIfEmpty()
  474. join cou in CoursematerialRepository.Entities
  475. on sc.CoursematerialID equals cou.CoursematerialID
  476. join scts in SpecialtyCourseTeachingSettingRepository.Entities
  477. on sc.SpecialtyCourseID equals scts.SpecialtyCourseID into tempscts
  478. from scscts in tempscts.DefaultIfEmpty()
  479. join dep in DepartmentRepository.Entities
  480. on sc.DepartmentID equals dep.DepartmentID into tempdep
  481. from scdep in tempdep.DefaultIfEmpty()
  482. join col in CollegeRepository.Entities
  483. on scdep.CollegeID equals col.CollegeID into tempcol
  484. from sccol in tempcol.DefaultIfEmpty()
  485. join sp in
  486. (
  487. from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  488. join sy in SchoolyearRepository.Entities
  489. on sp.SchoolyearID equals sy.SchoolyearID
  490. join gr in GrademajorRepository.Entities
  491. on sp.GrademajorID equals gr.GrademajorID
  492. join fa in FacultymajorRepository.Entities
  493. on gr.FacultymajorID equals fa.FacultymajorID
  494. join spe in SpecialtyRepository.Entities
  495. on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  496. equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  497. join spst in SpecialtyPlanTeachingSettingRepository.Entities
  498. on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
  499. from spspst in tempspst.DefaultIfEmpty()
  500. join dep in DepartmentRepository.Entities
  501. on sp.DepartmentID equals dep.DepartmentID into tempdep
  502. from spdep in tempdep.DefaultIfEmpty()
  503. select new
  504. {
  505. SpecialtyPlanID = sp.SpecialtyPlanID,
  506. SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
  507. SchoolcodeID = sy.SchoolcodeID,
  508. StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
  509. GrademajorID = sp.GrademajorID,
  510. GradeID = gr.GradeID,
  511. SpecialtyID = spe.SpecialtyID,
  512. StartSchoolcodeID = gr.SemesterID,
  513. CoursematerialID = sp.CoursematerialID,
  514. CourseTypeID = sp.CourseTypeID,
  515. Credit = spspst.Credit,
  516. DepartmentID = spdep.DepartmentID
  517. }
  518. )
  519. on new { GrademajorID = gr.GrademajorID, StarttermID = sc.StarttermID, CoursematerialID = sc.CoursematerialID }
  520. equals new { GrademajorID = sp.GrademajorID.Value, StarttermID = sp.StarttermID, CoursematerialID = sp.CoursematerialID } into tempsp
  521. from scsp in tempsp.DefaultIfEmpty()
  522. where scsp.SpecialtyPlanID == null
  523. select new SpecialtyCourseView
  524. {
  525. SpecialtyCourseID = sc.SpecialtyCourseID,
  526. SpecialtyID = sc.SpecialtyID,
  527. StandardID = spe.StandardID,
  528. StandardName = spest.Name,
  529. EducationID = spe.EducationID,
  530. LearningformID = spe.LearningformID,
  531. LearnSystem = spe.LearnSystem,
  532. StarttermID = sc.StarttermID,
  533. CoursematerialID = sc.CoursematerialID,
  534. CourseCode = cou.CourseCode,
  535. CourseName = cou.CourseName,
  536. CourseStructureID = sc.CourseStructureID,
  537. CourseCategoryID = sc.CourseCategoryID,
  538. CourseTypeID = sc.CourseTypeID,
  539. CourseQualityID = sc.CourseQualityID,
  540. Credit = scscts.Credit ?? 0,
  541. TheoryCourse = scscts.TheoryCourse ?? 0,
  542. Practicehours = scscts.Practicehours ?? 0,
  543. Trialhours = scscts.Trialhours ?? 0,
  544. Totalhours = (scscts.TheoryCourse ?? 0) + (scscts.Practicehours ?? 0),
  545. TheoryWeeklyNum = scscts.TheoryWeeklyNum ?? 0,
  546. PracticeWeeklyNum = scscts.PracticeWeeklyNum ?? 0,
  547. TrialWeeklyNum = scscts.TrialWeeklyNum ?? 0,
  548. SchoolweeksNum = (scscts.TheoryWeeklyNum ?? 0) + (scscts.PracticeWeeklyNum ?? 0),
  549. WeeklyHours = scscts.WeeklyHours ?? 0,
  550. WeeklyNum = scscts.WeeklyNum ?? 0,
  551. StartWeeklyNum = scscts.StartWeeklyNum ?? 0,
  552. EndWeeklyNum = scscts.EndWeeklyNum ?? 0,
  553. StartEndWeeklyNum = (scscts.StartWeeklyNum ?? 0) + "-" + (scscts.EndWeeklyNum ?? 0),
  554. DepartmentID = sc.DepartmentID,
  555. DepartmentCode = scdep.No,
  556. DepartmentName = scdep.Name,
  557. CollegeID = scdep.CollegeID,
  558. CollegeCode = sccol.No,
  559. CollegeName = sccol.Name,
  560. IsSpecialtycore = sc.IsSpecialtycore ?? false,
  561. IsCooperation = sc.IsCooperation ?? false,
  562. IsRequired = sc.IsRequired ?? false,
  563. IsElective = sc.IsElective ?? false,
  564. IsNetworkCourse = sc.IsNetworkCourse ?? false,
  565. IsMainCourse = sc.IsMainCourse ?? false,
  566. IsNeedMaterial = sc.IsNeedMaterial ?? false,
  567. CourseFineID = sc.CourseFineID,
  568. PracticeTypeID = sc.PracticeTypeID,
  569. TeachinglanguageID = sc.TeachinglanguageID,
  570. ExaminationModeID = sc.ExaminationModeID,
  571. ResultTypeID = sc.ResultTypeID,
  572. HandleModeID = sc.HandleModeID,
  573. TeachingModeIDList = sc.EM_TeachingModeType.Select(x => x.TeachingModeID).ToList(),
  574. TeachingPlaceIDList = sc.EM_TeachingPlace.Select(x => x.TeachingPlace).ToList(),
  575. IsEnable = sc.IsEnable ?? false,
  576. Remark = sc.Remark,
  577. RecordStatus = sc.RecordStatus,
  578. CreateUserID = sc.CreateUserID,
  579. CreateTime = sc.CreateTime,
  580. ModifyUserID = sc.ModifyUserID,
  581. ModifyTime = sc.ModifyTime
  582. };
  583. return query;
  584. }
  585. /// <summary>
  586. /// 查询专业计划信息SpecialtyPlanView
  587. /// 注:成教版本(入学学年学期、专业信息)
  588. /// </summary>
  589. /// <param name="exp"></param>
  590. /// <returns></returns>
  591. public IQueryable<SpecialtyPlanView> GetAdultSpecialtyPlanViewQueryable(Expression<Func<EM_SpecialtyPlan, bool>> exp)
  592. {
  593. var query = from sp in SpecialtyPlanRepository.GetList(exp)
  594. join spst in SpecialtyPlanTeachingSettingRepository.Entities
  595. on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
  596. from spspst in tempspst.DefaultIfEmpty()
  597. join sy in SchoolyearRepository.Entities
  598. on sp.SchoolyearID equals sy.SchoolyearID
  599. join cou in CoursematerialRepository.Entities
  600. on sp.CoursematerialID equals cou.CoursematerialID
  601. join dep in DepartmentRepository.Entities
  602. on sp.DepartmentID equals dep.DepartmentID into tempdep
  603. from spdep in tempdep.DefaultIfEmpty()
  604. join startsy in SchoolyearRepository.Entities
  605. on sp.StartSchoolyearID equals startsy.SchoolyearID
  606. join spe in SpecialtyRepository.Entities
  607. on sp.SpecialtyID equals spe.SpecialtyID
  608. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  609. on spe.StandardID equals dicst.Value into tempst
  610. from spest in tempst.DefaultIfEmpty()
  611. select new SpecialtyPlanView
  612. {
  613. SpecialtyPlanID = sp.SpecialtyPlanID,
  614. PlanApplicationID = sp.PlanApplicationID,
  615. SchoolyearID = sp.SchoolyearID,
  616. SchoolyearCode = sy.Code,
  617. YearID = sy.Years,
  618. Value = sy.Value,
  619. SchoolyearNumID = (sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1)) / 2 + 1,
  620. SchoolcodeID = sy.SchoolcodeID,
  621. StarttermID = sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1) + 1,
  622. GrademajorID = sp.GrademajorID,
  623. GradeID = startsy.Years,
  624. StartSchoolyearID = startsy.SchoolyearID,
  625. StartSchoolyearCode = startsy.Code,
  626. StartValue = startsy.Value,
  627. StartSchoolcodeID = startsy.SchoolcodeID,
  628. GraduatingSemesterValue = (int)(((startsy.Years * 2) - 1 + (startsy.SchoolcodeID - 1)) + Math.Ceiling(spe.LearnSystem.Value * 2 - 1)),
  629. SpecialtyID = sp.SpecialtyID,
  630. StandardID = spe.StandardID,
  631. StandardName = spest.Name,
  632. EducationID = spe.EducationID,
  633. LearningformID = spe.LearningformID,
  634. LearnSystem = spe.LearnSystem,
  635. CoursematerialID = sp.CoursematerialID,
  636. CourseCode = cou.CourseCode,
  637. CourseName = cou.CourseName,
  638. CourseStructureID = sp.CourseStructureID,
  639. CourseCategoryID = sp.CourseCategoryID,
  640. CourseTypeID = sp.CourseTypeID,
  641. CourseQualityID = sp.CourseQualityID,
  642. Credit = spspst.Credit ?? 0,
  643. TheoryCourse = spspst.TheoryCourse ?? 0,
  644. Practicehours = spspst.Practicehours ?? 0,
  645. Trialhours = spspst.Trialhours ?? 0,
  646. Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
  647. TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
  648. PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
  649. TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
  650. SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
  651. WeeklyHours = spspst.WeeklyHours ?? 0,
  652. WeeklyNum = spspst.WeeklyNum ?? 0,
  653. StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
  654. EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
  655. StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
  656. DepartmentID = sp.DepartmentID,
  657. DepartmentCode = spdep.No,
  658. DepartmentName = spdep.Name,
  659. CourseCollegeID = spdep.CollegeID,
  660. CourseCollegeCode = spdep.CF_College.No,
  661. CourseCollegeName = spdep.CF_College.Name,
  662. IsSpecialtycore = sp.IsSpecialtycore ?? false,
  663. IsCooperation = sp.IsCooperation ?? false,
  664. IsRequired = sp.IsRequired ?? false,
  665. IsElective = sp.IsElective ?? false,
  666. IsNetworkCourse = sp.IsNetworkCourse ?? false,
  667. IsMainCourse = sp.IsMainCourse ?? false,
  668. IsNeedMaterial = sp.IsNeedMaterial ?? false,
  669. CourseFineID = sp.CourseFineID,
  670. PracticeTypeID = sp.PracticeTypeID,
  671. TeachinglanguageID = sp.TeachinglanguageID,
  672. ExaminationModeID = sp.ExaminationModeID,
  673. ResultTypeID = sp.ResultTypeID,
  674. HandleModeID = sp.HandleModeID,
  675. TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
  676. TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
  677. PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
  678. Remark = sp.Remark,
  679. RecordStatus = sp.RecordStatus,
  680. CreateUserID = sp.CreateUserID,
  681. CreateTime = sp.CreateTime,
  682. ModifyUserID = sp.ModifyUserID,
  683. ModifyTime = sp.ModifyTime
  684. };
  685. return query;
  686. }
  687. /// <summary>
  688. /// 查询专业计划信息SpecialtyPlanView(统计对应的计划范围、学生人数)
  689. /// 注:成教版本(入学学年学期、专业信息)
  690. /// </summary>
  691. /// <param name="expSpecialtyPlan"></param>
  692. /// <param name="expStudent"></param>
  693. /// <returns></returns>
  694. public IQueryable<SpecialtyPlanView> GetAdultSpecialtyPlanViewQueryable(Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan,
  695. Expression<Func<CF_Student, bool>> expStudent)
  696. {
  697. var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  698. join spst in SpecialtyPlanTeachingSettingRepository.Entities
  699. on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
  700. from spspst in tempspst.DefaultIfEmpty()
  701. join sy in SchoolyearRepository.Entities
  702. on sp.SchoolyearID equals sy.SchoolyearID
  703. join cou in CoursematerialRepository.Entities
  704. on sp.CoursematerialID equals cou.CoursematerialID
  705. join dep in DepartmentRepository.Entities
  706. on sp.DepartmentID equals dep.DepartmentID into tempdep
  707. from spdep in tempdep.DefaultIfEmpty()
  708. join startsy in SchoolyearRepository.Entities
  709. on sp.StartSchoolyearID equals startsy.SchoolyearID
  710. join spe in SpecialtyRepository.Entities
  711. on sp.SpecialtyID equals spe.SpecialtyID
  712. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  713. on spe.StandardID equals dicst.Value into tempst
  714. from spest in tempst.DefaultIfEmpty()
  715. join pr in
  716. (
  717. from gr in GrademajorRepository.Entities
  718. join fa in FacultymajorRepository.Entities
  719. on gr.FacultymajorID equals fa.FacultymajorID
  720. join spe in SpecialtyRepository.Entities
  721. on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  722. equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  723. group new { gr, spe } by new { gr.GradeID, gr.SemesterID, spe.SpecialtyID } into gpr
  724. select new
  725. {
  726. GradeID = gpr.Key.GradeID,
  727. StartSchoolcodeID = gpr.Key.SemesterID,
  728. SpecialtyID = gpr.Key.SpecialtyID,
  729. PlanRange = gpr.Count()
  730. }
  731. )
  732. on new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID, SpecialtyID = spe.SpecialtyID }
  733. equals new { GradeID = pr.GradeID.Value, StartSchoolcodeID = pr.StartSchoolcodeID.Value, SpecialtyID = pr.SpecialtyID } into temppr
  734. from sppr in temppr.DefaultIfEmpty()
  735. join sc in
  736. (
  737. from stu in StudentRepository.GetList(expStudent)
  738. join cl in ClassmajorRepository.Entities
  739. on stu.ClassmajorID equals cl.ClassmajorID
  740. join gr in GrademajorRepository.Entities
  741. on cl.GrademajorID equals gr.GrademajorID
  742. join fa in FacultymajorRepository.Entities
  743. on gr.FacultymajorID equals fa.FacultymajorID
  744. join spe in SpecialtyRepository.Entities
  745. on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  746. equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  747. group new { gr, spe } by new { gr.GradeID, gr.SemesterID, spe.SpecialtyID } into gstu
  748. select new
  749. {
  750. GradeID = gstu.Key.GradeID,
  751. StartSchoolcodeID = gstu.Key.SemesterID,
  752. SpecialtyID = gstu.Key.SpecialtyID,
  753. StudentCount = gstu.Count()
  754. }
  755. )
  756. on new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID, SpecialtyID = spe.SpecialtyID }
  757. equals new { GradeID = sc.GradeID.Value, StartSchoolcodeID = sc.StartSchoolcodeID.Value, SpecialtyID = sc.SpecialtyID } into tempstu
  758. from spstu in tempstu.DefaultIfEmpty()
  759. select new SpecialtyPlanView
  760. {
  761. SpecialtyPlanID = sp.SpecialtyPlanID,
  762. PlanApplicationID = sp.PlanApplicationID,
  763. SchoolyearID = sp.SchoolyearID,
  764. SchoolyearCode = sy.Code,
  765. YearID = sy.Years,
  766. Value = sy.Value,
  767. SchoolyearNumID = (sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1)) / 2 + 1,
  768. SchoolcodeID = sy.SchoolcodeID,
  769. StarttermID = sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1) + 1,
  770. GrademajorID = sp.GrademajorID,
  771. GradeID = startsy.Years,
  772. StartSchoolyearID = startsy.SchoolyearID,
  773. StartSchoolyearCode = startsy.Code,
  774. StartValue = startsy.Value,
  775. StartSchoolcodeID = startsy.SchoolcodeID,
  776. GraduatingSemesterValue = (int)(((startsy.Years * 2) - 1 + (startsy.SchoolcodeID - 1)) + Math.Ceiling(spe.LearnSystem.Value * 2 - 1)),
  777. SpecialtyID = sp.SpecialtyID,
  778. StandardID = spe.StandardID,
  779. StandardName = spest.Name,
  780. EducationID = spe.EducationID,
  781. LearningformID = spe.LearningformID,
  782. LearnSystem = spe.LearnSystem,
  783. CoursematerialID = sp.CoursematerialID,
  784. CourseCode = cou.CourseCode,
  785. CourseName = cou.CourseName,
  786. CourseStructureID = sp.CourseStructureID,
  787. CourseCategoryID = sp.CourseCategoryID,
  788. CourseTypeID = sp.CourseTypeID,
  789. CourseQualityID = sp.CourseQualityID,
  790. Credit = spspst.Credit ?? 0,
  791. TheoryCourse = spspst.TheoryCourse ?? 0,
  792. Practicehours = spspst.Practicehours ?? 0,
  793. Trialhours = spspst.Trialhours ?? 0,
  794. Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
  795. TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
  796. PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
  797. TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
  798. SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
  799. WeeklyHours = spspst.WeeklyHours ?? 0,
  800. WeeklyNum = spspst.WeeklyNum ?? 0,
  801. StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
  802. EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
  803. StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
  804. DepartmentID = sp.DepartmentID,
  805. DepartmentCode = spdep.No,
  806. DepartmentName = spdep.Name,
  807. CourseCollegeID = spdep.CollegeID,
  808. CourseCollegeCode = spdep.CF_College.No,
  809. CourseCollegeName = spdep.CF_College.Name,
  810. IsSpecialtycore = sp.IsSpecialtycore ?? false,
  811. IsCooperation = sp.IsCooperation ?? false,
  812. IsRequired = sp.IsRequired ?? false,
  813. IsElective = sp.IsElective ?? false,
  814. IsNetworkCourse = sp.IsNetworkCourse ?? false,
  815. IsMainCourse = sp.IsMainCourse ?? false,
  816. IsNeedMaterial = sp.IsNeedMaterial ?? false,
  817. CourseFineID = sp.CourseFineID,
  818. PracticeTypeID = sp.PracticeTypeID,
  819. TeachinglanguageID = sp.TeachinglanguageID,
  820. ExaminationModeID = sp.ExaminationModeID,
  821. ResultTypeID = sp.ResultTypeID,
  822. HandleModeID = sp.HandleModeID,
  823. TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
  824. TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
  825. PlanRange = sppr.PlanRange == null ? 0 : sppr.PlanRange,
  826. StudentCount = spstu.StudentCount == null ? 0 : spstu.StudentCount,
  827. PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
  828. Remark = sp.Remark,
  829. RecordStatus = sp.RecordStatus,
  830. CreateUserID = sp.CreateUserID,
  831. CreateTime = sp.CreateTime,
  832. ModifyUserID = sp.ModifyUserID,
  833. ModifyTime = sp.ModifyTime
  834. };
  835. return query;
  836. }
  837. /// <summary>
  838. /// 查询专业计划信息SpecialtyPlanView(需匹配年级专业信息、专业信息)
  839. /// 注:查询出学年学期、年级专业、课程信息等信息
  840. /// 注:成教版本(入学学年学期、专业信息)
  841. /// </summary>
  842. /// <param name="expSchoolyear"></param>
  843. /// <param name="expSpecialty"></param>
  844. /// <param name="expSpecialtyPlan"></param>
  845. /// <returns></returns>
  846. public IQueryable<SpecialtyPlanView> GetAdultSpecialtyPlanViewQueryable(Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear,
  847. Expression<Func<CF_Specialty, bool>> expSpecialty, Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan)
  848. {
  849. var query = from gr in GrademajorRepository.Entities
  850. join startsy in SchoolyearRepository.GetList(expSchoolyear)
  851. on new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value }
  852. equals new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID }
  853. join grsy in SchoolyearRepository.Entities
  854. on gr.GraduateSchoolyearID equals grsy.SchoolyearID into tempgrsy
  855. from gradsy in tempgrsy.DefaultIfEmpty()
  856. join fa in FacultymajorRepository.Entities
  857. on gr.FacultymajorID equals fa.FacultymajorID
  858. join spe in SpecialtyRepository.GetList(expSpecialty)
  859. on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  860. equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  861. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  862. on fa.StandardID equals dicst.Value into tempst
  863. from fast in tempst.DefaultIfEmpty()
  864. join col in CollegeRepository.Entities
  865. on fa.CollegeID equals col.CollegeID
  866. join cam in CampusRepository.Entities
  867. on col.CampusID equals cam.CampusID
  868. join sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  869. on new { StartSchoolyearID = startsy.SchoolyearID, SpecialtyID = spe.SpecialtyID }
  870. equals new { StartSchoolyearID = sp.StartSchoolyearID.Value, SpecialtyID = sp.SpecialtyID.Value }
  871. join spst in SpecialtyPlanTeachingSettingRepository.Entities
  872. on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
  873. from spspst in tempspst.DefaultIfEmpty()
  874. join sy in SchoolyearRepository.Entities
  875. on sp.SchoolyearID equals sy.SchoolyearID
  876. join cou in CoursematerialRepository.Entities
  877. on sp.CoursematerialID equals cou.CoursematerialID
  878. join dep in DepartmentRepository.Entities
  879. on sp.DepartmentID equals dep.DepartmentID into tempdep
  880. from spdep in tempdep.DefaultIfEmpty()
  881. select new SpecialtyPlanView
  882. {
  883. SpecialtyPlanID = sp.SpecialtyPlanID,
  884. PlanApplicationID = sp.PlanApplicationID,
  885. SchoolyearID = sp.SchoolyearID,
  886. SchoolyearCode = sy.Code,
  887. YearID = sy.Years,
  888. Value = sy.Value,
  889. SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
  890. SchoolcodeID = sy.SchoolcodeID,
  891. StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
  892. GrademajorID = gr.GrademajorID,
  893. GrademajorCode = gr.Code,
  894. GrademajorName = gr.Name,
  895. GradeID = gr.GradeID,
  896. FacultymajorID = gr.FacultymajorID,
  897. FacultymajorCode = fa.Code,
  898. FacultymajorName = fa.Name,
  899. CollegeID = fa.CollegeID,
  900. CollegeCode = col.No,
  901. CollegeName = col.Name,
  902. CampusID = col.CampusID,
  903. CampusNo = cam.No,
  904. CampusName = cam.Name,
  905. StartSchoolyearID = sp.StartSchoolyearID,
  906. StartSchoolyearCode = startsy.Code,
  907. StartValue = startsy.Value,
  908. StartSchoolcodeID = gr.SemesterID,
  909. GraduatingSemesterID = gr.GraduateSchoolyearID,
  910. GraduatingSemesterCode = gradsy.Code,
  911. GraduatingSemesterValue = gradsy.Value,
  912. SpecialtyID = sp.SpecialtyID,
  913. StandardID = fa.StandardID,
  914. StandardName = fast.Name,
  915. EducationID = fa.EducationID,
  916. LearningformID = fa.LearningformID,
  917. LearnSystem = fa.LearnSystem,
  918. CoursematerialID = sp.CoursematerialID,
  919. CourseCode = cou.CourseCode,
  920. CourseName = cou.CourseName,
  921. CourseStructureID = sp.CourseStructureID,
  922. CourseCategoryID = sp.CourseCategoryID,
  923. CourseTypeID = sp.CourseTypeID,
  924. CourseQualityID = sp.CourseQualityID,
  925. Credit = spspst.Credit ?? 0,
  926. TheoryCourse = spspst.TheoryCourse ?? 0,
  927. Practicehours = spspst.Practicehours ?? 0,
  928. Trialhours = spspst.Trialhours ?? 0,
  929. Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
  930. TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
  931. PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
  932. TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
  933. SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
  934. WeeklyHours = spspst.WeeklyHours ?? 0,
  935. WeeklyNum = spspst.WeeklyNum ?? 0,
  936. StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
  937. EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
  938. StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
  939. DepartmentID = sp.DepartmentID,
  940. DepartmentCode = spdep.No,
  941. DepartmentName = spdep.Name,
  942. CourseCollegeID = spdep.CollegeID,
  943. CourseCollegeCode = spdep.CF_College.No,
  944. CourseCollegeName = spdep.CF_College.Name,
  945. IsSpecialtycore = sp.IsSpecialtycore ?? false,
  946. IsCooperation = sp.IsCooperation ?? false,
  947. IsRequired = sp.IsRequired ?? false,
  948. IsElective = sp.IsElective ?? false,
  949. IsNetworkCourse = sp.IsNetworkCourse ?? false,
  950. IsMainCourse = sp.IsMainCourse ?? false,
  951. IsNeedMaterial = sp.IsNeedMaterial ?? false,
  952. CourseFineID = sp.CourseFineID,
  953. PracticeTypeID = sp.PracticeTypeID,
  954. TeachinglanguageID = sp.TeachinglanguageID,
  955. ExaminationModeID = sp.ExaminationModeID,
  956. ResultTypeID = sp.ResultTypeID,
  957. HandleModeID = sp.HandleModeID,
  958. TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
  959. TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
  960. PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
  961. Remark = sp.Remark,
  962. RecordStatus = sp.RecordStatus,
  963. CreateUserID = sp.CreateUserID,
  964. CreateTime = sp.CreateTime,
  965. ModifyUserID = sp.ModifyUserID,
  966. ModifyTime = sp.ModifyTime
  967. };
  968. return query;
  969. }
  970. /// <summary>
  971. /// 查询对应的年级专业信息(根据学年学期信息、专业信息,统计年级专业对应的学生人数)
  972. /// 注:成教版本(入学学年学期、专业信息)
  973. /// </summary>
  974. /// <param name="expSchoolyear"></param>
  975. /// <param name="expSpecialty"></param>
  976. /// <returns></returns>
  977. public IQueryable<GrademajorView> GetAdultGrademajorViewQueryable(Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear,
  978. Expression<Func<CF_Specialty, bool>> expSpecialty)
  979. {
  980. var query = from gr in GrademajorRepository.Entities
  981. join startsy in SchoolyearRepository.GetList(expSchoolyear)
  982. on new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value }
  983. equals new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID }
  984. join fa in FacultymajorRepository.Entities
  985. on gr.FacultymajorID equals fa.FacultymajorID
  986. join spe in SpecialtyRepository.GetList(expSpecialty)
  987. on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  988. equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  989. join col in CollegeRepository.Entities
  990. on fa.CollegeID equals col.CollegeID
  991. join cam in CampusRepository.Entities
  992. on col.CampusID equals cam.CampusID
  993. join stu in
  994. (
  995. from stu in StudentRepository.Entities
  996. group stu by stu.CF_Classmajor.CF_Grademajor.GrademajorID into gstu
  997. select new
  998. {
  999. GrademajorID = gstu.Key,
  1000. StudentCount = gstu.Count()
  1001. }
  1002. )
  1003. on gr.GrademajorID equals stu.GrademajorID into tempstu
  1004. from grstu in tempstu.DefaultIfEmpty()
  1005. select new GrademajorView
  1006. {
  1007. GrademajorID = gr.GrademajorID,
  1008. Code = gr.Code,
  1009. Name = gr.Name,
  1010. Abbreviation = gr.Abbreviation,
  1011. FacultymajorID = fa.FacultymajorID,
  1012. FacultymajorCode = fa.Code,
  1013. FacultymajorName = fa.Name,
  1014. CampusID = col.CampusID,
  1015. CampusNo = cam.No,
  1016. CampusName = cam.Name,
  1017. CollegeID = fa.CollegeID,
  1018. CollegeCode = col.No,
  1019. CollegeName = col.Name,
  1020. GradeID = gr.GradeID,
  1021. SemesterID = gr.SemesterID,
  1022. SpecialtyID = spe.SpecialtyID,
  1023. StandardID = fa.StandardID,
  1024. EducationID = fa.EducationID,
  1025. LearningformID = fa.LearningformID,
  1026. LearnSystem = fa.LearnSystem,
  1027. StartSchoolyearID = startsy.SchoolyearID,
  1028. StartSchoolyearCode = startsy.Code,
  1029. StartValue = startsy.Value,
  1030. GraduateSchoolyearID = gr.GraduateSchoolyearID,
  1031. GraduateValue = gr.CF_Schoolyear.Value,
  1032. GraduateSchoolyearCode = gr.CF_Schoolyear.Code,
  1033. Professional = gr.Professional,
  1034. StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
  1035. Remark = gr.Remark,
  1036. RecordStatus = gr.RecordStatus
  1037. };
  1038. return query;
  1039. }
  1040. /// <summary>
  1041. /// 查询对应的计划范围信息(根据专业计划信息,统计各年级专业对应的班级数、学生人数)
  1042. /// 注:成教版本(入学学年学期、专业信息)
  1043. /// </summary>
  1044. /// <param name="expSpecialtyPlan"></param>
  1045. /// <param name="expStudent"></param>
  1046. /// <returns></returns>
  1047. public IQueryable<GrademajorView> GetAdultPlanRangeViewQueryable(Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan,
  1048. Expression<Func<CF_Student, bool>> expStudent)
  1049. {
  1050. var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  1051. join startsy in SchoolyearRepository.Entities
  1052. on sp.StartSchoolyearID equals startsy.SchoolyearID
  1053. join spe in SpecialtyRepository.Entities
  1054. on sp.SpecialtyID equals spe.SpecialtyID
  1055. join fa in FacultymajorRepository.Entities
  1056. on new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  1057. equals new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  1058. join col in CollegeRepository.Entities
  1059. on fa.CollegeID equals col.CollegeID
  1060. join gr in GrademajorRepository.Entities
  1061. on new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID, FacultymajorID = fa.FacultymajorID }
  1062. equals new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value, FacultymajorID = gr.FacultymajorID.Value }
  1063. join cl in
  1064. (
  1065. from cl in ClassmajorRepository.Entities
  1066. group cl by cl.GrademajorID into gcl
  1067. select new
  1068. {
  1069. GrademajorID = gcl.Key,
  1070. ClassmajorCount = gcl.Count()
  1071. }
  1072. )
  1073. on gr.GrademajorID equals cl.GrademajorID into tempcl
  1074. from grcl in tempcl.DefaultIfEmpty()
  1075. join sc in
  1076. (
  1077. from stu in StudentRepository.GetList(expStudent)
  1078. group stu by stu.CF_Classmajor.CF_Grademajor.GrademajorID into gstu
  1079. select new
  1080. {
  1081. GrademajorID = gstu.Key,
  1082. StudentCount = gstu.Count()
  1083. }
  1084. )
  1085. on gr.GrademajorID equals sc.GrademajorID into tempstu
  1086. from grstu in tempstu.DefaultIfEmpty()
  1087. select new GrademajorView
  1088. {
  1089. GrademajorID = gr.GrademajorID,
  1090. Code = gr.Code,
  1091. Name = gr.Name,
  1092. Abbreviation = gr.Abbreviation,
  1093. FacultymajorID = fa.FacultymajorID,
  1094. FacultymajorCode = fa.Code,
  1095. FacultymajorName = fa.Name,
  1096. CampusID = col.CampusID,
  1097. CampusNo = col.CF_Campus.No,
  1098. CampusName = col.CF_Campus.Name,
  1099. CollegeID = fa.CollegeID,
  1100. CollegeCode = col.No,
  1101. CollegeName = col.Name,
  1102. GradeID = gr.GradeID,
  1103. SemesterID = gr.SemesterID,
  1104. StandardID = fa.StandardID,
  1105. EducationID = fa.EducationID,
  1106. LearningformID = fa.LearningformID,
  1107. LearnSystem = fa.LearnSystem,
  1108. GraduateSchoolyearID = gr.GraduateSchoolyearID,
  1109. GraduateValue = gr.CF_Schoolyear.Value,
  1110. GraduateSchoolyearCode = gr.CF_Schoolyear.Code,
  1111. Professional = gr.Professional,
  1112. ClassmajorCount = grcl.ClassmajorCount == null ? 0 : grcl.ClassmajorCount,
  1113. StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
  1114. Remark = gr.Remark,
  1115. RecordStatus = gr.RecordStatus,
  1116. CreateUserID = gr.CreateUserID,
  1117. CreateTime = gr.CreateTime,
  1118. ModifyUserID = gr.ModifyUserID,
  1119. ModifyTime = gr.ModifyTime
  1120. };
  1121. return query;
  1122. }
  1123. /// <summary>
  1124. /// 查询专业计划对应的学生信息BaseStudentView
  1125. /// 注:成教版本(入学学年学期、专业信息)
  1126. /// </summary>
  1127. /// <param name="expSpecialtyPlan"></param>
  1128. /// <param name="expStudent"></param>
  1129. /// <returns></returns>
  1130. public IQueryable<BaseStudentView> GetAdultBaseStudentViewQueryable(Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan,
  1131. Expression<Func<CF_Student, bool>> expStudent)
  1132. {
  1133. var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  1134. join startsy in SchoolyearRepository.Entities
  1135. on sp.StartSchoolyearID equals startsy.SchoolyearID
  1136. join spe in SpecialtyRepository.Entities
  1137. on sp.SpecialtyID equals spe.SpecialtyID
  1138. join fa in FacultymajorRepository.Entities
  1139. on new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
  1140. equals new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
  1141. join col in CollegeRepository.Entities
  1142. on fa.CollegeID equals col.CollegeID
  1143. join gr in GrademajorRepository.Entities
  1144. on new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID, FacultymajorID = fa.FacultymajorID }
  1145. equals new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value, FacultymajorID = gr.FacultymajorID.Value }
  1146. join cl in ClassmajorRepository.Entities
  1147. on gr.GrademajorID equals cl.GrademajorID
  1148. join stu in StudentRepository.GetList(expStudent)
  1149. on cl.ClassmajorID equals stu.ClassmajorID
  1150. join us in UserRepository.Entities
  1151. on stu.UserID equals us.UserID
  1152. select new BaseStudentView
  1153. {
  1154. UserID = stu.UserID,
  1155. LoginID = us.LoginID,
  1156. UserName = us.Name,
  1157. SexID = stu.SexID,
  1158. IDNumber = stu.IDNumber,
  1159. StudentStatus = stu.StudentStatus,
  1160. InSchoolStatusID = stu.InSchoolStatusID,
  1161. ClassmajorID = stu.ClassmajorID,
  1162. ClassmajorCode = cl.No,
  1163. ClassmajorName = cl.Name,
  1164. ClassNum = cl.ClassNum == null ? 1 : cl.ClassNum,
  1165. SchoolyearID = gr.GradeID,
  1166. GrademajorID = cl.GrademajorID,
  1167. GrademajorCode = gr.Code,
  1168. GrademajorName = gr.Name,
  1169. FacultymajorID = gr.FacultymajorID,
  1170. FacultymajorCode = fa.Code,
  1171. FacultymajorName = fa.Name,
  1172. CollegeID = fa.CollegeID,
  1173. CollegeNo = col.No,
  1174. CollegeName = col.Name
  1175. };
  1176. return query;
  1177. }
  1178. /// <summary>
  1179. /// 查询对应的未新增专业课程信息
  1180. /// 注:成教版本(入学学年学期、专业信息)
  1181. /// </summary>
  1182. /// <param name="expSpecialtyCourse"></param>
  1183. /// <param name="expSchoolyear"></param>
  1184. /// <param name="expSpecialty"></param>
  1185. /// <returns></returns>
  1186. public IQueryable<SpecialtyCourseView> GetAdultSpecialtyCourseViewNoAddQueryable(Expression<Func<EM_SpecialtyCourse, bool>> expSpecialtyCourse,
  1187. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear, Expression<Func<CF_Specialty, bool>> expSpecialty,
  1188. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan)
  1189. {
  1190. var query = from sc in SpecialtyCourseRepository.GetList(expSpecialtyCourse)
  1191. join spe in SpecialtyRepository.GetList(expSpecialty)
  1192. on sc.SpecialtyID equals spe.SpecialtyID
  1193. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  1194. on spe.StandardID equals dicst.Value into tempst
  1195. from spest in tempst.DefaultIfEmpty()
  1196. join cou in CoursematerialRepository.Entities
  1197. on sc.CoursematerialID equals cou.CoursematerialID
  1198. join scts in SpecialtyCourseTeachingSettingRepository.Entities
  1199. on sc.SpecialtyCourseID equals scts.SpecialtyCourseID into tempscts
  1200. from scscts in tempscts.DefaultIfEmpty()
  1201. join dep in DepartmentRepository.Entities
  1202. on sc.DepartmentID equals dep.DepartmentID into tempdep
  1203. from scdep in tempdep.DefaultIfEmpty()
  1204. join col in CollegeRepository.Entities
  1205. on scdep.CollegeID equals col.CollegeID into tempcol
  1206. from sccol in tempcol.DefaultIfEmpty()
  1207. join sp in
  1208. (
  1209. from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
  1210. join sy in SchoolyearRepository.Entities
  1211. on sp.SchoolyearID equals sy.SchoolyearID
  1212. join startsy in SchoolyearRepository.GetList(expSchoolyear)
  1213. on sp.StartSchoolyearID equals startsy.SchoolyearID
  1214. join spe in SpecialtyRepository.Entities
  1215. on sp.SpecialtyID equals spe.SpecialtyID
  1216. join spst in SpecialtyPlanTeachingSettingRepository.Entities
  1217. on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
  1218. from spspst in tempspst.DefaultIfEmpty()
  1219. join dep in DepartmentRepository.Entities
  1220. on sp.DepartmentID equals dep.DepartmentID into tempdep
  1221. from spdep in tempdep.DefaultIfEmpty()
  1222. select new
  1223. {
  1224. SpecialtyPlanID = sp.SpecialtyPlanID,
  1225. SchoolyearNumID = (sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1)) / 2 + 1,
  1226. SchoolcodeID = sy.SchoolcodeID,
  1227. StarttermID = sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1) + 1,
  1228. StartSchoolyearID = sp.StartSchoolyearID,
  1229. GradeID = startsy.Years,
  1230. SpecialtyID = sp.SpecialtyID,
  1231. StartSchoolcodeID = startsy.SchoolcodeID,
  1232. CoursematerialID = sp.CoursematerialID,
  1233. CourseTypeID = sp.CourseTypeID,
  1234. Credit = spspst.Credit,
  1235. DepartmentID = spdep.DepartmentID
  1236. }
  1237. )
  1238. on new { SpecialtyID = sc.SpecialtyID, StarttermID = sc.StarttermID, CoursematerialID = sc.CoursematerialID }
  1239. equals new { SpecialtyID = sp.SpecialtyID, StarttermID = sp.StarttermID, CoursematerialID = sp.CoursematerialID } into tempsp
  1240. from scsp in tempsp.DefaultIfEmpty()
  1241. where scsp.SpecialtyPlanID == null
  1242. select new SpecialtyCourseView
  1243. {
  1244. SpecialtyCourseID = sc.SpecialtyCourseID,
  1245. SpecialtyID = sc.SpecialtyID,
  1246. StandardID = spe.StandardID,
  1247. StandardName = spest.Name,
  1248. EducationID = spe.EducationID,
  1249. LearningformID = spe.LearningformID,
  1250. LearnSystem = spe.LearnSystem,
  1251. StarttermID = sc.StarttermID,
  1252. CoursematerialID = sc.CoursematerialID,
  1253. CourseCode = cou.CourseCode,
  1254. CourseName = cou.CourseName,
  1255. CourseStructureID = sc.CourseStructureID,
  1256. CourseCategoryID = sc.CourseCategoryID,
  1257. CourseTypeID = sc.CourseTypeID,
  1258. CourseQualityID = sc.CourseQualityID,
  1259. Credit = scscts.Credit ?? 0,
  1260. TheoryCourse = scscts.TheoryCourse ?? 0,
  1261. Practicehours = scscts.Practicehours ?? 0,
  1262. Trialhours = scscts.Trialhours ?? 0,
  1263. Totalhours = (scscts.TheoryCourse ?? 0) + (scscts.Practicehours ?? 0),
  1264. TheoryWeeklyNum = scscts.TheoryWeeklyNum ?? 0,
  1265. PracticeWeeklyNum = scscts.PracticeWeeklyNum ?? 0,
  1266. TrialWeeklyNum = scscts.TrialWeeklyNum ?? 0,
  1267. SchoolweeksNum = (scscts.TheoryWeeklyNum ?? 0) + (scscts.PracticeWeeklyNum ?? 0),
  1268. WeeklyHours = scscts.WeeklyHours ?? 0,
  1269. WeeklyNum = scscts.WeeklyNum ?? 0,
  1270. StartWeeklyNum = scscts.StartWeeklyNum ?? 0,
  1271. EndWeeklyNum = scscts.EndWeeklyNum ?? 0,
  1272. StartEndWeeklyNum = (scscts.StartWeeklyNum ?? 0) + "-" + (scscts.EndWeeklyNum ?? 0),
  1273. DepartmentID = sc.DepartmentID,
  1274. DepartmentCode = scdep.No,
  1275. DepartmentName = scdep.Name,
  1276. CollegeID = scdep.CollegeID,
  1277. CollegeCode = sccol.No,
  1278. CollegeName = sccol.Name,
  1279. IsSpecialtycore = sc.IsSpecialtycore ?? false,
  1280. IsCooperation = sc.IsCooperation ?? false,
  1281. IsRequired = sc.IsRequired ?? false,
  1282. IsElective = sc.IsElective ?? false,
  1283. IsNetworkCourse = sc.IsNetworkCourse ?? false,
  1284. IsMainCourse = sc.IsMainCourse ?? false,
  1285. IsNeedMaterial = sc.IsNeedMaterial ?? false,
  1286. CourseFineID = sc.CourseFineID,
  1287. PracticeTypeID = sc.PracticeTypeID,
  1288. TeachinglanguageID = sc.TeachinglanguageID,
  1289. ExaminationModeID = sc.ExaminationModeID,
  1290. ResultTypeID = sc.ResultTypeID,
  1291. HandleModeID = sc.HandleModeID,
  1292. TeachingModeIDList = sc.EM_TeachingModeType.Select(x => x.TeachingModeID).ToList(),
  1293. TeachingPlaceIDList = sc.EM_TeachingPlace.Select(x => x.TeachingPlace).ToList(),
  1294. IsEnable = sc.IsEnable ?? false,
  1295. Remark = sc.Remark,
  1296. RecordStatus = sc.RecordStatus,
  1297. CreateUserID = sc.CreateUserID,
  1298. CreateTime = sc.CreateTime,
  1299. ModifyUserID = sc.ModifyUserID,
  1300. ModifyTime = sc.ModifyTime
  1301. };
  1302. return query;
  1303. }
  1304. /// <summary>
  1305. /// 查询专业计划信息对应的授课方式
  1306. /// </summary>
  1307. /// <param name="exp"></param>
  1308. /// <returns></returns>
  1309. public IQueryable<int?> GetTeachingModeTypeQueryble(Expression<Func<EM_SpecialtyPlan, bool>> exp)
  1310. {
  1311. var query = from sp in SpecialtyPlanRepository.GetList(exp)
  1312. join sptm in SpecialtyPlanTeachingModeTypeRepository.Entities
  1313. on sp.SpecialtyPlanID equals sptm.SpecialtyPlanID
  1314. join dictm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
  1315. on sptm.TeachingModeID equals dictm.Value
  1316. select dictm.Value;
  1317. return query;
  1318. }
  1319. /// <summary>
  1320. /// 查询专业计划信息对应的授课方式
  1321. /// </summary>
  1322. /// <param name="exp"></param>
  1323. /// <returns></returns>
  1324. public IQueryable<int?> GetTeachingPlaceQueryble(Expression<Func<EM_SpecialtyPlan, bool>> exp)
  1325. {
  1326. var query = from sp in SpecialtyPlanRepository.GetList(exp)
  1327. join sptp in SpecialtyPlanTeachingPlaceRepository.Entities
  1328. on sp.SpecialtyPlanID equals sptp.SpecialtyPlanID
  1329. join dictp in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EMIS.ViewModel.EM_TeachingPlace).Name)
  1330. on sptp.TeachingPlace equals dictp.Value
  1331. select dictp.Value;
  1332. return query;
  1333. }
  1334. }
  1335. }