using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMISOnline.Entities; using EMISOnline.DataLogic.Repositories; using EMISOnline.ViewModel.Educational; namespace EMISOnline.DataLogic.Educational { public class EducationMissionClassDAL { public ExecutablePlanRepository ExecutablePlanRepository { get; set; } public CoursematerialRepository CoursematerialRepository { get; set; } public GrademajorRepository GrademajorRepository { get; set; } public SchoolyearRepository SchoolyearRepository { get; set; } public StudentRepository StudentRepository { get; set; } public ClassmajorRepository ClassmajorRepository { get; set; } public EducationMissionRepository EducationMissionRepository { get; set; } public EducationMissionClassRepository EducationMissionClassRepository { get; set; } public EducationSchedulingClassRepository EducationSchedulingClassRepository { get; set; } public EducationSchedulingClass_CF_StudentRepository EducationSchedulingClass_CF_StudentRepository { get; set; } public IQueryable GetEducationMissionClassList() { var query = from emc in EducationMissionClassRepository.Entities join em in EducationMissionRepository.Entities on emc.EducationMissionID equals em.EducationMissionID join cm in CoursematerialRepository.Entities on emc.CoursematerialID equals cm.CoursematerialID join sy in SchoolyearRepository.Entities on em.SchoolyearID equals sy.SchoolyearID select new EducationMissionClassView { EducationMissionClassID = emc.EducationMissionClassID, Name = emc.Name, CoursematerialName = cm.CourseName, SchoolyearID = sy.SchoolyearID, SchoolyearName = sy.Code, CoursematerialID = emc.CoursematerialID }; return query; } public IQueryable GetEducationMissionClassByUserID(Guid UserID) { var query = from stu in StudentRepository.Entities join escs in EducationSchedulingClass_CF_StudentRepository.Entities on stu.UserID equals escs.UserID join esc in EducationSchedulingClassRepository.Entities on escs.EducationSchedulingClassID equals esc.EducationSchedulingClassID join emc in EducationMissionClassRepository.Entities on esc.EducationMissionClassID equals emc.EducationMissionClassID where stu.UserID == UserID select emc; return query; } } }