using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel; using EMIS.DataLogic.UniversityManage.AdministrativeOrgan; using EMIS.DataLogic.Common.CalendarManage; using EMIS.ViewModel.UniversityManage.AdministrativeOrgan; namespace EMIS.DataLogic.EducationSchedule { public class CollegeScheduleDAL { public CollegePriorityRepository CollegePriorityRepository { get; set; } public CollegeScheduleStatusRepository CollegeScheduleStatusRepository { get; set; } public EducationSchedulingRepository EducationSchedulingRepository { get; set; } public SchoolyearRepository SchoolyearRepository { get; set; } public Lazy CollegeDAL { get; set; } public IQueryable GetCollegeViewByTime(DateTime scheduleDate) { var currentSchoolyear = SchoolyearRepository.GetSingle(x => x.IsCurrent == true); scheduleDate = scheduleDate.Date; var sql = (from cp in CollegePriorityRepository.GetList(x => x.StartDate <= scheduleDate && x.EndDate >= scheduleDate) join c in CollegeDAL.Value.GetCollegeViewQueryable(x => true) on cp.CollegeID equals c.CollegeID join css in CollegeScheduleStatusRepository.GetList(x => x.RecordStatus != (int)ES_CollegeScheduleStatusCode.Submited) on new { cp.CollegeID, SchoolyearID = (Guid?)currentSchoolyear.SchoolyearID } equals new { css.CollegeID, css.SchoolyearID } orderby cp.Priority descending select c ).Distinct(); return sql; } } }