OptionalCourseSettingDAL.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data.Entity;
  6. using EMIS.DataLogic.Repositories;
  7. using EMIS.ViewModel.SelectCourse;
  8. using System.Linq.Expressions;
  9. using EMIS.Entities;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.CultureplanManage.PlanManagement;
  12. using EMIS.ViewModel.Students;
  13. using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
  14. using EMIS.ViewModel.EducationManage;
  15. using EMIS.ViewModel.SelectCourse.SelectCourseResult;
  16. namespace EMIS.DataLogic.SelectCourse
  17. {
  18. public class OptionalCourseSettingDAL
  19. {
  20. public SelectCourseOpenControlSettingRepository SelectCourseOpenControlSettingRepository { get; set; }
  21. public ExecutableOptionalCourseRepository ExecutableOptionalCourseRepository { get; set; }
  22. public SchoolyearRepository SchoolyearRepository { get; set; }
  23. public GrademajorRepository GrademajorRepository { get; set; }
  24. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  25. public OptionalCoursePlanRepository OptionalCoursePlanRepository { get; set; }
  26. public SpecialtyCourseRepository SpecialtyCourseRepository { get; set; }
  27. public SpecialtyRepository SpecialtyRepository { get; set; }
  28. public CoursematerialRepository CoursematerialRepository { get; set; }
  29. public DepartmentRepository DepartmentRepository { get; set; }
  30. public ClassmajorRepository ClassmajorRepository { get; set; }
  31. public ExecutableOptionalCourseTeachingSettingRepository ExecutableOptionalCourseTeachingSettingRepository { get; set; }
  32. public ExecutableOptionalCourseTeacherRepository ExecutableOptionalCourseTeacherRepository { get; set; }
  33. public ExecutableOptionalCourseTeachingModeRepository ExecutableOptionalCourseTeachingModeRepository { get; set; }
  34. public StudentRepository StudentRepository { get; set; }
  35. public ExecutableFreeSelectionCouseRepository ExecutableFreeSelectionCouseRepository { get; set; }//任选设定
  36. public StaffRepository StaffRepository { get; set; }
  37. public EducationMissionClassRepository EducationMissionClassRepository { get; set; } //教学任务班表
  38. public UserRepository UserRepository { get; set; }
  39. public EducationMissionRepository EducationMissionRepository { get; set; }
  40. public IQueryable<OptionalCourseSettingView> GetOpenControlSettingView(
  41. Expression<Func<EM_ExecutableOptionalCourse, bool>> openCourseSettingExp,
  42. Expression<Func<EM_OptionalCoursePlan, bool>> exp,
  43. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> schoolYearExp,
  44. Expression<Func<CF_Grademajor, bool>> gradeMajorExp)
  45. {
  46. var q = from eoc in ExecutableOptionalCourseRepository.GetList(openCourseSettingExp)
  47. join ocp in OptionalCoursePlanRepository.Entities on eoc.OptionalCourseID equals ocp.OptionalCourseID
  48. into tmp
  49. from ocpss in tmp.DefaultIfEmpty()
  50. join gr in GrademajorRepository.Entities on eoc.GrademajorID equals gr.GrademajorID
  51. into tmp1
  52. from gr in tmp1.DefaultIfEmpty()
  53. //from cl in eoc.CF_Classmajor.DefaultIfEmpty()
  54. //from st in eoc.CF_Student.DefaultIfEmpty()
  55. //join cl in classmajorRepository.Entities on gr.GrademajorID equals cl.GrademajorID
  56. join sc in SchoolyearRepository.Entities on new { Years = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value } equals new { Years = sc.Years, SchoolcodeID = sc.SchoolcodeID }
  57. join sc1 in SchoolyearRepository.Entities on eoc.SchoolyearID equals sc1.SchoolyearID
  58. join co in CoursematerialRepository.Entities on ocpss.CoursematerialID equals co.CoursematerialID
  59. join de in DepartmentRepository.Entities on eoc.DepartmentID equals de.DepartmentID
  60. into tmp4
  61. from de1 in tmp4.DefaultIfEmpty()
  62. join sp in SpecialtyRepository.Entities on ocpss.SpecialtyID equals sp.SpecialtyID
  63. join dis in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name) on sp.StandardID equals dis.Value into ddis
  64. from edis in ddis.DefaultIfEmpty()
  65. //join eoct in executableOptionalCourseTeacherRepository.Entities.GroupBy(x => new { x.ExecutableOptionalCourseID })
  66. // .Select(x => new { ExecutableOptionalCourseID = x.Key.ExecutableOptionalCourseID, TeacherName = x.Join()//string.Join(",", x.Select(g => g.CF_Staff.Sys_User.Name).ToArray()) })
  67. // on eoc.ExecutableOptionalCourseID equals eoct.ExecutableOptionalCourseID
  68. // into tmp1
  69. //from ecot1 in tmp1.DefaultIfEmpty()
  70. //join eoct in executableOptionalCourseTeacherRepository.Entities on eoc.ExecutableOptionalCourseID equals eoct.ExecutableOptionalCourseID
  71. //into tmp1
  72. //from ecot1 in tmp1.DefaultIfEmpty()
  73. //join eoctm in executableOptionalCourseTeachingModeRepository.Entities on eoc.ExecutableOptionalCourseID equals eoctm.ExecutableOptionalCourseID
  74. //into tmp2 from eoctm1 in tmp2.DefaultIfEmpty()
  75. join eocts in ExecutableOptionalCourseTeachingSettingRepository.Entities on eoc.ExecutableOptionalCourseID equals eocts.ExecutableOptionalCourseID
  76. into tmp3 from ecots1 in tmp3.DefaultIfEmpty()
  77. select new OptionalCourseSettingView
  78. {
  79. ExecutableOptionalCourseID = eoc.ExecutableOptionalCourseID,
  80. //ExecutableOptionalCourseTeacherID = ecot1.ExecutableOptionalCourseTeacherID,
  81. //TeacherNames=ecot1.TeacherName,
  82. //ExecutableOptionalCourseTeachingModeID = eoctm1.ExecutableOptionalCourseTeachingModeID,
  83. OptionalCourseID = ocpss.OptionalCourseID,
  84. SchoolyearID = eoc.SchoolyearID,
  85. DefaultClassName = eoc.DefaultClassName,
  86. //ClassmajorID = cl.ClassmajorID,
  87. //StandardID=sp.StandardID,
  88. SchoolYearCode = sc1.Code,
  89. YearID = sc1.Years,
  90. GSchoolYearCode = sc.Code,
  91. GrademajorID = gr.GrademajorID,
  92. GrademajorCode = gr.Code,
  93. GrademajorName = gr.Name,
  94. GradeID = gr.GradeID,
  95. CampusID = gr.CF_Facultymajor.CF_College.CampusID,
  96. CollegeID = gr.CF_Facultymajor.CollegeID,
  97. CollegeName = gr.CF_Facultymajor.CF_College.Name,
  98. DepartmentID = eoc.DepartmentID,
  99. DepartmentName = de1.Name,
  100. //SpecialtyCourseID = sc.SpecialtyCourseID,
  101. SpecialtyID = ocpss.SpecialtyID,
  102. StandardID = ocpss.CF_Specialty.StandardID,
  103. CoursematerialID = ocpss.CoursematerialID,
  104. CourseCode = co.CourseCode,
  105. CourseName = co.CourseName,
  106. //Credit = sc.EM_SpecialtyCourseTeachingSetting.Credit,
  107. //EndWeeklyNum = ocp.EM_SpecialtyCourse.EM_SpecialtyCourseTeachingSetting.EndWeeklyNum,
  108. ExaminationModeID = eoc.ExaminationModeID,
  109. TeachinglanguageID = eoc.TeachinglanguageID,
  110. //HandleModeID = ocp.HandleModeID,
  111. //No = ocp.No,
  112. //DefaultClassName = ocp.DefaultClassName,
  113. //SchoolyearID = ocp.SchoolyearID,
  114. //SchoolyearDesc = ocp.CF_Schoolyear.Code,
  115. //IsNeedMaterial = ocp.IsNeedMaterial ?? false,
  116. PeopleNumlower = eoc.PeopleNumlower,
  117. PeopleNumlimit = eoc.PeopleNumlimit,
  118. IsEnable = eoc.IsEnable ?? true,
  119. IsOpened = eoc.IsOpened ?? true,
  120. Remarks = eoc.Remarks,
  121. RecordStatus = eoc.RecordStatus,
  122. CreateUserID = eoc.CreateUserID,
  123. CreateTime = eoc.CreateTime,
  124. ModifyUserID = eoc.ModifyUserID,
  125. ModifyTime = eoc.ModifyTime,
  126. //Schoolyear = gs.SchoolyearID,
  127. //Sys_User = ocp.EM_OptionalCoursePlanStaff.Select(x => x.CF_Staff.Sys_User),
  128. CourseStructureID = eoc.CourseStructureID,
  129. CourseTypeID = eoc.CourseTypeID,
  130. //TeachingModeID = eoctm1.TeachingModeID,
  131. Credit = ecots1.Credit ?? 0,
  132. TheoryCourse = ecots1.TheoryCourse??0,
  133. Practicehours = ecots1.Practicehours??0,
  134. Trialhours = ecots1.Trialhours??0,
  135. WeeklyNum=ecots1.WeeklyNum??0,
  136. TheoryWeeklyNum = ecots1.TheoryWeeklyNum ?? 0,
  137. PracticeWeeklyNum = ecots1.PracticeWeeklyNum ?? 0,
  138. TrialWeeklyNum = ecots1.TrialWeeklyNum ?? 0,
  139. StartWeeklyNum = ecots1.StartWeeklyNum ?? 0,
  140. EndWeeklyNum = ecots1.EndWeeklyNum ?? 0,
  141. WeeklyHours = ecots1.WeeklyHours ?? 0,
  142. SchoolyearNumID = ocpss.SchoolyearNumID,
  143. SchoolcodeID = ocpss.SchoolcodeID,
  144. StarttermID = ((ocpss.SchoolyearNumID - 1) * 2) + (ocpss.SchoolcodeID == eoc.CF_Grademajor.SemesterID ? 0 : 1) + 1,
  145. CourseCategoryID = eoc.CourseCategoryID,
  146. //IsMainCourse = ocp.EM_SpecialtyCourse.IsMainCourse ?? false,
  147. CourseQualityID = eoc.CourseQualityID,
  148. PracticeTypeID = eoc.PracticeTypeID,
  149. //StandardDesc=edis.Name,
  150. //StandardCode = edis.Code,
  151. Years=gr.GradeID,
  152. ClassCount = eoc.CF_Classmajor.Count,
  153. ResultTypeID=eoc.ResultTypeID
  154. };
  155. //var q = (from scocs in SelectCourseOpenControlSettingRepository.GetList(openControlSettingExp)
  156. // join sy in SchoolyearRepository.GetList(schoolYearExp) on scocs.SchoolyearID equals sy.SchoolyearID
  157. // join gm in GrademajorRepository.GetList(gradeMajorExp) on scocs.GrademajorID equals gm.GrademajorID
  158. // join dis in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name) on gm.CF_Facultymajor.StandardID equals dis.Value into ddis
  159. // from edis in ddis.DefaultIfEmpty()
  160. // join disy in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EMIS.ViewModel.CF_Schoolyear).Name) on gm.SchoolyearID equals disy.Value into ddisy
  161. // from edisy in ddisy.DefaultIfEmpty()
  162. // select new SelectCourseOpenControlSettingView
  163. // {
  164. // SelectCourseOpenControlSettingID = scocs.SelectCourseOpenControlSettingID,
  165. // SchoolyearID = scocs.SchoolyearID,
  166. // SchoolyearCode = sy.Code,
  167. // GrademajorID = scocs.GrademajorID,
  168. // GrademajorName = gm.Name,
  169. // YearID = gm.SchoolyearID,
  170. // YearName = edisy.Name,
  171. // StandardID = gm.CF_Facultymajor.StandardID,
  172. // StandardDesc = edis.Name,
  173. // CollegeID = gm.CF_Facultymajor.CollegeID,
  174. // CollegeName = gm.CF_Facultymajor.CF_College.Name,
  175. // StartTime = scocs.StartTime,
  176. // EndTime = scocs.EndTime,
  177. // MaxSelectCount = scocs.MaxSelectCount,
  178. // MinSelectCount = scocs.MinSelectCount,
  179. // MaxCredit = scocs.MaxCredit,
  180. // MinCredit = scocs.MinCredit,
  181. // Remark = scocs.Remark,
  182. // RecordStatus = scocs.RecordStatus,
  183. // CreateUserID = scocs.CreateUserID,
  184. // CreateTime = scocs.CreateTime,
  185. // ModifyUserID = scocs.ModifyUserID,
  186. // ModifyTime = scocs.ModifyTime
  187. // });
  188. return q;
  189. }
  190. public IQueryable<OptionalCourseSettingView> GetOpenControlSettingClassmajorView(
  191. Expression<Func<EM_ExecutableOptionalCourse, bool>> openCourseSettingExp)
  192. {
  193. var q = from ocps in ExecutableOptionalCourseRepository.GetList(openCourseSettingExp)
  194. from cl in ocps.CF_Classmajor
  195. select new OptionalCourseSettingView
  196. {
  197. ExecutableOptionalCourseID = ocps.ExecutableOptionalCourseID,
  198. DefaultClassName = ocps.DefaultClassName,
  199. ClassmajorID = cl.ClassmajorID,
  200. ExaminationModeID = ocps.ExaminationModeID,
  201. TeachinglanguageID = ocps.TeachinglanguageID,
  202. PeopleNumlower = ocps.PeopleNumlower,
  203. PeopleNumlimit = ocps.PeopleNumlimit,
  204. IsEnable = ocps.IsEnable ?? false,
  205. IsOpened = ocps.IsOpened ?? false,
  206. Remarks = ocps.Remarks,
  207. RecordStatus = ocps.RecordStatus,
  208. CreateUserID = ocps.CreateUserID,
  209. CreateTime = ocps.CreateTime,
  210. ModifyUserID = ocps.ModifyUserID,
  211. ModifyTime = ocps.ModifyTime,
  212. CourseStructureID = ocps.CourseStructureID,
  213. CourseTypeID = ocps.CourseTypeID,
  214. //StarttermID = ((ocp.EM_SpecialtyCourse.SchoolyearNumID - 1) * 2) + (ocp.EM_SpecialtyCourse.SchoolcodeID == ocp.CF_Grademajor.SchoolcodeID ? 0 : 1) + 1,
  215. CourseCategoryID = ocps.CourseCategoryID,
  216. //IsMainCourse = ocp.EM_SpecialtyCourse.IsMainCourse ?? false,
  217. CourseQualityID = ocps.CourseQualityID,
  218. PracticeTypeID = ocps.PracticeTypeID
  219. };
  220. return q;
  221. }
  222. public List<string> GetTeachingModeTypeQueryble(Guid? ExecutableOptionalCourseID)
  223. {
  224. var query = from a in ExecutableOptionalCourseTeachingModeRepository.Entities.Where(x => x.ExecutableOptionalCourseID == ExecutableOptionalCourseID)
  225. join b in DictionaryItemRepository.Entities on new { a.TeachingModeID, DictionaryCode = DictionaryItem.CF_TeachingMode.ToString() }
  226. equals new { TeachingModeID = b.Value, b.DictionaryCode }
  227. select b.Value.Value.ToString();
  228. return query.ToList();
  229. }
  230. /// <summary>
  231. /// 获取任务班
  232. /// </summary>
  233. /// <param name="educationMissionClassID"></param>
  234. /// <returns></returns>
  235. public IQueryable<OptionalCourseClassListView> GetExecutableOptionalCourseClassmajorList()
  236. {
  237. var query = from a in ExecutableOptionalCourseRepository.Entities
  238. from b in a.CF_Classmajor
  239. join c in OptionalCoursePlanRepository.Entities on a.OptionalCourseID equals c.OptionalCourseID
  240. //join b in executableOptionalCourseTeacherRepository.Entities
  241. //on a.ExecutableOptionalCourseID equals b.ExecutableOptionalCourseID
  242. select new OptionalCourseClassListView
  243. {
  244. ExecutableOptionalCourseID = a.ExecutableOptionalCourseID,
  245. ClassmajorID = b.ClassmajorID,
  246. Name=b.Name,
  247. //EducationMissionClassID = a.EducationMissionClassID,
  248. UserID = b.UserID,
  249. No = b.No,
  250. yearID = b.CF_Grademajor.GradeID,
  251. StandardID = b.CF_Grademajor.CF_Facultymajor.StandardID,
  252. GrademajorCode = b.CF_Grademajor.Code,
  253. GrademajorName = b.CF_Grademajor.Name,
  254. LearnSystem = b.CF_Grademajor.CF_Facultymajor.LearnSystem,
  255. EducationID = b.CF_Grademajor.CF_Facultymajor.EducationID,
  256. LearningformID = b.CF_Grademajor.CF_Facultymajor.LearningformID,
  257. CoursematerialID=c.CoursematerialID,
  258. CourseCode = c.EM_Coursematerial.CourseCode,
  259. CourseName = c.EM_Coursematerial.CourseName,
  260. SchoolyearID=a.SchoolyearID,
  261. DefaultClassName=a.DefaultClassName,
  262. StudentCount = b.CF_Student.Count(),
  263. };
  264. return query;
  265. }
  266. /// <summary>
  267. /// 提交时查询限选设定及相关班级
  268. /// </summary>
  269. /// <param name="ExecutableOptionalCourseID"></param>
  270. /// <param name="SchoolyearID"></param>
  271. /// <param name="CoursematerialID"></param>
  272. /// <returns></returns>
  273. public IQueryable<OptionalCourseClassListView> GetSubmitcompareClassmajor( )
  274. {
  275. var query = from a in ExecutableOptionalCourseRepository.GetList(x => true
  276. //x.ExecutableOptionalCourseID != ExecutableOptionalCourseID &&
  277. //x.RecordStatus>(int)EMIS.ViewModel.EM_SelectCourseResultStatus.NotSubmit&&
  278. //x.SchoolyearID == SchoolyearID && x.EM_OptionalCoursePlan.CoursematerialID == CoursematerialID
  279. )
  280. from b in a.CF_Classmajor
  281. join c in OptionalCoursePlanRepository.Entities on a.OptionalCourseID equals c.OptionalCourseID
  282. //join d in executableOptionalCourseTeacherRepository.Entities on a.ExecutableOptionalCourseID equals d.ExecutableOptionalCourseID
  283. select new OptionalCourseClassListView
  284. {
  285. ExecutableOptionalCourseID = a.ExecutableOptionalCourseID,
  286. ClassmajorID = b.ClassmajorID,
  287. Name = b.Name,
  288. //EducationMissionClassID = a.EducationMissionClassID,
  289. UserID = b.UserID,
  290. No = b.No,
  291. CoursematerialID = c.CoursematerialID,
  292. SchoolyearID = a.SchoolyearID,
  293. DefaultClassName = a.DefaultClassName,
  294. StudentCount = b.CF_Student.Count(),
  295. //TeacherID = d.UserID.Value,
  296. RecordStatus = a.RecordStatus,
  297. };
  298. return query;
  299. }
  300. /// <summary>
  301. /// 获取任务班授课老师
  302. /// </summary>
  303. /// <param name="educationMissionClassID"></param>
  304. /// <returns></returns>
  305. public IQueryable<OptionalCourseTeacherListView> GetEducationMissionClassTeacherListViewQueryble()
  306. {
  307. var query = from a in ExecutableOptionalCourseRepository.Entities
  308. join b in ExecutableOptionalCourseTeacherRepository.Entities
  309. on a.ExecutableOptionalCourseID equals b.ExecutableOptionalCourseID
  310. select new OptionalCourseTeacherListView
  311. {
  312. ExecutableOptionalCourseID = a.ExecutableOptionalCourseID,
  313. //EducationMissionClassID = a.EducationMissionClassID,
  314. UserID = b.CF_Staff.UserID,
  315. LoginID = b.CF_Staff.Sys_User.LoginID,
  316. Name = b.CF_Staff.Sys_User.Name,
  317. CollegeID = b.CF_Staff.CF_College.CollegeID,
  318. CollegeName = b.CF_Staff.CF_College.Name,
  319. BirthDate = b.CF_Staff.BirthDate,
  320. TeacherType = b.CF_Staff.TeacherTypeID,
  321. IncumbencyState = b.CF_Staff.IncumbencyState,
  322. Title = b.CF_Staff.TitleID,
  323. TeachingMethod = b.TeachingMethod,
  324. };
  325. return query;
  326. }
  327. /// <summary>
  328. /// 获取限选任务班授课老师
  329. /// </summary>
  330. /// <param name="educationMissionClassID"></param>
  331. /// <returns></returns>
  332. public IQueryable<OptionalCourseTeacherListView> GetTeacherList()
  333. {
  334. var query = from a in ExecutableOptionalCourseRepository.Entities
  335. join b in ExecutableOptionalCourseTeacherRepository.Entities
  336. on a.ExecutableOptionalCourseID equals b.ExecutableOptionalCourseID
  337. select new OptionalCourseTeacherListView
  338. {
  339. ID = a.ExecutableOptionalCourseID,
  340. //EducationMissionClassID = a.EducationMissionClassID,
  341. UserID = b.CF_Staff.UserID,
  342. LoginID = b.CF_Staff.Sys_User.LoginID,
  343. Name = b.CF_Staff.Sys_User.Name,
  344. CollegeID = b.CF_Staff.CF_College.CollegeID,
  345. CollegeName = b.CF_Staff.CF_College.Name,
  346. BirthDate = b.CF_Staff.BirthDate,
  347. TeacherType = b.CF_Staff.TeacherTypeID,
  348. IncumbencyState = b.CF_Staff.IncumbencyState,
  349. Title = b.CF_Staff.TitleID,
  350. TeachingMethod = b.TeachingMethod,
  351. };
  352. return query;
  353. }
  354. /// <summary>
  355. /// 获取任选任务班授课老师
  356. /// </summary>
  357. /// <returns></returns>
  358. public IQueryable<OptionalCourseTeacherListView> GetTeacherList1()
  359. {
  360. var query = from a in ExecutableFreeSelectionCouseRepository.Entities
  361. from b in a.EM_ExecutableFreeSelectionCouseTeacher
  362. //on a.ExecutableOptionalCourseID equals b.ExecutableOptionalCourseID
  363. select new OptionalCourseTeacherListView
  364. {
  365. ID = a.ExecutableFreeSelectionCouseID,
  366. //EducationMissionClassID = a.EducationMissionClassID,
  367. UserID = b.CF_Staff.UserID,
  368. LoginID = b.CF_Staff.Sys_User.LoginID,
  369. Name = b.CF_Staff.Sys_User.Name,
  370. CollegeID = b.CF_Staff.CF_College.CollegeID,
  371. CollegeName = b.CF_Staff.CF_College.Name,
  372. BirthDate = b.CF_Staff.BirthDate,
  373. TeacherType = b.CF_Staff.TeacherTypeID,
  374. IncumbencyState = b.CF_Staff.IncumbencyState,
  375. Title = b.CF_Staff.TitleID,
  376. TeachingMethod = b.TeachingMethod,
  377. };
  378. return query;
  379. }
  380. /// <summary>
  381. /// 获取老师
  382. /// </summary>
  383. /// <param name="educationMissionClassID"></param>
  384. /// <returns></returns>
  385. public IQueryable<EMIS.ViewModel.EducationManage.BaseTeacherTeachingView> GetBaseTeacherListViewQueryble()
  386. {
  387. var query = from a in StaffRepository.Entities
  388. select new OptionalCourseTeacherListView
  389. {
  390. //ExecutableOptionalCourseID = a.ExecutableOptionalCourseID,
  391. //EducationMissionClassID = a.EducationMissionClassID,
  392. UserID = a.UserID,
  393. LoginID = a.Sys_User.LoginID,
  394. Name = a.Sys_User.Name,
  395. CollegeID = a.CF_College.CollegeID,
  396. CollegeName = a.CF_College.Name,
  397. BirthDate = a.BirthDate,
  398. TeacherType = a.TeacherTypeID,
  399. IncumbencyState = a.IncumbencyState,
  400. Title = a.TitleID,
  401. //TeachingMethod = a.TeachingMethod,
  402. };
  403. return query;
  404. }
  405. /// <summary>
  406. /// 选课结果页获取课程的学生名单
  407. /// </summary>
  408. /// <param name="type">0限选,1任选</param>
  409. /// <returns></returns>
  410. public IQueryable<BaseStudentView> GetSelectCourseStudent(Expression<Func<EM_ExecutableOptionalCourse, bool>> exp)
  411. {
  412. var q = from a in ExecutableOptionalCourseRepository.GetList(exp)
  413. from b in a.CF_Student.DefaultIfEmpty()
  414. join c in StudentRepository.Entities on b.UserID equals c.UserID
  415. select new BaseStudentView
  416. {
  417. UserID = c.UserID,
  418. LoginID = c.Sys_User.LoginID,
  419. UserName = c.Sys_User.Name,
  420. SexID = c.SexID,
  421. IDNumber = c.IDNumber,
  422. StudentStatus = c.StudentStatus,
  423. InSchoolStatusID = c.InSchoolStatusID,
  424. ClassmajorName = c.CF_Classmajor.Name,
  425. SchoolYearCode = a.CF_Schoolyear.Code,
  426. DefaultClassName = a.DefaultClassName,
  427. CoursematerialCode = a.EM_OptionalCoursePlan.EM_Coursematerial.CourseCode,
  428. CoursematerialName = a.EM_OptionalCoursePlan.EM_Coursematerial.CourseName,
  429. CourseTypeID = a.EM_OptionalCoursePlan.CourseTypeID
  430. };
  431. return q;
  432. }
  433. public IQueryable<BaseStudentView> GetSelectCourseStudent1(Expression<Func<EM_ExecutableFreeSelectionCouse, bool>> exp)
  434. {
  435. var q = from a in ExecutableFreeSelectionCouseRepository.GetList(exp)
  436. from b in a.CF_Student.DefaultIfEmpty()
  437. join c in StudentRepository.Entities on b.UserID equals c.UserID
  438. select new BaseStudentView
  439. {
  440. UserID = c.UserID,
  441. LoginID = c.Sys_User.LoginID,
  442. UserName = c.Sys_User.Name,
  443. SexID = c.SexID,
  444. IDNumber = c.IDNumber,
  445. StudentStatus = c.StudentStatus,
  446. InSchoolStatusID = c.InSchoolStatusID,
  447. ClassmajorName = c.CF_Classmajor.Name,
  448. SchoolYearCode = a.CF_Schoolyear.Code,
  449. DefaultClassName = a.DefaultClassName,
  450. CoursematerialCode = a.EM_FreeSelectionCouse.EM_Coursematerial.CourseCode,
  451. CoursematerialName = a.EM_FreeSelectionCouse.EM_Coursematerial.CourseName,
  452. CourseTypeID = a.EM_FreeSelectionCouse.CourseTypeID
  453. };
  454. return q;
  455. }
  456. public IQueryable<DuplicateOptionCourseView> GetDuplicateOptionCourseViewQueryable(Expression<Func<EM_ExecutableOptionalCourse, bool>> exp)
  457. {
  458. var q = from a in ExecutableOptionalCourseRepository.GetList(exp)
  459. from b in a.CF_Student
  460. from c in ExecutableOptionalCourseRepository.Entities
  461. .Where(x => x.SchoolyearID == a.SchoolyearID && x.EM_OptionalCoursePlan.CoursematerialID == a.EM_OptionalCoursePlan.CoursematerialID
  462. && x.ExecutableOptionalCourseID != a.ExecutableOptionalCourseID && x.RecordStatus == (int)EMIS.ViewModel.EM_SelectCourseResultStatus.Opened)
  463. from d in c.CF_Student.Where(x => x.UserID == b.UserID)
  464. group a by new { SourceName = a.DefaultClassName, DestinationName = c.DefaultClassName } into g
  465. select new DuplicateOptionCourseView
  466. {
  467. SourceName = g.Key.SourceName,
  468. DestinationName = g.Key.DestinationName
  469. };
  470. return q;
  471. }
  472. /// <summary>
  473. /// 选课结果页面,生成任务班时
  474. /// </summary>
  475. /// <param name="executableOptionalCourseIDList"></param>
  476. /// <returns></returns>
  477. public IQueryable<EducationMissionClassStudentView> GetEducationMissionClassStudentByExecutableOptionalCourseID(IList<Guid?> executableOptionalCourseIDList)
  478. {
  479. var q = (from ep in ExecutableOptionalCourseRepository.GetList(x => executableOptionalCourseIDList.Contains(x.ExecutableOptionalCourseID))
  480. join emc in EducationMissionClassRepository.Entities on
  481. new
  482. {
  483. ep.SchoolyearID,
  484. ep.EM_OptionalCoursePlan.CoursematerialID,
  485. HandleModeID = (int?)CF_HandleMode.SelectionCourse
  486. } equals new
  487. {
  488. emc.EM_EducationMission.SchoolyearID,
  489. emc.CoursematerialID,
  490. emc.HandleModeID
  491. }
  492. from esc in emc.EM_EducationSchedulingClass
  493. from s in esc.CF_Student
  494. join u in UserRepository.Entities
  495. on s.UserID equals u.UserID
  496. select new EducationMissionClassStudentView
  497. {
  498. SchoolyearID = emc.EM_EducationMission.SchoolyearID,
  499. CoursematerialID = emc.CoursematerialID,
  500. CourseSelectTypeID = emc.OptionalCourseTypeID,
  501. HandleModeID = emc.HandleModeID,
  502. UserID = u.UserID,
  503. LoginID = u.LoginID,
  504. Name = u.Name,
  505. ClassName = s.CF_Classmajor.Name,
  506. StudentStatus = s.StudentStatus
  507. });
  508. return q;
  509. }
  510. public IQueryable<EM_ExecutableOptionalCourse> GetNoMissionClassExecutableOptionalCourse(int? schoolyearValue, List<Guid> educationMissionClassIDList)
  511. {
  512. var q = (from optional in ExecutableOptionalCourseRepository.GetList(x => x.RecordStatus == (int)EMIS.ViewModel.EM_SelectCourseResultStatus.Created &&
  513. x.CF_Schoolyear.Value >= schoolyearValue)
  514. join missionClass in
  515. (
  516. from missionClass in EducationMissionClassRepository.GetList(x => x.HandleModeID == (int)CF_HandleMode.SelectionCourse && x.OptionalCourseTypeID == (int)CF_CourseSelectType.OptionalCourse && !educationMissionClassIDList.Contains(x.EducationMissionClassID))
  517. join mission in EducationMissionRepository.Entities on missionClass.EducationMissionID equals mission.EducationMissionID
  518. from schedulingClass in missionClass.EM_EducationSchedulingClass
  519. from student in schedulingClass.CF_Student
  520. from optional in student.EM_ExecutableOptionalCourse
  521. .Where(x => x.SchoolyearID == mission.SchoolyearID
  522. && x.EM_OptionalCoursePlan.CoursematerialID == missionClass.CoursematerialID)
  523. group optional by optional.ExecutableOptionalCourseID into g
  524. select new { ExecutableOptionalCourseID = g.Key }
  525. )
  526. on optional.ExecutableOptionalCourseID equals missionClass.ExecutableOptionalCourseID into dmissionClass
  527. from missionClass in dmissionClass.DefaultIfEmpty()
  528. where missionClass.ExecutableOptionalCourseID == null
  529. select optional);
  530. return q;
  531. }
  532. }
  533. }