using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.ViewModel.GraduationManage.GraduationRequirement;
using System.Linq.Expressions;
using EMIS.Entities;
using EMIS.DataLogic.Repositories;
using EMIS.ViewModel;
namespace EMIS.DataLogic.GraduationManage.GraduationRequirement
{
public class GraduationCourseTypeSettingDAL
{
public GraduationCourseTypeSettingRepository GraduationCourseTypeSettingRepository { get; set; }
public CourseTypeSelectCourseTypeRepository CourseTypeSelectCourseTypeRepository { get; set; }
public DictionaryItemRepository DictionaryItemRepository { get; set; }
///
/// 查询对应的毕业课程类型设定信息View(对应的字典表信息左连毕业课程类型设定表、课程类型选修设置表)
///
///
///
public IQueryable GetGraduationCourseTypeSettingQueryable(Expression> exp)
{
var query = from courseType in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseType).Name)
join cs in CourseTypeSelectCourseTypeRepository.Entities
on courseType.Value equals cs.CourseTypeID
into tempcs
from csc in tempcs.DefaultIfEmpty()
join gs in GraduationCourseTypeSettingRepository.GetList(exp)
on courseType.Value equals gs.CourseTypeID
into tempgs
from gcs in tempgs.DefaultIfEmpty()
select new GraduationCourseTypeSettingView
{
GraduationCourseTypeSettingID = gcs.GraduationCourseTypeSettingID == null ? Guid.Empty : gcs.GraduationCourseTypeSettingID,
CourseTypeID = courseType.Value,
CourseTypeName = courseType.Name,
ColourBlock = "",
CourseTypeColour = (csc.CourseTypeColour == null || csc.CourseTypeColour == "") ? "white" : csc.CourseTypeColour,
IsRequired = csc.IsRequired == null ? false : csc.IsRequired,
IsOptionalCourse = csc.IsOptionalCourse == null ? false : csc.IsOptionalCourse,
IsFreeSelectionCourse = csc.IsFreeSelectionCourse == null ? false : csc.IsFreeSelectionCourse,
IsElective = gcs.IsElective == null ? false : gcs.IsElective,
IsElectivePublic = gcs.IsElectivePublic == null ? false : gcs.IsElectivePublic,
IsGeneralEducation = gcs.IsGeneralEducation == null ? false : gcs.IsGeneralEducation,
IsSchoolbasedCurriculum = gcs.IsSchoolbasedCurriculum == null ? false : gcs.IsSchoolbasedCurriculum,
IsPractise = gcs.IsPractise == null ? false : gcs.IsPractise,
IsDisplay = courseType.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
RecordStatus = gcs.RecordStatus,
CreateUserID = gcs.CreateUserID,
CreateTime = gcs.CreateTime,
ModifyUserID = gcs.ModifyUserID,
ModifyTime = gcs.ModifyTime
};
return query;
}
///
/// 查询对应的毕业课程类型设定信息View(设定表与对应的字典表信息内联)
///
///
///
public IQueryable GetGraduationCourseTypeSettingView(Expression> exp)
{
var query = from gcs in GraduationCourseTypeSettingRepository.GetList(exp)
join courseType in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseType).Name)
on gcs.CourseTypeID equals courseType.Value
select new GraduationCourseTypeSettingView
{
GraduationCourseTypeSettingID = gcs.GraduationCourseTypeSettingID,
CourseTypeID = courseType.Value,
CourseTypeName = courseType.Name,
IsElective = gcs.IsElective,
IsElectivePublic = gcs.IsElectivePublic,
IsGeneralEducation = gcs.IsGeneralEducation,
IsSchoolbasedCurriculum = gcs.IsSchoolbasedCurriculum,
IsPractise = gcs.IsPractise,
IsDisplay = courseType.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
RecordStatus = gcs.RecordStatus,
CreateUserID = gcs.CreateUserID,
CreateTime = gcs.CreateTime,
ModifyUserID = gcs.ModifyUserID,
ModifyTime = gcs.ModifyTime
};
return query;
}
}
}