123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.CultureplanManage.CourseMaterial;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- namespace EMIS.DataLogic.CultureplanManage.CourseMaterial
- {
- public class CourseTypeSetDAL
- {
- public CourseTypeSelectCourseTypeRepository CourseTypeSelectCourseTypeRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- /// <summary>
- /// 查询对应的课程类型设定信息View(对应的字典表信息左连设定表)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<CourseTypeSetView> GetCourseTypeSetListView(Expression<Func<EM_CourseTypeSelectCourseType, bool>> exp)
- {
- var query = from courseType in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseType).Name)
- join set in CourseTypeSelectCourseTypeRepository.GetList(exp)
- on courseType.Value equals set.CourseTypeID into tempcou
- from courseTypeSet in tempcou.DefaultIfEmpty()
- join usc in UserRepository.Entities
- on courseTypeSet.CreateUserID equals usc.UserID into tempusc
- from uscu in tempusc.DefaultIfEmpty()
- join usm in UserRepository.Entities
- on courseTypeSet.ModifyUserID equals usm.UserID into tempusm
- from usmu in tempusm.DefaultIfEmpty()
- select new CourseTypeSetView
- {
- CourseTypeSelectCourseTypeID = courseTypeSet.CourseTypeSelectCourseTypeID == null ? Guid.Empty : courseTypeSet.CourseTypeSelectCourseTypeID,
- CourseTypeID = courseType.Value,
- CourseTypeName = courseType.Name,
- ColourBlock = "",
- CourseTypeColour = (courseTypeSet.CourseTypeColour == null || courseTypeSet.CourseTypeColour == "") ? "white" : courseTypeSet.CourseTypeColour,
- IsRequired = courseTypeSet.IsRequired == null ? false : courseTypeSet.IsRequired,
- IsOptionalCourse = courseTypeSet.IsOptionalCourse == null ? false : courseTypeSet.IsOptionalCourse,
- IsFreeSelectionCourse = courseTypeSet.IsFreeSelectionCourse == null ? false : courseTypeSet.IsFreeSelectionCourse,
- IsDisplay = courseType.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
- RecordStatus = courseTypeSet.RecordStatus,
- CreateUserID = courseTypeSet.CreateUserID,
- CreateUserName = uscu.Name,
- CreateTime = courseTypeSet.CreateTime,
- ModifyUserID = courseTypeSet.ModifyUserID,
- ModifyUserName = usmu.Name,
- ModifyTime = courseTypeSet.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的课程类型设定信息View(设定表与对应的字典表信息内联)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<CourseTypeSetView> GetCourseTypeSelectCourseType(Expression<Func<EM_CourseTypeSelectCourseType, bool>> exp)
- {
- var query = from courseTypeSet in CourseTypeSelectCourseTypeRepository.GetList(exp)
- join courseType in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseType).Name)
- on courseTypeSet.CourseTypeID equals courseType.Value
- join usc in UserRepository.Entities
- on courseTypeSet.CreateUserID equals usc.UserID into tempusc
- from uscu in tempusc.DefaultIfEmpty()
- join usm in UserRepository.Entities
- on courseTypeSet.ModifyUserID equals usm.UserID into tempusm
- from usmu in tempusm.DefaultIfEmpty()
- select new CourseTypeSetView
- {
- CourseTypeSelectCourseTypeID = courseTypeSet.CourseTypeSelectCourseTypeID,
- CourseTypeID = courseType.Value.Value,
- CourseTypeName = courseType.Name,
- ColourBlock = "",
- CourseTypeColour = (courseTypeSet.CourseTypeColour == null || courseTypeSet.CourseTypeColour == "") ? "white" : courseTypeSet.CourseTypeColour,
- IsRequired = courseTypeSet.IsRequired,
- IsOptionalCourse = courseTypeSet.IsOptionalCourse,
- IsFreeSelectionCourse = courseTypeSet.IsFreeSelectionCourse,
- IsDisplay = courseType.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
- RecordStatus = courseTypeSet.RecordStatus,
- CreateUserID = courseTypeSet.CreateUserID,
- CreateUserName = uscu.Name,
- CreateTime = courseTypeSet.CreateTime,
- ModifyUserID = courseTypeSet.ModifyUserID,
- ModifyUserName = usmu.Name,
- ModifyTime = courseTypeSet.ModifyTime
- };
- return query;
- }
- }
- }
|