MinorApplyDAL.cs 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.Entities;
  8. using EMIS.ViewModel.MinorManage.MinorApply;
  9. namespace EMIS.DataLogic.MinorManage.MinorApply
  10. {
  11. public class MinorApplyDAL
  12. {
  13. public StudentMinorRegistRepository studentMinorRegistRepository { get; set; }
  14. public UserRepository userRepository { get; set; }
  15. public SchoolyearRepository schoolyearRepository { get; set; }
  16. public StudentRepository studentRepository { get; set; }
  17. public GrademajorRepository grademajorRepository { get; set; }
  18. public ClassmajorRepository classmajorRepository { get; set; }
  19. public GrademinorRepository grademinorRepository { get; set; }
  20. public GrademinorApplicationRepository grademinorApplicationRepository { get; set; }
  21. public DictionaryItemRepository dictionaryItemRepository { get; set; }
  22. public CollegeRepository collegeRepository { get; set; }
  23. public FacultymajorRepository facultymajorRepository { get; set; }
  24. public IQueryable<MinorApplyView> GetMinorApplyViewQueryable(Expression<Func<EM_StudentMinorRegist, bool>> exp,
  25. Expression<Func<CF_Classmajor, bool>> expcla, Expression<Func<CF_College, bool>> expcol)
  26. {
  27. var query = from stumrr in studentMinorRegistRepository.GetList(exp)
  28. join gm in grademinorRepository.Entities
  29. on stumrr.GrademinorID equals gm.GrademinorID
  30. join gmar in grademinorApplicationRepository.Entities
  31. on gm.GrademinorApplicationID equals gmar.GradeMinorApplicationID
  32. join dic in dictionaryItemRepository.GetList(x => x.DictionaryCode == "CF_Standard")
  33. on gmar.StandardID equals dic.Value
  34. join user in userRepository.Entities
  35. on stumrr.UserID equals user.UserID
  36. join year in schoolyearRepository.Entities
  37. on stumrr.SchoolyearID equals year.SchoolyearID
  38. join stu in studentRepository.Entities
  39. on stumrr.UserID equals stu.UserID
  40. join cla in classmajorRepository.GetList(expcla)
  41. on stu.ClassmajorID equals cla.ClassmajorID
  42. join gra in grademajorRepository.Entities
  43. on cla.GrademajorID equals gra.GrademajorID
  44. join fac in facultymajorRepository.Entities
  45. on gra.FacultymajorID equals fac.FacultymajorID
  46. join col in collegeRepository.GetList(expcol)
  47. on fac.CollegeID equals col.CollegeID
  48. select new MinorApplyView
  49. {
  50. StudentMinorRegistID = stumrr.StudentMinorRegistID,
  51. UserID = stumrr.UserID,
  52. LoginID = user.LoginID,
  53. UserName = user.Name,
  54. SchoolyearID = stumrr.SchoolyearID,
  55. SchoolyearCode = year.Code,
  56. GrademajorID = gra.GrademajorID,
  57. GrademajorCode = gra.Code,
  58. GrademajorName = gra.Name,
  59. GradeYearID = gm.YearID,
  60. ClassmajorID = cla.ClassmajorID,
  61. ClassmajorCode = cla.No,
  62. ClassmajorName = cla.Name,
  63. GrademinorID = gm.GrademinorID,
  64. GrademinorCode = dic.Code,
  65. GrademinorName = dic.Name,
  66. RecordStatus = stumrr.RecordStatus,
  67. CollegeID = col.CollegeID,
  68. CollegeCode = col.No,
  69. CollegeName = col.Name,
  70. OpenStatus = gm.RecordStatus,
  71. };
  72. return query;
  73. }
  74. //public IQueryable<MinorApplyView> GetMinorConditionViewQueryable()
  75. //{
  76. //}
  77. }
  78. }