MinorGraduationConditionDAL.cs 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.MinorGraduation.MinorGraduationSetting;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using EMIS.DataLogic.Repositories;
  9. using EMIS.ViewModel.ScoreManage;
  10. using EMIS.ViewModel;
  11. namespace EMIS.DataLogic.MinorGraduation.MinorGraduationSetting
  12. {
  13. public class MinorGraduationConditionDAL
  14. {
  15. public MinorGraduationConditionRepository minorGraduationConditionRepository { get; set; }
  16. public FinallyScoreRepository finallyScoreRepository { get; set; }
  17. public StudentRepository studentRepository { get; set; }
  18. public SchoolyearRepository schoolyearRepository { get; set; }
  19. public CoursematerialRepository coursematerialRepository { get; set; }
  20. public MinorGraduationConditionPackageRepository minorGraduationConditionPackageRepository { get; set; }
  21. public IQueryable<MinorGraduationConditionView> GetMinorGraduationConditionQueryable(Expression<Func<ER_MinorGraduationCondition, bool>> exp)
  22. {
  23. var query = from gc in minorGraduationConditionRepository.GetList(exp)
  24. select new MinorGraduationConditionView
  25. {
  26. MinorGraduationConditionID = gc.MinorGraduationConditionID,
  27. Title = gc.Title,
  28. MethodFullName = gc.MethodFullName,
  29. IsEnable = gc.RecordStatus.Value > 0 ? true : false,
  30. RecordStatus = gc.RecordStatus,
  31. CreateUserID = gc.CreateUserID,
  32. CreateTime = gc.CreateTime,
  33. ModifyUserID = gc.ModifyUserID,
  34. ModifyTime = gc.ModifyTime
  35. };
  36. return query;
  37. }
  38. public IQueryable<StudentScoreView> GetFinallyScoreViewQueryableByUserID(Guid? userID)
  39. {
  40. //处理方式为辅修课的成绩
  41. var query = from finsco in finallyScoreRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.UserID == userID && x.HandleModeID == (int)CF_HandleMode.MinorCourse)
  42. //join stu in studentRepository.GetList(expStudent)
  43. //on finsco.UserID equals stu.UserID
  44. //join sy in schoolyearRepository.Entities
  45. //on finsco.SchoolyearID equals sy.SchoolyearID
  46. //join cou in coursematerialRepository.Entities
  47. //on finsco.CoursematerialID equals cou.CoursematerialID
  48. select new StudentScoreView
  49. {
  50. FinallyScoreID = finsco.FinallyScoreID,
  51. SchoolyearID = finsco.SchoolyearID,
  52. UserID = finsco.UserID,
  53. CourseTypeID = finsco.CourseTypeID,
  54. Credit = finsco.Credit,
  55. TotalHours = finsco.TotalHours,
  56. ExamsCategoryID = finsco.ExamsCategoryID,
  57. ExamsStateID = finsco.ExamsStateID,
  58. TotalScore = finsco.TotalScore,
  59. ScoreCredit = finsco.ScoreCredit,
  60. SchoolyearNumID = finsco.SchoolyearNumID,
  61. StarttermID = finsco.StarttermID,
  62. ResultTypeID = finsco.ResultTypeID,
  63. CreateUserID = finsco.CreateUserID,
  64. CreateTime = finsco.CreateTime
  65. };
  66. return query;
  67. }
  68. public IQueryable<MinorGraduationConditionView> GetMinorGraduationConditionByPackageID(Expression<Func<ER_MinorGraduationConditionPackage, bool>> exp)
  69. {
  70. var query = from mgcpr in minorGraduationConditionPackageRepository.GetList(exp)
  71. from gc in mgcpr.ER_MinorGraduationCondition
  72. select new MinorGraduationConditionView
  73. {
  74. MinorGraduationConditionID = gc.MinorGraduationConditionID,
  75. Title = gc.Title,
  76. MethodFullName = gc.MethodFullName,
  77. IsEnable = gc.RecordStatus.Value > 0 ? true : false,
  78. RecordStatus = gc.RecordStatus,
  79. CreateUserID = gc.CreateUserID,
  80. CreateTime = gc.CreateTime,
  81. ModifyUserID = gc.ModifyUserID,
  82. ModifyTime = gc.ModifyTime
  83. };
  84. return query;
  85. }
  86. }
  87. }