GrademajorRequirementDAL.cs 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using System.Linq.Expressions;
  7. using EMIS.ViewModel.GraduationManage.GraduationRequirement;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.GraduationManage.GraduationRequirement
  10. {
  11. public class GrademajorRequirementDAL
  12. {
  13. public GraduationRequirementRepository GraduationRequirementRepository { get; set; }
  14. public GrademajorRepository GrademajorRepository { get; set; }
  15. public FacultymajorRepository FacultymajorRepository { get; set; }
  16. public CollegeRepository CollegeRepository { get; set; }
  17. public SchoolyearRepository SchoolyearRepository { get; set; }
  18. /// <summary>
  19. /// 查询对应的毕业专业学分信息View
  20. /// </summary>
  21. /// <param name="exp"></param>
  22. /// <returns></returns>
  23. public IQueryable<GrademajorRequirementView> GetGradGrademajorRequirementQueryable(Expression<Func<ER_GraduationRequirement, bool>> exp)
  24. {
  25. var query = from gsr in GraduationRequirementRepository.GetList(exp)
  26. join gr in GrademajorRepository.Entities
  27. on gsr.GrademajorID equals gr.GrademajorID
  28. join fa in FacultymajorRepository.Entities
  29. on gr.FacultymajorID equals fa.FacultymajorID
  30. join col in CollegeRepository.Entities
  31. on fa.CollegeID equals col.CollegeID
  32. join sye in SchoolyearRepository.Entities
  33. on
  34. new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
  35. equals
  36. new { SchoolyearID = sye.Years, SchoolcodeID = sye.SchoolcodeID }
  37. into tempsyenter
  38. from syenter in tempsyenter.DefaultIfEmpty()
  39. select new GrademajorRequirementView
  40. {
  41. GraduationRequirementID = gsr.GraduationRequirementID,
  42. GrademajorID = gsr.GrademajorID,
  43. GrademajorCode = gr.Code,
  44. GrademajorName = gr.Name,
  45. FacultymajorID = gr.FacultymajorID,
  46. FacultymajorNo = fa.Code,
  47. FacultymajorName = fa.Name,
  48. CollegeID = fa.CollegeID,
  49. CollegeNo = col.No,
  50. CollegeName = col.Name,
  51. SchoolyearID = gr.GradeID,
  52. SchoolcodeID = gr.SemesterID,
  53. EnteringSchoolYearID = syenter.SchoolyearID,
  54. EnteringSchoolYearCode = syenter.Code,
  55. GraduatingSemesterID = gr.CF_Schoolyear.SchoolyearID,
  56. GraduatingSemesterCode = gr.CF_Schoolyear.Code,
  57. StandardID = fa.StandardID,
  58. EducationID = fa.EducationID,
  59. LearningformID = fa.LearningformID,
  60. LearnSystem = fa.LearnSystem,
  61. OptionalCourseCredit = gsr.OptionalCourseCredit,
  62. RequiredCredit = gsr.RequiredCredit,
  63. TotalCredit = gsr.TotalCredit,
  64. RecordStatus = gsr.RecordStatus,
  65. CreateUserID = gsr.CreateUserID,
  66. CreateTime = gsr.CreateTime,
  67. ModifyUserID = gsr.ModifyUserID,
  68. ModifyTime = gsr.ModifyTime
  69. };
  70. return query;
  71. }
  72. }
  73. }