using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using EMIS.Entities;
using EMIS.ViewModel;
using EMIS.ViewModel.Cultureplan;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.Common.Cultureplan
{
public class CoursematerialDAL
{
public CoursematerialRepository CoursematerialRepository { get; set; }
public ClassGroupingRepository ClassGroupingRepository { get; set; }
///
/// 查询对应的课程信息CoursematerialView
///
///
///
public IQueryable GetCoursematerialViewQueryable(Expression> exp)
{
var query = from cou in CoursematerialRepository.GetList(exp)
join cg in ClassGroupingRepository.Entities
on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg
from coucg in tempcg.DefaultIfEmpty()
select new CoursematerialView
{
CoursematerialID = cou.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
Abbreviation = cou.Abbreviation,
EnglishName = cou.EnglishName,
StandardName = cou.StandardName,
CourseEdition = cou.CourseEdition,
CourseLevelID = cou.CourseLevelID,
CourseScienceID = cou.CourseScienceID,
ClassGroupingID = cou.ClassGroupingID,
ClassName = coucg.ClassName,
CourseSynopsis = cou.CourseSynopsis,
CourseReserve = cou.CourseReserve,
IsEnable = cou.IsEnable == true ? true : false,
Remark = cou.Remark,
RecordStatus = cou.RecordStatus,
CreateUserID = cou.CreateUserID,
CreateTime = cou.CreateTime,
ModifyUserID = cou.ModifyUserID,
ModifyTime = cou.ModifyTime
};
return query;
}
}
}