MinorSpecialtyCourseDAL.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.MinorManage.MinorCourseManage;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using EMIS.DataLogic.Repositories;
  9. using EMIS.ViewModel;
  10. namespace EMIS.DataLogic.MinorManage.MinorCourseManage
  11. {
  12. public class MinorSpecialtyCourseDAL
  13. {
  14. public MinorCourseRepository MinorCourseRepository { get; set; }
  15. public MinorCourseTeachingSettingRepository MinorCourseTeachingSettingRepository { get; set; }
  16. public MinorCourseTeachingModeTypeRepository MinorCourseTeachingModeTypeRepository { get; set; }
  17. public MinorCourseTeachingPlaceRepository MinorCourseTeachingPlaceRepository { get; set; }
  18. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  19. /// <summary>
  20. /// 查询专业计划
  21. /// </summary>
  22. /// <param name="exp"></param>
  23. /// <returns></returns>
  24. public IQueryable<MinorSpecialtyCourseView> GetMinorSpecialtyCourseViewQueryable(Expression<Func<EM_MinorCourse, bool>> exp)
  25. {
  26. var query = from a in MinorCourseRepository.GetList(exp)
  27. select new MinorSpecialtyCourseView
  28. {
  29. MinorCourseID=a.MinorCourseID,
  30. DepartmentID = a.DepartmentID,
  31. DepartmentName = a.CF_Department.Name,
  32. IsEnable = a.IsEnable ?? true,
  33. CollegeID=a.CF_Department.CF_College.CollegeID,
  34. StandardID = a.StandardID,
  35. CoursematerialID = a.EM_Coursematerial.CoursematerialID,
  36. CourseCode = a.EM_Coursematerial.CourseCode,
  37. CourseName = a.EM_Coursematerial.CourseName,
  38. CourseStructureID = a.CourseStructureID,
  39. CourseCategoryID = a.CourseCategoryID,
  40. CourseTypeID = a.CourseTypeID,
  41. CourseQualityID = a.CourseQualityID,
  42. PracticeTypeID = a.PracticeTypeID,
  43. ExaminationModeID = a.ExaminationModeID,
  44. TeachinglanguageID = a.TeachinglanguageID,
  45. SchoolyearNumID = a.SchoolyearNumID,
  46. SchoolcodeID = a.SchoolcodeID,
  47. //StarttermID = a.CF_Schoolyear.Value - ((a.CF_Grademajor.SchoolyearID * 2 - 1) + a.CF_Grademajor.SchoolcodeID - 1) + 1,
  48. CourseFineID = a.CourseFineID,
  49. IsSpecialtycore = a.IsSpecialtycore ?? true,
  50. IsCooperation = a.IsCooperation ?? true,
  51. IsRequired = a.IsRequired ?? true,
  52. IsElective = a.IsElective ?? true,
  53. IsNetworkCourse = a.IsNetworkCourse ?? true,
  54. IsMainCourse = a.IsMainCourse ?? true,
  55. Credit = a.EM_MinorCourseTeachingSetting.Credit,
  56. TheoryCourse = a.EM_MinorCourseTeachingSetting.TheoryCourse,
  57. Practicehours = a.EM_MinorCourseTeachingSetting.Practicehours,
  58. Trialhours = a.EM_MinorCourseTeachingSetting.Trialhours,
  59. Totalhours=a.EM_MinorCourseTeachingSetting.TheoryCourse+a.EM_MinorCourseTeachingSetting.Practicehours+a.EM_MinorCourseTeachingSetting.Trialhours,
  60. WeeklyNum = a.EM_MinorCourseTeachingSetting.WeeklyNum,
  61. TheoryWeeklyNum = a.EM_MinorCourseTeachingSetting.TheoryWeeklyNum,
  62. PracticeWeeklyNum = a.EM_MinorCourseTeachingSetting.PracticeWeeklyNum,
  63. TrialWeeklyNum = a.EM_MinorCourseTeachingSetting.TrialWeeklyNum,
  64. StartWeeklyNum = a.EM_MinorCourseTeachingSetting.StartWeeklyNum,
  65. WeeklyHours = a.EM_MinorCourseTeachingSetting.WeeklyHours,
  66. EndWeeklyNum = a.EM_MinorCourseTeachingSetting.EndWeeklyNum,
  67. CreateUserID = a.CreateUserID,
  68. CreateTime = a.CreateTime,
  69. ResultTypeID = a.ResultTypeID,
  70. Remarks = a.Remarks,
  71. };
  72. return query;
  73. }
  74. /// <summary>
  75. /// 根据辅修专业课程获取授课方式
  76. /// </summary>
  77. /// <param name="specialtyCourseID"></param>
  78. /// <returns></returns>
  79. public List<string> GetTeachingModeTypeQueryble(Guid? MinorCourseID)
  80. {
  81. var query = from a in MinorCourseTeachingModeTypeRepository.Entities.Where(x => x.MinorCourseID == MinorCourseID)
  82. join b in DictionaryItemRepository.Entities on new { a.TeachingModeID, DictionaryCode = DictionaryItem.CF_TeachingMode.ToString() }
  83. equals new { TeachingModeID = b.Value, b.DictionaryCode }
  84. select b.Value.Value.ToString();
  85. return query.ToList();
  86. }
  87. /// <summary>
  88. /// 根据辅修专业课程获取授课地点
  89. /// </summary>
  90. /// <param name="specialtyCourseID"></param>
  91. /// <returns></returns>
  92. public List<string> GetTeachingPlaceQueryble(Guid? MinorCourseID)
  93. {
  94. var query = from a in MinorCourseTeachingPlaceRepository.Entities.Where(x => x.MinorCourseID == MinorCourseID)
  95. join b in DictionaryItemRepository.Entities on new { a.TeachingPlace, DictionaryCode = DictionaryItem.EM_TeachingPlace.ToString() }
  96. equals new { TeachingPlace = b.Value, b.DictionaryCode }
  97. select b.Value.Value.ToString();
  98. return query.ToList();
  99. }
  100. }
  101. }