12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.CultureplanManage.CourseMaterial;
- using EMIS.DataLogic.Repositories;
- namespace EMIS.DataLogic.CultureplanManage.CourseMaterial
- {
- public class TeachTypeDAL
- {
- public ClassGroupingRepository ClassGroupingRepository { get; set; }
- public ClassGroupingSettingsRepository ClassGroupingSettingsRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- /// <summary>
- /// 查询对应的上课类型信息TeachTypeView
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<TeachTypeView> GetTeachTypeViewQueryable(Expression<Func<EM_ClassGrouping, bool>> exp)
- {
- var query = from cg in ClassGroupingRepository.GetList(exp)
- select new TeachTypeView
- {
- ClassGroupingID = cg.ClassGroupingID,
- ClassName = cg.ClassName,
- TeachingModeIDList = cg.EM_ClassGroupingSettings.Select(x => x.TeachingModeID).ToList(),
- Remark = cg.Remark,
- RecordStatus = cg.RecordStatus,
- CreateUserID = cg.CreateUserID,
- CreateTime = cg.CreateTime,
- ModifyUserID = cg.ModifyUserID,
- ModifyTime = cg.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的上课类型分班明细信息TeachTypeSettingView(根据主表)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<TeachTypeSettingView> GetTeachTypeSettingViewQueryable(Expression<Func<EM_ClassGrouping, bool>> exp)
- {
- var query = from dic in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
- join cgs in
- (
- from cg in ClassGroupingRepository.GetList(exp)
- join cgs in ClassGroupingSettingsRepository.Entities
- on cg.ClassGroupingID equals cgs.ClassGroupingID
- select new
- {
- ClassGroupingSettingsID = cgs.ClassGroupingSettingsID,
- ClassGroupingID = cgs.ClassGroupingID,
- ClassName = cg.ClassName,
- TeachingModeID = cgs.TeachingModeID,
- RecordStatus = cgs.RecordStatus
- }
- )
- on dic.Value equals cgs.TeachingModeID into tempcgs
- from diccgs in tempcgs.DefaultIfEmpty()
- select new TeachTypeSettingView
- {
- ClassGroupingSettingsID = diccgs.ClassGroupingSettingsID == null ? Guid.Empty : diccgs.ClassGroupingSettingsID,
- ClassGroupingID = diccgs.ClassGroupingID,
- ClassName = diccgs.ClassName,
- TeachingModeID = dic.Value,
- IsDivide = diccgs.ClassGroupingSettingsID == null ? false : true,
- IsDisplay = dic.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
- RecordStatus = diccgs.RecordStatus
- };
- return query;
- }
- }
- }
|