MinorGraduationApplyDAL.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.MinorGraduation.MinorGraduationManage;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.MinorGraduation.MinorGraduationManage
  10. {
  11. public class MinorGraduationApplyDAL
  12. {
  13. public MinorGraduationApplyRepository minorGraduationApplyRepository { get; set; }
  14. public UserRepository userRepository { get; set; }
  15. public StudentRepository studentRepository { get; set; }
  16. public ClassmajorRepository classmajorRepository { get; set; }
  17. public GrademajorRepository grademajorRepository { get; set; }
  18. public FacultymajorRepository facultymajorRepository { get; set; }
  19. public CollegeRepository collegeRepository { get; set; }
  20. public ClassminorStudentRepository classminorStudentRepository { get; set; }
  21. public ClassminorRepository classminorRepository { get; set; }
  22. public SchoolyearRepository schoolyearRepository { get; set; }
  23. public IQueryable<MinorGraduationApplyView> GetMinorGraduationApplyViewQueryable(Expression<Func<ER_MinorGraduationApply, bool>> exp,
  24. Expression<Func<CF_Student, bool>> expstu)
  25. {
  26. var query = from mgar in minorGraduationApplyRepository.GetList(exp)
  27. join user in userRepository.Entities
  28. on mgar.UserID equals user.UserID
  29. join stu in studentRepository.GetList(expstu)
  30. on mgar.UserID equals stu.UserID
  31. join clastu in classminorStudentRepository.Entities
  32. on mgar.UserID equals clastu.UserID
  33. join appyear in schoolyearRepository.Entities
  34. on mgar.ApplySchoolyearID equals appyear.SchoolyearID
  35. join grayear in schoolyearRepository.Entities
  36. on mgar.GraduatingSemesterID equals grayear.SchoolyearID
  37. join claminor in classminorRepository.Entities
  38. on clastu.ClassminorID equals claminor.ClassminorID
  39. join cla in classmajorRepository.Entities
  40. on stu.ClassmajorID equals cla.ClassmajorID
  41. join gra in grademajorRepository.Entities
  42. on cla.GrademajorID equals gra.GrademajorID
  43. join fac in facultymajorRepository.Entities
  44. on gra.FacultymajorID equals fac.FacultymajorID
  45. join col in collegeRepository.Entities
  46. on fac.CollegeID equals col.CollegeID
  47. select new MinorGraduationApplyView
  48. {
  49. MinorGraduationApplyID = mgar.MinorGraduationApplyID,
  50. UserID = mgar.UserID,
  51. StudentNo = user.LoginID,
  52. UserName = user.Name,
  53. Sex = stu.SexID,
  54. CollegeID = col.CollegeID,
  55. CollegeNo = col.No,
  56. CollegeName = col.Name,
  57. GraduationTypeID = mgar.GraduationTypeID,
  58. ClassminorID = claminor.ClassminorID,
  59. ClassminorName = claminor.Name,
  60. InSchoolStatusID = stu.InSchoolStatusID,
  61. ApprovalResult = mgar.ApprovalResult,
  62. ApplySchoolyearID = mgar.ApplySchoolyearID,
  63. ApplySchoolyearCode = appyear.Code,
  64. GraduatingSemesterID = mgar.GraduatingSemesterID,
  65. GraduatingSemesterCode = grayear.Code,
  66. GraduatingSemesterValue = grayear.Value,
  67. MinorGraduationConditionPackageID = mgar.MinorGraduationConditionPackageID,
  68. MinorGraduationResult = mgar.MinorGraduationResult,
  69. //RecordStatus = mgar.RecordStatus,
  70. ApprovalStatus = mgar.RecordStatus,
  71. Remark = mgar.Remark,
  72. };
  73. return query;
  74. }
  75. }
  76. }