123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.EducationSchedule;
- using EMIS.ViewModel;
- using EMIS.DataLogic.EducationSchedule;
- using EMIS.Entities;
- using EMIS.CommonLogic.SystemServices;
- using System.Linq.Expressions;
- namespace EMIS.CommonLogic.EducationSchedule
- {
- public class EducationSchedulingStopServices : BaseWorkflowServices<ES_EducationSchedulingStop>, IEducationSchedulingStopServices
- {
- public EducationSchedulingDAL EducationSchedulingDAL { get; set; }
- public EducationSchedulingStopDAL EducationSchedulingStopDAL { get; set; }
- public IGridResultSet<EducationSchedulingStopView> GetEducationSchedulingStopViewList(ConfiguretView configuretView, Guid? schoolyearID,
- Guid? coursematerialID, Guid? collegeID, Guid? userID, int? WeekNum, int? WeekDay, Guid? CoursesTimeID, Guid? ClassroomID, Guid? applyUserID, DateTime? starDate, DateTime? endDate, int? recordStatus, int? pageIndex, int? pageSize)
- {
- var statusList = this.GetStatusViewList();
- Expression<Func<ES_EducationSchedulingStop, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<EM_EducationMission, bool>> missionExp = (x => true);
- Expression<Func<EM_EducationMissionClass, bool>> missionClassExp = (x => true);
- exp = exp.And(x => x.ES_EducationSchedulingStopTeacher.AsQueryable().Any(
- this.GetDataRageExpression<ES_EducationSchedulingStopTeacher>(w => w.UserID)));
- if (schoolyearID.HasValue)
- {
- missionExp = missionExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- missionClassExp = missionClassExp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.ES_EducationSchedulingStopTeacher.Any(w => w.CF_Staff.CollegeID == collegeID));
- }
- if (userID.HasValue)
- {
- exp = exp.And(x => x.ES_EducationSchedulingStopTeacher.Any(w => w.UserID == userID));
- }
- if(WeekNum.HasValue)
- {
- exp = exp.And(x => x.WeekNum == WeekNum);
- }
- if (WeekDay.HasValue)
- {
- exp = exp.And(x => x.Weekday == WeekDay);
- }
- if (CoursesTimeID.HasValue)
- {
- exp = exp.And(x => x.CoursesTimeID == CoursesTimeID);
- }
- if (ClassroomID.HasValue)
- {
- exp = exp.And(x => x.ClassroomID == ClassroomID);
- }
- if(applyUserID.HasValue)
- {
- exp = exp.And(x => x.CreateUserID == applyUserID);
- }
- if(starDate.HasValue)
- {
- exp = exp.And(x => x.ApplyTime >= starDate);
- }
- if (endDate.HasValue)
- {
- exp = exp.And(x => x.ApplyTime <= endDate.Value.AddDays(1));
- }
- if (starDate.HasValue && endDate.HasValue)
- {
- exp = exp.And(x => x.ApplyTime >= starDate && x.ApplyTime <= endDate.Value.AddDays(1));
- }
- if (recordStatus.HasValue)
- {
- exp = exp.And(x => x.RecordStatus == recordStatus);
- }
- var query = this.EducationSchedulingStopDAL.GetEducationSchedulingStopViewQueryable(exp, missionExp, missionClassExp);
- var teacherQuery = this.EducationSchedulingStopDAL.GetEducationSchedulingStopTeacherViewQueryable(
- exp, missionExp, missionClassExp);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var resultQuery = query.OrderByDescending(x => x.ApplyTime)
- .ThenBy(x => x.applyUserName);
- var result = resultQuery.ToGridResultSet<EducationSchedulingStopView>(pageIndex, pageSize);
- if (pageIndex.HasValue && pageSize.HasValue)
- {
- var stopIDList = result.rows.Select(x => (Guid?)x.EducationSchedulingStopID).ToList();
- var teacherList = teacherQuery.Where(x => stopIDList.Contains(x.EducationSchedulingStopID))
- .OrderBy(x => x.TeachingMethod).ThenBy(x => x.Name)
- .ToList();
- result.rows.ForEach(x =>
- {
- x.TeacherList = teacherList
- .Where(w => w.EducationSchedulingStopID == x.EducationSchedulingStopID).ToList();
- x.RecordStatusName = statusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name;
- });
- }
- else
- {
- var teacherList = teacherQuery
- .OrderBy(x => x.TeachingMethod).ThenBy(x => x.Name).ToList();
- result.rows.ForEach(x =>
- {
- x.TeacherList = teacherList
- .Where(w => w.EducationSchedulingStopID == x.EducationSchedulingStopID).ToList();
- x.RecordStatusName = statusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name;
- });
- }
- return result;
- }
- public List<EducationSchedulingStopView> GetEducationSchedulingStopViewList(ConfiguretView configuretView,
- Guid? schoolyearID, Guid? coursematerialID, Guid? collegeID, Guid? userID, int? weekNum, int? weekDay, Guid? coursesTimeID, Guid? classroomID, Guid? applyUserID, DateTime? starDate, DateTime? endDate, int? recordStatus)
- {
- return this.GetEducationSchedulingStopViewList(configuretView, schoolyearID,
- coursematerialID, collegeID, userID, weekNum, weekDay, coursesTimeID, classroomID, applyUserID, starDate, endDate, recordStatus, null, null).rows;
- }
- public EducationSchedulingStopView GetEducationSchedulingStopView(Guid educationSchedulingStopID)
- {
- var result = this.EducationSchedulingStopDAL
- .GetEducationSchedulingStopViewQueryable(x => x.EducationSchedulingStopID == educationSchedulingStopID,
- (x => true), (x => true)).FirstOrDefault();
- var educationSchedule = this.EducationSchedulingDAL.EducationSchedulingRepository.GetSingle(x =>
- x.EM_EducationSchedulingClass.EducationMissionClassID == result.EducationMissionClassID
- && x.Weekday == result.Weekday && x.CoursesTimeID == result.CoursesTimeID
- && x.ES_EducationSchedulingWeekNum.Any(w => w.WeekNum == result.WeekNum),
- (x => x.ES_EducationSchedulingWeekNum));
- if (educationSchedule == null)
- {
- throw new Exception("无法读取停课记录,记录指定的课程安排已被移动或删除。");
- }
- result.ScheduleWeekNumList = educationSchedule.ES_EducationSchedulingWeekNum.Select(w => w.WeekNum)
- .ToList();
- return result;
- }
- public void Save(EducationSchedulingStopView educationSchedulingStopView)
- {
- ES_EducationScheduling educationSchedule;
- educationSchedule = this.EducationSchedulingDAL.EducationSchedulingRepository.GetSingle(x =>
- x.EM_EducationSchedulingClass.EducationMissionClassID == educationSchedulingStopView.EducationMissionClassID
- && x.Weekday == educationSchedulingStopView.Weekday && x.CoursesTimeID == educationSchedulingStopView.CoursesTimeID
- && x.ES_EducationSchedulingWeekNum.Any(w => w.WeekNum == educationSchedulingStopView.WeekNum),
- (x => x.EM_EducationSchedulingClass),
- (x => x.ES_EducationSchedulingTeacher));
- if (educationSchedule == null)
- {
- throw new Exception("所选排课记录不存在,请退出重新选择。");
- }
- var startStatusID = this.GetStartStatus();
- var backpointStatusList = this.GetBackpointStatus();
- var scheduleStop = new ES_EducationSchedulingStop();
- if (educationSchedulingStopView.EducationSchedulingStopID != Guid.Empty)
- {
- scheduleStop = this.EducationSchedulingStopDAL.EducationSchedulingStopRepository
- .GetSingle(x => x.EducationSchedulingStopID == educationSchedulingStopView.EducationSchedulingStopID,
- (x => x.ES_EducationSchedulingStopTeacher));
- if (scheduleStop == null)
- {
- throw new Exception("数据已经被删除,请退出重新选择。");
- }
- if (scheduleStop.RecordStatus != startStatusID && !backpointStatusList.Contains(scheduleStop.RecordStatus))
- {
- throw new Exception("数据已提交,不能修改。");
- }
- this.SetModifyStatus(scheduleStop);
- }
- else
- {
- scheduleStop.EducationSchedulingStopID = Guid.NewGuid();
- this.SetNewStatus(scheduleStop);
- scheduleStop.RecordStatus = startStatusID;
- this.UnitOfWork.Add(scheduleStop);
- }
- scheduleStop.EducationMissionClassID = educationSchedule.EM_EducationSchedulingClass.EducationMissionClassID;
- scheduleStop.Weekday = educationSchedulingStopView.Weekday;
- scheduleStop.WeekNum = educationSchedulingStopView.WeekNum;
- scheduleStop.CoursesTimeID = educationSchedulingStopView.CoursesTimeID;
- scheduleStop.ClassroomID = educationSchedulingStopView.ClassroomID;
- if (educationSchedulingStopView.UserID.HasValue)
- {
- scheduleStop.ES_EducationSchedulingStopTeacher = new HashSet<ES_EducationSchedulingStopTeacher>();
- if (educationSchedule.ES_EducationSchedulingTeacher.Any(x => x.UserID == educationSchedulingStopView.UserID
- && x.TeachingMethod == (int)EM_TeachingMethod.Lecturer))
- {
- foreach (var teacher in educationSchedule.ES_EducationSchedulingTeacher)
- {
- var fromTeacher = new ES_EducationSchedulingStopTeacher();
- fromTeacher.EducationSchedulingStopTeacherID = Guid.NewGuid();
- fromTeacher.EducationSchedulingStopID = scheduleStop.EducationSchedulingStopID;
- fromTeacher.UserID = teacher.UserID;
- fromTeacher.TeachingMethod = teacher.TeachingMethod;
- this.SetNewStatus(fromTeacher);
- scheduleStop.ES_EducationSchedulingStopTeacher.Add(fromTeacher);
- }
- }
- else
- {
- var teacher = educationSchedule.ES_EducationSchedulingTeacher.FirstOrDefault(x => x.UserID == educationSchedulingStopView.UserID);
- var fromTeacher = new ES_EducationSchedulingStopTeacher
- {
- EducationSchedulingStopTeacherID = Guid.NewGuid(),
- EducationSchedulingStopID = scheduleStop.EducationSchedulingStopID,
- UserID = teacher.UserID,
- TeachingMethod = teacher.TeachingMethod
- };
- this.SetNewStatus(fromTeacher);
- scheduleStop.ES_EducationSchedulingStopTeacher.Add(fromTeacher);
- }
- }
- this.UnitOfWork.Commit();
- }
- public void StopSave( List<Guid> id,Guid? userID)
- {
- List<ES_EducationSchedulingWeekNum> educationScheduleWeekNumList = new List<ES_EducationSchedulingWeekNum>();
- List<ES_EducationScheduling> educationScheduleList = new List<ES_EducationScheduling>();
- List<ES_EducationSchedulingStop> educationSchedulingStopList = new List<ES_EducationSchedulingStop>();
- List<ES_EducationSchedulingStopTeacher> educationSchedulingStopTeacherList = new List<ES_EducationSchedulingStopTeacher>();
- educationScheduleWeekNumList = this.EducationSchedulingDAL.EducationSchedulingWeekNumRepository.GetList(x => id.Contains(x.EducationSchedulingWeekNumID)).ToList();
- var educationScheduleIDs=educationScheduleWeekNumList.Select(x=>x.EducationSchedulingID).ToList();
- educationScheduleList = this.EducationSchedulingDAL.EducationSchedulingRepository.GetList(x => educationScheduleIDs.Contains(x.EducationSchedulingID),
- (x=>x.EM_EducationSchedulingClass),(x=>x.ES_EducationSchedulingTeacher)).ToList();
- educationSchedulingStopList = this.EducationSchedulingStopDAL.EducationSchedulingStopRepository.GetList(x => true).ToList();
- educationSchedulingStopTeacherList = this.EducationSchedulingStopDAL.EducationSchedulingStopTeacherRepository.GetList(x => true).ToList();
- foreach (var educationScheduleWeek in educationScheduleWeekNumList)
- {
- var educationSchedule = educationScheduleList.Where(x => x.EducationSchedulingID == educationScheduleWeek.EducationSchedulingID).FirstOrDefault();
- if (educationSchedule != null)
- {
- var ise = educationSchedulingStopList.Where(
- x => x.EducationMissionClassID == educationSchedule.EM_EducationSchedulingClass.EducationMissionClassID
- && x.Weekday == educationSchedule.Weekday
- && x.WeekNum == educationScheduleWeek.WeekNum
- && x.CoursesTimeID == educationSchedule.CoursesTimeID
- && x.ClassroomID == educationSchedule.ClassroomID
- ).ToList();
- if (ise.Count>0)
- {
- foreach(var isee in ise){
- var iset = educationSchedulingStopTeacherList.Where(x => x.UserID == userID && x.EducationSchedulingStopID == isee.EducationSchedulingStopID).FirstOrDefault();
- if (iset != null)
- {
- throw new Exception("存在重复数据请勿重复申请。");
- }
- }
- }
- var startStatusID = this.GetStartStatus();
- var backpointStatusList = this.GetBackpointStatus();
- var scheduleStop = new ES_EducationSchedulingStop();
- scheduleStop.EducationSchedulingStopID = Guid.NewGuid();
- this.SetNewStatus(scheduleStop);
- scheduleStop.RecordStatus = startStatusID;
- this.UnitOfWork.Add(scheduleStop);
- scheduleStop.EducationMissionClassID = educationSchedule.EM_EducationSchedulingClass.EducationMissionClassID;
- scheduleStop.Weekday = educationSchedule.Weekday;
- scheduleStop.WeekNum = educationScheduleWeek.WeekNum;
- scheduleStop.CoursesTimeID = educationSchedule.CoursesTimeID;
- scheduleStop.ClassroomID = educationSchedule.ClassroomID;
- scheduleStop.ES_EducationSchedulingStopTeacher = new HashSet<ES_EducationSchedulingStopTeacher>();
- if (educationSchedule.ES_EducationSchedulingTeacher.Any(x => x.UserID == userID
- && x.TeachingMethod == (int)EM_TeachingMethod.Lecturer))
- {
- foreach (var teacher in educationSchedule.ES_EducationSchedulingTeacher)
- {
- var fromTeacher = new ES_EducationSchedulingStopTeacher();
- fromTeacher.EducationSchedulingStopTeacherID = Guid.NewGuid();
- fromTeacher.EducationSchedulingStopID = scheduleStop.EducationSchedulingStopID;
- fromTeacher.UserID = teacher.UserID;
- fromTeacher.TeachingMethod = teacher.TeachingMethod;
- this.SetNewStatus(fromTeacher);
- scheduleStop.ES_EducationSchedulingStopTeacher.Add(fromTeacher);
- }
- }
- else
- {
- var teacher = educationSchedule.ES_EducationSchedulingTeacher.FirstOrDefault(x => x.UserID == userID);
- var fromTeacher = new ES_EducationSchedulingStopTeacher
- {
- EducationSchedulingStopTeacherID = Guid.NewGuid(),
- EducationSchedulingStopID = scheduleStop.EducationSchedulingStopID,
- UserID = teacher.UserID,
- TeachingMethod = teacher.TeachingMethod
- };
- this.SetNewStatus(fromTeacher);
- scheduleStop.ES_EducationSchedulingStopTeacher.Add(fromTeacher);
- }
- }
- }
- this.UnitOfWork.Commit();
- }
- public IGridResultSet<EducationSchedulingStopView> GetEducationSchedulingStopApproveList(ConfiguretView configuretView, Guid? schoolyearID, Guid? coursematerialID, Guid? collegeID, Guid? userID,
- int? weekNum, int? weekDay, Guid? coursesTimeID, Guid? classroomID, Guid? applyUserID, DateTime? starDate, DateTime? endDate, int? recordStatus, int? pageIndex, int? pageSize)
- {
- var statusList = this.GetStatusViewList();
- //var appprovalStatusList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- Expression<Func<ES_EducationSchedulingStop, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<EM_EducationMission, bool>> missionExp = (x => true);
- Expression<Func<EM_EducationMissionClass, bool>> missionClassExp = (x => true);
- exp = exp.And(x => x.ES_EducationSchedulingStopTeacher.AsQueryable().Any(
- this.GetDataRageExpression<ES_EducationSchedulingStopTeacher>(w => w.UserID))
- //&& appprovalStatusList.Contains(x.RecordStatus)
- );
- if (schoolyearID.HasValue)
- {
- missionExp = missionExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- missionClassExp = missionClassExp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.ES_EducationSchedulingStopTeacher.Any(w => w.CF_Staff.CollegeID == collegeID));
- }
- if (userID.HasValue)
- {
- exp = exp.And(x => x.ES_EducationSchedulingStopTeacher.Any(w => w.UserID == userID));
- }
- if (weekNum.HasValue)
- {
- exp = exp.And(x => x.WeekNum == weekNum);
- }
- if (weekDay.HasValue)
- {
- exp = exp.And(x => x.Weekday == weekDay);
- }
- if (coursesTimeID.HasValue)
- {
- exp = exp.And(x => x.CoursesTimeID == coursesTimeID);
- }
- if (classroomID.HasValue)
- {
- exp = exp.And(x => x.ClassroomID == classroomID);
- }
- if (applyUserID.HasValue)
- {
- exp = exp.And(x => x.CreateUserID == applyUserID);
- }
- if (starDate.HasValue)
- {
- exp = exp.And(x => x.ApplyTime >= starDate);
- }
- if (endDate.HasValue)
- {
- exp = exp.And(x => x.ApplyTime <= endDate.Value.AddDays(1));
- }
- if (starDate.HasValue && endDate.HasValue)
- {
- exp = exp.And(x => x.ApplyTime >= starDate && x.ApplyTime <= endDate.Value.AddDays(1));
- }
- if (recordStatus.HasValue)
- {
- exp = exp.And(x => x.RecordStatus == recordStatus);
- }
- var query = this.EducationSchedulingStopDAL.GetEducationSchedulingStopViewQueryable(exp, missionExp, missionClassExp);
- var teacherQuery = this.EducationSchedulingStopDAL.GetEducationSchedulingStopTeacherViewQueryable(
- exp, missionExp, missionClassExp);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var resultQuery = query.OrderByDescending(x => x.ApplyTime)
- .ThenBy(x => x.applyUserName);
- var result = resultQuery.ToGridResultSet<EducationSchedulingStopView>(pageIndex, pageSize);
- if (pageIndex.HasValue && pageSize.HasValue)
- {
- var stopIDList = result.rows.Select(x => (Guid?)x.EducationSchedulingStopID).ToList();
- var teacherList = teacherQuery.Where(x => stopIDList.Contains(x.EducationSchedulingStopID))
- .OrderBy(x => x.TeachingMethod).ThenBy(x => x.Name)
- .ToList();
- result.rows.ForEach(x =>
- {
- x.TeacherList = teacherList
- .Where(w => w.EducationSchedulingStopID == x.EducationSchedulingStopID).ToList();
- x.RecordStatusName = statusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name;
- });
- }
- else
- {
- var teacherList = teacherQuery
- .OrderBy(x => x.TeachingMethod).ThenBy(x => x.Name).ToList();
- result.rows.ForEach(x =>
- {
- x.TeacherList = teacherList
- .Where(w => w.EducationSchedulingStopID == x.EducationSchedulingStopID).ToList();
- x.RecordStatusName = statusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name;
- });
- }
- return result;
- }
- public List<EducationSchedulingStopView> GetEducationSchedulingStopApproveList(ConfiguretView configuretView, Guid? schoolyearID, Guid? coursematerialID, Guid? collegeID, Guid? userID,
- int? weekNum, int? weekDay, Guid? coursesTimeID, Guid? classroomID, Guid? applyUserID, DateTime? starDate, DateTime? endDate,int? recordStatus)
- {
- return this.GetEducationSchedulingStopApproveList(configuretView, schoolyearID, coursematerialID, collegeID, userID, weekNum, weekDay, coursesTimeID, classroomID, applyUserID, starDate, endDate, recordStatus,null,null).rows;
- }
- public void Delete(IList<Guid> educationSchedulingStopIDList)
- {
- var startStatus = this.GetStartStatus();
- var submitedAdjustmentList = this.EducationSchedulingStopDAL.EducationSchedulingStopRepository
- .GetList(x => educationSchedulingStopIDList.Contains(x.EducationSchedulingStopID) && x.RecordStatus != startStatus).ToList();
- if (submitedAdjustmentList.Count > 0)
- {
- throw new Exception("所选记录当中存在已经提交的记录,无法删除。");
- }
- var nullableStopIDList = educationSchedulingStopIDList.Select(x => (Guid?)x).ToList();
- this.UnitOfWork.Delete<ES_EducationSchedulingStopTeacher>(x => nullableStopIDList.Contains(x.EducationSchedulingStopID));
- this.UnitOfWork.Delete<ES_EducationSchedulingStop>(x => nullableStopIDList.Contains(x.EducationSchedulingStopID));
- }
- public void Submit(IList<Guid> educationSchedulingStopIDList, Guid userID)
- {
- var startStatus = this.GetStartStatus();
- var backpointStatusList = this.GetBackpointStatus();
- var adjustmentList = this.EducationSchedulingStopDAL.EducationSchedulingStopRepository
- .GetList(x => educationSchedulingStopIDList.Contains(x.EducationSchedulingStopID));
- if (adjustmentList.Any(x => x.RecordStatus != startStatus && !backpointStatusList.Contains(x.RecordStatus)))
- {
- throw new Exception("只能提交已提交和已退回的记录。");
- }
- var notSubmitList = adjustmentList.Where(x => x.RecordStatus == startStatus).Select(x => x.EducationSchedulingStopID).ToList();
- var submitedList = adjustmentList.Where(x => x.RecordStatus != startStatus).Select(x => x.EducationSchedulingStopID).ToList();
- if (notSubmitList.Count > 0)
- {
- this.StartUp(notSubmitList, userID);
- }
- if (submitedList.Count > 0)
- {
- var action = this.GetActionView(submitedList.First(), userID).FirstOrDefault();
- if (action != null)
- {
- this.Approve(submitedList, userID, action.ActionID);
- }
- }
- var nowTime = DateTime.Now;
- UnitOfWork.Update<ES_EducationSchedulingStop>((x => new ES_EducationSchedulingStop { ApplyUserID = userID, ApplyTime = nowTime }), (x => educationSchedulingStopIDList.Contains(x.EducationSchedulingStopID)));
- }
- public List<EducationSchedulingStopView> GetEducationSchedulingStopViewList(IList<Guid> schedulingStopIDList)
- {
- if (schedulingStopIDList.Count == 0)
- {
- throw new Exception("请选择需要查询的停课记录。");
- }
- var statusList = this.GetStatusViewList();
- Expression<Func<ES_EducationSchedulingStop, bool>> exp = (x => schedulingStopIDList.Contains(x.EducationSchedulingStopID));
- exp = exp.And(x => x.ES_EducationSchedulingStopTeacher.AsQueryable().Any(
- this.GetDataRageExpression<ES_EducationSchedulingStopTeacher>(w => w.UserID)));
- var query = this.EducationSchedulingStopDAL.GetEducationSchedulingStopViewQueryable(exp, (x => true), (x => true));
- var teacherQuery = this.EducationSchedulingStopDAL.GetEducationSchedulingStopTeacherViewQueryable(
- exp, (x => true), (x => true));
- var resultQuery = query.OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CourseName);
- var result = resultQuery.ToList();
- var teacherList = teacherQuery
- .OrderBy(x => x.TeachingMethod).ThenBy(x => x.Name).ToList();
- result.ForEach(x =>
- {
- x.TeacherList = teacherList
- .Where(w => w.EducationSchedulingStopID == x.EducationSchedulingStopID).ToList();
- x.RecordStatusName = statusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name;
- });
- return result;
- }
- public List<EducationSchedulingStopView> GetEducationSchedulingStopApproveList(IList<Guid> schedulingStopIDList)
- {
- if (schedulingStopIDList.Count == 0)
- {
- throw new Exception("请选择需要查询的停课记录。");
- }
- var statusList = this.GetStatusViewList();
- Expression<Func<ES_EducationSchedulingStop, bool>> exp = (x => schedulingStopIDList.Contains(x.EducationSchedulingStopID));
- exp = exp.And(x => x.ES_EducationSchedulingStopTeacher.AsQueryable().Any(
- this.GetDataRageExpression<ES_EducationSchedulingStopTeacher>(w => w.UserID))
- //&& appprovalStatusList.Contains(x.RecordStatus)
- );
- var query = this.EducationSchedulingStopDAL.GetEducationSchedulingStopViewQueryable(exp, (x => true), (x => true));
- var teacherQuery = this.EducationSchedulingStopDAL.GetEducationSchedulingStopTeacherViewQueryable(
- exp, (x => true), (x => true));
- var resultQuery = query.OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CourseName);
- var result = resultQuery.ToList();
- var teacherList = teacherQuery
- .OrderBy(x => x.TeachingMethod).ThenBy(x => x.Name).ToList();
- result.ForEach(x =>
- {
- x.TeacherList = teacherList
- .Where(w => w.EducationSchedulingStopID == x.EducationSchedulingStopID).ToList();
- x.RecordStatusName = statusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name;
- });
- return result;
- }
- }
- }
|