123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.EducationSchedule;
- using System.Linq.Expressions;
- using EMIS.Entities;
- namespace EMIS.DataLogic.EducationSchedule
- {
- public class TeacherScheduleDAL
- {
- public TeacherScheduleSettingRepository TeacherScheduleSettingRepository { get; set; }
- public EducationSchedulingRepository EducationSchedulingRepository { get; set; }
- public StaffRepository StaffRepository { get; set; }
- public IQueryable<TeacherWorkTimeView> GetTeacherWorkTimeView(Expression<Func<ES_EducationScheduling, bool>> schedulingExp,
- Expression<Func<CF_Staff, bool>> staffExp)
- {
- var q = (from es in EducationSchedulingRepository.GetList(schedulingExp)
- from s in es.ES_EducationSchedulingTeacher
- from eswn in es.ES_EducationSchedulingWeekNum.Where(x => x.WeekNum.HasValue)
- group es by new { s.CF_Staff.UserID, Name = s.CF_Staff.Sys_User.Name, WeekNum = eswn.WeekNum } into g
- select new TeacherWorkTimeView
- {
- UserID = g.Key.UserID,
- Name = g.Key.Name,
- WeekNum = g.Key.WeekNum ?? 0,
- WorkTime = g.Sum(x => (x.EM_CoursesTime.EndTimes != null && x.EM_CoursesTime.StartTimes != null) ? (x.EM_CoursesTime.EndTimes - x.EM_CoursesTime.StartTimes + 1) : 0)
- });
- return q;
- }
- }
- }
|