123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel;
- using EMIS.DataLogic.EducationManage;
- using EMIS.DataLogic.EducationSchedule;
- using EMIS.DataLogic.SchedulingManage.SchedulingSettings;
- using EMIS.ViewModel.EducationManagement;
- using Bowin.Common.Utility;
- using EMIS.Utility;
- using Bowin.Common.DataTime;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.CacheManage;
- using EMIS.ViewModel.SchedulingManage.SchedulingSettings;
- using EMIS.DataLogic;
- using EMIS.ViewModel.EducationManage;
- using System.Data.Entity;
- namespace EMIS.CommonLogic.EducationSchedule
- {
- public class RealtimeServices : BaseServices, IRealtimeServices
- {
- public RealtimeDAL RealtimeDAL { get; set; }
- public EducationMissionClassDAL educationMissionClassDAL { get; set; }
- /// <summary>
- /// 列表信息查询
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="collegeID"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="WeekNum"></param>
- /// <param name="WeekDay"></param>
- /// <param name="Times"></param>
- /// <param name="ClassroomID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<EducationMissionClassView> GetEducationMissionClassScheduleViewGrid(ConfiguretView configuretView,
- Guid? collegeID, Guid? openCollegeID, Guid? schoolyearID, int? WeekNum, int? WeekDay, Guid? Times, Guid? ClassroomID, int pageIndex, int pageSize)
- {
- Expression<Func<EM_EducationMissionClass, bool>> exp = (x => true);
- Expression<Func<ES_EducationScheduling, bool>> exeducationScheduling = (x => true);
- Expression<Func<ES_EducationSchedulingWeekNum, bool>> exducationSchedulingWeekNum = (x => true);
- Expression<Func<ES_ClassroomExcessiveUse, bool>> exexcessiveUse = (x => true);
- Expression<Func<ES_ClassroomExcessiveUseScheduling, bool>> exexcessiveUseScheduling = (x => true);
- Expression<Func<ES_ClassroomExcessiveUseSchedulingWeekNum, bool>> exexcessiveUseSchedulingWeekNum = (x => true);
- Expression<Func<CF_Classroom, bool>> exeClassroom = (x => true);
- Expression<Func<EM_CoursesTime, bool>> exeCoursesTime = (x => true);
- if (openCollegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_Department.CollegeID == openCollegeID);
- exexcessiveUse = exexcessiveUse.And(x => x.CollegeID == openCollegeID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CollegeID == collegeID);
- }
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.SchoolyearID == schoolyearID);
- exexcessiveUse = exexcessiveUse.And(x => x.SchoolyearID == schoolyearID);
- }
- if (WeekNum.HasValue)
- {
- exducationSchedulingWeekNum = exducationSchedulingWeekNum.And(x => x.WeekNum == WeekNum);
- exexcessiveUseSchedulingWeekNum = exexcessiveUseSchedulingWeekNum.And(x => x.WeekNum == WeekNum);
- }
- if (WeekDay.HasValue)
- {
- exeducationScheduling = exeducationScheduling.And(x => x.Weekday == WeekDay);
- exexcessiveUseScheduling = exexcessiveUseScheduling.And(x => x.Weekday == WeekDay);
- }
- if (Times.HasValue)
- {
- exeducationScheduling = exeducationScheduling.And(x => x.CoursesTimeID == Times);
- exexcessiveUseScheduling = exexcessiveUseScheduling.And(x => x.CoursesTimeID == Times);
- }
- if (ClassroomID.HasValue)
- {
- exeducationScheduling = exeducationScheduling.And(x => x.ClassroomID == ClassroomID);
- exexcessiveUse = exexcessiveUse.And(x => x.ClassroomID == ClassroomID);
- }
- var query = RealtimeDAL.GetEducationMissionClassViewQueryble(exp, exeducationScheduling, exducationSchedulingWeekNum,
- exexcessiveUse, exexcessiveUseScheduling, exexcessiveUseSchedulingWeekNum);
- //if (openCollegeID.HasValue)
- //{
- // query = query.Where(x => x.OpenCollegeID == openCollegeID || x.OpenCollegeID == null);
- //}
- //if (collegeID.HasValue)
- //{
- // query = query.Where(x => x.CollegeID == collegeID || x.CollegeID == null);
- //}
- //if (schoolyearID.HasValue)
- //{
- // query = query.Where(x => x.SchoolyearID == schoolyearID || x.SchoolyearID == null);
- //}
- //if (WeekNum.HasValue)
- //{
- // query = query.Where(x => x.WeekNum == WeekNum);
- //}
- //if (WeekDay.HasValue)
- //{
- // query = query.Where(x => x.Weekday == WeekDay);
- //}
- //if (Times.HasValue)
- //{
- // query = query.Where(x => x.newCoursesTimeID == Times);
- //}
- //if (ClassroomID.HasValue)
- //{
- // query = query.Where(x => x.ClassroomID == ClassroomID);
- //}
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var resultQuery = query.OrderBy(x => x.ClassroomName)
- .ThenBy(x => x.WeekNum).ThenBy(x => x.Weekday).ThenBy(x => x.StarTimes);
- var result = resultQuery.ToGridResultSet<EducationMissionClassView>(pageIndex, pageSize);
- var educationMissionClassID = result.rows.Select(x => x.EducationMissionClassID).ToList();
- var missionClassTeacherList = educationMissionClassDAL.GetEducationSchedulingTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- result.rows.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID && y.WeekNum == x.WeekNum && y.Weekday == x.Weekday && y.StarTimes == x.StarTimes)));
- return result;
- }
- public IGridResultSet<EducationMissionClassView> GetEducationMissionClassScheduleViewGridGT(ConfiguretView configuretView,
- Guid? collegeID, Guid? openCollegeID, Guid? schoolyearID, int? WeekNum, int? WeekDay, Guid? Times, Guid? ClassroomID, int pageIndex, int pageSize)
- {
- Expression<Func<EM_EducationMissionClass, bool>> exp = (x => true);
- Expression<Func<ES_EducationScheduling, bool>> exeducationScheduling = (x => true);
- Expression<Func<ES_EducationSchedulingWeekNum, bool>> exducationSchedulingWeekNum = (x => true);
- Expression<Func<ES_ClassroomExcessiveUse, bool>> exexcessiveUse = (x => true);
- Expression<Func<ES_ClassroomExcessiveUseScheduling, bool>> exexcessiveUseScheduling = (x => true);
- Expression<Func<ES_ClassroomExcessiveUseSchedulingWeekNum, bool>> exexcessiveUseSchedulingWeekNum = (x => true);
- Expression<Func<CF_Classroom, bool>> exeClassroom = (x => true);
- Expression<Func<EM_CoursesTime, bool>> exeCoursesTime = (x => true);
- if (openCollegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_Department.CollegeID == openCollegeID);
- exexcessiveUse = exexcessiveUse.And(x => x.CollegeID == openCollegeID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CollegeID == collegeID);
- }
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.SchoolyearID == schoolyearID);
- exexcessiveUse = exexcessiveUse.And(x => x.SchoolyearID == schoolyearID);
- }
- //if (WeekNum.HasValue)
- //{
- // exducationSchedulingWeekNum = exducationSchedulingWeekNum.And(x => x.WeekNum == WeekNum);
- // exexcessiveUseSchedulingWeekNum = exexcessiveUseSchedulingWeekNum.And(x => x.WeekNum == WeekNum);
- //}
- //if(WeekDay.HasValue)
- //{
- // exeducationScheduling = exeducationScheduling.And(x => x.Weekday == WeekDay);
- // exexcessiveUseScheduling = exexcessiveUseScheduling.And(x => x.Weekday == WeekDay);
- //}
- //if(Times.HasValue)
- //{
- // exeducationScheduling = exeducationScheduling.And(x => x.CoursesTimeID == Times);
- // exexcessiveUseScheduling = exexcessiveUseScheduling.And(x => x.CoursesTimeID == Times);
- //}
- //if (ClassroomID.HasValue)
- //{
- // exeducationScheduling = exeducationScheduling.And(x => x.ClassroomID == ClassroomID);
- // exexcessiveUse = exexcessiveUse.And(x => x.ClassroomID == ClassroomID);
- //}
- var query = RealtimeDAL.GetNewEducationMissionClassViewQueryble(exp, exeducationScheduling, exducationSchedulingWeekNum,
- exexcessiveUse, exexcessiveUseScheduling, exexcessiveUseSchedulingWeekNum, exeClassroom, exeCoursesTime);
- //if (openCollegeID.HasValue)
- //{
- // query = query.Where(x => x.OpenCollegeID == openCollegeID || x.OpenCollegeID == null);
- //}
- //if (collegeID.HasValue)
- //{
- // query = query.Where(x => x.CollegeID == collegeID || x.CollegeID == null);
- //}
- //if (schoolyearID.HasValue)
- //{
- // query = query.Where(x => x.SchoolyearID == schoolyearID || x.SchoolyearID == null);
- //}
- if (WeekNum.HasValue)
- {
- query = query.Where(x => x.WeekNum == WeekNum);
- }
- if (WeekDay.HasValue)
- {
- query = query.Where(x => x.Weekday == WeekDay);
- }
- if (Times.HasValue)
- {
- query = query.Where(x => x.newCoursesTimeID == Times);
- }
- if (ClassroomID.HasValue)
- {
- query = query.Where(x => x.ClassroomID == ClassroomID);
- }
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var resultQuery = query.OrderBy(x => x.ClassroomName)
- .ThenBy(x => x.WeekNum).ThenBy(x => x.Weekday).ThenBy(x => x.StarTimes);
- var result = resultQuery.ToGridResultSet<EducationMissionClassView>(pageIndex, pageSize);
- var educationMissionClassID = result.rows.Select(x => x.EducationMissionClassID).ToList();
- var missionClassTeacherList = educationMissionClassDAL.GetEducationSchedulingTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- result.rows.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID && y.WeekNum == x.WeekNum && y.Weekday == x.Weekday && y.StarTimes == x.StarTimes)));
- return result;
- }
- /// <summary>
- /// 查询对应的实时课表信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="collegeID"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="WeekNum"></param>
- /// <param name="WeekDay"></param>
- /// <param name="Times"></param>
- /// <param name="ClassroomID"></param>
- /// <returns></returns>
- public List<EducationMissionClassView> GetEducationMissionClassScheduleViewGridForExcel(ConfiguretView configuretView,
- Guid? collegeID, Guid? openCollegeID, Guid? schoolyearID, int? WeekNum, int? WeekDay, Guid? Times, Guid? ClassroomID)
- {
- Expression<Func<EM_EducationMissionClass, bool>> exp = (x => true);
- Expression<Func<ES_EducationScheduling, bool>> exeducationScheduling = (x => true);
- Expression<Func<ES_EducationSchedulingWeekNum, bool>> exducationSchedulingWeekNum = (x => true);
- Expression<Func<ES_ClassroomExcessiveUse, bool>> exexcessiveUse = (x => true);
- Expression<Func<ES_ClassroomExcessiveUseScheduling, bool>> exexcessiveUseScheduling = (x => true);
- Expression<Func<ES_ClassroomExcessiveUseSchedulingWeekNum, bool>> exexcessiveUseSchedulingWeekNum = (x => true);
- Expression<Func<CF_Classroom, bool>> exeClassroom = (x => true);
- Expression<Func<EM_CoursesTime, bool>> exeCoursesTime = (x => true);
- if (openCollegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CF_Department.CollegeID == openCollegeID);
- exexcessiveUse = exexcessiveUse.And(x => x.CollegeID == openCollegeID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.CollegeID == collegeID);
- }
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.EM_EducationMission.SchoolyearID == schoolyearID);
- exexcessiveUse = exexcessiveUse.And(x => x.SchoolyearID == schoolyearID);
- }
- if (WeekNum.HasValue)
- {
- exducationSchedulingWeekNum = exducationSchedulingWeekNum.And(x => x.WeekNum == WeekNum);
- exexcessiveUseSchedulingWeekNum = exexcessiveUseSchedulingWeekNum.And(x => x.WeekNum == WeekNum);
- }
- if (WeekDay.HasValue)
- {
- exeducationScheduling = exeducationScheduling.And(x => x.Weekday == WeekDay);
- exexcessiveUseScheduling = exexcessiveUseScheduling.And(x => x.Weekday == WeekDay);
- }
- if (Times.HasValue)
- {
- exeducationScheduling = exeducationScheduling.And(x => x.CoursesTimeID == Times);
- exexcessiveUseScheduling = exexcessiveUseScheduling.And(x => x.CoursesTimeID == Times);
- exeCoursesTime = exeCoursesTime.And(x => x.CoursesTimeID == Times);
- }
- if (ClassroomID.HasValue)
- {
- exeducationScheduling = exeducationScheduling.And(x => x.ClassroomID == ClassroomID);
- exexcessiveUse = exexcessiveUse.And(x => x.ClassroomID == ClassroomID);
- exeClassroom = exeClassroom.And(x => x.ClassroomID == ClassroomID);
- }
- var query =
- //RealtimeDAL.GetNewEducationMissionClassViewQueryble(exp, exeducationScheduling, exducationSchedulingWeekNum,
- //exexcessiveUse, exexcessiveUseScheduling, exexcessiveUseSchedulingWeekNum, exeClassroom, exeCoursesTime);
- RealtimeDAL.GetEducationMissionClassViewQueryble(exp, exeducationScheduling, exducationSchedulingWeekNum,
- exexcessiveUse, exexcessiveUseScheduling, exexcessiveUseSchedulingWeekNum);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var resultQuery = query.OrderBy(x => x.ClassroomName)
- .ThenBy(x => x.WeekNum).ThenBy(x => x.Weekday).ThenBy(x => x.Times).ThenBy(x => x.TimesHoure);
- var result = resultQuery.ToList();
- var educationMissionClassID = result.Select(x => x.EducationMissionClassID).ToList();
- var missionClassTeacherList = educationMissionClassDAL.GetEducationSchedulingTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
- result.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID && y.WeekNum == x.WeekNum && y.Weekday == x.Weekday && y.StarTimes == x.StarTimes)));
- return result.ToList();
- }
- }
- }
|