123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 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; }
- /// <summary>
- /// 查询对应的毕业课程类型设定信息View(对应的字典表信息左连毕业课程类型设定表、课程类型选修设置表)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<GraduationCourseTypeSettingView> GetGraduationCourseTypeSettingQueryable(Expression<Func<ER_GraduationCourseTypeSetting, bool>> 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;
- }
- /// <summary>
- /// 查询对应的毕业课程类型设定信息View(设定表与对应的字典表信息内联)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<GraduationCourseTypeSettingView> GetGraduationCourseTypeSettingView(Expression<Func<ER_GraduationCourseTypeSetting, bool>> 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;
- }
- }
- }
|