using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.DataLogic.Repositories;
using EMIS.ViewModel.SchedulingManage.SchedulingSettings;
using System.Linq.Expressions;
using EMIS.ViewModel.CalendarManage;
using EMIS.Entities;
namespace EMIS.DataLogic.SchedulingManage.SchedulingSettings
{
public class CourseTimeHoursDAL
{
public CoursesTimeRepository coursesTimeRepository { get; set; }
public DictionaryItemRepository dictionaryItemRepository { get; set; }
public CourseTimeHoursRepository courseTimeHoursRepository { get; set; }
///
/// 读取课程课时类别信息
///
///
///
public IQueryable GetCoursesTimeQueryable(Expression> exp, Expression> exps)
{
var query = from a in coursesTimeRepository.GetList(exp)
join b in courseTimeHoursRepository.GetList(exps) on a.CoursesTimeID equals b.CoursesTimeID
join c in dictionaryItemRepository.Entities on new { a.TimesSegment, DictionaryCode = "CF_TimesSegment" }
equals new { TimesSegment = c.Value.Value, c.DictionaryCode } into gbsta
from gicbsta in gbsta.DefaultIfEmpty()
select new CourseTimeHoursView
{
CoursesTimeID = a.CoursesTimeID,
StartTimes = a.StartTimes,
EndTimes = a.EndTimes,
TimesSegment = a.TimesSegment,
TimesSegmentName = gicbsta.Name,
StartHour = a.StartHour,
StartMinutes = a.StartMinutes,
EndHour = a.EndHour,
EndMinutes = a.EndMinutes,
CourseTimeHoursID=b.CourseTimeHoursID,
Year = b.Years,
Hours=b.Hours
};
return query;
}
}
}