MinorSpecialtyPlanDAL.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel.MinorManage.MinorPlanManage;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel;
  10. namespace EMIS.DataLogic.MinorManage.MinorPlanManage
  11. {
  12. public class MinorSpecialtyPlanDAL
  13. {
  14. public MinorPlanRepository MinorPlanRepository { get; set; }
  15. public MinorPlanTeachingModeTypeRepository MinorPlanTeachingModeTypeRepository { get; set; }
  16. public MinorPlanTeachingPlaceRepository MinorPlanTeachingPlaceRepository { get; set; }
  17. public MinorPlanTeachingSettingRepository MinorPlanTeachingSettingRepository { get; set; }
  18. public MinorCourseRepository MinorCourseRepository { get; set; }
  19. public GrademinorRepository GrademinorRepository { get; set; }
  20. public DepartmentRepository DepartmentRepository { get; set; }
  21. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  22. /// <summary>
  23. /// 查询专业计划
  24. /// </summary>
  25. /// <param name="exp"></param>
  26. /// <returns></returns>
  27. public IQueryable<MinorSpecialtyPlanView> GetMinorSpecialtyPlanViewQueryable(Expression<Func<EM_MinorPlan, bool>> exp)
  28. {
  29. var graduatingSemester = EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID;
  30. if (graduatingSemester == null)
  31. {
  32. throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查");
  33. }
  34. var SchoolcodeID = Convert.ToInt32(graduatingSemester);
  35. var query = from a in MinorPlanRepository.GetList(exp)
  36. select new MinorSpecialtyPlanView
  37. {
  38. MinorPlanID = a.MinorPlanID,
  39. DepartmentID = a.DepartmentID,
  40. DepartmentName = a.CF_Department.Name,
  41. CollegeID = a.CF_Department.CF_College.CollegeID,
  42. CollegeName=a.CF_Department.CF_College.Name,
  43. MinorPlanApplicationID = a.MinorPlanApplicationID,
  44. YearID=a.CF_Grademinor.YearID,
  45. StarttermID = a.CF_Schoolyear.Value - ((a.CF_Grademinor.YearID * 2 - 1) + SchoolcodeID - 1) + 1,
  46. StandardID=a.CF_Grademinor.StandardID,
  47. SchoolcodeID=a.CF_Schoolyear.SchoolcodeID,
  48. SchoolyearNumID = (a.CF_Schoolyear.Value - ((a.CF_Grademinor.YearID * 2 - 1) + SchoolcodeID - 1)) / 2 + 1,
  49. SchoolyearID=a.CF_Schoolyear.SchoolyearID,
  50. SchoolcodeStr=a.CF_Schoolyear.Code,
  51. CoursematerialID = a.EM_Coursematerial.CoursematerialID,
  52. CourseCode = a.EM_Coursematerial.CourseCode,
  53. CourseName = a.EM_Coursematerial.CourseName,
  54. CourseStructureID = a.CourseStructureID,
  55. CourseCategoryID = a.CourseCategoryID,
  56. CourseTypeID = a.CourseTypeID,
  57. CourseQualityID = a.CourseQualityID,
  58. PracticeTypeID = a.PracticeTypeID,
  59. ExaminationModeID = a.ExaminationModeID,
  60. TeachinglanguageID = a.TeachinglanguageID,
  61. CourseFineID = a.CourseFineID,
  62. IsSpecialtycore = a.IsSpecialtycore ?? true,
  63. IsCooperation = a.IsCooperation ?? true,
  64. IsRequired = a.IsRequired ?? true,
  65. IsElective = a.IsElective ?? true,
  66. IsNetworkCourse = a.IsNetworkCourse ?? true,
  67. IsMainCourse = a.IsMainCourse ?? true,
  68. HandleModeID=a.HandleModeID,
  69. IsNeedMaterial = a.IsNeedMaterial ?? true,
  70. Credit = a.EM_MinorPlanTeachingSetting.Credit,
  71. TheoryCourse = a.EM_MinorPlanTeachingSetting.TheoryCourse,
  72. Practicehours = a.EM_MinorPlanTeachingSetting.Practicehours,
  73. Trialhours = a.EM_MinorPlanTeachingSetting.Trialhours,
  74. Totalhours = a.EM_MinorPlanTeachingSetting.TheoryCourse + a.EM_MinorPlanTeachingSetting.Practicehours + a.EM_MinorPlanTeachingSetting.Trialhours,
  75. WeeklyNum = a.EM_MinorPlanTeachingSetting.WeeklyNum,
  76. TheoryWeeklyNum = a.EM_MinorPlanTeachingSetting.TheoryWeeklyNum,
  77. PracticeWeeklyNum = a.EM_MinorPlanTeachingSetting.PracticeWeeklyNum,
  78. TrialWeeklyNum = a.EM_MinorPlanTeachingSetting.TrialWeeklyNum,
  79. StartWeeklyNum = a.EM_MinorPlanTeachingSetting.StartWeeklyNum,
  80. WeeklyHours = a.EM_MinorPlanTeachingSetting.WeeklyHours,
  81. EndWeeklyNum = a.EM_MinorPlanTeachingSetting.EndWeeklyNum,
  82. CreateUserID = a.CreateUserID,
  83. CreateTime = a.CreateTime,
  84. ResultTypeID = a.ResultTypeID,
  85. Remarks = a.Remarks,
  86. IsGenerateExecutablePlan = a.EM_ExecutableMinorPlan.Count > 0 ? true : false,
  87. };
  88. return query;
  89. }
  90. /// <summary>
  91. /// 根据辅修专业课程获取授课方式
  92. /// </summary>
  93. /// <param name="specialtyCourseID"></param>
  94. /// <returns></returns>
  95. public List<string> GetTeachingModeTypeQueryble(Guid? MinorPlanID)
  96. {
  97. var query = from a in MinorPlanTeachingModeTypeRepository.Entities.Where(x => x.MinorPlanID == MinorPlanID)
  98. join b in DictionaryItemRepository.Entities on new { a.TeachingModeID, DictionaryCode = DictionaryItem.CF_TeachingMode.ToString() }
  99. equals new { TeachingModeID = b.Value, b.DictionaryCode }
  100. select b.Value.Value.ToString();
  101. return query.ToList();
  102. }
  103. /// <summary>
  104. /// 根据辅修专业课程获取授课地点
  105. /// </summary>
  106. /// <param name="specialtyCourseID"></param>
  107. /// <returns></returns>
  108. public List<string> GetTeachingPlaceQueryble(Guid? MinorPlanID)
  109. {
  110. var query = from a in MinorPlanTeachingPlaceRepository.Entities.Where(x => x.MinorPlanID == MinorPlanID)
  111. join b in DictionaryItemRepository.Entities on new { a.TeachingPlace, DictionaryCode = DictionaryItem.EM_TeachingPlace.ToString() }
  112. equals new { TeachingPlace = b.Value, b.DictionaryCode }
  113. select b.Value.Value.ToString();
  114. return query.ToList();
  115. }
  116. /// <summary>
  117. /// 查询所有年级和专业课程信息
  118. /// </summary>
  119. /// <returns></returns>
  120. public IQueryable<MinorPlanApplyView> StandardAndMinorSpecialtyCourseView(Expression<Func<EM_MinorCourse, bool>> exp, int? YearID)
  121. {
  122. var graduatingSemester = EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID;
  123. if (graduatingSemester == null)
  124. {
  125. throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查");
  126. }
  127. var SchoolcodeID = Convert.ToInt32(graduatingSemester);
  128. var query = from MinorCourse in MinorCourseRepository.GetList(exp)
  129. join GrademinorApply in
  130. (
  131. from Grademinor in GrademinorRepository.GetList(x => x.YearID == YearID)
  132. join MinorPlan in MinorPlanRepository.Entities on new { Grademinor.GrademinorID }
  133. equals new { GrademinorID = (Guid)MinorPlan.GrademinorID }
  134. select new
  135. {
  136. GrademinorID = Grademinor.GrademinorID,
  137. MinorPlanID = MinorPlan.MinorPlanID,
  138. CoursematerialID = MinorPlan.CoursematerialID,
  139. CollegeID = Grademinor.CollegeID,
  140. SchoolyearID = Grademinor.SchoolyearID,
  141. StandardID = Grademinor.StandardID,
  142. YearID = Grademinor.YearID
  143. }
  144. ) on new { MinorCourse.CoursematerialID, MinorCourse.StandardID } equals new { GrademinorApply.CoursematerialID, GrademinorApply.StandardID }
  145. into GrademinorApplication
  146. from GA in GrademinorApplication.DefaultIfEmpty()
  147. where GA.GrademinorID == null && GA.MinorPlanID == null
  148. select new MinorPlanApplyView
  149. {
  150. GradeMinorApplicationID = GA.GrademinorID,
  151. MinorPlanApplicationID = GA.MinorPlanID,
  152. MinorCourseID = MinorCourse.MinorCourseID,
  153. CollegeID = MinorCourse.CF_Department.CollegeID,
  154. CoursematerialID = MinorCourse.CoursematerialID,
  155. CourseCode = MinorCourse.EM_Coursematerial.CourseCode,
  156. CourseName = MinorCourse.EM_Coursematerial.CourseName,
  157. SchoolyearID = GA.SchoolyearID,
  158. YearID = GA.YearID,
  159. StandardID = MinorCourse.StandardID,
  160. CourseCategoryID = MinorCourse.CourseCategoryID,
  161. CourseQualityID = MinorCourse.CourseQualityID,
  162. SchoolcodeID = MinorCourse.SchoolcodeID,
  163. SchoolyearNumID = MinorCourse.SchoolyearNumID,
  164. StarttermID = ((MinorCourse.SchoolyearNumID - 1) * 2) + (MinorCourse.SchoolcodeID == SchoolcodeID ? 0 : 1) + 1,
  165. Credit = MinorCourse.EM_MinorCourseTeachingSetting.Credit ?? 0,
  166. TheoryCourse = MinorCourse.EM_MinorCourseTeachingSetting.TheoryCourse ?? 0,
  167. Practicehours = MinorCourse.EM_MinorCourseTeachingSetting.Practicehours ?? 0,
  168. Trialhours = MinorCourse.EM_MinorCourseTeachingSetting.Trialhours ?? 0,
  169. Totalhours = (MinorCourse.EM_MinorCourseTeachingSetting.TheoryCourse
  170. + MinorCourse.EM_MinorCourseTeachingSetting.Practicehours) ?? 0,
  171. TheoryWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.TheoryWeeklyNum ?? 0,
  172. PracticeWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.PracticeWeeklyNum ?? 0,
  173. TrialWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.TrialWeeklyNum ?? 0,
  174. SchoolweeksNum = (MinorCourse.EM_MinorCourseTeachingSetting.TheoryWeeklyNum
  175. + MinorCourse.EM_MinorCourseTeachingSetting.PracticeWeeklyNum) ?? 0,
  176. StartWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.StartWeeklyNum ?? 0,
  177. EndWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.EndWeeklyNum ?? 0,
  178. WeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.WeeklyNum ?? 0,
  179. WeeklyHours = MinorCourse.EM_MinorCourseTeachingSetting.WeeklyHours ?? 0,
  180. DepartmentID = MinorCourse.DepartmentID,
  181. CourseStructureID = MinorCourse.CourseStructureID,
  182. CourseTypeID = MinorCourse.CourseTypeID,
  183. ExaminationModeID = MinorCourse.ExaminationModeID,
  184. TeachinglanguageID = MinorCourse.TeachinglanguageID,
  185. PracticeTypeID = MinorCourse.PracticeTypeID,
  186. CourseFineID = MinorCourse.CourseFineID,
  187. IsSpecialtycore = MinorCourse.IsSpecialtycore ?? false,
  188. IsCooperation = MinorCourse.IsCooperation ?? false,
  189. IsRequired = MinorCourse.IsRequired ?? false,
  190. IsElective = MinorCourse.IsElective ?? false,
  191. IsNetworkCourse = MinorCourse.IsNetworkCourse ?? false,
  192. IsNeedMaterial = true,
  193. HandleModeID = (int)EMIS.ViewModel.CF_HandleMode.MinorCourse,
  194. IsMainCourse = MinorCourse.IsMainCourse ?? false,
  195. IsEnable = MinorCourse.IsEnable ?? false,
  196. ResultTypeID = MinorCourse.ResultTypeID
  197. };
  198. return query;
  199. }
  200. /// <summary>
  201. /// 查询所有年级和专业课程信息
  202. /// </summary>
  203. /// <returns></returns>
  204. public IQueryable<MinorSpecialtyPlanView> GetStandardView(Expression<Func<CF_Grademinor, bool>> exp)
  205. {
  206. var query = from Grademinor in GrademinorRepository.GetList(exp)
  207. select new MinorSpecialtyPlanView
  208. {
  209. StandardID = Grademinor.StandardID
  210. };
  211. return query;
  212. }
  213. }
  214. }