123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel.CalendarManage;
- using EMIS.ViewModel;
- namespace EMIS.DataLogic.Common.CalendarManage
- {
- public class CoursesTimeDAL
- {
- public CoursesTimeRepository coursesTimeRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
-
- /// <summary>
- /// 读取课程时间信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<CoursesTimeView> GetCoursesTimeQueryable(Expression<Func<EM_CoursesTime, bool>> exp)
- {
- var query = from a in coursesTimeRepository.GetList(exp)
- join c in dictionaryItemRepository.Entities on new { a.TimesSegment, DictionaryCode = "CF_TimesSegment" }
- equals new { TimesSegment = c.Value.Value, c.DictionaryCode } into gbsta
- from gicbsta in gbsta.DefaultIfEmpty()
- select new CoursesTimeView
- {
- CoursesTimeID = a.CoursesTimeID,
- StartTimes = a.StartTimes,
- EndTimes = a.EndTimes,
- TimesSegment = a.TimesSegment,
- TimesSegmentName = gicbsta.Name,
- StartHour = a.StartHour,
- StartMinutes = a.StartMinutes,
- EndHour = a.EndHour,
- EndMinutes = a.EndMinutes,
- CreateUserID = a.CreateUserID,
- CreateTime = a.CreateTime,
- ModifyUserID = a.ModifyUserID,
- ModifyTime = a.ModifyTime
- };
- return query;
- }
- public IQueryable<CoursesTimeView> GetNextCoursesTimeQueryable(Expression<Func<EM_CoursesTime, bool>> exp)
- {
- var query = from a in coursesTimeRepository.GetList(exp)
- join nc in coursesTimeRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE) on a.StartTimes + 1 equals nc.StartTimes
- join c in dictionaryItemRepository.Entities on new { nc.TimesSegment, DictionaryCode = "CF_TimesSegment" }
- equals new { TimesSegment = c.Value.Value, c.DictionaryCode } into gbsta
- from gicbsta in gbsta.DefaultIfEmpty()
- select new CoursesTimeView
- {
- CoursesTimeID = nc.CoursesTimeID,
- StartTimes = a.StartTimes,
- EndTimes = a.EndTimes,
- TimesSegment = nc.TimesSegment,
- TimesSegmentName = gicbsta.Name,
- StartHour = nc.StartHour,
- StartMinutes = nc.StartMinutes,
- EndHour = nc.EndHour,
- EndMinutes = nc.EndMinutes,
- CreateUserID = nc.CreateUserID,
- CreateTime = nc.CreateTime,
- ModifyUserID = nc.ModifyUserID,
- ModifyTime = nc.ModifyTime
- };
- return query;
- }
- }
- }
|