1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using System.Data.Entity;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.SelectCourse;
- using EMIS.ViewModel;
- using EMIS.Entities;
- using EMIS.DataLogic.SelectCourse;
- using EMIS.DataLogic.Repositories;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.Utility.FormValidate;
- using EMIS.ViewModel.EnrollManage.SpecialtyManage;
- using System.Transactions;
- namespace EMIS.CommonLogic.SelectCourse
- {
- public class FreeSelectionCourseApplyServices : BaseWorkflowServices<EM_FreeSelectionCouseApply>, IFreeSelectionCourseApplyServices
- {
- public ExecutableFreeSelectionCouseDAL ExecutableFreeSelectionCouseDAL { get; set; }
- public FreeSelectionCoursePlanDAL FreeSelectionCoursePlanDAL { get; set; }
- public FreeSelectionCourseDAL FreeSelectionCourseDAL { get; set; }
- public IStudentSelectCourseServices IStudentSelectCourseServices { get; set; }
- public FreeSelectionCouseTeachingModeRepository FreeSelectionCouseTeachingModeRepository { get; set; }
- public StaffRepository staffRepository { get; set; }
- public UserRepository userRepository { get; set; }
- private IGridResultSet<FreeSelectionCourseApplyView> GetFreeSelectionCourseApplyView(ConfiguretView configuretView,
- Expression<Func<EM_FreeSelectionCouseApply, bool>> exp, int? pageIndex = null, int? pageSize = null, bool? isApproveView = false)
- {
- var freeSelectionCourseView = FreeSelectionCoursePlanDAL.GetFreeSelectionCourseApplyViewQueryable(exp);
- var teacherView = FreeSelectionCoursePlanDAL.GetFreeSelectionCourseApplyTeacherViewQueryable(exp);
- var schedulingView = FreeSelectionCoursePlanDAL.GetScheduling(exp).ToList();
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- freeSelectionCourseView = freeSelectionCourseView.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- }
- freeSelectionCourseView = this.GetQueryByDataRangeByCollege(freeSelectionCourseView);
- IGridResultSet<FreeSelectionCourseApplyView> result;
- IList<FreeSelectionCourseApplyTeacherListView> teacherViewList;
- if (pageIndex.HasValue && pageSize.HasValue)
- {
- if (isApproveView == true)
- {
- result = this.QueryByPendingJob(freeSelectionCourseView, CustomPrincipal.Current.UserID,
- (x => x.FreeSelectionCouseApplyID), (x => x.CreateTime), true, pageIndex, pageSize);
- }
- else
- {
- result = freeSelectionCourseView.OrderByDescending(x => x.CreateTime).ToGridResultSet(pageIndex, pageSize);
- }
- //由于分页后数据量较少,可以考虑用Contains方法在数据库端筛选一下,不分页的情况就不要了
- var freeSelectionCourseIDList = result.rows.Select(x => x.FreeSelectionCouseApplyID).ToList();
- teacherViewList = teacherView.Where(x => freeSelectionCourseIDList.Contains(x.FreeSelectionCourseApplyID)).ToList();
- }
- else
- {
- var list = freeSelectionCourseView.ToList();
- if (isApproveView == true)
- {
- result = this.QueryByPendingJob(freeSelectionCourseView, CustomPrincipal.Current.UserID,
- (x => x.FreeSelectionCouseApplyID), (x => x.CreateTime), true);
- }
- else
- {
- result = new GridResultSet<FreeSelectionCourseApplyView>() { rows = list, total = list.Count };
- }
- teacherViewList = teacherView.ToList();
- }
- var statusViewList = this.GetStatusViewList();
- result.rows.ForEach(x =>
- {
- x.Teachers = new HashSet<FreeSelectionCourseApplyTeacherListView>(teacherViewList
- .Where(w => x.FreeSelectionCouseApplyID == w.FreeSelectionCourseApplyID));
- x.ApprovalStatusName = statusViewList.Where(w => w.ID == x.ApprovalStatus)
- .Select(w => w.Name).FirstOrDefault();
- });
- if (schedulingView.Count > 0)
- {
- var schedulingList = IStudentSelectCourseServices.GetWeekdayTimesSegmentName(schedulingView);
- result.rows.ForEach(x =>
- {
- var list = schedulingList.Where(w => w.ID == x.FreeSelectionCouseApplyID);
- x.WeekdayTimesSegmentName = string.Join(";", list.OrderBy(w => w.Weekday).Select(w => w.WeekdayTimesSegmentName));
- });
- }
- return result;
- }
- public EM_FreeSelectionCouse GetFreeSelectionCourse(Guid? freeSelectionCourseID)
- {
- System.Linq.Expressions.Expression<Func<EM_FreeSelectionCouse, bool>> expression =
- (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expression = (x => x.FreeSelectionCouseID == freeSelectionCourseID);
- return FreeSelectionCourseDAL.FreeSelectionCouseRepository.GetSingle(expression, (x => x.CF_Department), (x => x.EM_Coursematerial));
- }
- public FreeSelectionCourseView GetFreeSelectionCourseView(Guid? freeSelectionCourseID)
- {
- var query = FreeSelectionCourseDAL.GetFreeSelectionCourseViewQueryable(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- return query.Where(x => x.FreeSelectionCouseID == freeSelectionCourseID).FirstOrDefault();
- }
- public EM_FreeSelectionCouseTeachingSetting GetFreeSelectionCourseTeachingSetting(Guid? freeSelectionCourseID)
- {
- //查询条件
- System.Linq.Expressions.Expression<Func<EM_FreeSelectionCouseTeachingSetting, bool>> expression = (x => true);
- expression = (x => x.FreeSelectionCouseID == freeSelectionCourseID);
- return FreeSelectionCourseDAL.FreeSelectionCouseTeachingSettingRepository.GetSingle(expression);
- }
- private bool TeachingModeTypeAdd(List<int> list, Guid? freeSelectionCourseApplyID)
- {
- try
- {
- if (list.Count > 0)
- {
- UnitOfWork.Delete<EM_FreeSelectionCouseApplyTeachingMode>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyID);
- foreach (var i in list)
- {
- EM_FreeSelectionCouseApplyTeachingMode teachingModeType = new EM_FreeSelectionCouseApplyTeachingMode();
- teachingModeType.FreeSelectionCouseApplyTeachingModeID = Guid.NewGuid();
- teachingModeType.FreeSelectionCouseApplyID = freeSelectionCourseApplyID;
- teachingModeType.TeachingModeID = i;
- this.SetNewStatus(teachingModeType);
- UnitOfWork.Add(teachingModeType);
- }
- }
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 根据任选开课获取授课方式
- /// </summary>
- /// <param name="freeSelectionCourseApplyID"></param>
- /// <returns></returns>
- public List<int> GetCourseApplyTeachingModeType(Guid? FreeSelectionCouseApplyID)
- {
- var list = FreeSelectionCoursePlanDAL.GetTeachingModeType(x => x.FreeSelectionCouseApplyID == FreeSelectionCouseApplyID)
- .Select(x => x.Value ?? 0).ToList();
- if (list.Count > 0)
- list.Add((int)EMIS.ViewModel.CF_TeachingMode.Theory);
- return list;
- }
- /// <summary>
- /// 根据任选开课获取授课方式
- /// </summary>
- /// <param name="freeSelectionCourseApplyID"></param>
- /// <returns></returns>
- public List<int> GetCourseApplyGradeYear(Guid? FreeSelectionCouseApplyID)
- {
- List<int> list = new List<int>();
- return FreeSelectionCoursePlanDAL.GetGradeYear(x => x.FreeSelectionCouseApplyID == FreeSelectionCouseApplyID)
- .Select(x => x.Value ?? 0).ToList();
- }
- public EM_FreeSelectionCouse GetFreeSelectionCourseCourse(Guid? coursematerialID)
- {
- //查询条件
- System.Linq.Expressions.Expression<Func<EM_FreeSelectionCouse, bool>> expression = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expression = (x => x.CoursematerialID == coursematerialID);
- return FreeSelectionCourseDAL.FreeSelectionCouseRepository.GetSingle(expression, (x => x.CF_Department), (x => x.EM_Coursematerial));
- }
- public IGridResultSet<FreeSelectionCourseApplyView> GetFreeSelectionCoursePlanViewGrid(ConfiguretView configuretView,
- Guid? schoolyearID, Guid? campusID, Guid? collegeID, Guid? departmentID, int? approvalStatus, int pageIndex, int pageSize)
- {
- Expression<Func<EM_FreeSelectionCouseApply, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- if (campusID.HasValue)
- exp = exp.And(x => x.CF_Department.CF_College.CampusID == campusID);
- if (collegeID.HasValue)
- exp = exp.And(x => x.CF_Department.CollegeID == collegeID);
- if (departmentID.HasValue)
- exp = exp.And(x => x.DepartmentID == departmentID);
- if (approvalStatus.HasValue)
- exp = exp.And(x => x.ApprovalStatus == approvalStatus);
- return this.GetFreeSelectionCourseApplyView(configuretView, exp, pageIndex, pageSize);
- }
- public List<FreeSelectionCourseApplyView> GetFreeSelectionCoursePlanViewList(ConfiguretView configuretView,
- Guid? schoolyearID, Guid? campusID, Guid? collegeID, Guid? departmentID, int? approvalStatus)
- {
- Expression<Func<EM_FreeSelectionCouseApply, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- if (campusID.HasValue)
- exp = exp.And(x => x.CF_Department.CF_College.CampusID == campusID);
- if (collegeID.HasValue)
- exp = exp.And(x => x.CF_Department.CollegeID == collegeID);
- if (departmentID.HasValue)
- exp = exp.And(x => x.DepartmentID == departmentID);
- if (approvalStatus.HasValue)
- exp = exp.And(x => x.ApprovalStatus == approvalStatus);
- return this.GetFreeSelectionCourseApplyView(configuretView, exp).rows;
- }
- public IGridResultSet<FreeSelectionCourseApplyView> GetFreeSelectionCoursePlanApprovalViewGrid(ConfiguretView configuretView,
- Guid? schoolyearID, Guid? campusID, Guid? collegeID, Guid? departmentID, int? approvalStatus, int pageIndex, int pageSize)
- {
- List<int?> approveStatusList = this.GetApproveStatusViewList().Where(x => x.Description.Contains("[AP]")).Select(x => x.ID).ToList();
- Expression<Func<EM_FreeSelectionCouseApply, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE
- && approveStatusList.Contains(x.ApprovalStatus));
- if (schoolyearID.HasValue)
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- if (campusID.HasValue)
- exp = exp.And(x => x.CF_Department.CF_College.CampusID == campusID);
- if (collegeID.HasValue)
- exp = exp.And(x => x.CF_Department.CollegeID == collegeID);
- if (departmentID.HasValue)
- exp = exp.And(x => x.DepartmentID == departmentID);
- if (approvalStatus.HasValue)
- exp = exp.And(x => x.ApprovalStatus == approvalStatus);
- if (approveStatusList.Count > 0)
- exp = exp.And(x => approveStatusList.Contains(x.ApprovalStatus));
- return this.GetFreeSelectionCourseApplyView(configuretView, exp, pageIndex, pageSize, true);
- }
- public List<FreeSelectionCourseApplyView> GetFreeSelectionCoursePlanApprovalView(ConfiguretView configuretView,
- Guid? schoolyearID, Guid? campusID, Guid? collegeID, Guid? departmentID, int? approvalStatus)
- {
- List<int?> approveStatusList = this.GetApproveStatusViewList().Where(x => x.Description.Contains("[AP]")).Select(x => x.ID).ToList();
- Expression<Func<EM_FreeSelectionCouseApply, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE
- && approveStatusList.Contains(x.ApprovalStatus));
- if (schoolyearID.HasValue)
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- if (campusID.HasValue)
- exp = exp.And(x => x.CF_Department.CF_College.CampusID == campusID);
- if (collegeID.HasValue)
- exp = exp.And(x => x.CF_Department.CollegeID == collegeID);
- if (departmentID.HasValue)
- exp = exp.And(x => x.DepartmentID == departmentID);
- if (approvalStatus.HasValue)
- exp = exp.And(x => x.ApprovalStatus == approvalStatus);
- if (approveStatusList.Count > 0)
- exp = exp.And(x => approveStatusList.Contains(x.ApprovalStatus));
- return this.GetFreeSelectionCourseApplyView(configuretView, exp, null, null, true).rows;
- }
- public FreeSelectionCourseApplyView GetFreeSelectionCourseApplyView(Guid? freeSelectionCourseApplyID)
- {
- return FreeSelectionCoursePlanDAL.GetFreeSelectionCourseApplyViewQueryable(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyID)
- .FirstOrDefault();
- }
- public EM_FreeSelectionCouseApply GetFreeSelectionCourseApply(Guid? freeSelectionCourseApplyID)
- {
- //查询条件
- System.Linq.Expressions.Expression<Func<EM_FreeSelectionCouseApply, bool>> expression =
- (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expression = (x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyID);
- return FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyRepository.GetSingle(expression);
- }
- /// <summary>
- /// 提交申请
- /// </summary>
- /// <param name="planApplicationIDs">申请ID</param>
- /// <param name="userID">提交人</param>
- /// <param name="comment">备注</param>
- public void Submit(List<Guid> freeSelectionCourseApplyIDs, Guid userID, string comment = "")
- {
- try
- {
- var startStatus = this.GetStartStatus();
- List<int?> approveStatusList = this.GetApproveStatusViewList().Where(x => x.Description.Contains("[AP]")).Select(x => x.ID).ToList();
- var freeSelectionCouseApplyList = FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyRepository.GetList(x => freeSelectionCourseApplyIDs.Contains(x.FreeSelectionCouseApplyID)).ToList();
- List<Guid> submitIDList = new List<Guid>();
- List<Guid> approveIDList = new List<Guid>();
- if (freeSelectionCouseApplyList.Count > 0)
- {
- for (int i = 0; i < freeSelectionCouseApplyList.Count; i++)
- {
- if (freeSelectionCouseApplyList[i].ApprovalStatus == startStatus)
- {
- submitIDList.Add(freeSelectionCouseApplyList[i].FreeSelectionCouseApplyID);
- }
- else if (approveStatusList.Contains(freeSelectionCouseApplyList[i].ApprovalStatus))
- {
- throw new Exception("数据已提交申请,不能重复提交");
- }
- else
- {
- approveIDList.Add(freeSelectionCouseApplyList[i].FreeSelectionCouseApplyID);
- }
- }
- approveIDList = approveIDList.Where(x => !submitIDList.Contains(x)).ToList();
- if (submitIDList.Count > 0)
- {
- StartUp(submitIDList, userID, "");
- }
- if (approveIDList.Count > 0)
- {
- Approve(approveIDList, userID, Guid.Empty, comment);
- }
- }
- }
- catch (Exception)
- {
- throw;
- }
- }
- public void Approved(List<Guid> FreeSelectionCouseApplyIDList, Guid userID)
- {
- var freeSelectionCourseApplyList = FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyRepository.GetList(x =>
- FreeSelectionCouseApplyIDList.Contains(x.FreeSelectionCouseApplyID),
- x => x.EM_FreeSelectionCouse,
- x => x.EM_FreeSelectionCouseApplyGradeYear,
- x => x.EM_FreeSelectionCouseApplyTeachingSetting,
- x => x.EM_FreeSelectionCouseApplyTeachingMode,
- x => x.EM_FreeSelectionCouseApplyGradeYear,
- x => x.EM_FreeSelectionCouseApplySpecialty,
- x => x.EM_FreeSelectionCouseApplyScheduling,
- x => x.EM_FreeSelectionCouseApplyTeacher).ToList();
- foreach (var freeSelectionCourseApply in freeSelectionCourseApplyList)
- {
- //任选课开课申请表
- EM_ExecutableFreeSelectionCouse executableFreeSelectionCouse = new EM_ExecutableFreeSelectionCouse();
- executableFreeSelectionCouse.ExecutableFreeSelectionCouseID = Guid.NewGuid();
- executableFreeSelectionCouse.FreeSelectionCouseID = freeSelectionCourseApply.FreeSelectionCouseID;
- executableFreeSelectionCouse.SchoolyearID = freeSelectionCourseApply.SchoolyearID;
- executableFreeSelectionCouse.DefaultClassName = freeSelectionCourseApply.DefaultClassName;
- executableFreeSelectionCouse.DepartmentID = freeSelectionCourseApply.DepartmentID;
- executableFreeSelectionCouse.CourseStructureID = freeSelectionCourseApply.CourseStructureID;
- executableFreeSelectionCouse.CourseCategoryID = freeSelectionCourseApply.CourseCategoryID;
- executableFreeSelectionCouse.CourseTypeID = freeSelectionCourseApply.CourseTypeID;
- executableFreeSelectionCouse.CourseQualityID = freeSelectionCourseApply.CourseQualityID;
- executableFreeSelectionCouse.PracticeTypeID = freeSelectionCourseApply.PracticeTypeID;
- executableFreeSelectionCouse.ExaminationModeID = freeSelectionCourseApply.ExaminationModeID;
- executableFreeSelectionCouse.TeachinglanguageID = freeSelectionCourseApply.TeachinglanguageID;
- executableFreeSelectionCouse.IsNeedMaterial = freeSelectionCourseApply.IsNeedMaterial;
- executableFreeSelectionCouse.PeopleNumlower = freeSelectionCourseApply.PeopleNumlower;
- executableFreeSelectionCouse.PeopleNumlimit = freeSelectionCourseApply.PeopleNumlimit;
- executableFreeSelectionCouse.HandleModeID = freeSelectionCourseApply.HandleModeID;
- executableFreeSelectionCouse.ResultTypeID = freeSelectionCourseApply.ResultTypeID;
- executableFreeSelectionCouse.Remarks = freeSelectionCourseApply.Remarks;
- this.SetNewStatus(executableFreeSelectionCouse);
- UnitOfWork.Add(executableFreeSelectionCouse);
- //任选课开课申请教学设置表
- EM_ExecutableFreeSelectionCouseTeachingSetting executableFreeSelectionCouseTeachingSetting = new EM_ExecutableFreeSelectionCouseTeachingSetting();
- executableFreeSelectionCouseTeachingSetting.ExecutableFreeSelectionCouseID = executableFreeSelectionCouse.ExecutableFreeSelectionCouseID;
- executableFreeSelectionCouseTeachingSetting.Credit = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.Credit;
- executableFreeSelectionCouseTeachingSetting.TheoryCourse = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.TheoryCourse;
- executableFreeSelectionCouseTeachingSetting.Practicehours = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.Practicehours;
- executableFreeSelectionCouseTeachingSetting.Trialhours = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.Trialhours;
- executableFreeSelectionCouseTeachingSetting.WeeklyNum = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.WeeklyNum;
- executableFreeSelectionCouseTeachingSetting.TheoryWeeklyNum = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.TheoryWeeklyNum;
- executableFreeSelectionCouseTeachingSetting.PracticeWeeklyNum = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.PracticeWeeklyNum;
- executableFreeSelectionCouseTeachingSetting.TrialWeeklyNum = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.TrialWeeklyNum;
- executableFreeSelectionCouseTeachingSetting.StartWeeklyNum = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.StartWeeklyNum;
- executableFreeSelectionCouseTeachingSetting.EndWeeklyNum = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.EndWeeklyNum;
- executableFreeSelectionCouseTeachingSetting.WeeklyHours = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingSetting.WeeklyHours;
- //SetNewStatus(freeSelectionCourseTeachingSetting);
- UnitOfWork.Add(executableFreeSelectionCouseTeachingSetting);
- //任选课开课申请课程表
- if (freeSelectionCourseApply.EM_FreeSelectionCouseApplyScheduling != null)
- {
- //首先查出至少一个教室
- var firstClassroomID = freeSelectionCourseApply.EM_FreeSelectionCouseApplyScheduling.Select(x => x.ClassroomID).FirstOrDefault();
- freeSelectionCourseApply.EM_FreeSelectionCouseApplyScheduling.ToList().ForEach(x =>
- {
- var scheduling = new EM_ExecutableFreeSelectionCouseScheduling
- {
- ExecutableFreeSelectionCouseSchedulingID = Guid.NewGuid(),
- ExecutableFreeSelectionCouseID = executableFreeSelectionCouse.ExecutableFreeSelectionCouseID,
- ClassroomID = x.ClassroomID != null ? x.ClassroomID : firstClassroomID, //这一行没有教室时,填查询到的其它行的教室,如果都没有就为空
- CoursesTimeID = x.CoursesTimeID,
- Weekday = x.Weekday,
- };
- this.SetNewStatus(scheduling);
- this.UnitOfWork.Add(scheduling);
- });
- //var freeSelectionCouseApplyScheduling = freeSelectionCourseApply.EM_FreeSelectionCouseApplyScheduling.FirstOrDefault();
- //EM_ExecutableFreeSelectionCouseScheduling executableFreeSelectionCouseScheduling = new EM_ExecutableFreeSelectionCouseScheduling();
- //executableFreeSelectionCouseScheduling.ExecutableFreeSelectionCouseSchedulingID = Guid.NewGuid();
- //executableFreeSelectionCouseScheduling.ExecutableFreeSelectionCouseID = executableFreeSelectionCouse.ExecutableFreeSelectionCouseID;
- //executableFreeSelectionCousefreeSelectionCourseApply.ClassroomID = freeSelectionCouseApplyfreeSelectionCourseApply.ClassroomID;
- //executableFreeSelectionCouseScheduling.CoursesTimeID = freeSelectionCouseApplyScheduling.CoursesTimeID;
- //executableFreeSelectionCouseScheduling.Weekday = freeSelectionCouseApplyScheduling.Weekday;
- //SetNewStatus(executableFreeSelectionCouseScheduling);
- //UnitOfWork.Add(executableFreeSelectionCouseScheduling);
- }
- //任选课开课申请授课方式表
- if (freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingMode != null)
- {
- var list = freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeachingMode;
- if (list.Count > 0)
- {
- //UnitOfWork.Delete<EM_FreeSelectionCouseTeachingMode>(x => x.FreeSelectionCouseID == freeSelectionCourseApply.freeSelectionCourseID);
- foreach (var i in list)
- {
- EM_ExecutableFreeSelectionCouseTeachingMode teachingModeType = new EM_ExecutableFreeSelectionCouseTeachingMode();
- teachingModeType.ExecutableFreeSelectionCouseTeachingModeID = Guid.NewGuid();
- teachingModeType.ExecutableFreeSelectionCouseID = executableFreeSelectionCouse.ExecutableFreeSelectionCouseID;
- teachingModeType.TeachingModeID = i.TeachingModeID;
- //this.SetNewStatus(teachingModeType);
- UnitOfWork.Add(teachingModeType);
- }
- }
- }
- //任选课开课申请年级范围表
- if (freeSelectionCourseApply.EM_FreeSelectionCouseApplyGradeYear != null)
- {
- var list = freeSelectionCourseApply.EM_FreeSelectionCouseApplyGradeYear;
- if (list.Count > 0)
- {
- //UnitOfWork.Delete<EM_FreeSelectionCouseTeachingMode>(x => x.FreeSelectionCouseID == freeSelectionCourseApply.freeSelectionCourseID);
- foreach (var i in list)
- {
- EM_ExecutableFreeSelectionCouseGradeYear gradeYear = new EM_ExecutableFreeSelectionCouseGradeYear();
- gradeYear.ExecutableFreeSelectionCouseGradeYearID = Guid.NewGuid();
- gradeYear.ExecutableFreeSelectionCouseID = executableFreeSelectionCouse.ExecutableFreeSelectionCouseID;
- gradeYear.GradeYear = i.GradeYear;
- this.SetNewStatus(gradeYear);
- UnitOfWork.Add(gradeYear);
- }
- }
- }
- //任选课开课申请专业范围表
- if (freeSelectionCourseApply.EM_FreeSelectionCouseApplySpecialty != null)
- {
- //UnitOfWork.Delete<EM_FreeSelectionCouseTeachingMode>(x => x.FreeSelectionCouseID == freeSelectionCourseApply.freeSelectionCourseID);
- foreach (var i in freeSelectionCourseApply.EM_FreeSelectionCouseApplySpecialty)
- {
- EM_ExecutableFreeSelectionCouseSpecialty specialty = new EM_ExecutableFreeSelectionCouseSpecialty();
- specialty.ExecutableFreeSelectionCouseSpecialtyID = Guid.NewGuid();
- specialty.ExecutableFreeSelectionCouseID = executableFreeSelectionCouse.ExecutableFreeSelectionCouseID;
- specialty.SpecialtyID = i.SpecialtyID;
- this.SetNewStatus(specialty);
- UnitOfWork.Add(specialty);
- }
- }
- //任选课开课申请教师表
- if (freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeacher != null)
- {
- freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeacher.ToList().ForEach(x =>
- {
- var freeSelectionTeacher = new EM_ExecutableFreeSelectionCouseTeacher
- {
- ExecutableFreeSelectionCouseStaffID = Guid.NewGuid(),
- ExecutableFreeSelectionCouseID = executableFreeSelectionCouse.ExecutableFreeSelectionCouseID,
- UserID = x.UserID,
- TeachingMethod = x.TeachingMethod
- };
- this.SetNewStatus(freeSelectionTeacher);
- this.UnitOfWork.Add(freeSelectionTeacher);
- });
- }
- executableFreeSelectionCouse.RecordStatus = (int)EMIS.ViewModel.EM_SelectCourseResultStatus.NotOpen;
- }
- UnitOfWork.Commit();
- ////任选课开课申请教学设置表
- //EM_FreeSelectionCouseApplyTeachingSetting freeSelectionCourseTeachingSetting = FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyTeachingSettingRepository.Entities.Where(x => x.FreeSelectionCouseApplyID == FreeSelectionCouseApplyID).FirstOrDefault();
- ////任选课开课申请课程表
- //EM_FreeSelectionCouseApplyScheduling freeSelectionCouseApplyScheduling = FreeSelectionCoursePlanDAL.FreeSelectionCouseApplySchedulingRepository.Entities.Where(x => x.FreeSelectionCouseApplySchedulingID == FreeSelectionCouseApplyID).FirstOrDefault();
- ////任选课开课申请授课方式表
- //EM_FreeSelectionCouseApplyTeachingMode
- // EM_FreeSelectionCouseApplyGradeYear
- // EM_FreeSelectionCouseApplySpecialty
- // EM_FreeSelectionCouseApplyScheduling
- }
- public bool FreeSelectionCourseApplyAdd(FreeSelectionCourseApplyView freeSelectionCourseApply, IList<FreeSelectionCourseApplyTeacherListView> teacherList, IList<FreeSelectionCourseApplySpecialtyListView> specialtyList, IList<ExecutableFreeSelectionCouseSchedulingView> schedulingList, out int? type)
- {
- try
- {
- var StartStatus = this.GetStartStatus();
- var EndStatus = this.GetCorrectEndStatus();
- //schedulingList = schedulingList.Where(x => x.CoursesTimeID != null && x.Weekday != null && x.ClassroomID != null).ToList();
- if (schedulingList.Where(x => x.CoursesTimeID == null || x.Weekday == null).ToList().Count > 0)
- {
- throw new Exception("排课信息不能为空");
- }
- //else
- //{
- // var repeat = schedulingList.GroupBy(x => new { x.Weekday, x.CoursesTimeID }).Max().ToList();
- // if (repeat.Count > 1)
- // throw new Exception("上课时间不能重复");
- //}
- var SpecialtyIDList = specialtyList.Select(x => x.SpecialtyID).ToList();
- var freeSelectionCourse = this.GetFreeSelectionCourseView(freeSelectionCourseApply.FreeSelectionCouseID);
- if (this.FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyRepository
- .GetList(x => x.FreeSelectionCouseID == freeSelectionCourseApply.FreeSelectionCouseID
- && x.SchoolyearID == freeSelectionCourseApply.SchoolyearID
- && x.DefaultClassName == freeSelectionCourseApply.DefaultClassName
- && x.DepartmentID == freeSelectionCourseApply.DepartmentID
- && x.CourseTypeID == freeSelectionCourseApply.CourseTypeID
- && x.EM_FreeSelectionCouseApplySpecialty.Any(w => SpecialtyIDList.Contains(w.SpecialtyID))
- ).Count() > 0)
- {
- throw new Exception(freeSelectionCourse.CourseName + "对应的" + freeSelectionCourseApply.DefaultClassName + "在该学期已经申请过了,无需重复申请。");
- }
- if (this.ExecutableFreeSelectionCouseDAL.ExecutableFreeSelectionCouseRepository
- .GetList(x => x.FreeSelectionCouseID == freeSelectionCourseApply.FreeSelectionCouseID
- && x.SchoolyearID == freeSelectionCourseApply.SchoolyearID
- && x.DefaultClassName == freeSelectionCourseApply.DefaultClassName
- && x.DepartmentID == freeSelectionCourseApply.DepartmentID
- && x.CourseTypeID == freeSelectionCourseApply.CourseTypeID
- && x.EM_ExecutableFreeSelectionCouseSpecialty.Any(w => SpecialtyIDList.Contains(w.SpecialtyID))
- ).Count() > 0)
- {
- throw new Exception(freeSelectionCourse.CourseName + "对应的" + freeSelectionCourseApply.DefaultClassName + "在该学期存在相同的任选设定。");
- }
- //如果IsNeedVerify为false时,不验证冲突
- if (freeSelectionCourseApply.IsNeedVerify != false)
- {
- //判断教室和教室冲突
- foreach (var scheduling in schedulingList)
- {
- if (freeSelectionCourseApply.ClassroomID != null)
- {
- //任选设定冲突
- var repeatExecutableClassroom = ExecutableFreeSelectionCouseDAL.GetRepeatExecutableFreeSelectionCouseClassroom(scheduling.CoursesTimeID, freeSelectionCourseApply.ClassroomID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum).FirstOrDefault();
- if (repeatExecutableClassroom != null)
- {
- type = 1;
- throw new Exception(repeatExecutableClassroom.WeekdayName + "第" + repeatExecutableClassroom.StartTimes + "节时间段教室与任选设定【" + repeatExecutableClassroom.DefaultClassName + "】有冲突");
- }
- //任选申请冲突
- var repeatApplyClassroom = ExecutableFreeSelectionCouseDAL.GetRepeatFreeSelectionCouseApplyClassroom(scheduling.CoursesTimeID, freeSelectionCourseApply.ClassroomID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum, EndStatus).FirstOrDefault();
- if (repeatApplyClassroom != null)
- {
- type = 1;
- throw new Exception(repeatApplyClassroom.WeekdayName + "第" + repeatApplyClassroom.StartTimes + "节时间段教室与开课申请【" + repeatApplyClassroom.DefaultClassName + "】有冲突");
- }
- //教学任务冲突
- var repeatEducationClassroom = ExecutableFreeSelectionCouseDAL.GetRepeatEducationMissionClassroom(scheduling.CoursesTimeID, freeSelectionCourseApply.ClassroomID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum).FirstOrDefault();
- if (repeatEducationClassroom != null)
- {
- type = 1;
- throw new Exception("该设定上课时间段教室与教学任务班【" + repeatEducationClassroom.DefaultClassName + "】有冲突");
- }
- }
- //任选设定冲突
- var repeatExecutableTeacher = ExecutableFreeSelectionCouseDAL.GetRepeatExecutableFreeSelectionCouseTeacher(teacherList.Select(x => x.UserID).ToList(), scheduling.CoursesTimeID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum).FirstOrDefault();
- if (repeatExecutableTeacher != null)
- {
- type = 1;
- throw new Exception(repeatExecutableTeacher.WeekdayName + "第" + repeatExecutableTeacher.StartTimes + "节时间段教师与任选设定【" + repeatExecutableTeacher.DefaultClassName + "】有冲突");
- }
- //任选申请冲突
- var repeatApplyTeacher = ExecutableFreeSelectionCouseDAL.GetRepeatFreeSelectionCouseApplyTeacher(teacherList.Select(x => x.UserID).ToList(), scheduling.CoursesTimeID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum, EndStatus).FirstOrDefault();
- if (repeatApplyTeacher != null)
- {
- type = 1;
- throw new Exception(repeatApplyTeacher.WeekdayName + "第" + repeatApplyTeacher.StartTimes + "节时间段教师与开课申请【" + repeatApplyTeacher.DefaultClassName + "】有冲突");
- }
- //教学任务冲突
- var repeatEducationTeacher = ExecutableFreeSelectionCouseDAL.GetRepeatEducationMissionTeacher(teacherList.Select(x => x.UserID).ToList(), scheduling.CoursesTimeID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum).FirstOrDefault();
- if (repeatEducationTeacher != null)
- {
- type = 1;
- throw new Exception("该设定上课时间段教师与教学任务班【" + repeatEducationTeacher.DefaultClassName + "】有冲突");
- }
- }
- }
- using (TransactionScope ts = new TransactionScope())
- {
- //任选课开课申请表
- EM_FreeSelectionCouseApply freeSelectionCourseApplyEntity = new EM_FreeSelectionCouseApply();
- freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID = Guid.NewGuid();
- freeSelectionCourseApplyEntity.FreeSelectionCouseID = freeSelectionCourseApply.FreeSelectionCouseID;
- freeSelectionCourseApplyEntity.SchoolyearID = freeSelectionCourseApply.SchoolyearID;
- freeSelectionCourseApplyEntity.DefaultClassName = freeSelectionCourseApply.DefaultClassName;
- //freeSelectionCourseApplyEntity.DefaultClassName = freeSelectionCourse.DepartmentName + "-"
- // + freeSelectionCourse.CourseName + "班(任选)";
- freeSelectionCourseApplyEntity.DepartmentID = freeSelectionCourseApply.DepartmentID;
- freeSelectionCourseApplyEntity.CourseStructureID = freeSelectionCourseApply.CourseStructureID;
- freeSelectionCourseApplyEntity.CourseCategoryID = freeSelectionCourseApply.CourseCategoryID;
- freeSelectionCourseApplyEntity.CourseTypeID = freeSelectionCourseApply.CourseTypeID;
- freeSelectionCourseApplyEntity.CourseQualityID = freeSelectionCourseApply.CourseQualityID;
- freeSelectionCourseApplyEntity.PracticeTypeID = freeSelectionCourseApply.PracticeTypeID;
- freeSelectionCourseApplyEntity.ExaminationModeID = freeSelectionCourseApply.ExaminationModeID;
- freeSelectionCourseApplyEntity.TeachinglanguageID = freeSelectionCourseApply.TeachinglanguageID;
- freeSelectionCourseApplyEntity.IsNeedMaterial = freeSelectionCourseApply.IsNeedMaterial;
- freeSelectionCourseApplyEntity.PeopleNumlower = freeSelectionCourseApply.PeopleNumlower;
- freeSelectionCourseApplyEntity.PeopleNumlimit = freeSelectionCourseApply.PeopleNumlimit;
- freeSelectionCourseApplyEntity.HandleModeID = freeSelectionCourseApply.HandleModeID;
- freeSelectionCourseApplyEntity.IsOpened = freeSelectionCourseApply.IsOpened;
- freeSelectionCourseApplyEntity.ApprovalStatus = StartStatus;
- freeSelectionCourseApplyEntity.ResultTypeID = freeSelectionCourseApply.ResultTypeID;
- freeSelectionCourseApplyEntity.Remarks = freeSelectionCourseApply.Remarks;
- this.SetNewStatus(freeSelectionCourseApplyEntity);
- UnitOfWork.Add(freeSelectionCourseApplyEntity);
- //任选课开课申请教学设置表
- EM_FreeSelectionCouseApplyTeachingSetting freeSelectionCourseTeachingSetting;
- freeSelectionCourseTeachingSetting = new EM_FreeSelectionCouseApplyTeachingSetting();
- freeSelectionCourseTeachingSetting.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- freeSelectionCourseTeachingSetting.Credit = freeSelectionCourseApply.Credit;
- freeSelectionCourseTeachingSetting.TheoryCourse = freeSelectionCourseApply.TheoryCourse;
- freeSelectionCourseTeachingSetting.Practicehours = freeSelectionCourseApply.Practicehours;
- freeSelectionCourseTeachingSetting.Trialhours = freeSelectionCourseApply.Trialhours;
- freeSelectionCourseTeachingSetting.WeeklyNum = freeSelectionCourseApply.WeeklyNum;
- freeSelectionCourseTeachingSetting.TheoryWeeklyNum = freeSelectionCourseApply.TheoryWeeklyNum;
- freeSelectionCourseTeachingSetting.PracticeWeeklyNum = freeSelectionCourseApply.PracticeWeeklyNum;
- freeSelectionCourseTeachingSetting.TrialWeeklyNum = freeSelectionCourseApply.TrialWeeklyNum;
- freeSelectionCourseTeachingSetting.StartWeeklyNum = freeSelectionCourseApply.StartWeeklyNum;
- freeSelectionCourseTeachingSetting.EndWeeklyNum = freeSelectionCourseApply.EndWeeklyNum;
- freeSelectionCourseTeachingSetting.WeeklyHours = freeSelectionCourseApply.WeeklyHours;
- //SetNewStatus(freeSelectionCourseTeachingSetting);
- UnitOfWork.Add(freeSelectionCourseTeachingSetting);
- //任选设定课程表
- schedulingList.Where(x => x.CoursesTimeID != null && x.Weekday != null).ToList().ForEach(x =>
- {
- var scheduling = new EM_FreeSelectionCouseApplyScheduling
- {
- FreeSelectionCouseApplySchedulingID = Guid.NewGuid(),
- FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID,
- ClassroomID = freeSelectionCourseApply.ClassroomID, //这一行没有教室时,填查询到的其它行的教室,如果都没有就为空
- CoursesTimeID = x.CoursesTimeID,
- Weekday = x.Weekday,
- };
- this.SetNewStatus(scheduling);
- this.UnitOfWork.Add(scheduling);
- });
- //任选课开课申请授课方式表,没有时默认为理论
- if (freeSelectionCourseApply.TeachingModeID != null)
- {
- var list = freeSelectionCourseApply.TeachingModeID;
- if (list.Count > 0)
- {
- //UnitOfWork.Delete<EM_FreeSelectionCouseTeachingMode>(x => x.FreeSelectionCouseID == freeSelectionCourseApply.freeSelectionCourseID);
- foreach (var i in list)
- {
- EM_FreeSelectionCouseApplyTeachingMode teachingModeType = new EM_FreeSelectionCouseApplyTeachingMode();
- teachingModeType.FreeSelectionCouseApplyTeachingModeID = Guid.NewGuid();
- teachingModeType.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- teachingModeType.TeachingModeID = i;
- //this.SetNewStatus(teachingModeType);
- UnitOfWork.Add(teachingModeType);
- }
- }
- }
- else
- {
- EM_FreeSelectionCouseApplyTeachingMode teachingModeType = new EM_FreeSelectionCouseApplyTeachingMode();
- teachingModeType.FreeSelectionCouseApplyTeachingModeID = Guid.NewGuid();
- teachingModeType.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- teachingModeType.TeachingModeID = (int)EMIS.ViewModel.CF_TeachingMode.Theory;
- UnitOfWork.Add(teachingModeType);
- }
- //任选课开课申请年级范围表
- if (freeSelectionCourseApply.GradeYear != null)
- {
- var list = freeSelectionCourseApply.GradeYear;
- if (list.Count > 0)
- {
- //UnitOfWork.Delete<EM_FreeSelectionCouseTeachingMode>(x => x.FreeSelectionCouseID == freeSelectionCourseApply.freeSelectionCourseID);
- foreach (var i in list)
- {
- EM_FreeSelectionCouseApplyGradeYear gradeYear = new EM_FreeSelectionCouseApplyGradeYear();
- gradeYear.FreeSelectionCouseApplyGradeYearID = Guid.NewGuid();
- gradeYear.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- gradeYear.GradeYear = i;
- this.SetNewStatus(gradeYear);
- UnitOfWork.Add(gradeYear);
- }
- }
- }
- //任选课开课申请专业范围表
- if (specialtyList.Count > 0)
- {
- //UnitOfWork.Delete<EM_FreeSelectionCouseTeachingMode>(x => x.FreeSelectionCouseID == freeSelectionCourseApply.freeSelectionCourseID);
- foreach (var i in specialtyList)
- {
- EM_FreeSelectionCouseApplySpecialty specialty = new EM_FreeSelectionCouseApplySpecialty();
- specialty.FreeSelectionCouseApplySpecialtyID = Guid.NewGuid();
- specialty.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- specialty.SpecialtyID = i.SpecialtyID;
- this.SetNewStatus(specialty);
- UnitOfWork.Add(specialty);
- }
- }
- //任选课开课申请教师表,没有授课老师时,默认为申请人
- if (teacherList.Count > 0)
- {
- var ids = teacherList.Select(w => w.UserID).ToList();
- var noExistStaff = userRepository.GetList(x => ids.Contains(x.UserID) && x.CF_Staff == null).FirstOrDefault();
- if (noExistStaff != null)
- throw new Exception(noExistStaff.Name + "账号不是教职工账号,不能设为授课老师");
- teacherList.ToList().ForEach(x =>
- {
- var freeSelectionTeacher = new EM_FreeSelectionCouseApplyTeacher
- {
- FreeSelectionCouseApplyStaffID = Guid.NewGuid(),
- FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID,
- UserID = x.UserID,
- TeachingMethod = x.TeachingMethod
- };
- this.SetNewStatus(freeSelectionTeacher);
- this.UnitOfWork.Add(freeSelectionTeacher);
- });
- }
- else
- {
- if (CustomPrincipal.Current.StaffID == null)
- throw new Exception("当前账号不是教职工账号,不能设为授课老师");
- var freeSelectionTeacher = new EM_FreeSelectionCouseApplyTeacher();
- freeSelectionTeacher.FreeSelectionCouseApplyStaffID = Guid.NewGuid();
- freeSelectionTeacher.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- freeSelectionTeacher.UserID = CustomPrincipal.Current.UserID;
- freeSelectionTeacher.TeachingMethod = (int)EMIS.ViewModel.EM_TeachingMethod.Lecturer;
- this.SetNewStatus(freeSelectionTeacher);
- this.UnitOfWork.Add(freeSelectionTeacher);
- }
- UnitOfWork.Commit();
- ts.Complete();
- }
- type = 0;
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public bool FreeSelectionCourseApplyUpdate(FreeSelectionCourseApplyView freeSelectionCourseApply, IList<FreeSelectionCourseApplyTeacherListView> teacherList, IList<FreeSelectionCourseApplySpecialtyListView> specialtyList, IList<ExecutableFreeSelectionCouseSchedulingView> schedulingList, out int? type)
- {
- try
- {
- var ApprovalStatus = this.GetCorrectEndStatus();
- //schedulingList = schedulingList.Where(x => x.CoursesTimeID != null && x.Weekday != null && x.ClassroomID != null).ToList();
- if (schedulingList.Where(x => x.CoursesTimeID == null || x.Weekday == null).ToList().Count > 0)
- {
- throw new Exception("排课信息不能为空");
- }
- //else
- //{
- // var repeat = schedulingList.GroupBy(x => new { x.Weekday, x.CoursesTimeID }).Max().ToList();
- // if (repeat.Count > 1)
- // throw new Exception("上课时间不能重复");
- //}
- var SpecialtyIDList = specialtyList.Select(x => x.SpecialtyID).ToList();
- var freeSelectionCourse = this.GetFreeSelectionCourseView(freeSelectionCourseApply.FreeSelectionCouseID);
- List<int?> approveStatusList = this.GetApproveStatusViewList().Where(x => x.Description.Contains("[AP]")).Select(x => x.ID).ToList();
- approveStatusList.Add(this.GetCorrectEndStatus());
- if (approveStatusList.Contains(freeSelectionCourseApply.ApprovalStatus))
- throw new Exception("数据已进入审核环节,不能修改。");
- if (this.FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyRepository
- .GetList(x => x.FreeSelectionCouseID == freeSelectionCourseApply.FreeSelectionCouseID
- && x.SchoolyearID == freeSelectionCourseApply.SchoolyearID
- && x.FreeSelectionCouseApplyID != freeSelectionCourseApply.FreeSelectionCouseApplyID
- && x.DefaultClassName == freeSelectionCourseApply.DefaultClassName
- && x.DepartmentID == freeSelectionCourseApply.DepartmentID
- && x.CourseTypeID == freeSelectionCourseApply.CourseTypeID
- && x.EM_FreeSelectionCouseApplySpecialty.Any(w => SpecialtyIDList.Contains(w.SpecialtyID))
- ).Count() > 0)
- {
- throw new Exception(freeSelectionCourse.CourseName + "对应的" + freeSelectionCourseApply.DefaultClassName + "在该学期已经申请过了,无需重复申请。");
- }
- if (this.ExecutableFreeSelectionCouseDAL.ExecutableFreeSelectionCouseRepository
- .GetList(x => x.FreeSelectionCouseID == freeSelectionCourseApply.FreeSelectionCouseID
- && x.SchoolyearID == freeSelectionCourseApply.SchoolyearID
- && x.DefaultClassName == freeSelectionCourseApply.DefaultClassName
- && x.DepartmentID == freeSelectionCourseApply.DepartmentID
- && x.CourseTypeID == freeSelectionCourseApply.CourseTypeID
- && x.EM_ExecutableFreeSelectionCouseSpecialty.Any(w => SpecialtyIDList.Contains(w.SpecialtyID))
- ).Count() > 0)
- {
- throw new Exception(freeSelectionCourse.CourseName + "对应的" + freeSelectionCourseApply.DefaultClassName + "在该学期存在相同的任选设定。");
- }
- if (freeSelectionCourseApply.IsNeedVerify != false)
- {
- //判断教室和教师冲突
- foreach (var scheduling in schedulingList)
- {
- if (freeSelectionCourseApply.ClassroomID != null)
- {
- //任选设定冲突
- var repeatExecutableClassroom = ExecutableFreeSelectionCouseDAL.GetRepeatExecutableFreeSelectionCouseClassroom(scheduling.CoursesTimeID, freeSelectionCourseApply.ClassroomID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum).FirstOrDefault();
- if (repeatExecutableClassroom != null)
- {
- type = 1;
- throw new Exception(repeatExecutableClassroom.WeekdayName + "第" + repeatExecutableClassroom.StartTimes + "节时间段教室与任选设定【" + repeatExecutableClassroom.DefaultClassName + "】有冲突");
- }
- //任选申请冲突
- var repeatApplyClassroom = ExecutableFreeSelectionCouseDAL.GetRepeatFreeSelectionCouseApplyClassroom(scheduling.CoursesTimeID, freeSelectionCourseApply.ClassroomID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum, ApprovalStatus)
- .Where(x => x.ID != freeSelectionCourseApply.FreeSelectionCouseApplyID).FirstOrDefault();
- if (repeatApplyClassroom != null)
- {
- type = 1;
- throw new Exception(repeatApplyClassroom.WeekdayName + "第" + repeatApplyClassroom.StartTimes + "节时间段教室与开课申请【" + repeatApplyClassroom.DefaultClassName + "】有冲突");
- }//教学任务冲突
- var repeatEducationClassroom = ExecutableFreeSelectionCouseDAL.GetRepeatEducationMissionClassroom(scheduling.CoursesTimeID, freeSelectionCourseApply.ClassroomID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum).FirstOrDefault();
- if (repeatEducationClassroom != null)
- {
- type = 1;
- throw new Exception("该设定上课时间段教室与教学任务班【" + repeatEducationClassroom.DefaultClassName + "】有冲突");
- }
- }
- //任选设定冲突
- var repeatExecutableTeacher = ExecutableFreeSelectionCouseDAL.GetRepeatExecutableFreeSelectionCouseTeacher(teacherList.Select(x => x.UserID).ToList(), scheduling.CoursesTimeID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum).FirstOrDefault();
- if (repeatExecutableTeacher != null)
- {
- type = 1;
- throw new Exception(repeatExecutableTeacher.WeekdayName + "第" + repeatExecutableTeacher.StartTimes + "节时间段教师与任选设定【" + repeatExecutableTeacher.DefaultClassName + "】有冲突");
- }
- //任选申请冲突
- var repeatApplyTeacher = ExecutableFreeSelectionCouseDAL.GetRepeatFreeSelectionCouseApplyTeacher(teacherList.Select(x => x.UserID).ToList(), scheduling.CoursesTimeID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum, ApprovalStatus)
- .Where(x => x.ID != freeSelectionCourseApply.FreeSelectionCouseApplyID).FirstOrDefault();
- if (repeatApplyTeacher != null)
- {
- type = 1;
- throw new Exception(repeatApplyTeacher.WeekdayName + "第" + repeatApplyTeacher.StartTimes + "节时间段教师与开课申请【" + repeatApplyTeacher.DefaultClassName + "】有冲突");
- }
- //教学任务冲突
- var repeatEducationTeacher = ExecutableFreeSelectionCouseDAL.GetRepeatEducationMissionTeacher(teacherList.Select(x => x.UserID).ToList(), scheduling.CoursesTimeID, scheduling.Weekday, freeSelectionCourseApply.SchoolyearID, freeSelectionCourseApply.StartWeeklyNum, freeSelectionCourseApply.EndWeeklyNum).FirstOrDefault();
- if (repeatEducationTeacher != null)
- {
- type = 1;
- throw new Exception("该设定上课时间段教师与教学任务班【" + repeatEducationTeacher.DefaultClassName + "】有冲突");
- }
- }
- }
- using (TransactionScope ts = new TransactionScope())
- {
- EM_FreeSelectionCouseApply freeSelectionCourseApplyEntity = GetFreeSelectionCourseApply(freeSelectionCourseApply.FreeSelectionCouseApplyID);
- freeSelectionCourseApplyEntity.FreeSelectionCouseID = freeSelectionCourseApply.FreeSelectionCouseID;
- freeSelectionCourseApplyEntity.SchoolyearID = freeSelectionCourseApply.SchoolyearID;
- freeSelectionCourseApplyEntity.DefaultClassName = freeSelectionCourseApply.DefaultClassName;
- //freeSelectionCourseApplyEntity.DefaultClassName = freeSelectionCourse.DepartmentName + "-"
- // + freeSelectionCourse.CourseName + "班(任选)";
- freeSelectionCourseApplyEntity.DepartmentID = freeSelectionCourseApply.DepartmentID;
- freeSelectionCourseApplyEntity.CourseStructureID = freeSelectionCourseApply.CourseStructureID;
- freeSelectionCourseApplyEntity.CourseCategoryID = freeSelectionCourseApply.CourseCategoryID;
- freeSelectionCourseApplyEntity.CourseTypeID = freeSelectionCourseApply.CourseTypeID;
- freeSelectionCourseApplyEntity.CourseQualityID = freeSelectionCourseApply.CourseQualityID;
- freeSelectionCourseApplyEntity.PracticeTypeID = freeSelectionCourseApply.PracticeTypeID;
- freeSelectionCourseApplyEntity.ExaminationModeID = freeSelectionCourseApply.ExaminationModeID;
- freeSelectionCourseApplyEntity.TeachinglanguageID = freeSelectionCourseApply.TeachinglanguageID;
- freeSelectionCourseApplyEntity.IsNeedMaterial = freeSelectionCourseApply.IsNeedMaterial;
- freeSelectionCourseApplyEntity.PeopleNumlower = freeSelectionCourseApply.PeopleNumlower;
- freeSelectionCourseApplyEntity.PeopleNumlimit = freeSelectionCourseApply.PeopleNumlimit;
- freeSelectionCourseApplyEntity.HandleModeID = freeSelectionCourseApply.HandleModeID;
- freeSelectionCourseApplyEntity.IsOpened = freeSelectionCourseApply.IsOpened;
- freeSelectionCourseApplyEntity.ResultTypeID = freeSelectionCourseApply.ResultTypeID;
- //freeSelectionCourseApplyEntity.ApprovalStatus = freeSelectionCourseApply.ApprovalStatus;//(int)EMIS.ViewModel.CF_PlanApplicationStatus.NotSubmitted;
- freeSelectionCourseApplyEntity.Remarks = freeSelectionCourseApply.Remarks;
- //任选课开课申请教学设置表
- EM_FreeSelectionCouseApplyTeachingSetting freeSelectionCourseTeachingSetting = FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyTeachingSettingRepository.Entities.Where(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApply.FreeSelectionCouseApplyID).FirstOrDefault();
- //freeSelectionCourseTeachingSetting = new EM_FreeSelectionCouseApplyTeachingSetting();
- freeSelectionCourseTeachingSetting.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- freeSelectionCourseTeachingSetting.Credit = freeSelectionCourseApply.Credit;
- freeSelectionCourseTeachingSetting.TheoryCourse = freeSelectionCourseApply.TheoryCourse;
- freeSelectionCourseTeachingSetting.Practicehours = freeSelectionCourseApply.Practicehours;
- freeSelectionCourseTeachingSetting.Trialhours = freeSelectionCourseApply.Trialhours;
- freeSelectionCourseTeachingSetting.WeeklyNum = freeSelectionCourseApply.WeeklyNum;
- freeSelectionCourseTeachingSetting.TheoryWeeklyNum = freeSelectionCourseApply.TheoryWeeklyNum;
- freeSelectionCourseTeachingSetting.PracticeWeeklyNum = freeSelectionCourseApply.PracticeWeeklyNum;
- freeSelectionCourseTeachingSetting.TrialWeeklyNum = freeSelectionCourseApply.TrialWeeklyNum;
- freeSelectionCourseTeachingSetting.StartWeeklyNum = freeSelectionCourseApply.StartWeeklyNum;
- freeSelectionCourseTeachingSetting.EndWeeklyNum = freeSelectionCourseApply.EndWeeklyNum;
- freeSelectionCourseTeachingSetting.WeeklyHours = freeSelectionCourseApply.WeeklyHours;
- //SetNewStatus(freeSelectionCourseTeachingSetting);
- //任选课开课申请课程表
- this.UnitOfWork.Delete<EM_FreeSelectionCouseApplyScheduling>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID);
- //首先查出至少一个教室
- var firstClassroomID = schedulingList.Select(x => x.ClassroomID).FirstOrDefault();
- schedulingList.Where(x => x.CoursesTimeID != null && x.Weekday != null).ToList().ForEach(x =>
- {
- var scheduling = new EM_FreeSelectionCouseApplyScheduling
- {
- FreeSelectionCouseApplySchedulingID = Guid.NewGuid(),
- FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID,
- ClassroomID = freeSelectionCourseApply.ClassroomID, //这一行没有教室时,填查询到的其它行的教室,如果都没有就为空
- CoursesTimeID = x.CoursesTimeID,
- Weekday = x.Weekday,
- };
- this.SetNewStatus(scheduling);
- this.UnitOfWork.Add(scheduling);
- });
- //任选课开课申请授课方式表
- if (freeSelectionCourseApply.TeachingModeID != null)
- {
- TeachingModeTypeAdd(freeSelectionCourseApply.TeachingModeID, freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID);
- }
- this.SetModifyStatus(freeSelectionCourseApplyEntity);
- //
- UnitOfWork.Delete<EM_FreeSelectionCouseApplyGradeYear>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID);
- if (freeSelectionCourseApply.GradeYear != null)
- {
- foreach (var i in freeSelectionCourseApply.GradeYear)
- {
- EM_FreeSelectionCouseApplyGradeYear gradeYear = new EM_FreeSelectionCouseApplyGradeYear();
- gradeYear.FreeSelectionCouseApplyGradeYearID = Guid.NewGuid();
- gradeYear.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- gradeYear.GradeYear = i;
- this.SetNewStatus(gradeYear);
- UnitOfWork.Add(gradeYear);
- }
- }
- //
- if (specialtyList.Count > 0)
- {
- UnitOfWork.Delete<EM_FreeSelectionCouseApplySpecialty>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID);
- foreach (var i in specialtyList)
- {
- EM_FreeSelectionCouseApplySpecialty specialty = new EM_FreeSelectionCouseApplySpecialty();
- specialty.FreeSelectionCouseApplySpecialtyID = Guid.NewGuid();
- specialty.FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID;
- specialty.SpecialtyID = i.SpecialtyID;
- this.SetNewStatus(specialty);
- UnitOfWork.Add(specialty);
- }
- }
- this.UnitOfWork.Delete<EM_FreeSelectionCouseApplyTeacher>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID);
- teacherList.ToList().ForEach(x =>
- {
- var freeSelectionTeacher = new EM_FreeSelectionCouseApplyTeacher
- {
- FreeSelectionCouseApplyStaffID = Guid.NewGuid(),
- FreeSelectionCouseApplyID = freeSelectionCourseApplyEntity.FreeSelectionCouseApplyID,
- UserID = x.UserID,
- TeachingMethod = x.TeachingMethod
- };
- this.SetNewStatus(freeSelectionTeacher);
- this.UnitOfWork.Add(freeSelectionTeacher);
- });
- this.SetModifyStatus(freeSelectionCourseApplyEntity);
- UnitOfWork.Commit();
- ts.Complete();
- }
- type = 0;
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public bool FreeSelectionCourseApplyUpdate(IList<FreeSelectionCourseApplyView> freeSelectionCourseApplyList)
- {
- try
- {
- foreach (var freeSelectionCourseApply in freeSelectionCourseApplyList)
- {
- EM_FreeSelectionCouseApply freeSelectionCourseApplyEntity = GetFreeSelectionCourseApply(freeSelectionCourseApply.FreeSelectionCouseApplyID);
- freeSelectionCourseApplyEntity.PeopleNumlower = freeSelectionCourseApply.PeopleNumlower;
- freeSelectionCourseApplyEntity.PeopleNumlimit = freeSelectionCourseApply.PeopleNumlimit;
- freeSelectionCourseApplyEntity.IsOpened = freeSelectionCourseApply.IsOpened;
- freeSelectionCourseApplyEntity.IsNeedMaterial = freeSelectionCourseApply.IsNeedMaterial;
- this.SetModifyStatus(freeSelectionCourseApplyEntity);
- }
- UnitOfWork.Commit();
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public bool FreeSelectionCourseApplyDelete(List<Guid?> freeSelectionCourseApplyIDs)
- {
- try
- {
- if (freeSelectionCourseApplyIDs.Count > 0)
- {
- var statusList = this.GetStatusViewList();
- var startStatus = this.GetStartStatus();
- //所有审核环节
- var status = statusList.Where(x =>x.Description.Contains("[AP]") && x.ID != startStatus || x.ID == this.GetCorrectEndStatus()).Select(x => x.ID).ToList();
- foreach (var freeSelectionCourseApplyID in freeSelectionCourseApplyIDs)
- {
- EM_FreeSelectionCouseApply freeSelectionCourseApply = GetFreeSelectionCourseApply(freeSelectionCourseApplyID);
- if (freeSelectionCourseApply.ApprovalStatus == startStatus) //未提交状态
- {
- UnitOfWork.Remove<EM_FreeSelectionCouseApplyScheduling>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApply.FreeSelectionCouseApplyID);
- UnitOfWork.Remove<EM_FreeSelectionCouseApplyTeachingSetting>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApply.FreeSelectionCouseApplyID);
- UnitOfWork.Remove<EM_FreeSelectionCouseApplyTeachingMode>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApply.FreeSelectionCouseApplyID);
- UnitOfWork.Remove<EM_FreeSelectionCouseApplyTeacher>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApply.FreeSelectionCouseApplyID);
- UnitOfWork.Remove<EM_FreeSelectionCouseApplyGradeYear>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApply.FreeSelectionCouseApplyID);
- UnitOfWork.Remove<EM_FreeSelectionCouseApplySpecialty>(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApply.FreeSelectionCouseApplyID);
- UnitOfWork.Remove(freeSelectionCourseApply);
- }
- else if (!status.Contains(freeSelectionCourseApply.ApprovalStatus))
- {
- ModifyProcessState(freeSelectionCourseApply.FreeSelectionCouseApplyID, "D", "");
- UnitOfWork.Remove(freeSelectionCourseApply);
- }
- else
- {
- throw new Exception("数据已进入审核环节,不能删除");
- //不属于以上两种情况不能删除
- }
- }
- this.UnitOfWork.Commit();
- return true;
- }
- return false;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public Entities.CF_Staff GetStaff(Guid? userID)
- {
- //查询条件
- System.Linq.Expressions.Expression<Func<CF_Staff, bool>> expression = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expression = (x => x.UserID == userID);
- return staffRepository.GetSingle(expression, (x => x.CF_StaffManageCampus), (x => x.CF_StaffManageCollege), (x => x.CF_StaffProfile), (x => x.Sys_User));
- }
- public List<FreeSelectionCourseApplyTeacherListView> GetFreeSelectionCourseApplyTeacherListView(Guid freeSelectionCourseApplyID)
- {
- var teacherView = FreeSelectionCoursePlanDAL.GetFreeSelectionCourseApplyTeacherViewQueryable(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyID).ToList();
- if (teacherView.Count == 0)
- {
- var staff = GetStaff(CustomPrincipal.Current.UserID);
- FreeSelectionCourseApplyTeacherListView teacherList = new FreeSelectionCourseApplyTeacherListView();
- teacherList.UserID = staff.UserID;
- teacherList.TeachingMethod = (int)EMIS.ViewModel.EM_TeachingMethod.Lecturer;
- }
- return teacherView;
- }
- //查询专业范围
- public List<SpecialtyView> GetFreeSelectionCourseApplySpecialtyListView(Guid freeSelectionCourseApplyID)
- {
- var specialtyView = FreeSelectionCoursePlanDAL.GetFreeSelectionCourseApplySpecialtyViewQueryable(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyID);
- return specialtyView.ToList();
- }
- public void SaveFreeSelectionCourseTeachers(Guid freeSelectionCourseApplyID, IList<FreeSelectionCourseApplyTeacherListView> teacherList)
- {
- var freeSelectionCourseApply = this.FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyRepository
- .GetSingle(x => x.FreeSelectionCouseApplyID == freeSelectionCourseApplyID, (x => x.EM_FreeSelectionCouseApplyTeacher));
- freeSelectionCourseApply.EM_FreeSelectionCouseApplyTeacher.ToList().ForEach(x => this.UnitOfWork.Remove(x));
- //teacherList.ToList().ForEach(x =>
- //{
- // var freeSelectionCourseApplyStaffEntity = new EM_FreeSelectionCouseApplyStaff
- // {
- // FreeSelectionCouseApplyStaffID = Guid.NewGuid(),
- // FreeSelectionCouseApplyID = freeSelectionCourseApplyID,
- // UserID = x.UserID,
- // TeachingMethod = x.TeachingMethod
- // };
- // this.SetNewStatus(freeSelectionCourseApplyStaffEntity);
- // this.UnitOfWork.Add(freeSelectionCourseApplyStaffEntity);
- //});
- this.UnitOfWork.Commit();
- }
- /// <summary>
- /// 根据起止周次定义班号顺序
- /// </summary>
- /// <param name="SchoolyearID"></param>
- /// <param name="freeSelectionCourseID"></param>
- /// <param name="StartWeeklyNum"></param>
- /// <param name="EndWeeklyNum"></param>
- /// <returns></returns>
- public string DefaultClassNo(Guid SchoolyearID, Guid freeSelectionCourseID, string StartWeeklyNum, string EndWeeklyNum)
- {
- if (StartWeeklyNum != "" && EndWeeklyNum != "")
- {
- //var freeSelectionCouseApply = FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyRepository.GetList(x => x.SchoolyearID == SchoolyearID && x.FreeSelectionCouseID == freeSelectionCourseID, x => x.EM_FreeSelectionCouseApplyTeachingSetting).ToList();
- var FreeSelectionCouseApplyTeachingSetting = FreeSelectionCoursePlanDAL.FreeSelectionCouseApplyTeachingSettingRepository.GetList(x => x.EM_FreeSelectionCouseApply.SchoolyearID == SchoolyearID && x.EM_FreeSelectionCouseApply.FreeSelectionCouseID == freeSelectionCourseID);
- var list = FreeSelectionCouseApplyTeachingSetting.Select(x => new { WeeklyNum = x.StartWeeklyNum.Value + x.EndWeeklyNum.Value }).ToList();
- List<int> l = new List<int> { Convert.ToInt32(StartWeeklyNum) + Convert.ToInt32(EndWeeklyNum) };
- list.ForEach(x => l.Add(x.WeeklyNum));
- l.Sort();
- int index = l.IndexOf(Convert.ToInt32(StartWeeklyNum) + Convert.ToInt32(EndWeeklyNum)) + 1;
- return index.ToString();
- }
- return "";
- }
- public List<ExecutableFreeSelectionCouseSchedulingView> GetSchedulingView(Guid FreeSelectionCouseApplyID)
- {
- //2016年12月1日15:28:47
- //TODO :调整教学任务课程进度统计规则[将原按教学任务获取该教学任务下所对应的教学任务班课程进度信息调整为按对应教学任务班进行统计]
- //var courseViewList = this.educationMissionClassDAL.GetCourseProcessView(x => x.EducationMissionID == educationMissionID)
- // .OrderBy(x => x.Week).ToList();
- var courseViewList = this.FreeSelectionCoursePlanDAL.GetSchedulingView(x => x.FreeSelectionCouseApplyID == FreeSelectionCouseApplyID)
- .OrderBy(x => x.Weekday).ToList();
- return courseViewList;
- }
- }
- }
|