1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.UniversityManage.TeacherManage;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel.ExaminationManage;
- using EMIS.DataLogic.UniversityManage.TeacherManage;
- namespace EMIS.DataLogic.ExaminationManage
- {
- public class ExaminationTeacherDAL
- {
- public ExaminationTeacherRepository ExaminationTeacherRepository { get; set; }
- public ExaminationRoomLayoutRepository ExaminationRoomLayoutRepository { get; set; }
- public ExaminationPlanRepository ExaminationPlanRepository { get; set; }
- public StaffDAL StaffDAL { get; set; }
- public IQueryable<StaffView> GetAvailableStaffView(Expression<Func<EX_ExaminationPlan, bool>> examinationPlanExp,
- Guid classroomID,
- Expression<Func<CF_Staff, bool>> staffExp)
- {
- var q = (
- from et in ExaminationTeacherRepository.Entities
- join s in StaffDAL.GetStaffViewQueryable(staffExp) on et.UserID equals s.UserID
- join nas in (
- from ep in ExaminationPlanRepository.GetList(examinationPlanExp)
- join erl in ExaminationRoomLayoutRepository.Entities on true equals true
- where erl.EX_ExaminationPlan.ExaminationDate == ep.ExaminationDate
- && erl.ClassroomID != classroomID
- && erl.EX_ExaminationPlan.EndTime >= ep.StartTime && erl.EX_ExaminationPlan.StartTime <= ep.EndTime
- from s in erl.CF_Staff
- select s
- ) on et.UserID equals nas.UserID into dnas
- from enas in dnas.DefaultIfEmpty()
- where enas.UserID == null
- select s
- );
- return q;
- }
- public IQueryable<StaffView> GetAvailableStaffViewGdss(Expression<Func<EX_ExaminationPlan, bool>> otherExaminationPlanExp,
- Guid classroomID, Expression<Func<CF_Staff, bool>> staffExp)
- {
- var q = (
- from et in ExaminationTeacherRepository.Entities
- join s in StaffDAL.GetStaffViewQueryable(staffExp) on et.UserID equals s.UserID
- join nas in
- (
- from other in ExaminationPlanRepository.GetList(otherExaminationPlanExp)
- join otherLayout in ExaminationRoomLayoutRepository.Entities on other.ExaminationPlanID equals otherLayout.ExaminationPlanID
- where otherLayout.ClassroomID != classroomID
- from s in otherLayout.CF_Staff
- select s
- ) on et.UserID equals nas.UserID into dnas
- from enas in dnas.DefaultIfEmpty()
- where enas.UserID == null
- select s
- );
- return q;
- }
- public IQueryable<TeacherConflictView> GetConflictStaffView(Expression<Func<EX_ExaminationPlan, bool>> examinationPlanExp,
- DateTime? date, TimeSpan? startTime, TimeSpan? endTime)
- {
- var q = (
- from ep in ExaminationPlanRepository.GetList(examinationPlanExp)
- from erl in ep.EX_ExaminationRoomLayout
- from erls in erl.CF_Staff
- join erlt in
- (
- from erlt1 in ExaminationRoomLayoutRepository.Entities
- from erlst1 in erlt1.CF_Staff
- select new { UserID = erlst1.UserID, ExaminationPlanID = erlt1.EX_ExaminationPlan.ExaminationPlanID,
- ExaminationPlanName = erlt1.EX_ExaminationPlan.ClassName,
- erlt1.EX_ExaminationPlan.ExaminationDate, erlt1.EX_ExaminationPlan.StartTime, erlt1.EX_ExaminationPlan.EndTime }
- ) on erls.UserID equals erlt.UserID
- where ep.ExaminationPlanID != erlt.ExaminationPlanID && erlt.ExaminationDate == date
- && erlt.EndTime >= startTime && erlt.StartTime <= endTime
- select new TeacherConflictView
- {
- UserID = erls.Sys_User.UserID,
- Name = erls.Sys_User.Name,
- ExaminationPlanID = erlt.ExaminationPlanID,
- ExaminationPlanName = erlt.ExaminationPlanName,
- StartTime = erlt.StartTime,
- EndTime = erlt.EndTime
- }
- );
- return q;
- }
- }
- }
|