EducationMissionClassDAL.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMISOnline.Entities;
  6. using EMISOnline.DataLogic.Repositories;
  7. using EMISOnline.ViewModel.Educational;
  8. namespace EMISOnline.DataLogic.Educational
  9. {
  10. public class EducationMissionClassDAL
  11. {
  12. public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
  13. public CoursematerialRepository CoursematerialRepository { get; set; }
  14. public GrademajorRepository GrademajorRepository { get; set; }
  15. public SchoolyearRepository SchoolyearRepository { get; set; }
  16. public StudentRepository StudentRepository { get; set; }
  17. public ClassmajorRepository ClassmajorRepository { get; set; }
  18. public EducationMissionRepository EducationMissionRepository { get; set; }
  19. public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
  20. public EducationSchedulingClassRepository EducationSchedulingClassRepository { get; set; }
  21. public EducationSchedulingClass_CF_StudentRepository EducationSchedulingClass_CF_StudentRepository { get; set; }
  22. public IQueryable<EducationMissionClassView> GetEducationMissionClassList()
  23. {
  24. var query = from emc in EducationMissionClassRepository.Entities
  25. join em in EducationMissionRepository.Entities on emc.EducationMissionID equals em.EducationMissionID
  26. join cm in CoursematerialRepository.Entities on emc.CoursematerialID equals cm.CoursematerialID
  27. join sy in SchoolyearRepository.Entities on em.SchoolyearID equals sy.SchoolyearID
  28. select new EducationMissionClassView
  29. {
  30. EducationMissionClassID = emc.EducationMissionClassID,
  31. Name = emc.Name,
  32. CoursematerialName = cm.CourseName,
  33. SchoolyearID = sy.SchoolyearID,
  34. SchoolyearName = sy.Code,
  35. CoursematerialID = emc.CoursematerialID
  36. };
  37. return query;
  38. }
  39. public IQueryable<EM_EducationMissionClass> GetEducationMissionClassByUserID(Guid UserID)
  40. {
  41. var query = from stu in StudentRepository.Entities
  42. join escs in EducationSchedulingClass_CF_StudentRepository.Entities on stu.UserID equals escs.UserID
  43. join esc in EducationSchedulingClassRepository.Entities on escs.EducationSchedulingClassID equals esc.EducationSchedulingClassID
  44. join emc in EducationMissionClassRepository.Entities on esc.EducationMissionClassID equals emc.EducationMissionClassID
  45. where stu.UserID == UserID
  46. select emc;
  47. return query;
  48. }
  49. }
  50. }